mirror of
https://github.com/esphome/esphome.git
synced 2026-07-10 17:05:36 +00:00
cleaups
This commit is contained in:
@@ -331,13 +331,12 @@ OTAResponseTypes IDFOTABackend::update_partition_table() {
|
||||
// underlying ESP-IDF calls take longer than expected on a given chip variant.
|
||||
watchdog::WatchdogManager watchdog(15000);
|
||||
|
||||
// Copy the running app partition to new position if needed
|
||||
// Copy the running app partition to new position if needed.
|
||||
// esp_ota_get_running_partition() is still valid here (we have not yet called
|
||||
// esp_partition_unload_all()) and returns the same partition that find_app_partition_at would
|
||||
// have located, without an extra iterator walk.
|
||||
if (new_app_part_index == -1) {
|
||||
const esp_partition_t *running_app_part = find_app_partition_at(running_app_offset, running_app_size);
|
||||
if (running_app_part == nullptr) {
|
||||
ESP_LOGE(TAG, "Running app partition not found in current partition table");
|
||||
return OTA_RESPONSE_ERROR_PARTITION_TABLE_UPDATE;
|
||||
}
|
||||
const esp_partition_t *running_app_part = esp_ota_get_running_partition();
|
||||
ESP_LOGD(TAG, "Copying running app from 0x%X to 0x%X (size: 0x%X)", running_app_part->address,
|
||||
app_copy_target_part->address, running_app_size);
|
||||
|
||||
|
||||
@@ -45,11 +45,14 @@ class IDFOTABackend final {
|
||||
char expected_bin_md5_[32];
|
||||
bool md5_set_{false};
|
||||
#ifdef USE_OTA_PARTITIONS
|
||||
ota::OTAType ota_type_{ota::OTA_TYPE_UPDATE_APP};
|
||||
// Place the byte buffer first so it sits immediately after the preceding `bool md5_set_`,
|
||||
// eliminating the 3-byte alignment padding that an int-sized member would otherwise force.
|
||||
// Remaining members are 4-byte-aligned and pack tightly after the buffer.
|
||||
uint8_t buf_[PARTITION_TABLE_BUFFER_SIZE];
|
||||
size_t buf_written_{0};
|
||||
size_t image_size_{0};
|
||||
const esp_partition_t *partition_table_part_{nullptr};
|
||||
ota::OTAType ota_type_{ota::OTA_TYPE_UPDATE_APP};
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user