From 57829ddd760ed88d490968209a4b503364692a26 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 26 Dec 2025 20:23:13 -1000 Subject: [PATCH] fixes --- esphome/components/ota/ota_backend_esp8266.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/esphome/components/ota/ota_backend_esp8266.cpp b/esphome/components/ota/ota_backend_esp8266.cpp index 09e0d4b359..bcba252006 100644 --- a/esphome/components/ota/ota_backend_esp8266.cpp +++ b/esphome/components/ota/ota_backend_esp8266.cpp @@ -53,8 +53,9 @@ std::unique_ptr make_ota_backend() { return make_unique 2 * FLASH_SECTOR_SIZE) { - this->buffer_size_ = FLASH_SECTOR_SIZE; - } else { - this->buffer_size_ = MIN_BUFFER_SIZE; - } + this->buffer_size_ = (ESP.getFreeHeap() > 2 * FLASH_SECTOR_SIZE) ? FLASH_SECTOR_SIZE : MIN_BUFFER_SIZE; this->buffer_ = make_unique(this->buffer_size_); if (!this->buffer_) {