Skip to content

Commit

Permalink
microbit: Allow ctrl-C at the REPL to stop a scrolling error message.
Browse files Browse the repository at this point in the history
  • Loading branch information
dpgeorge committed Apr 11, 2018
1 parent ee6ddc8 commit 1342601
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions source/microbit/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,18 @@ static void microbit_display_exception(mp_obj_t exc_in) {
mp_obj_print_helper(&print, exc->args->items[0], PRINT_STR);
}
}
// Allow ctrl-C to stop the scrolling message
mp_hal_set_interrupt_char(CHAR_CTRL_C);
mp_hal_display_string(vstr_null_terminated_str(&vstr));
vstr_clear(&vstr);
mp_hal_set_interrupt_char(-1);
// This is a variant of mp_handle_pending that swallows exceptions
#if MICROPY_ENABLE_SCHEDULER
#error Scheduler currently unsupported
#endif
if (MP_STATE_VM(mp_pending_exception) != MP_OBJ_NULL) {
MP_STATE_VM(mp_pending_exception) = MP_OBJ_NULL;
}
}
}

Expand Down

0 comments on commit 1342601

Please sign in to comment.