Skip to content

Commit

Permalink
Check if an update process is up and running before begin a new one
Browse files Browse the repository at this point in the history
  • Loading branch information
pennam committed Oct 19, 2023
1 parent a6eb0a8 commit 8e67365
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Arduino_ESP32_OTA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,12 @@ Arduino_ESP32_OTA::Error Arduino_ESP32_OTA::begin()
/* initialize private variables */
_ota_size = 0;
_ota_header = {0};


if(Update.isRunning()) {
Update.abort();
DEBUG_DEBUG("%s: Aborting running update", __FUNCTION__);
}

if(!Update.begin(UPDATE_SIZE_UNKNOWN)) {
DEBUG_ERROR("%s: failed to initialize flash update", __FUNCTION__);
return Error::OtaStorageInit;
Expand Down

0 comments on commit 8e67365

Please sign in to comment.