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 3
3
#include " eboot_command.h"
4
4
#include < interrupts.h>
5
5
#include < esp8266_peri.h>
6
+ #include < PolledTimeout.h>
6
7
7
8
// #define DEBUG_UPDATER Serial
8
9
@@ -446,7 +447,7 @@ size_t UpdaterClass::writeStream(Stream &data, uint16_t streamTimeout) {
446
447
_reset ();
447
448
return 0 ;
448
449
}
449
- unsigned long timeout = millis ( );
450
+ esp8266::polledTimeout::oneShotMs timeOut (streamTimeout );
450
451
if (_progress_callback) {
451
452
_progress_callback (0 , _size);
452
453
}
@@ -464,15 +465,15 @@ size_t UpdaterClass::writeStream(Stream &data, uint16_t streamTimeout) {
464
465
}
465
466
toRead = data.readBytes (_buffer + _bufferLen, bytesToRead);
466
467
if (toRead == 0 ) { // Timeout
467
- if (millis () - timeout > streamTimeout ) {
468
+ if (timeOut ) {
468
469
_currentAddress = (_startAddress + _size);
469
470
_setError (UPDATE_ERROR_STREAM);
470
471
_reset ();
471
472
return written;
472
473
}
473
474
delay (100 );
474
475
} else {
475
- timeout = millis ();
476
+ timeOut. reset ();
476
477
}
477
478
if (_ledPin != -1 ) {
478
479
digitalWrite (_ledPin, !_ledOn); // Switch LED off
You can’t perform that action at this time.
0 commit comments