@@ -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,7 +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 }
299- mp_hal_stdout_tx_str ("\x1b[2K\x1b[0G" ); // Clear line of junk text
301+ mp_hal_stdout_tx_str (line_clear );
300302 mp_hal_stdout_tx_str (_current_executing_filename );
301303 serial_write_compressed (MP_ERROR_TEXT (" output:\n" ));
302304
@@ -410,7 +412,7 @@ STATIC void cleanup_after_vm(mp_obj_t exception) {
410412}
411413
412414STATIC void print_code_py_status_message (safe_mode_t safe_mode ) {
413- mp_hal_stdout_tx_str ("\x1b[2K\x1b[0G" ); // Clear line
415+ mp_hal_stdout_tx_str (line_clear );
414416 if (autoreload_is_enabled ()) {
415417 serial_write_compressed (
416418 MP_ERROR_TEXT ("Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.\n" ));
@@ -1006,7 +1008,7 @@ int __attribute__((used)) main(void) {
10061008
10071009 // Start the debug serial
10081010 serial_early_init ();
1009- mp_hal_stdout_tx_str ("\x1b[2K\x1b[0G" ); // Clear line
1011+ mp_hal_stdout_tx_str (line_clear );
10101012
10111013 // Wait briefly to give a reset window where we'll enter safe mode after the reset.
10121014 if (get_safe_mode () == SAFE_MODE_NONE ) {
@@ -1058,7 +1060,7 @@ int __attribute__((used)) main(void) {
10581060 // displays init after filesystem, since they could share the flash SPI
10591061 board_init ();
10601062
1061- mp_hal_stdout_tx_str ("\x1b[2K\x1b[0G" ); // Clear line
1063+ mp_hal_stdout_tx_str (line_clear );
10621064
10631065 // This is first time we are running CircuitPython after a reset or power-up.
10641066 supervisor_set_run_reason (RUN_REASON_STARTUP );
0 commit comments