Skip to content

Commit 82bfb2a

Browse files
committed
Check if an update process is up and running before begin a new one
1 parent 7d34bf7 commit 82bfb2a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Arduino_ESP32_OTA.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ Arduino_ESP32_OTA::Error Arduino_ESP32_OTA::begin()
7575
/* initialize private variables */
7676
_ota_size = 0;
7777
_ota_header = {0};
78+
79+
if(Update.isRunning()) {
80+
Update.abort();
81+
DEBUG_DEBUG("%s: Aborting running update", __FUNCTION__);
82+
}
7883

7984
if(!Update.begin(UPDATE_SIZE_UNKNOWN)) {
8085
DEBUG_ERROR("%s: failed to initialize flash update", __FUNCTION__);

0 commit comments

Comments
 (0)