Unify cache polling on CACHE_STATUS and split API docs.
Replace separate accel/tap snapshot UART commands with one clients[] response that omits unsubscribed fields; remove snapshot handlers and CLI commands. Add goTool/docs for WebSocket streams and REST; tap-snapshot REST uses CACHE_STATUS. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -22,11 +22,11 @@ enum MessageType {
|
||||
OTA_SLAVE_PROGRESS = 21;
|
||||
FIND_ME = 22;
|
||||
RESTART = 23;
|
||||
ACCEL_SNAPSHOT = 24;
|
||||
reserved 24;
|
||||
ACCEL_STREAM = 25;
|
||||
BATTERY_STATUS = 26;
|
||||
TAP_NOTIFY = 27;
|
||||
TAP_SNAPSHOT = 28;
|
||||
reserved 28;
|
||||
/** Combined cached accel + tap poll (one UART round-trip, ~16 ms cadence). */
|
||||
CACHE_STATUS = 29;
|
||||
}
|
||||
@@ -55,16 +55,12 @@ message UartMessage {
|
||||
EspNowFindMeResponse espnow_find_me_response = 20;
|
||||
RestartRequest restart_request = 21;
|
||||
RestartResponse restart_response = 22;
|
||||
AccelSnapshotRequest accel_snapshot_request = 23;
|
||||
AccelSnapshotResponse accel_snapshot_response = 24;
|
||||
AccelStreamRequest accel_stream_request = 25;
|
||||
AccelStreamResponse accel_stream_response = 26;
|
||||
BatteryStatusRequest battery_status_request = 27;
|
||||
BatteryStatusResponse battery_status_response = 28;
|
||||
TapNotifyRequest tap_notify_request = 29;
|
||||
TapNotifyResponse tap_notify_response = 30;
|
||||
TapSnapshotRequest tap_snapshot_request = 31;
|
||||
TapSnapshotResponse tap_snapshot_response = 32;
|
||||
CacheStatusRequest cache_status_request = 33;
|
||||
CacheStatusResponse cache_status_response = 34;
|
||||
}
|
||||
@@ -174,12 +170,7 @@ message BatteryStatusResponse {
|
||||
repeated BatterySample samples = 2 [(nanopb).max_count = 17];
|
||||
}
|
||||
|
||||
// Host → master: read cached accel samples from slaves (only while stream enabled).
|
||||
// client_id 0 = all registered slaves; otherwise one slave.
|
||||
message AccelSnapshotRequest {
|
||||
uint32 client_id = 1;
|
||||
}
|
||||
|
||||
/** Legacy host-side sample shape (dashboard helpers); use CACHE_STATUS on the wire. */
|
||||
message AccelSample {
|
||||
uint32 client_id = 1;
|
||||
bool valid = 2;
|
||||
@@ -190,10 +181,6 @@ message AccelSample {
|
||||
uint32 age_ms = 6;
|
||||
}
|
||||
|
||||
message AccelSnapshotResponse {
|
||||
repeated AccelSample samples = 1 [(nanopb).max_count = 16];
|
||||
}
|
||||
|
||||
/** Host → master: enable/disable tap ESP-NOW notify per slave (single/double/triple). */
|
||||
message TapNotifyRequest {
|
||||
bool write = 1;
|
||||
@@ -220,11 +207,7 @@ enum TapKind {
|
||||
TAP_TRIPLE = 3;
|
||||
}
|
||||
|
||||
/** Host → master: read cached tap events (discarded after reply or when age > 16 ms). */
|
||||
message TapSnapshotRequest {
|
||||
uint32 client_id = 1;
|
||||
}
|
||||
|
||||
/** Legacy tap event shape (dashboard helpers); use CACHE_STATUS on the wire. */
|
||||
message TapEvent {
|
||||
uint32 client_id = 1;
|
||||
bool valid = 2;
|
||||
@@ -232,18 +215,34 @@ message TapEvent {
|
||||
uint32 age_ms = 4;
|
||||
}
|
||||
|
||||
message TapSnapshotResponse {
|
||||
repeated TapEvent events = 1 [(nanopb).max_count = 16];
|
||||
}
|
||||
|
||||
/** Host → master: one-shot read of subscribed cached slave data (no request body). */
|
||||
message CacheStatusRequest {}
|
||||
|
||||
/** Accel slice inside CACHE_STATUS (no client_id — use parent CacheClientStatus). */
|
||||
message CacheClientAccel {
|
||||
bool valid = 1;
|
||||
sint32 x = 2;
|
||||
sint32 y = 3;
|
||||
sint32 z = 4;
|
||||
uint32 age_ms = 5;
|
||||
}
|
||||
|
||||
/** Tap slice inside CACHE_STATUS; only present when a pending tap was consumed. */
|
||||
message CacheClientTap {
|
||||
TapKind kind = 1;
|
||||
uint32 age_ms = 2;
|
||||
}
|
||||
|
||||
/** One slave with accel and/or tap notify enabled; only subscribed fields are set. */
|
||||
message CacheClientStatus {
|
||||
uint32 client_id = 1;
|
||||
CacheClientAccel accel = 2;
|
||||
CacheClientTap tap = 3;
|
||||
}
|
||||
|
||||
message CacheStatusResponse {
|
||||
/** Slaves with accel_stream_enabled. */
|
||||
repeated AccelSample accel = 1 [(nanopb).max_count = 16];
|
||||
/** Slaves with any tap notify flag; pending taps are consumed (like TAP_SNAPSHOT). */
|
||||
repeated TapEvent taps = 2 [(nanopb).max_count = 16];
|
||||
/** Slaves with accel_stream and/or tap notify; omitted fields are not subscribed. */
|
||||
repeated CacheClientStatus clients = 1 [(nanopb).max_count = 16];
|
||||
}
|
||||
|
||||
message EspNowUnicastTestRequest {
|
||||
|
||||
Reference in New Issue
Block a user