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:
+11
-6
@@ -22,13 +22,18 @@
|
||||
#define UART_DRIVER_TX_BUF_SIZE 4096
|
||||
#define START_MARKER 0xAA
|
||||
#define STOP_MARKER 0xCC
|
||||
#define MAX_BUF_SIZE 252
|
||||
#define MAX_PAYLOAD_SIZE \
|
||||
MAX_BUF_SIZE - 4 // Buffer overhead, Start, Len, CRC, End
|
||||
/** Frame: AA | len_lo | len_hi | payload[len] | xor | CC */
|
||||
#define UART_FRAME_OVERHEAD 5
|
||||
/**
|
||||
* Max application payload (type byte + protobuf). Sized for CLIENT_REGISTRY_MAX
|
||||
* aggregations (CLIENT_INFO / BATTERY_STATUS with 16+ samples).
|
||||
*/
|
||||
#define MAX_PAYLOAD_SIZE 1024
|
||||
|
||||
typedef enum {
|
||||
STATE_START,
|
||||
STATE_LEN,
|
||||
STATE_LEN_LO,
|
||||
STATE_LEN_HI,
|
||||
STATE_DATA,
|
||||
STATE_CHECKSUM,
|
||||
STATE_STOP
|
||||
@@ -36,8 +41,8 @@ typedef enum {
|
||||
|
||||
typedef struct {
|
||||
uint8_t payload[MAX_PAYLOAD_SIZE];
|
||||
uint8_t len;
|
||||
uint8_t index;
|
||||
uint16_t len;
|
||||
uint16_t index;
|
||||
uint8_t checksum;
|
||||
parser_state_t state;
|
||||
} uart_packet_t;
|
||||
|
||||
Reference in New Issue
Block a user