Fixed Serial buffer
parent
45176e1e09
commit
ab49606bc2
|
|
@ -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);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue