Add repl.py support

This commit is contained in:
Jeff Epler 2023-08-28 13:59:34 -05:00
parent adfd90f022
commit d7cf11d3ef
No known key found for this signature in database
GPG Key ID: D5BF15AB975AB4DE
2 changed files with 7 additions and 0 deletions

View File

@ -133,6 +133,8 @@ Behavior
``code.py`` **in the REPL anymore, as the REPL is a fresh vm.** CircuitPython's goal for this
change includes reducing confusion about pins and memory being used.
- After the main code is finished the REPL can be entered by pressing any key.
- If the file ``repl.py`` exists, it is executed before the REPL Prompt is shown
- In safe mode this functionality is disabled, to ensure the REPL Prompt can always be reached
- Autoreload state will be maintained across reload.
- Adds a safe mode that does not run user code after a hard crash or brown out. This makes it

5
main.c
View File

@ -929,6 +929,11 @@ STATIC int run_repl(safe_mode_t safe_mode) {
autoreload_suspend(AUTORELOAD_SUSPEND_REPL);
if (get_safe_mode() == SAFE_MODE_NONE) {
const char *const filenames[] = { "repl.py" };
(void)maybe_run_list(filenames, MP_ARRAY_SIZE(filenames));
}
// Set the status LED to the REPL color before running the REPL. For
// NeoPixels and DotStars this will be sticky but for PWM or single LED it
// won't. This simplifies pin sharing because they won't be in use when