Add CACHE_STATUS UART poll and dashboard live stream.
Combine cached accel and tap in one low-overhead master command for ~16 ms host polling. The dashboard uses a single live-stream toggle plus per-slave accel-stream controls; fix live_stream state so polling is not cleared every slow client refresh. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -32,7 +32,9 @@ typedef enum _alox_MessageType {
|
||||
alox_MessageType_ACCEL_STREAM = 25,
|
||||
alox_MessageType_BATTERY_STATUS = 26,
|
||||
alox_MessageType_TAP_NOTIFY = 27,
|
||||
alox_MessageType_TAP_SNAPSHOT = 28
|
||||
alox_MessageType_TAP_SNAPSHOT = 28,
|
||||
/* * Combined cached accel + tap poll (one UART round-trip, ~16 ms cadence). */
|
||||
alox_MessageType_CACHE_STATUS = 29
|
||||
} alox_MessageType;
|
||||
|
||||
typedef enum _alox_TapKind {
|
||||
@@ -209,6 +211,20 @@ typedef struct _alox_TapSnapshotResponse {
|
||||
alox_TapEvent events[16];
|
||||
} alox_TapSnapshotResponse;
|
||||
|
||||
/* * Host → master: one-shot read of subscribed cached slave data (no request body). */
|
||||
typedef struct _alox_CacheStatusRequest {
|
||||
char dummy_field;
|
||||
} alox_CacheStatusRequest;
|
||||
|
||||
typedef struct _alox_CacheStatusResponse {
|
||||
/* * Slaves with accel_stream_enabled. */
|
||||
pb_size_t accel_count;
|
||||
alox_AccelSample accel[16];
|
||||
/* * Slaves with any tap notify flag; pending taps are consumed (like TAP_SNAPSHOT). */
|
||||
pb_size_t taps_count;
|
||||
alox_TapEvent taps[16];
|
||||
} alox_CacheStatusResponse;
|
||||
|
||||
typedef struct _alox_EspNowUnicastTestRequest {
|
||||
uint32_t client_id;
|
||||
uint32_t seq;
|
||||
@@ -357,6 +373,8 @@ typedef struct _alox_UartMessage {
|
||||
alox_TapNotifyResponse tap_notify_response;
|
||||
alox_TapSnapshotRequest tap_snapshot_request;
|
||||
alox_TapSnapshotResponse tap_snapshot_response;
|
||||
alox_CacheStatusRequest cache_status_request;
|
||||
alox_CacheStatusResponse cache_status_response;
|
||||
} payload;
|
||||
} alox_UartMessage;
|
||||
|
||||
@@ -367,8 +385,8 @@ extern "C" {
|
||||
|
||||
/* Helper constants for enums */
|
||||
#define _alox_MessageType_MIN alox_MessageType_UNKNOWN
|
||||
#define _alox_MessageType_MAX alox_MessageType_TAP_SNAPSHOT
|
||||
#define _alox_MessageType_ARRAYSIZE ((alox_MessageType)(alox_MessageType_TAP_SNAPSHOT+1))
|
||||
#define _alox_MessageType_MAX alox_MessageType_CACHE_STATUS
|
||||
#define _alox_MessageType_ARRAYSIZE ((alox_MessageType)(alox_MessageType_CACHE_STATUS+1))
|
||||
|
||||
#define _alox_TapKind_MIN alox_TapKind_TAP_NONE
|
||||
#define _alox_TapKind_MAX alox_TapKind_TAP_TRIPLE
|
||||
@@ -416,6 +434,8 @@ extern "C" {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* Initializer values for message structs */
|
||||
#define alox_UartMessage_init_default {_alox_MessageType_MIN, 0, {alox_Ack_init_default}}
|
||||
#define alox_Ack_init_default {0}
|
||||
@@ -441,6 +461,8 @@ extern "C" {
|
||||
#define alox_TapSnapshotRequest_init_default {0}
|
||||
#define alox_TapEvent_init_default {0, 0, _alox_TapKind_MIN, 0}
|
||||
#define alox_TapSnapshotResponse_init_default {0, {alox_TapEvent_init_default, alox_TapEvent_init_default, alox_TapEvent_init_default, alox_TapEvent_init_default, alox_TapEvent_init_default, alox_TapEvent_init_default, alox_TapEvent_init_default, alox_TapEvent_init_default, alox_TapEvent_init_default, alox_TapEvent_init_default, alox_TapEvent_init_default, alox_TapEvent_init_default, alox_TapEvent_init_default, alox_TapEvent_init_default, alox_TapEvent_init_default, alox_TapEvent_init_default}}
|
||||
#define alox_CacheStatusRequest_init_default {0}
|
||||
#define alox_CacheStatusResponse_init_default {0, {alox_AccelSample_init_default, alox_AccelSample_init_default, alox_AccelSample_init_default, alox_AccelSample_init_default, alox_AccelSample_init_default, alox_AccelSample_init_default, alox_AccelSample_init_default, alox_AccelSample_init_default, alox_AccelSample_init_default, alox_AccelSample_init_default, alox_AccelSample_init_default, alox_AccelSample_init_default, alox_AccelSample_init_default, alox_AccelSample_init_default, alox_AccelSample_init_default, alox_AccelSample_init_default}, 0, {alox_TapEvent_init_default, alox_TapEvent_init_default, alox_TapEvent_init_default, alox_TapEvent_init_default, alox_TapEvent_init_default, alox_TapEvent_init_default, alox_TapEvent_init_default, alox_TapEvent_init_default, alox_TapEvent_init_default, alox_TapEvent_init_default, alox_TapEvent_init_default, alox_TapEvent_init_default, alox_TapEvent_init_default, alox_TapEvent_init_default, alox_TapEvent_init_default, alox_TapEvent_init_default}}
|
||||
#define alox_EspNowUnicastTestRequest_init_default {0, 0}
|
||||
#define alox_EspNowUnicastTestResponse_init_default {0, 0}
|
||||
#define alox_LedRingProgressRequest_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||
@@ -480,6 +502,8 @@ extern "C" {
|
||||
#define alox_TapSnapshotRequest_init_zero {0}
|
||||
#define alox_TapEvent_init_zero {0, 0, _alox_TapKind_MIN, 0}
|
||||
#define alox_TapSnapshotResponse_init_zero {0, {alox_TapEvent_init_zero, alox_TapEvent_init_zero, alox_TapEvent_init_zero, alox_TapEvent_init_zero, alox_TapEvent_init_zero, alox_TapEvent_init_zero, alox_TapEvent_init_zero, alox_TapEvent_init_zero, alox_TapEvent_init_zero, alox_TapEvent_init_zero, alox_TapEvent_init_zero, alox_TapEvent_init_zero, alox_TapEvent_init_zero, alox_TapEvent_init_zero, alox_TapEvent_init_zero, alox_TapEvent_init_zero}}
|
||||
#define alox_CacheStatusRequest_init_zero {0}
|
||||
#define alox_CacheStatusResponse_init_zero {0, {alox_AccelSample_init_zero, alox_AccelSample_init_zero, alox_AccelSample_init_zero, alox_AccelSample_init_zero, alox_AccelSample_init_zero, alox_AccelSample_init_zero, alox_AccelSample_init_zero, alox_AccelSample_init_zero, alox_AccelSample_init_zero, alox_AccelSample_init_zero, alox_AccelSample_init_zero, alox_AccelSample_init_zero, alox_AccelSample_init_zero, alox_AccelSample_init_zero, alox_AccelSample_init_zero, alox_AccelSample_init_zero}, 0, {alox_TapEvent_init_zero, alox_TapEvent_init_zero, alox_TapEvent_init_zero, alox_TapEvent_init_zero, alox_TapEvent_init_zero, alox_TapEvent_init_zero, alox_TapEvent_init_zero, alox_TapEvent_init_zero, alox_TapEvent_init_zero, alox_TapEvent_init_zero, alox_TapEvent_init_zero, alox_TapEvent_init_zero, alox_TapEvent_init_zero, alox_TapEvent_init_zero, alox_TapEvent_init_zero, alox_TapEvent_init_zero}}
|
||||
#define alox_EspNowUnicastTestRequest_init_zero {0, 0}
|
||||
#define alox_EspNowUnicastTestResponse_init_zero {0, 0}
|
||||
#define alox_LedRingProgressRequest_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||
@@ -570,6 +594,8 @@ extern "C" {
|
||||
#define alox_TapEvent_kind_tag 3
|
||||
#define alox_TapEvent_age_ms_tag 4
|
||||
#define alox_TapSnapshotResponse_events_tag 1
|
||||
#define alox_CacheStatusResponse_accel_tag 1
|
||||
#define alox_CacheStatusResponse_taps_tag 2
|
||||
#define alox_EspNowUnicastTestRequest_client_id_tag 1
|
||||
#define alox_EspNowUnicastTestRequest_seq_tag 2
|
||||
#define alox_EspNowUnicastTestResponse_success_tag 1
|
||||
@@ -648,6 +674,8 @@ extern "C" {
|
||||
#define alox_UartMessage_tap_notify_response_tag 30
|
||||
#define alox_UartMessage_tap_snapshot_request_tag 31
|
||||
#define alox_UartMessage_tap_snapshot_response_tag 32
|
||||
#define alox_UartMessage_cache_status_request_tag 33
|
||||
#define alox_UartMessage_cache_status_response_tag 34
|
||||
|
||||
/* Struct field encoding specification for nanopb */
|
||||
#define alox_UartMessage_FIELDLIST(X, a) \
|
||||
@@ -682,7 +710,9 @@ X(a, STATIC, ONEOF, MESSAGE, (payload,battery_status_response,payload.batt
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload,tap_notify_request,payload.tap_notify_request), 29) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload,tap_notify_response,payload.tap_notify_response), 30) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload,tap_snapshot_request,payload.tap_snapshot_request), 31) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload,tap_snapshot_response,payload.tap_snapshot_response), 32)
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload,tap_snapshot_response,payload.tap_snapshot_response), 32) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload,cache_status_request,payload.cache_status_request), 33) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload,cache_status_response,payload.cache_status_response), 34)
|
||||
#define alox_UartMessage_CALLBACK NULL
|
||||
#define alox_UartMessage_DEFAULT NULL
|
||||
#define alox_UartMessage_payload_ack_payload_MSGTYPE alox_Ack
|
||||
@@ -716,6 +746,8 @@ X(a, STATIC, ONEOF, MESSAGE, (payload,tap_snapshot_response,payload.tap_sn
|
||||
#define alox_UartMessage_payload_tap_notify_response_MSGTYPE alox_TapNotifyResponse
|
||||
#define alox_UartMessage_payload_tap_snapshot_request_MSGTYPE alox_TapSnapshotRequest
|
||||
#define alox_UartMessage_payload_tap_snapshot_response_MSGTYPE alox_TapSnapshotResponse
|
||||
#define alox_UartMessage_payload_cache_status_request_MSGTYPE alox_CacheStatusRequest
|
||||
#define alox_UartMessage_payload_cache_status_response_MSGTYPE alox_CacheStatusResponse
|
||||
|
||||
#define alox_Ack_FIELDLIST(X, a) \
|
||||
|
||||
@@ -890,6 +922,19 @@ X(a, STATIC, REPEATED, MESSAGE, events, 1)
|
||||
#define alox_TapSnapshotResponse_DEFAULT NULL
|
||||
#define alox_TapSnapshotResponse_events_MSGTYPE alox_TapEvent
|
||||
|
||||
#define alox_CacheStatusRequest_FIELDLIST(X, a) \
|
||||
|
||||
#define alox_CacheStatusRequest_CALLBACK NULL
|
||||
#define alox_CacheStatusRequest_DEFAULT NULL
|
||||
|
||||
#define alox_CacheStatusResponse_FIELDLIST(X, a) \
|
||||
X(a, STATIC, REPEATED, MESSAGE, accel, 1) \
|
||||
X(a, STATIC, REPEATED, MESSAGE, taps, 2)
|
||||
#define alox_CacheStatusResponse_CALLBACK NULL
|
||||
#define alox_CacheStatusResponse_DEFAULT NULL
|
||||
#define alox_CacheStatusResponse_accel_MSGTYPE alox_AccelSample
|
||||
#define alox_CacheStatusResponse_taps_MSGTYPE alox_TapEvent
|
||||
|
||||
#define alox_EspNowUnicastTestRequest_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, UINT32, client_id, 1) \
|
||||
X(a, STATIC, SINGULAR, UINT32, seq, 2)
|
||||
@@ -1022,6 +1067,8 @@ extern const pb_msgdesc_t alox_TapNotifyResponse_msg;
|
||||
extern const pb_msgdesc_t alox_TapSnapshotRequest_msg;
|
||||
extern const pb_msgdesc_t alox_TapEvent_msg;
|
||||
extern const pb_msgdesc_t alox_TapSnapshotResponse_msg;
|
||||
extern const pb_msgdesc_t alox_CacheStatusRequest_msg;
|
||||
extern const pb_msgdesc_t alox_CacheStatusResponse_msg;
|
||||
extern const pb_msgdesc_t alox_EspNowUnicastTestRequest_msg;
|
||||
extern const pb_msgdesc_t alox_EspNowUnicastTestResponse_msg;
|
||||
extern const pb_msgdesc_t alox_LedRingProgressRequest_msg;
|
||||
@@ -1063,6 +1110,8 @@ extern const pb_msgdesc_t alox_OtaSlaveProgressResponse_msg;
|
||||
#define alox_TapSnapshotRequest_fields &alox_TapSnapshotRequest_msg
|
||||
#define alox_TapEvent_fields &alox_TapEvent_msg
|
||||
#define alox_TapSnapshotResponse_fields &alox_TapSnapshotResponse_msg
|
||||
#define alox_CacheStatusRequest_fields &alox_CacheStatusRequest_msg
|
||||
#define alox_CacheStatusResponse_fields &alox_CacheStatusResponse_msg
|
||||
#define alox_EspNowUnicastTestRequest_fields &alox_EspNowUnicastTestRequest_msg
|
||||
#define alox_EspNowUnicastTestResponse_fields &alox_EspNowUnicastTestResponse_msg
|
||||
#define alox_LedRingProgressRequest_fields &alox_LedRingProgressRequest_msg
|
||||
@@ -1086,7 +1135,7 @@ extern const pb_msgdesc_t alox_OtaSlaveProgressResponse_msg;
|
||||
/* alox_ClientInfo_size depends on runtime parameters */
|
||||
/* alox_ClientInfoResponse_size depends on runtime parameters */
|
||||
/* alox_ClientInputResponse_size depends on runtime parameters */
|
||||
#define ALOX_UART_MESSAGES_PB_H_MAX_SIZE alox_BatteryStatusResponse_size
|
||||
#define ALOX_UART_MESSAGES_PB_H_MAX_SIZE alox_CacheStatusResponse_size
|
||||
#define alox_AccelDeadzoneRequest_size 16
|
||||
#define alox_AccelDeadzoneResponse_size 20
|
||||
#define alox_AccelSample_size 32
|
||||
@@ -1098,6 +1147,8 @@ extern const pb_msgdesc_t alox_OtaSlaveProgressResponse_msg;
|
||||
#define alox_BatterySample_size 32
|
||||
#define alox_BatteryStatusRequest_size 8
|
||||
#define alox_BatteryStatusResponse_size 580
|
||||
#define alox_CacheStatusRequest_size 0
|
||||
#define alox_CacheStatusResponse_size 832
|
||||
#define alox_ClientInput_size 22
|
||||
#define alox_EspNowFindMeRequest_size 6
|
||||
#define alox_EspNowFindMeResponse_size 8
|
||||
|
||||
Reference in New Issue
Block a user