Restore watchdog cover for bootloader staging erase, fix stale comment

This commit is contained in:
J. Nick Koston
2026-08-21 01:01:23 -05:00
parent 2017c4a54b
commit da2f73f8e8
2 changed files with 5 additions and 2 deletions
@@ -1,6 +1,7 @@
#ifdef USE_ESP32
#include "ota_backend_esp_idf.h"
#include "esphome/components/watchdog/watchdog.h"
#include "esphome/core/defines.h"
#ifdef USE_OTA_PARTITIONS
@@ -69,7 +70,9 @@ OTAResponseTypes IDFOTABackend::setup_bootloader_staging_() {
return OTA_RESPONSE_ERROR_BOOTLOADER_VERIFY;
}
// Erase full size of the bootloader partition in the staging partition
// to avoid copying old data to the bootloader partition later
// to avoid copying old data to the bootloader partition later. Up to
// ESP_BOOTLOADER_SIZE of blocking erase; widen the WDT for its duration.
watchdog::WatchdogManager watchdog(15000);
esp_err_t err = esp_partition_erase_range(this->partition_, 0, this->bootloader_part_->size);
if (err != ESP_OK) {
ESP_LOGW(TAG, "esp_partition_erase_range failed (err=0x%X)", err);
@@ -211,7 +211,7 @@ bool rsa_pss_verify(uint8_t *block, const uint8_t *digest) {
bool IDFOTABackend::verify_signed_image_(const esp_partition_t *incoming) {
// Verification re-hashes the full image (after esp_ota_end already did one
// pass), which can approach the task WDT budget on a large app. Extend it for
// the duration, mirroring the erase budget in begin().
// the duration, scaled to the image size over a 15 s floor.
const uint32_t verify_budget_ms = 15000 + (incoming->size >> 10) * 10;
watchdog::WatchdogManager watchdog(verify_budget_ms);