@@ -667,24 +667,27 @@ 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
+ static const size_t NUM_CHARS_TO_COMPARE =
672
+ strlen (MICROPY_FULL_VERSION_INFO ) + strlen (CIRCUITPY_BOARD_INFO ) + 1 ;
671
673
if (!have_boot_py && f_open (fs , boot_output_file , CIRCUITPY_BOOT_OUTPUT_FILE , FA_READ ) == FR_OK ) {
672
674
673
675
char file_contents [NUM_CHARS_TO_COMPARE ];
674
676
UINT chars_read = 0 ;
675
677
f_read (boot_output_file , file_contents , NUM_CHARS_TO_COMPARE , & chars_read );
676
678
f_close (boot_output_file );
677
679
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 ;
680
+ chars_read == strlen (MICROPY_FULL_VERSION_INFO ) + strlen (CIRCUITPY_BOARD_INFO ) &&
681
+ strncmp (file_contents , MICROPY_FULL_VERSION_INFO , strlen (MICROPY_FULL_VERSION_INFO )) == 0 &&
682
+ strncmp (file_contents + strlen (MICROPY_FULL_VERSION_INFO ),
683
+ CIRCUITPY_BOARD_INFO , strlen (CIRCUITPY_BOARD_INFO )) == 0 ;
681
684
}
682
685
683
686
if (!skip_boot_output ) {
684
- // Wait 1.5 seconds before opening CIRCUITPY_BOOT_OUTPUT_FILE for write,
687
+ // Wait 1 second before opening CIRCUITPY_BOOT_OUTPUT_FILE for write,
685
688
// in case power is momentary or will fail shortly due to, say a low, battery.
686
689
if (common_hal_mcu_processor_get_reset_reason () == RESET_REASON_POWER_ON ) {
687
- mp_hal_delay_ms (1500 );
690
+ mp_hal_delay_ms (1000 );
688
691
}
689
692
// USB isn't up, so we can write the file.
690
693
filesystem_set_internal_writable_by_usb (false);
@@ -694,12 +697,9 @@ STATIC void __attribute__ ((noinline)) run_boot_py(safe_mode_t safe_mode) {
694
697
// since boot.py might change it back to writable.
695
698
filesystem_set_internal_writable_by_usb (true);
696
699
697
- // Write version info to boot_out.txt.
700
+ // Write version info and board ID to boot_out.txt.
698
701
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" );
702
+ mp_hal_stdout_tx_str (CIRCUITPY_BOARD_INFO );
703
703
}
704
704
#endif
705
705
0 commit comments