bricks/stm32/main: move run status message
The REPL is treated like a regular program, so make sure it is run in the same place as a regular program.
This fixes the start/stop buttons in Pybricks Code when clicking the REPL button, allowing for a clean stop of the REPL using the stop button.
@@ -218,15 +218,6 @@ static void run_user_program(uint32_t len, uint8_t *buf, uint32_t free_len) {
return;
}
- if (len == REPL_LEN) {
- #if MICROPY_ENABLE_COMPILER
- pyexec_friendly_repl();
- #else
- mp_print_str(&mp_plat_print, "REPL not supported!\n");
- #endif // MICROPY_ENABLE_COMPILER
- return;
- }
-
// Send a message to say we will run a program
mp_print_str(&mp_plat_print, "\n>>>> RUNNING\n");
@@ -236,6 +227,15 @@ static void run_user_program(uint32_t len, uint8_t *buf, uint32_t free_len) {
// are gobbled up.
mp_print_str(&mp_plat_print, "--------------\n");
+ if (len == REPL_LEN) {
+ #if MICROPY_ENABLE_COMPILER
+ pyexec_friendly_repl();
+ #else
+ mp_print_str(&mp_plat_print, "REPL not supported!\n");
+ #endif // MICROPY_ENABLE_COMPILER
+ return;
+ }
+
// Allow script to be stopped with hub button
mp_hal_set_interrupt_char(3);
