@@ -70,6 +70,7 @@ bool UpdaterClass::begin(size_t size, int command, int ledPin, uint8_t ledOn) {
70
70
#ifdef DEBUG_UPDATER
71
71
DEBUG_UPDATER.println (F (" [begin] already running" ));
72
72
#endif
73
+ _setError (UPDATE_ERROR_RUNNING_ALREADY);
73
74
return false ;
74
75
}
75
76
@@ -86,7 +87,7 @@ bool UpdaterClass::begin(size_t size, int command, int ledPin, uint8_t ledOn) {
86
87
_setError (UPDATE_ERROR_BOOTSTRAP);
87
88
return false ;
88
89
}
89
-
90
+
90
91
#ifdef DEBUG_UPDATER
91
92
if (command == U_FS) {
92
93
DEBUG_UPDATER.println (F (" [begin] Update Filesystem." ));
@@ -133,7 +134,7 @@ bool UpdaterClass::begin(size_t size, int command, int ledPin, uint8_t ledOn) {
133
134
134
135
// make sure that the size of both sketches is less than the total space (updateEndAddress)
135
136
if (updateStartAddress < currentSketchSize) {
136
- _setError (UPDATE_ERROR_SPACE);
137
+ _setError (UPDATE_ERROR_SPACE);
137
138
return false ;
138
139
}
139
140
}
@@ -162,6 +163,7 @@ bool UpdaterClass::begin(size_t size, int command, int ledPin, uint8_t ledOn) {
162
163
#ifdef DEBUG_UPDATER
163
164
DEBUG_UPDATER.println (F (" [begin] Unknown update command." ));
164
165
#endif
166
+ _setError (UPDATE_ERROR_UNKNOWN_COMMAND);
165
167
return false ;
166
168
}
167
169
@@ -404,7 +406,7 @@ bool UpdaterClass::_writeBuffer(){
404
406
modifyFlashMode = true ;
405
407
}
406
408
}
407
-
409
+
408
410
if (eraseResult) {
409
411
if (!_async) yield ();
410
412
writeResult = ESP.flashWrite (_currentAddress, _buffer, _bufferLen);
@@ -488,7 +490,7 @@ bool UpdaterClass::_verifyEnd() {
488
490
uint8_t buf[4 ] __attribute__ ((aligned (4 )));
489
491
if (!ESP.flashRead (_startAddress, (uint32_t *) &buf[0 ], 4 )) {
490
492
_currentAddress = (_startAddress);
491
- _setError (UPDATE_ERROR_READ);
493
+ _setError (UPDATE_ERROR_READ);
492
494
return false ;
493
495
}
494
496
@@ -500,7 +502,7 @@ bool UpdaterClass::_verifyEnd() {
500
502
return true ;
501
503
} else if (buf[0 ] != 0xE9 ) {
502
504
_currentAddress = (_startAddress);
503
- _setError (UPDATE_ERROR_MAGIC_BYTE);
505
+ _setError (UPDATE_ERROR_MAGIC_BYTE);
504
506
return false ;
505
507
}
506
508
@@ -512,7 +514,7 @@ bool UpdaterClass::_verifyEnd() {
512
514
// check if new bin fits to SPI flash
513
515
if (bin_flash_size > ESP.getFlashChipRealSize ()) {
514
516
_currentAddress = (_startAddress);
515
- _setError (UPDATE_ERROR_NEW_FLASH_CONFIG);
517
+ _setError (UPDATE_ERROR_NEW_FLASH_CONFIG);
516
518
return false ;
517
519
}
518
520
#endif
@@ -649,6 +651,12 @@ String UpdaterClass::getErrorString() const {
649
651
case UPDATE_ERROR_OOM:
650
652
out = F (" Out of memory" );
651
653
break ;
654
+ case UPDATE_ERROR_RUNNING_ALREADY:
655
+ out = F (" Update already running" );
656
+ break ;
657
+ case UPDATE_ERROR_UNKNOWN_COMMAND:
658
+ out = F (" Unknown update command" );
659
+ break ;
652
660
default :
653
661
out = F (" UNKNOWN" );
654
662
break ;
0 commit comments