From ab49606bc228b3b2fffd8a1abe16fa81162dbce3 Mon Sep 17 00:00:00 2001 From: Noah Metz Date: Thu, 14 Dec 2023 19:40:00 -0700 Subject: [PATCH] Fixed Serial buffer --- v5_field_control.ino | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/v5_field_control.ino b/v5_field_control.ino index 4b564bb..32d2662 100644 --- a/v5_field_control.ino +++ b/v5_field_control.ino @@ -245,9 +245,13 @@ void parse_poll(uint8_t* pkt, size_t len) { } void on_rx(void) { - uint8_t pkt[4]; + uint8_t pkt[12]; 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; } int read = Serial.readBytes(pkt, n);