mirror of
https://github.com/esphome/esphome.git
synced 2026-09-17 18:18:43 +00:00
Apply suggestions
This commit is contained in:
@@ -380,10 +380,12 @@ void ESPHomeOTAComponent::handle_data_() {
|
||||
(static_cast<size_t>(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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user