Raise host frame payload limit so multi-client UART replies fit.
Use a uint16 LE length and 1024-byte max payload so CLIENT_INFO and BATTERY_STATUS no longer fail encoding past ~10 connected pods. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+13
-4
@@ -81,18 +81,27 @@ bool parse_uart_byte(uint8_t byte, uart_packet_t *p) {
|
||||
if (byte == START_MARKER) {
|
||||
p->index = 0;
|
||||
p->checksum = 0;
|
||||
p->state = STATE_LEN;
|
||||
p->len = 0;
|
||||
p->state = STATE_LEN_LO;
|
||||
}
|
||||
break;
|
||||
|
||||
case STATE_LEN:
|
||||
if (byte > MAX_PAYLOAD_SIZE || byte == 0) {
|
||||
case STATE_LEN_LO:
|
||||
p->len = byte;
|
||||
p->state = STATE_LEN_HI;
|
||||
break;
|
||||
|
||||
case STATE_LEN_HI: {
|
||||
uint16_t len = (uint16_t)(p->len | ((uint16_t)byte << 8));
|
||||
if (len == 0 || len > MAX_PAYLOAD_SIZE) {
|
||||
p->state = STATE_START;
|
||||
} else {
|
||||
p->len = byte;
|
||||
p->len = len;
|
||||
p->index = 0;
|
||||
p->state = STATE_DATA;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case STATE_DATA:
|
||||
p->payload[p->index++] = byte;
|
||||
|
||||
Reference in New Issue
Block a user