Skip to content

Commit f5caf86

Browse files
committed
atmel-samd: Add message for when auto reset is off. Fixes #112
1 parent be1ed7a commit f5caf86

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

atmel-samd/autoreset.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ void autoreset_disable() {
5454
autoreset_enabled = false;
5555
}
5656

57+
inline bool autoreset_is_enabled() {
58+
return autoreset_enabled;
59+
}
60+
5761
void autoreset_start() {
5862
autoreset_delay_ms = AUTORESET_DELAY_MS;
5963
}

atmel-samd/autoreset.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,6 @@ void autoreset_start(void);
3737
void autoreset_stop(void);
3838
void autoreset_enable(void);
3939
void autoreset_disable(void);
40+
bool autoreset_is_enabled(void);
4041

4142
#endif // __MICROPY_INCLUDED_ATMEL_SAMD_AUTORESET_H__

atmel-samd/main.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ bool start_mp(void) {
259259
#ifdef AUTORESET_DELAY_MS
260260
if (cdc_enabled_at_start) {
261261
mp_hal_stdout_tx_str("\r\n");
262-
mp_hal_stdout_tx_str("Auto-soft reset is on. Simply save files over USB to run them.\r\n");
262+
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");
263263
}
264264
#endif
265265

@@ -330,10 +330,14 @@ bool start_mp(void) {
330330
if (!cdc_enabled_before && mp_cdc_enabled) {
331331
if (cdc_enabled_at_start) {
332332
mp_hal_stdout_tx_str("\r\n\r\n");
333+
}
334+
335+
if (!cdc_enabled_at_start && autoreset_is_enabled()) {
336+
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");
333337
} else {
334-
mp_hal_stdout_tx_str("Auto-soft reset is on. Simply save files over USB to run them.\r\n");
338+
mp_hal_stdout_tx_str("Auto-soft reset is off.\r\n");
335339
}
336-
mp_hal_stdout_tx_str("Press any key to enter the REPL and disable auto-reset. Use CTRL-D to soft reset.\r\n");
340+
mp_hal_stdout_tx_str("Press any key to enter the REPL. Use CTRL-D to soft reset.\r\n");
337341
}
338342
if (cdc_enabled_before && !mp_cdc_enabled) {
339343
cdc_enabled_at_start = false;

0 commit comments

Comments
 (0)