Skip to content

Commit 8e67365

Browse files
committed
Check if an update process is up and running before begin a new one
1 parent a6eb0a8 commit 8e67365

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Arduino_ESP32_OTA.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,12 @@ Arduino_ESP32_OTA::Error Arduino_ESP32_OTA::begin()
7575
/* initialize private variables */
7676
_ota_size = 0;
7777
_ota_header = {0};
78-
78+
79+
if(Update.isRunning()) {
80+
Update.abort();
81+
DEBUG_DEBUG("%s: Aborting running update", __FUNCTION__);
82+
}
83+
7984
if(!Update.begin(UPDATE_SIZE_UNKNOWN)) {
8085
DEBUG_ERROR("%s: failed to initialize flash update", __FUNCTION__);
8186
return Error::OtaStorageInit;

0 commit comments

Comments
 (0)