diff --git a/armsrc/appmain.c b/armsrc/appmain.c index 032b0797b..fc7533778 100644 --- a/armsrc/appmain.c +++ b/armsrc/appmain.c @@ -1163,13 +1163,12 @@ void __attribute__((noreturn)) AppMain(void) { byte_t rx[sizeof(UsbCommand)]; for(;;) { - + WDT_HIT(); + // Check if there is a usb packet available if ( cmd_receive( (UsbCommand*)rx ) ) UsbPacketReceived(rx, sizeof(UsbCommand) ); - WDT_HIT(); - // Press button for one second to enter a possible standalone mode if (BUTTON_HELD(1000) > 0) { diff --git a/bootrom/bootrom.c b/bootrom/bootrom.c index 7e0598dde..302916476 100644 --- a/bootrom/bootrom.c +++ b/bootrom/bootrom.c @@ -191,7 +191,7 @@ static void flash_mode(int externally_entered) { end_addr = 0; bootrom_unlocked = 0; byte_t rx[sizeof(UsbCommand)]; - size_t rx_len; + //size_t rx_len; usb_enable(); //for (volatile size_t i=0; i<0x100000; i++) {}; @@ -199,11 +199,15 @@ static void flash_mode(int externally_entered) { for(;;) { WDT_HIT(); - if ( usb_poll_validate_length()) { - rx_len = usb_read(rx, sizeof(UsbCommand)); - if (rx_len == sizeof(UsbCommand)) - UsbPacketReceived(rx, rx_len); - } + // Check if there is a usb packet available + if ( cmd_receive( (UsbCommand*)rx ) ) + UsbPacketReceived(rx, sizeof(UsbCommand) ); + + // if ( usb_poll_validate_length()) { + // rx_len = usb_read(rx, sizeof(UsbCommand)); + // if (rx_len) + // UsbPacketReceived(rx, rx_len); + //} if (!externally_entered && !BUTTON_PRESS()) { /* Perform a reset to leave flash mode */