File tree 2 files changed +16
-1
lines changed
2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 2
2
#include " Arduino.h"
3
3
#include " eboot_command.h"
4
4
#include " interrupts.h"
5
+ #include " esp8266_peri.h"
5
6
6
7
// #define DEBUG_UPDATER Serial
7
8
@@ -44,6 +45,20 @@ bool UpdaterClass::begin(size_t size, int command) {
44
45
return false ;
45
46
}
46
47
48
+ /* Check boot mode; if boot mode is 1 (UART download mode),
49
+ we will not be able to reset into normal mode once update is done.
50
+ Fail early to avoid frustration.
51
+ https://github.com/esp8266/Arduino/issues/1017#issuecomment-200605576
52
+ */
53
+ int boot_mode = (GPI >> 16 ) & 0xf ;
54
+ if (boot_mode == 1 ) {
55
+ _error = UPDATE_ERROR_BOOTSTRAP;
56
+ #ifdef DEBUG_UPDATER
57
+ printError (DEBUG_UPDATER);
58
+ #endif
59
+ return false ;
60
+ }
61
+
47
62
#ifdef DEBUG_UPDATER
48
63
if (command == U_SPIFFS) {
49
64
DEBUG_UPDATER.println (F (" [begin] Update SPIFFS." ));
Original file line number Diff line number Diff line change 16
16
#define UPDATE_ERROR_FLASH_CONFIG (8 )
17
17
#define UPDATE_ERROR_NEW_FLASH_CONFIG (9 )
18
18
#define UPDATE_ERROR_MAGIC_BYTE (10 )
19
-
19
+ # define UPDATE_ERROR_BOOTSTRAP ( 11 )
20
20
21
21
#define U_FLASH 0
22
22
#define U_SPIFFS 100
You can’t perform that action at this time.
0 commit comments