mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-07 16:23:38 +03:00
Updater - missing error codes (#9104)
Adds the two missing error states when beginning an Update. There were debugging logs for this but the error state was not set which would lead to confusion
This commit is contained in:
parent
760dbeeda9
commit
1248d3874e
@ -70,6 +70,7 @@ bool UpdaterClass::begin(size_t size, int command, int ledPin, uint8_t ledOn) {
|
||||
#ifdef DEBUG_UPDATER
|
||||
DEBUG_UPDATER.println(F("[begin] already running"));
|
||||
#endif
|
||||
_setError(UPDATE_ERROR_RUNNING_ALREADY);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -162,6 +163,7 @@ bool UpdaterClass::begin(size_t size, int command, int ledPin, uint8_t ledOn) {
|
||||
#ifdef DEBUG_UPDATER
|
||||
DEBUG_UPDATER.println(F("[begin] Unknown update command."));
|
||||
#endif
|
||||
_setError(UPDATE_ERROR_UNKNOWN_COMMAND);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -649,6 +651,12 @@ String UpdaterClass::getErrorString() const {
|
||||
case UPDATE_ERROR_OOM:
|
||||
out = F("Out of memory");
|
||||
break;
|
||||
case UPDATE_ERROR_RUNNING_ALREADY:
|
||||
out = F("Update already running");
|
||||
break;
|
||||
case UPDATE_ERROR_UNKNOWN_COMMAND:
|
||||
out = F("Unknown update command");
|
||||
break;
|
||||
default:
|
||||
out = F("UNKNOWN");
|
||||
break;
|
||||
|
@ -21,6 +21,8 @@
|
||||
#define UPDATE_ERROR_SIGN (12)
|
||||
#define UPDATE_ERROR_NO_DATA (13)
|
||||
#define UPDATE_ERROR_OOM (14)
|
||||
#define UPDATE_ERROR_RUNNING_ALREADY (15)
|
||||
#define UPDATE_ERROR_UNKNOWN_COMMAND (16)
|
||||
|
||||
#define U_FLASH 0
|
||||
#define U_FS 100
|
||||
@ -69,7 +71,7 @@ class UpdaterClass {
|
||||
bool begin(size_t size, int command = U_FLASH, int ledPin = -1, uint8_t ledOn = LOW);
|
||||
|
||||
/*
|
||||
Run Updater from asynchronous callbacs
|
||||
Run Updater from asynchronous callbacks
|
||||
*/
|
||||
void runAsync(bool async){ _async = async; }
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user