@@ -140,6 +140,8 @@ static void reset_devices(void) {
140140STATIC uint8_t * _heap ;
141141STATIC uint8_t * _pystack ;
142142
143+ STATIC const char line_clear [] = "\x1b[2K\x1b[0G" ;
144+
143145#if MICROPY_ENABLE_PYSTACK || MICROPY_ENABLE_GC
144146STATIC uint8_t * _allocate_memory (safe_mode_t safe_mode , const char * env_key , size_t default_size , size_t * final_size ) {
145147 * final_size = default_size ;
@@ -296,6 +298,7 @@ STATIC bool maybe_run_list(const char *const *filenames, size_t n_filenames) {
296298 if (_current_executing_filename == NULL ) {
297299 return false;
298300 }
301+ mp_hal_stdout_tx_str (line_clear );
299302 mp_hal_stdout_tx_str (_current_executing_filename );
300303 serial_write_compressed (MP_ERROR_TEXT (" output:\n" ));
301304
@@ -409,6 +412,7 @@ STATIC void cleanup_after_vm(mp_obj_t exception) {
409412}
410413
411414STATIC void print_code_py_status_message (safe_mode_t safe_mode ) {
415+ mp_hal_stdout_tx_str (line_clear );
412416 if (autoreload_is_enabled ()) {
413417 serial_write_compressed (
414418 MP_ERROR_TEXT ("Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.\n" ));
@@ -1004,6 +1008,7 @@ int __attribute__((used)) main(void) {
10041008
10051009 // Start the debug serial
10061010 serial_early_init ();
1011+ mp_hal_stdout_tx_str (line_clear );
10071012
10081013 // Wait briefly to give a reset window where we'll enter safe mode after the reset.
10091014 if (get_safe_mode () == SAFE_MODE_NONE ) {
@@ -1055,6 +1060,8 @@ int __attribute__((used)) main(void) {
10551060 // displays init after filesystem, since they could share the flash SPI
10561061 board_init ();
10571062
1063+ mp_hal_stdout_tx_str (line_clear );
1064+
10581065 // This is first time we are running CircuitPython after a reset or power-up.
10591066 supervisor_set_run_reason (RUN_REASON_STARTUP );
10601067
0 commit comments