Skip to content

Commit 5bca86b

Browse files
committed
Fix print of "soft reboot" when the user presses ^D
The logic of the main loop was changed between version 7 and 8. [Commit](9307b62) Something is wrong with the existing version 8 logic so the serial write of "soft reboot" is never executed when the user does a soft reboot. A consequence of this is that tools like `tools/pyboard.py`, `ampy` and `mpremote` are not able to activate the raw REPL since they execute a soft reboot and wait for this to be printed to the console.
1 parent f9831b3 commit 5bca86b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

main.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1078,15 +1078,17 @@ int __attribute__((used)) main(void) {
10781078
int exit_code = PYEXEC_FORCED_EXIT;
10791079
bool skip_repl = true;
10801080
bool simulate_reset = true;
1081+
bool first_run = true;
10811082
for (;;) {
10821083
if (!skip_repl) {
10831084
exit_code = run_repl(get_safe_mode());
10841085
supervisor_set_run_reason(RUN_REASON_REPL_RELOAD);
10851086
}
10861087
if (exit_code == PYEXEC_FORCED_EXIT) {
1087-
if (!simulate_reset) {
1088+
if (!first_run) {
10881089
serial_write_compressed(translate("soft reboot\n"));
10891090
}
1091+
first_run = false;
10901092
if (pyexec_mode_kind == PYEXEC_MODE_FRIENDLY_REPL) {
10911093
// If code.py did a fake deep sleep, pretend that we
10921094
// are running code.py for the first time after a hard

0 commit comments

Comments
 (0)