ESPHome  2024.4.0
ota_backend_arduino_esp32.cpp
Go to the documentation of this file.
1 #include "esphome/core/defines.h"
2 #ifdef USE_ESP32_FRAMEWORK_ARDUINO
3 
5 #include "ota_component.h"
6 #include "ota_backend.h"
7 
8 #include <Update.h>
9 
10 namespace esphome {
11 namespace ota {
12 
14  bool ret = Update.begin(image_size, U_FLASH);
15  if (ret) {
16  return OTA_RESPONSE_OK;
17  }
18 
19  uint8_t error = Update.getError();
20  if (error == UPDATE_ERROR_SIZE)
23 }
24 
25 void ArduinoESP32OTABackend::set_update_md5(const char *md5) { Update.setMD5(md5); }
26 
28  size_t written = Update.write(data, len);
29  if (written != len) {
31  }
32  return OTA_RESPONSE_OK;
33 }
34 
36  if (!Update.end())
38  return OTA_RESPONSE_OK;
39 }
40 
41 void ArduinoESP32OTABackend::abort() { Update.abort(); }
42 
43 } // namespace ota
44 } // namespace esphome
45 
46 #endif // USE_ESP32_FRAMEWORK_ARDUINO
OTAResponseTypes begin(size_t image_size) override
void set_update_md5(const char *md5) override
OTAResponseTypes write(uint8_t *data, size_t len) override
std::string size_t len
Definition: helpers.h:292
This is a workaround until we can figure out a way to get the tflite-micro idf component code availab...
Definition: a01nyub.cpp:7