22std::unique_ptr<ArduinoRP2OTABackend>
make_ota_backend() {
return make_unique<ArduinoRP2OTABackend>(); }
32 if (image_size == 0) {
33 image_size =
reinterpret_cast<uintptr_t
>(&
_FS_end) -
reinterpret_cast<uintptr_t
>(&
_FS_start);
35 bool ret = Update.begin(image_size, U_FLASH);
41 uint8_t error = Update.getError();
42 if (error == UPDATE_ERROR_BOOTSTRAP)
44 if (error == UPDATE_ERROR_NEW_FLASH_CONFIG)
46 if (error == UPDATE_ERROR_FLASH_CONFIG)
48 if (error == UPDATE_ERROR_SPACE || error == UPDATE_ERROR_SIZE)
51 ESP_LOGE(TAG,
"Begin error: %d", error);
58 this->md5_set_ =
true;
67 uint8_t error = Update.getError();
68 ESP_LOGE(TAG,
"Write error: %d", error);
76 if (Update.end(!this->md5_set_)) {
81 uint8_t error = Update.getError();
82 ESP_LOGE(TAG,
"End error: %d", error);
void set_update_md5(const char *md5)
OTAResponseTypes begin(size_t image_size, OTAType ota_type=OTA_TYPE_UPDATE_APP)
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_WRONG_NEW_FLASH_CONFIG
@ OTA_RESPONSE_ERROR_WRONG_CURRENT_FLASH_CONFIG
@ OTA_RESPONSE_ERROR_WRITING_FLASH
@ OTA_RESPONSE_ERROR_UNSUPPORTED_OTA_TYPE
@ OTA_RESPONSE_ERROR_UPDATE_END
@ OTA_RESPONSE_ERROR_UPDATE_BUSY
@ OTA_RESPONSE_ERROR_RP2040_NOT_ENOUGH_SPACE
@ OTA_RESPONSE_ERROR_UNKNOWN
@ OTA_RESPONSE_ERROR_INVALID_BOOTSTRAPPING
std::unique_ptr< ArduinoLibreTinyOTABackend > make_ota_backend()
void preferences_prevent_write(bool prevent)