@@ -667,24 +667,26 @@ STATIC void __attribute__ ((noinline)) run_boot_py(safe_mode_t safe_mode) {
667
667
// This saves wear and tear on the flash and also prevents filesystem damage if power is lost
668
668
// during the write, which may happen due to bobbling the power connector or weak power.
669
669
670
- static const size_t NUM_CHARS_TO_COMPARE = 160 ;
670
+ // + 1 to check that there aren't extra characters beyond the version info.
671
+ const size_t constant_string_length = strlen (MICROPY_FULL_VERSION_INFO ) + strlen (CIRCUITPY_BOARD_INFO ) + 1 ;
671
672
if (!have_boot_py && f_open (fs , boot_output_file , CIRCUITPY_BOOT_OUTPUT_FILE , FA_READ ) == FR_OK ) {
672
673
673
- char file_contents [NUM_CHARS_TO_COMPARE ];
674
+ char file_contents [constant_string_length ];
674
675
UINT chars_read = 0 ;
675
- f_read (boot_output_file , file_contents , NUM_CHARS_TO_COMPARE , & chars_read );
676
+ f_read (boot_output_file , file_contents , constant_string_length , & chars_read );
676
677
f_close (boot_output_file );
677
678
skip_boot_output =
678
- // + 2 accounts for \r\n.
679
- chars_read == strlen (MICROPY_FULL_VERSION_INFO ) + 2 &&
680
- strncmp (file_contents , MICROPY_FULL_VERSION_INFO , strlen (MICROPY_FULL_VERSION_INFO )) == 0 ;
679
+ chars_read == strlen (MICROPY_FULL_VERSION_INFO ) + strlen (CIRCUITPY_BOARD_INFO ) &&
680
+ strncmp (file_contents , MICROPY_FULL_VERSION_INFO , strlen (MICROPY_FULL_VERSION_INFO )) == 0 &&
681
+ strncmp (file_contents + strlen (MICROPY_FULL_VERSION_INFO ),
682
+ CIRCUITPY_BOARD_INFO , strlen (CIRCUITPY_BOARD_INFO )) == 0 ;
681
683
}
682
684
683
685
if (!skip_boot_output ) {
684
- // Wait 1.5 seconds before opening CIRCUITPY_BOOT_OUTPUT_FILE for write,
686
+ // Wait 1 second before opening CIRCUITPY_BOOT_OUTPUT_FILE for write,
685
687
// in case power is momentary or will fail shortly due to, say a low, battery.
686
688
if (common_hal_mcu_processor_get_reset_reason () == RESET_REASON_POWER_ON ) {
687
- mp_hal_delay_ms (1500 );
689
+ mp_hal_delay_ms (1000 );
688
690
}
689
691
// USB isn't up, so we can write the file.
690
692
filesystem_set_internal_writable_by_usb (false);
@@ -694,12 +696,9 @@ STATIC void __attribute__ ((noinline)) run_boot_py(safe_mode_t safe_mode) {
694
696
// since boot.py might change it back to writable.
695
697
filesystem_set_internal_writable_by_usb (true);
696
698
697
- // Write version info to boot_out.txt.
699
+ // Write version info and board ID to boot_out.txt.
698
700
mp_hal_stdout_tx_str (MICROPY_FULL_VERSION_INFO );
699
- // Write the board ID (board directory and ID on circuitpython.org)
700
- mp_hal_stdout_tx_str ("\r\n" "Board ID:" );
701
- mp_hal_stdout_tx_str (CIRCUITPY_BOARD_ID );
702
- mp_hal_stdout_tx_str ("\r\n" );
701
+ mp_hal_stdout_tx_str (CIRCUITPY_BOARD_INFO );
703
702
}
704
703
#endif
705
704
0 commit comments