File tree Expand file tree Collapse file tree 2 files changed +17
-4
lines changed
Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -312,8 +312,10 @@ void Arduino_ESP32_OTA::clean()
312312 }
313313}
314314
315- Arduino_ESP32_OTA::Error Arduino_ESP32_OTA::update ()
315+ Arduino_ESP32_OTA::Error Arduino_ESP32_OTA::verify ()
316316{
317+ assert (_context != nullptr );
318+
317319 /* ... then finalize ... */
318320 _context->calculatedCrc32 ^= 0xFFFFFFFF ;
319321
@@ -323,14 +325,24 @@ Arduino_ESP32_OTA::Error Arduino_ESP32_OTA::update()
323325 return Error::OtaHeaderCrc;
324326 }
325327
328+ clean ();
329+
330+ return Error::None;
331+ }
332+
333+ Arduino_ESP32_OTA::Error Arduino_ESP32_OTA::update ()
334+ {
335+ Arduino_ESP32_OTA::Error res = Error::None;
336+ if (_context != nullptr && (res = verify ()) != Error::None) {
337+ return res;
338+ }
339+
326340 if (!Update.end (true )) {
327341 DEBUG_ERROR (" %s: Failure to apply OTA update" , __FUNCTION__);
328342 return Error::OtaStorageEnd;
329343 }
330344
331- clean ();
332-
333- return Error::None;
345+ return res;
334346}
335347
336348void Arduino_ESP32_OTA::reset ()
Original file line number Diff line number Diff line change @@ -114,6 +114,7 @@ class Arduino_ESP32_OTA
114114 size_t downloadSize ();
115115
116116 virtual void write_byte_to_flash (uint8_t data);
117+ Arduino_ESP32_OTA::Error verify ();
117118 Arduino_ESP32_OTA::Error update ();
118119 void reset ();
119120 static bool isCapable ();
You can’t perform that action at this time.
0 commit comments