File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 33#include " eboot_command.h"
44#include < interrupts.h>
55#include < esp8266_peri.h>
6+ #include < PolledTimeout.h>
67
78// #define DEBUG_UPDATER Serial
89
@@ -446,7 +447,7 @@ size_t UpdaterClass::writeStream(Stream &data, uint16_t streamTimeout) {
446447 _reset ();
447448 return 0 ;
448449 }
449- unsigned long timeout = millis ( );
450+ esp8266::polledTimeout::oneShotMs timeOut (streamTimeout );
450451 if (_progress_callback) {
451452 _progress_callback (0 , _size);
452453 }
@@ -464,15 +465,15 @@ size_t UpdaterClass::writeStream(Stream &data, uint16_t streamTimeout) {
464465 }
465466 toRead = data.readBytes (_buffer + _bufferLen, bytesToRead);
466467 if (toRead == 0 ) { // Timeout
467- if (millis () - timeout > streamTimeout ) {
468+ if (timeOut ) {
468469 _currentAddress = (_startAddress + _size);
469470 _setError (UPDATE_ERROR_STREAM);
470471 _reset ();
471472 return written;
472473 }
473474 delay (100 );
474475 } else {
475- timeout = millis ();
476+ timeOut. reset ();
476477 }
477478 if (_ledPin != -1 ) {
478479 digitalWrite (_ledPin, !_ledOn); // Switch LED off
You can’t perform that action at this time.
0 commit comments