From 63c9b63fcf19b36170158f44fcb3e3e496c4d510 Mon Sep 17 00:00:00 2001 From: Mat931 <49403702+Mat931@users.noreply.github.com> Date: Fri, 1 May 2026 19:42:39 +0200 Subject: [PATCH] Apply suggestions --- esphome/components/esphome/ota/ota_esphome.cpp | 6 ++---- esphome/components/ota/ota_backend_esp_idf.h | 2 -- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/esphome/components/esphome/ota/ota_esphome.cpp b/esphome/components/esphome/ota/ota_esphome.cpp index 4261b4c91e6..84d6fa3c0e4 100644 --- a/esphome/components/esphome/ota/ota_esphome.cpp +++ b/esphome/components/esphome/ota/ota_esphome.cpp @@ -380,10 +380,12 @@ void ESPHomeOTAComponent::handle_data_() { (static_cast(buf[2]) << 8) | buf[3]; ESP_LOGV(TAG, "Size is %u bytes", ota_size); +#ifndef USE_OTA_PARTITIONS if (ota_type != ota::OTA_TYPE_UPDATE_APP) { error_code = ota::OTA_RESPONSE_ERROR_UNSUPPORTED_OTA_TYPE; goto error; // NOLINT(cppcoreguidelines-avoid-goto) } +#endif // Now that we've passed authentication and are actually // starting the update, set the warning status and notify @@ -398,10 +400,6 @@ void ESPHomeOTAComponent::handle_data_() { #ifdef USE_OTA_PARTITIONS error_code = this->backend_->begin(ota_size, ota_type); #else - if (ota_type != ota::OTA_TYPE_UPDATE_APP) { - error_code = ota::OTA_RESPONSE_ERROR_UNSUPPORTED_OTA_TYPE; - goto error; // NOLINT(cppcoreguidelines-avoid-goto) - } // This will block for a few seconds as it locks flash error_code = this->backend_->begin(ota_size); #endif diff --git a/esphome/components/ota/ota_backend_esp_idf.h b/esphome/components/ota/ota_backend_esp_idf.h index 08d4ac2abef..ed1f2496d1b 100644 --- a/esphome/components/ota/ota_backend_esp_idf.h +++ b/esphome/components/ota/ota_backend_esp_idf.h @@ -14,9 +14,7 @@ namespace esphome::ota { // ESP_PARTITION_TABLE_MAX_LEN (0xC00) so the entire partition table fits before verification. // Kept separate from any OTA chunk-transfer buffer to avoid coupling unrelated sizes. static constexpr size_t PARTITION_TABLE_BUFFER_SIZE = ESP_PARTITION_TABLE_MAX_LEN; // 0xC00 -#endif -#ifdef USE_OTA_PARTITIONS void get_running_app_position(uint32_t &offset, size_t &size); #endif