mirror of
https://github.com/esphome/esphome.git
synced 2026-09-16 01:28:39 +00:00
[ota] Make partition-table verify errors actionable
When the running app does not fit any slot in the new partition table, the user has almost certainly picked the wrong migration .bin for their device. Replace the generic "No compatible app partition found" error with one that prints the running app's offset, used size, and the size limit a migration method must clear, plus an explicit reassurance that no flash content has been modified yet. Same treatment for the otadata-overlap case: include the running app offset/size and tell the user to pick a different migration method. Verification phase is non-destructive, so these errors are recoverable by retrying with the correct .bin -- the new wording makes that explicit so users don't lose time on a brick scare they aren't in. No code-flow change; only log message wording.
This commit is contained in:
@@ -131,7 +131,14 @@ OTAResponseTypes IDFOTABackend::validate_new_partition_table_(uint32_t running_a
|
||||
}
|
||||
|
||||
if (new_app_part_index == -1 && new_app_part_index_with_copy == -1) {
|
||||
ESP_LOGE(TAG, "No compatible app partition found in the new partition table");
|
||||
// Most likely cause: the user picked the wrong migration .bin for their running app's size.
|
||||
// Rejecting here is non-destructive (no flash op has run yet); the user can safely retry with
|
||||
// a different .bin. Log enough info that they can pick the right method without guessing.
|
||||
ESP_LOGE(TAG,
|
||||
"Running app at 0x%X (%u bytes used) does not fit any compatible slot in the new "
|
||||
"partition table. Pick a migration method whose size limit is at least %u bytes and "
|
||||
"retry; no flash content was modified.",
|
||||
running_app_offset, running_app_size, running_app_size);
|
||||
return OTA_RESPONSE_ERROR_PARTITION_TABLE_VERIFY;
|
||||
}
|
||||
if (app_partitions_found < 2) {
|
||||
@@ -147,7 +154,11 @@ OTAResponseTypes IDFOTABackend::validate_new_partition_table_(uint32_t running_a
|
||||
return OTA_RESPONSE_ERROR_PARTITION_TABLE_VERIFY;
|
||||
}
|
||||
if (otadata_overlap) {
|
||||
ESP_LOGE(TAG, "New otadata partition overlaps with running app");
|
||||
ESP_LOGE(TAG,
|
||||
"New otadata partition overlaps with the running app at 0x%X (size %u). The chosen "
|
||||
"partition table is not compatible with this device's current flash layout; pick a "
|
||||
"different migration method.",
|
||||
running_app_offset, running_app_size);
|
||||
return OTA_RESPONSE_ERROR_PARTITION_TABLE_VERIFY;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user