aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Shawcroft <scott.shawcroft@gmail.com>2017-01-13 15:39:50 -0800
committerScott Shawcroft <scott.shawcroft@gmail.com>2017-01-13 15:39:50 -0800
commit35a5d44399204eb0b72786828436b586cd6e9930 (patch)
treec2aca4d81d811f675e1f69cdb74a7f2edf3a55bd
parent6c858c7a78677dc5345f1f8c587d65658379df26 (diff)
atmel-samd: Ensure pin state for first script run because we don't0.8.2
know the post-bootloader state. Also, color the status LED purple for ValueErrors which are used to indicate a pin in use.
-rw-r--r--atmel-samd/main.c7
-rw-r--r--atmel-samd/rgb_led_colors.h1
2 files changed, 5 insertions, 3 deletions
diff --git a/atmel-samd/main.c b/atmel-samd/main.c
index 89de725ec..5285a8c6e 100644
--- a/atmel-samd/main.c
+++ b/atmel-samd/main.c
@@ -305,6 +305,8 @@ bool start_mp(void) {
new_status_color(NAME_ERROR);
} else if (mp_obj_is_subclass_fast(result.exception_type, &mp_type_OSError)) {
new_status_color(OS_ERROR);
+ } else if (mp_obj_is_subclass_fast(result.exception_type, &mp_type_ValueError)) {
+ new_status_color(VALUE_ERROR);
} else {
new_status_color(OTHER_ERROR);
}
@@ -424,7 +426,6 @@ int main(int argc, char **argv) {
// stack so the GC can account for objects that may be referenced by the
// stack between here and where gc_collect is called.
stack_top = (char*)&stack_dummy;
- reset_mp();
// Initialise the local flash filesystem after the gc in case we need to
// grab memory from it. Create it if needed, mount in on /flash, and set it
@@ -454,9 +455,9 @@ int main(int argc, char **argv) {
if (exit_code == PYEXEC_FORCED_EXIT) {
if (!first_run) {
mp_hal_stdout_tx_str("soft reboot\r\n");
- reset_samd21();
- reset_mp();
}
+ reset_samd21();
+ reset_mp();
first_run = false;
skip_repl = start_mp();
} else if (exit_code != 0) {
diff --git a/atmel-samd/rgb_led_colors.h b/atmel-samd/rgb_led_colors.h
index cfdb93690..525b8c545 100644
--- a/atmel-samd/rgb_led_colors.h
+++ b/atmel-samd/rgb_led_colors.h
@@ -29,4 +29,5 @@
#define SYNTAX_ERROR CYAN
#define NAME_ERROR WHITE
#define OS_ERROR ORANGE
+#define VALUE_ERROR PURPLE
#define OTHER_ERROR YELLOW