summaryrefslogtreecommitdiff
path: root/supervisor
diff options
context:
space:
mode:
authorScott Shawcroft <scott@tannewt.org>2019-05-08 15:23:40 -0700
committerScott Shawcroft <scott@tannewt.org>2019-05-08 15:23:40 -0700
commit837d3f57eefe8189969dda6512f278b4fb76af55 (patch)
treeb812e18626960dcb6f8785b4199e5c4401aeff45 /supervisor
parentbec84f20abb716c0d8052554d841c1291ddf64cc (diff)
Update `on_next_reset` for new safe mode.
Fixes #1831
Diffstat (limited to 'supervisor')
-rw-r--r--supervisor/shared/safe_mode.c14
-rw-r--r--supervisor/shared/safe_mode.h3
2 files changed, 11 insertions, 6 deletions
diff --git a/supervisor/shared/safe_mode.c b/supervisor/shared/safe_mode.c
index f965bc48a..bb4b99f84 100644
--- a/supervisor/shared/safe_mode.c
+++ b/supervisor/shared/safe_mode.c
@@ -90,10 +90,13 @@ void __attribute__((noinline,)) reset_into_safe_mode(safe_mode_t reason) {
}
void print_safe_mode_message(safe_mode_t reason) {
+ if (reason == NO_SAFE_MODE) {
+ return;
+ }
+ serial_write("\r\n");
// Output a user safe mode string if its set.
#ifdef BOARD_USER_SAFE_MODE
if (reason == USER_SAFE_MODE) {
- serial_write("\r\n");
serial_write_compressed(translate("You requested starting safe mode by "));
serial_write(BOARD_USER_SAFE_MODE_ACTION);
serial_write("\r\n");
@@ -102,8 +105,11 @@ void print_safe_mode_message(safe_mode_t reason) {
serial_write("\r\n");
} else
#endif
- if (reason != NO_SAFE_MODE) {
- serial_write("\r\n");
+ if (reason == MANUAL_SAFE_MODE) {
+ serial_write_compressed(translate("The reset button was pressed while booting CircuitPython. Press again to exit safe mode.\n"));
+ } else if (reason == PROGRAMMATIC_SAFE_MODE) {
+ serial_write_compressed(translate("The `microcontroller` module was used to boot into safe mode. Press reset to exit safe mode.\n"));
+ } else {
serial_write_compressed(translate("You are running in safe mode which means something unanticipated happened.\n"));
if (reason == HARD_CRASH || reason == MICROPY_NLR_JUMP_FAIL || reason == MICROPY_FATAL_ERROR || reason == GC_ALLOC_OUTSIDE_VM) {
serial_write_compressed(translate("Looks like our core CircuitPython code crashed hard. Whoops!\nPlease file an issue at https://github.com/adafruit/circuitpython/issues\n with the contents of your CIRCUITPY drive and this message:\n"));
@@ -121,8 +127,6 @@ void print_safe_mode_message(safe_mode_t reason) {
} else if (reason == HEAP_OVERWRITTEN) {
serial_write_compressed(translate("The CircuitPython heap was corrupted because the stack was too small.\nPlease increase stack size limits and press reset (after ejecting CIRCUITPY).\nIf you didn't change the stack, then file an issue here with the contents of your CIRCUITPY drive:\n"));
serial_write("https://github.com/adafruit/circuitpython/issues\r\n");
- } else if (reason == MANUAL_SAFE_MODE) {
- serial_write_compressed(translate("The reset button was pressed while booting CircuitPython. Press again to exit safe mode.\n"));
}
}
}
diff --git a/supervisor/shared/safe_mode.h b/supervisor/shared/safe_mode.h
index 59480b55b..b4ff1aa33 100644
--- a/supervisor/shared/safe_mode.h
+++ b/supervisor/shared/safe_mode.h
@@ -36,7 +36,8 @@ typedef enum {
MANUAL_SAFE_MODE,
MICROPY_NLR_JUMP_FAIL,
MICROPY_FATAL_ERROR,
- GC_ALLOC_OUTSIDE_VM
+ GC_ALLOC_OUTSIDE_VM,
+ PROGRAMMATIC_SAFE_MODE
} safe_mode_t;
safe_mode_t wait_for_safe_mode_reset(void);