14std::unique_ptr<ArduinoLibreTinyOTABackend>
make_ota_backend() {
return make_unique<ArduinoLibreTinyOTABackend>(); }
24 if (image_size == 0) {
25 image_size = UPDATE_SIZE_UNKNOWN;
27 bool ret = Update.begin(image_size, U_FLASH);
32 uint8_t error = Update.getError();
33 if (error == UPDATE_ERROR_SIZE)
36 ESP_LOGE(TAG,
"Begin error: %d", error);
43 this->md5_set_ =
true;
52 uint8_t error = Update.getError();
53 ESP_LOGE(TAG,
"Write error: %d", error);
61 if (Update.end(!this->md5_set_)) {
66 uint8_t error = Update.getError();
67 ESP_LOGE(TAG,
"End error: %d", error);
OTAResponseTypes begin(size_t image_size, OTAType ota_type=OTA_TYPE_UPDATE_APP)
void set_update_md5(const char *md5)
OTAResponseTypes write(uint8_t *data, size_t len)
void hold_until_reboot()
Keep the lock set until reboot; is_held() becomes false.
bool try_acquire()
Returns false if held elsewhere.
ESPHOME_LOG_TAG(TAG, "ota")
@ OTA_RESPONSE_ERROR_ESP32_NOT_ENOUGH_SPACE
@ OTA_RESPONSE_ERROR_WRITING_FLASH
@ OTA_RESPONSE_ERROR_UNSUPPORTED_OTA_TYPE
@ OTA_RESPONSE_ERROR_UPDATE_END
@ OTA_RESPONSE_ERROR_UPDATE_BUSY
@ OTA_RESPONSE_ERROR_UNKNOWN
std::unique_ptr< ArduinoLibreTinyOTABackend > make_ota_backend()