fix initial usb crash with a delay

This commit is contained in:
Adolfo Reyna
2025-11-29 22:59:33 -05:00
parent 2cb23b70d3
commit 7ebfbcb0fb

View File

@@ -451,6 +451,8 @@ void tuh_hid_report_received_cb(uint8_t dev_addr, uint8_t instance, uint8_t cons
int main() {
stdio_init_all();
sleep_ms(3000); // Give time for power to settle and serial to connect
printf("System Booting...\n");
// Launch display initialization on core 1
printf("Launching e-Paper display init on core 1...\n");
@@ -464,9 +466,17 @@ int main() {
printf("Initializing TinyUSB Host...\n");
tuh_init(BOARD_TUH_RHPORT);
printf("TinyUSB Host Initialized.\n");
uint32_t last_print = 0;
while (true) {
tuh_task();
uint32_t now = to_ms_since_boot(get_absolute_time());
if (now - last_print > 5000) {
printf("Heartbeat: %u\n", now);
last_print = now;
}
}
return 0;