Fixed Serial buffer

main
noah metz 2023-12-14 19:40:00 -07:00
parent 45176e1e09
commit ab49606bc2
1 changed files with 6 additions and 2 deletions

@ -245,9 +245,13 @@ void parse_poll(uint8_t* pkt, size_t len) {
} }
void on_rx(void) { void on_rx(void) {
uint8_t pkt[4]; uint8_t pkt[12];
int n = Serial.available(); int n = Serial.available();
if (n < 4) { if (n != 12) {
Serial.printf("Wrong number of bytes on serial port %d/12\n", n);
for (int i = 0; i < n; i++) {
Serial.read();
}
return; return;
} }
int read = Serial.readBytes(pkt, n); int read = Serial.readBytes(pkt, n);