]> mj.ucw.cz Git - home-hw.git/commitdiff
BSB: Bug fixes
authorMartin Mares <mj@ucw.cz>
Tue, 25 Feb 2020 22:01:32 +0000 (23:01 +0100)
committerMartin Mares <mj@ucw.cz>
Tue, 25 Feb 2020 22:01:32 +0000 (23:01 +0100)
bsb/firmware/main.c

index 4e10dc5b563dab8d32eba3ead6e497155df6376c..26b3def9390cad7a8cdfc080e140fff92af9d6b5 100644 (file)
@@ -103,7 +103,7 @@ static void delay_ms(uint ms)
 #define BSB_MAX_SIZE 32
 #define BSB_RX_TIMEOUT 10  // ms
 
-#define DEBUG_BSB
+#undef DEBUG_BSB
 #ifdef DEBUG_BSB
 #define BSB_DEBUG(x...) debug_printf(x)
 #else
@@ -190,7 +190,7 @@ void usart3_isr(void)
                                                BSB_DEBUG("!O");
                                        } else {
                                                memcpy(bsb_rx_frame, bsb_rx_buf, bsb_rx_buf[3]);
-                                               bsb_rx_frame_len = bsb_rx_buf[3];
+                                               bsb_rx_frame_len = bsb_rx_buf[3] - 2;
                                                bsb_stat.rx_ok++;
                                                BSB_DEBUG(".");
                                        }
@@ -398,6 +398,7 @@ static void reset_cb(void)
 {
        debug_printf("USB: Reset\n");
        usb_configured = 0;
+       usb_rx_pending = 0;
 }
 
 static volatile bool usb_event_pending;