From 4da478382d8e428d3e702dcd8c35f67cf80cc319 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Sat, 12 Sep 2020 17:46:52 +0530 Subject: [PATCH] Fix serial console output & add more boards --- .../esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h | 4 ++++ ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h | 4 ++++ .../esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h | 2 +- .../esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h | 2 +- ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h | 2 +- .../boards/unexpectedmaker_feathers2/mpconfigboard.h | 4 ++++ supervisor/shared/safe_mode.c | 6 +++--- 7 files changed, 18 insertions(+), 6 deletions(-) diff --git a/ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h b/ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h index ed3f23a3c4..2af3515f4c 100644 --- a/ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h +++ b/ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h @@ -29,4 +29,8 @@ #define MICROPY_HW_BOARD_NAME "BastWiFi" #define MICROPY_HW_MCU_NAME "ESP32S2" +#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) + +#define BOARD_USER_SAFE_MODE_ACTION "pressing boot button at start up.\n" + #define AUTORESET_DELAY_MS 500 diff --git a/ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h b/ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h index 84d15ffc2b..a4c8e65762 100644 --- a/ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h +++ b/ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h @@ -31,4 +31,8 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO45) +#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) + +#define BOARD_USER_SAFE_MODE_ACTION "pressing boot button at start up.\n" + #define AUTORESET_DELAY_MS 500 diff --git a/ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h b/ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h index 6d603ba57b..335aaeb5e1 100644 --- a/ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h +++ b/ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h @@ -33,6 +33,6 @@ #define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) -#define BOARD_USER_SAFE_MODE_ACTION "pressing boot button at start up." +#define BOARD_USER_SAFE_MODE_ACTION "pressing boot button at start up.\n" #define AUTORESET_DELAY_MS 500 diff --git a/ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h b/ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h index f5b6c7948e..d3ef8bb260 100644 --- a/ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h +++ b/ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h @@ -33,6 +33,6 @@ #define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) -#define BOARD_USER_SAFE_MODE_ACTION "pressing boot button at start up." +#define BOARD_USER_SAFE_MODE_ACTION "pressing boot button at start up.\n" #define AUTORESET_DELAY_MS 500 diff --git a/ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h b/ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h index d844f37d09..1a1ef7a6c7 100644 --- a/ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h +++ b/ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h @@ -34,6 +34,6 @@ #define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) -#define BOARD_USER_SAFE_MODE_ACTION "pressing boot button at start up." +#define BOARD_USER_SAFE_MODE_ACTION "pressing boot button at start up.\n" #define AUTORESET_DELAY_MS 500 diff --git a/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h b/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h index 93fb0c573d..a65d00206d 100644 --- a/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h +++ b/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h @@ -29,6 +29,10 @@ #define MICROPY_HW_BOARD_NAME "FeatherS2" #define MICROPY_HW_MCU_NAME "ESP32S2" +#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) + +#define BOARD_USER_SAFE_MODE_ACTION "pressing boot button at start up.\n" + #define AUTORESET_DELAY_MS 500 // Doesn't work with this on. diff --git a/supervisor/shared/safe_mode.c b/supervisor/shared/safe_mode.c index cbbdfe4276..f4f23378a4 100644 --- a/supervisor/shared/safe_mode.c +++ b/supervisor/shared/safe_mode.c @@ -72,7 +72,7 @@ safe_mode_t wait_for_safe_mode_reset(void) { // Blink on for 100, off for 100, on for 100, off for 100 and on for 200 common_hal_digitalio_digitalinout_set_value(&status_led, diff > 100 && diff / 100 != 2 && diff / 100 != 4); #endif - #ifdef CIRCUITPY_BOOT_BUTTON + #ifdef CIRCUITPY_BOOT_BUTTON if (!common_hal_digitalio_digitalinout_get_value(&boot_button)) { return USER_SAFE_MODE; } @@ -120,11 +120,11 @@ void print_safe_mode_message(safe_mode_t reason) { // Output a user safe mode string if it's set. serial_write_compressed(translate("You requested starting safe mode by ")); serial_write_compressed(translate(BOARD_USER_SAFE_MODE_ACTION)); - serial_write_compressed(translate("\nTo exit, please reset the board without ")); + serial_write_compressed(translate("To exit, please reset the board without ")); serial_write_compressed(translate(BOARD_USER_SAFE_MODE_ACTION)); - serial_write("\n"); #else // fallthrough + serial_write_compressed(translate("CircuitPython is in safe mode with status being USER_SAFE_MODE but no specific reason was provided.\n")); #endif return; case MANUAL_SAFE_MODE: