1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-17 10:42:21 +01:00

Implement RP2040 preferences (#3946)

This commit is contained in:
Jesse Hills
2022-10-26 22:56:56 +13:00
committed by GitHub
parent f97252b93a
commit 9865cb7f55
3 changed files with 122 additions and 8 deletions

View File

@@ -15,6 +15,7 @@ namespace ota {
OTAResponseTypes ArduinoRP2040OTABackend::begin(size_t image_size) {
bool ret = Update.begin(image_size, U_FLASH);
if (ret) {
rp2040::preferences_prevent_write(true);
return OTA_RESPONSE_OK;
}
@@ -46,7 +47,10 @@ OTAResponseTypes ArduinoRP2040OTABackend::end() {
return OTA_RESPONSE_OK;
}
void ArduinoRP2040OTABackend::abort() { Update.end(); }
void ArduinoRP2040OTABackend::abort() {
Update.end();
rp2040::preferences_prevent_write(false);
}
} // namespace ota
} // namespace esphome