atmel-samd: Ensure pin state for first script run because we don't

know the post-bootloader state.

Also, color the status LED purple for ValueErrors which are used to
indicate a pin in use.
This commit is contained in:
Scott Shawcroft 2017-01-13 15:39:50 -08:00
parent 6c858c7a78
commit 35a5d44399
2 changed files with 5 additions and 3 deletions

View File

@ -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) {

View File

@ -29,4 +29,5 @@
#define SYNTAX_ERROR CYAN
#define NAME_ERROR WHITE
#define OS_ERROR ORANGE
#define VALUE_ERROR PURPLE
#define OTHER_ERROR YELLOW