Skip to content

Commit c644a2f

Browse files
committed
Check if an update process is up and running before begin a new one
1 parent 6a06b25 commit c644a2f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Diff for: src/Arduino_ESP32_OTA.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,12 @@ Arduino_ESP32_OTA::Error Arduino_ESP32_OTA::begin()
8080
/* initialize private variables */
8181
_ota_size = 0;
8282
_ota_header = {0};
83-
83+
84+
if(Update.isRunning()) {
85+
Update.abort();
86+
DEBUG_DEBUG("%s: Aborting running update", __FUNCTION__);
87+
}
88+
8489
if(!Update.begin(UPDATE_SIZE_UNKNOWN)) {
8590
DEBUG_ERROR("%s: failed to initialize flash update", __FUNCTION__);
8691
return Error::OtaStorageInit;

0 commit comments

Comments
 (0)