From f5caf8687086d1b3cf3a3b5f6d6218682beca5c2 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Mon, 27 Mar 2017 20:12:30 +0100 Subject: [PATCH] atmel-samd: Add message for when auto reset is off. Fixes #112 --- atmel-samd/autoreset.c | 4 ++++ atmel-samd/autoreset.h | 1 + atmel-samd/main.c | 12 ++++++++---- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/atmel-samd/autoreset.c b/atmel-samd/autoreset.c index 3f6681938f..b048a32d24 100644 --- a/atmel-samd/autoreset.c +++ b/atmel-samd/autoreset.c @@ -54,6 +54,10 @@ void autoreset_disable() { autoreset_enabled = false; } +inline bool autoreset_is_enabled() { + return autoreset_enabled; +} + void autoreset_start() { autoreset_delay_ms = AUTORESET_DELAY_MS; } diff --git a/atmel-samd/autoreset.h b/atmel-samd/autoreset.h index 5719aaa2f1..02e3ec18ab 100644 --- a/atmel-samd/autoreset.h +++ b/atmel-samd/autoreset.h @@ -37,5 +37,6 @@ void autoreset_start(void); void autoreset_stop(void); void autoreset_enable(void); void autoreset_disable(void); +bool autoreset_is_enabled(void); #endif // __MICROPY_INCLUDED_ATMEL_SAMD_AUTORESET_H__ diff --git a/atmel-samd/main.c b/atmel-samd/main.c index 47edc2537d..8c22b6a6cd 100644 --- a/atmel-samd/main.c +++ b/atmel-samd/main.c @@ -259,7 +259,7 @@ bool start_mp(void) { #ifdef AUTORESET_DELAY_MS if (cdc_enabled_at_start) { mp_hal_stdout_tx_str("\r\n"); - mp_hal_stdout_tx_str("Auto-soft reset is on. Simply save files over USB to run them.\r\n"); + mp_hal_stdout_tx_str("Auto-soft reset is on. Simply save files over USB to run them or enter REPL to disable.\r\n"); } #endif @@ -330,10 +330,14 @@ bool start_mp(void) { if (!cdc_enabled_before && mp_cdc_enabled) { if (cdc_enabled_at_start) { mp_hal_stdout_tx_str("\r\n\r\n"); - } else { - mp_hal_stdout_tx_str("Auto-soft reset is on. Simply save files over USB to run them.\r\n"); } - mp_hal_stdout_tx_str("Press any key to enter the REPL and disable auto-reset. Use CTRL-D to soft reset.\r\n"); + + if (!cdc_enabled_at_start && autoreset_is_enabled()) { + mp_hal_stdout_tx_str("Auto-soft reset is on. Simply save files over USB to run them or enter REPL to disable.\r\n"); + } else { + mp_hal_stdout_tx_str("Auto-soft reset is off.\r\n"); + } + mp_hal_stdout_tx_str("Press any key to enter the REPL. Use CTRL-D to soft reset.\r\n"); } if (cdc_enabled_before && !mp_cdc_enabled) { cdc_enabled_at_start = false;