mirror of
https://github.com/esp8266/Arduino.git
synced 2025-05-03 20:44:46 +03:00
Update Updater.cpp
This commit is contained in:
parent
0328fde3c1
commit
7304f9bf5a
@ -3,6 +3,7 @@
|
|||||||
#include "eboot_command.h"
|
#include "eboot_command.h"
|
||||||
#include <interrupts.h>
|
#include <interrupts.h>
|
||||||
#include <esp8266_peri.h>
|
#include <esp8266_peri.h>
|
||||||
|
#include <PolledTimeout.h>
|
||||||
|
|
||||||
//#define DEBUG_UPDATER Serial
|
//#define DEBUG_UPDATER Serial
|
||||||
|
|
||||||
@ -446,7 +447,7 @@ size_t UpdaterClass::writeStream(Stream &data, uint16_t streamTimeout) {
|
|||||||
_reset();
|
_reset();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
unsigned long timeout = millis();
|
esp8266::polledTimeout::oneShotMs timeOut(streamTimeout);
|
||||||
if (_progress_callback) {
|
if (_progress_callback) {
|
||||||
_progress_callback(0, _size);
|
_progress_callback(0, _size);
|
||||||
}
|
}
|
||||||
@ -464,7 +465,7 @@ size_t UpdaterClass::writeStream(Stream &data, uint16_t streamTimeout) {
|
|||||||
}
|
}
|
||||||
toRead = data.readBytes(_buffer + _bufferLen, bytesToRead);
|
toRead = data.readBytes(_buffer + _bufferLen, bytesToRead);
|
||||||
if(toRead == 0) { //Timeout
|
if(toRead == 0) { //Timeout
|
||||||
if (millis() - timeout > streamTimeout) {
|
if (timeOut) {
|
||||||
_currentAddress = (_startAddress + _size);
|
_currentAddress = (_startAddress + _size);
|
||||||
_setError(UPDATE_ERROR_STREAM);
|
_setError(UPDATE_ERROR_STREAM);
|
||||||
_reset();
|
_reset();
|
||||||
@ -472,7 +473,7 @@ size_t UpdaterClass::writeStream(Stream &data, uint16_t streamTimeout) {
|
|||||||
}
|
}
|
||||||
delay(100);
|
delay(100);
|
||||||
} else {
|
} else {
|
||||||
timeout = millis();
|
timeOut.reset();
|
||||||
}
|
}
|
||||||
if(_ledPin != -1) {
|
if(_ledPin != -1) {
|
||||||
digitalWrite(_ledPin, !_ledOn); // Switch LED off
|
digitalWrite(_ledPin, !_ledOn); // Switch LED off
|
||||||
|
Loading…
x
Reference in New Issue
Block a user