Skip to content

Commit d7cf11d

Browse files
committed
Add repl.py support
1 parent adfd90f commit d7cf11d

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

README.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ Behavior
133133
``code.py`` **in the REPL anymore, as the REPL is a fresh vm.** CircuitPython's goal for this
134134
change includes reducing confusion about pins and memory being used.
135135
- After the main code is finished the REPL can be entered by pressing any key.
136+
- If the file ``repl.py`` exists, it is executed before the REPL Prompt is shown
137+
- In safe mode this functionality is disabled, to ensure the REPL Prompt can always be reached
136138
- Autoreload state will be maintained across reload.
137139

138140
- Adds a safe mode that does not run user code after a hard crash or brown out. This makes it

main.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -929,6 +929,11 @@ STATIC int run_repl(safe_mode_t safe_mode) {
929929

930930
autoreload_suspend(AUTORELOAD_SUSPEND_REPL);
931931

932+
if (get_safe_mode() == SAFE_MODE_NONE) {
933+
const char *const filenames[] = { "repl.py" };
934+
(void)maybe_run_list(filenames, MP_ARRAY_SIZE(filenames));
935+
}
936+
932937
// Set the status LED to the REPL color before running the REPL. For
933938
// NeoPixels and DotStars this will be sticky but for PWM or single LED it
934939
// won't. This simplifies pin sharing because they won't be in use when

0 commit comments

Comments
 (0)