mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 07:03:55 +00:00 
			
		
		
		
	cleanup
This commit is contained in:
		| @@ -19,7 +19,6 @@ std::unique_ptr<ota::OTABackend> make_ota_backend() { return make_unique<ota::ID | ||||
| OTAResponseTypes IDFOTABackend::begin(size_t image_size) { | ||||
|   // Reset MD5 validation state | ||||
|   this->md5_set_ = false; | ||||
|   memset(this->expected_bin_md5_, 0, sizeof(this->expected_bin_md5_)); | ||||
|  | ||||
|   this->partition_ = esp_ota_get_next_update_partition(nullptr); | ||||
|   if (this->partition_ == nullptr) { | ||||
|   | ||||
| @@ -6,14 +6,13 @@ | ||||
| #include "esphome/core/defines.h" | ||||
|  | ||||
| #include <esp_ota_ops.h> | ||||
| #include <cstring> | ||||
|  | ||||
| namespace esphome { | ||||
| namespace ota { | ||||
|  | ||||
| class IDFOTABackend : public OTABackend { | ||||
|  public: | ||||
|   IDFOTABackend() : md5_set_(false) { memset(expected_bin_md5_, 0, sizeof(expected_bin_md5_)); } | ||||
|   IDFOTABackend() : md5_set_(false), expected_bin_md5_{} {} | ||||
|   OTAResponseTypes begin(size_t image_size) override; | ||||
|   void set_update_md5(const char *md5) override; | ||||
|   OTAResponseTypes write(uint8_t *data, size_t len) override; | ||||
|   | ||||
| @@ -129,14 +129,15 @@ void OTARequestHandler::handleUpload(AsyncWebServerRequest *request, const Strin | ||||
|     auto result = backend->begin(0); | ||||
|     if (result != ota::OTA_RESPONSE_OK) { | ||||
|       ESP_LOGE(TAG, "OTA begin failed: %d", result); | ||||
|       this->ota_success_ = false; | ||||
|       return; | ||||
|     } | ||||
|  | ||||
|     // Store the backend pointer | ||||
|     this->ota_backend_ = backend.release(); | ||||
|     this->ota_started_ = true; | ||||
|   } else if (!this->ota_started_ || !this->ota_backend_) { | ||||
|   } | ||||
|  | ||||
|   if (!this->ota_started_ || !this->ota_backend_) { | ||||
|     // Begin failed or was aborted | ||||
|     return; | ||||
|   } | ||||
|   | ||||
| @@ -157,7 +157,7 @@ class OTARequestHandler : public AsyncWebHandler { | ||||
|  | ||||
|  private: | ||||
| #if defined(USE_ESP_IDF) && defined(USE_WEBSERVER_OTA) | ||||
|   void *ota_backend_{nullptr};  // Actually ota::OTABackend*, stored as void* to avoid incomplete type issues | ||||
|   void *ota_backend_{nullptr}; | ||||
|   bool ota_started_{false}; | ||||
|   bool ota_success_{false}; | ||||
| #endif | ||||
|   | ||||
		Reference in New Issue
	
	Block a user