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:
@@ -18,10 +18,8 @@ idf_component_register(
|
||||
"cmd/cmd_version.c"
|
||||
"cmd/cmd_client_info.c"
|
||||
"cmd/cmd_accel_deadzone.c"
|
||||
"cmd/cmd_accel_snapshot.c"
|
||||
"cmd/cmd_accel_stream.c"
|
||||
"cmd/cmd_tap_notify.c"
|
||||
"cmd/cmd_tap_snapshot.c"
|
||||
"cmd/cmd_cache_status.c"
|
||||
"cmd/cmd_espnow_unicast_test.c"
|
||||
"cmd/cmd_espnow_find_me.c"
|
||||
|
||||
+16
-53
@@ -222,10 +222,9 @@ Host and master speak nanopb-encoded `UartMessage` inside UART frames (byte 0 =
|
||||
| 21 | `OTA_SLAVE_PROGRESS` | Implemented (`cmd/cmd_ota_slave_progress.c`) — query per-slave ESP-NOW OTA progress |
|
||||
| 22 | `FIND_ME` | Implemented (`cmd/cmd_espnow_find_me.c`) — `client_id=0` local ring, `>0` ESP-NOW to slave |
|
||||
| 23 | `RESTART` | Implemented (`cmd/cmd_restart.c`) — `client_id=0` reboot master, `>0` ESP-NOW reboot slave |
|
||||
| 24 | `ACCEL_SNAPSHOT` | Implemented (`cmd/cmd_accel_snapshot.c`) — cached slave accel from ESP-NOW stream |
|
||||
| 25 | `ACCEL_STREAM` | Implemented — enable/disable slave ESP-NOW accel stream to master |
|
||||
| 27 | `TAP_NOTIFY` | Implemented (`cmd/cmd_tap_notify.c`) — get/set which tap kinds notify via ESP-NOW |
|
||||
| 28 | `TAP_SNAPSHOT` | Implemented (`cmd/cmd_tap_snapshot.c`) — consume cached tap events from master registry |
|
||||
| 29 | `CACHE_STATUS` | Implemented (`cmd/cmd_cache_status.c`) — combined accel + tap cache in one UART round-trip |
|
||||
| 29 | `CACHE_STATUS` | Implemented (`cmd/cmd_cache_status.c`) — subscribed accel + tap cache (one UART round-trip) |
|
||||
|
||||
Regenerate C code:
|
||||
|
||||
@@ -319,29 +318,6 @@ Sets the **software** deadzone used by `bosch456.c` when logging accel (see [BMA
|
||||
|
||||
**Response:** `accel_deadzone_response` with applied `deadzone`, `success`, and `slaves_updated` (ESP-NOW count).
|
||||
|
||||
### ACCEL_SNAPSHOT command
|
||||
|
||||
Read **cached** accelerometer samples on the **master** (one entry per registered slave). Slaves send `ESPNOW_ACCEL_SAMPLE` to the master every **16 ms** (`esp_now_comm.c`); the master stores the latest value per client in `client_registry.c`.
|
||||
|
||||
**Request:** framed `18` (`0x18`) + optional `accel_snapshot_request` (`client_id`: `0` = all slaves, `>0` = one id).
|
||||
|
||||
**Response:** `accel_snapshot_response.samples[]`:
|
||||
|
||||
| Field | Meaning |
|
||||
|-------|---------|
|
||||
| `client_id` | Slave id (registry) |
|
||||
| `valid` | At least one ESP-NOW sample received since boot |
|
||||
| `x`, `y`, `z` | Raw BMA456 LSB (±2g) |
|
||||
| `age_ms` | Ms since last sample from that slave |
|
||||
|
||||
Host:
|
||||
|
||||
```bash
|
||||
go run . -port /dev/ttyUSB0 accel
|
||||
```
|
||||
|
||||
External API (`serve -api-addr :8081`) polls this command every 16 ms and streams JSON over WebSocket.
|
||||
|
||||
### TAP_NOTIFY command
|
||||
|
||||
Configure which BMA456 tap kinds a **slave** forwards to the master over ESP-NOW. The slave only sends `ESPNOW_TAP_EVENT` when the matching notify flag is enabled (set locally on the slave via ESP-NOW).
|
||||
@@ -364,41 +340,30 @@ go run . -port /dev/ttyUSB0 tap-notify -client 16 -set -single
|
||||
go run . -port /dev/ttyUSB0 tap-notify -client 16
|
||||
```
|
||||
|
||||
### TAP_SNAPSHOT command
|
||||
|
||||
Read **cached** tap events on the **master** (one pending event per slave). Slaves send `ESPNOW_TAP_EVENT` on tap; the master stores the latest value per client in `client_registry.c` for up to **16 ms** (`CLIENT_REGISTRY_TAP_MAX_AGE_MS`). Each snapshot **consumes** fresh events (cleared after read).
|
||||
|
||||
### CACHE_STATUS command
|
||||
|
||||
Fast combined poll for host tools at **16 ms** or faster: one UART frame, no request body (command id `0x1d` only).
|
||||
Read **cached** accel and/or tap data on the **master** in one UART round-trip. Slaves send `ESPNOW_ACCEL_SAMPLE` every **16 ms** when streaming; tap events arrive via `ESPNOW_TAP_EVENT` and are held up to **16 ms** (`CLIENT_REGISTRY_TAP_MAX_AGE_MS`). Pending taps are **consumed** on read (like the former `TAP_SNAPSHOT`).
|
||||
|
||||
**Response:** `cache_status_response` with:
|
||||
**Request:** framed `1d` (`0x1d`) only — no body (`CacheStatusRequest` empty).
|
||||
|
||||
- `accel[]` — same as `ACCEL_SNAPSHOT`, only clients with `accel_stream_enabled`
|
||||
- `taps[]` — same as `TAP_SNAPSHOT`, only clients with any tap notify flag; pending taps are consumed
|
||||
**Response:** `cache_status_response.clients[]` — one entry per slave with `accel_stream_enabled` and/or any tap-notify flag:
|
||||
|
||||
The master walks `client_registry` once per request (`cmd/cmd_cache_status.c`). Prefer this over separate `ACCEL_SNAPSHOT` + `TAP_SNAPSHOT` when polling both streams.
|
||||
| Field | When present |
|
||||
|-------|----------------|
|
||||
| `client_id` | Always (for listed slaves) |
|
||||
| `accel` | Slave has accel stream on (`valid`, `x`/`y`/`z`, `age_ms` when sample fresh) |
|
||||
| `tap` | Tap notify on **and** a pending tap was consumed (`kind`, `age_ms`) |
|
||||
|
||||
Only slaves with at least one tap-notify flag enabled are included.
|
||||
Unsubscribed submessages are omitted on the wire (proto3 defaults). The master walks `client_registry` once per request (`cmd/cmd_cache_status.c`).
|
||||
|
||||
**Request:** framed `1c` (`0x1c`) + optional `tap_snapshot_request` (`client_id`: `0` = all, `>0` = one id).
|
||||
|
||||
**Response:** `tap_snapshot_response.events[]`:
|
||||
|
||||
| Field | Meaning |
|
||||
|-------|---------|
|
||||
| `client_id` | Slave id (registry) |
|
||||
| `valid` | Fresh tap available (≤16 ms) |
|
||||
| `kind` | `TAP_SINGLE`, `TAP_DOUBLE`, or `TAP_TRIPLE` |
|
||||
| `age_ms` | Ms since tap was received on master |
|
||||
|
||||
Host tools poll this only when **receive** is enabled (dashboard tap column, WebSocket `set_tap_stream`). They keep events visible for **2 s** in the UI/API after first sight.
|
||||
Host tools poll this at **16 ms** when live-stream / WebSocket receive is enabled. Tap events stay visible for **2 s** in the UI/API after first sight.
|
||||
|
||||
```bash
|
||||
go run . -port /dev/ttyUSB0 tap
|
||||
go run . -port /dev/ttyUSB0 tap -client 16
|
||||
go run . -port /dev/ttyUSB0 cache-status
|
||||
```
|
||||
|
||||
External API (`serve -api-addr :8081`) uses the same command for WebSocket `accel` / `tap` push.
|
||||
|
||||
### ESPNOW_UNICAST_TEST command
|
||||
|
||||
Minimal master→slave ESP-NOW unicast check (no BMA456). Use this before debugging `ACCEL_DEADZONE` unicast.
|
||||
@@ -564,10 +529,8 @@ Target: ESP32-S3. Close serial monitor on the UART adapter port before running `
|
||||
| `cmd/cmd_client_info.c/h` | CLIENT_INFO handler |
|
||||
| `client_registry.c/h` | Registered slave table |
|
||||
| `bosch456.c/h` | BMA456H I2C driver, accel poll, on-demand read, tap INT, deadzone filter |
|
||||
| `cmd/cmd_accel_snapshot.c` | UART `ACCEL_SNAPSHOT` — cached slave accel |
|
||||
| `cmd/cmd_tap_notify.c` | UART `TAP_NOTIFY` — ESP-NOW tap notify config |
|
||||
| `cmd/cmd_tap_snapshot.c` | UART `TAP_SNAPSHOT` — consume cached tap events |
|
||||
| `cmd/cmd_cache_status.c` | UART `CACHE_STATUS` — combined accel + tap cache poll |
|
||||
| `cmd/cmd_cache_status.c` | UART `CACHE_STATUS` — subscribed accel + tap cache poll |
|
||||
| `board_input.c/h` | Taster GPIO12, LiPo ADC on GPIO1 / GPIO12 |
|
||||
| `pod_settings.c/h` | NVS persistence (accel deadzone, …) |
|
||||
| `led_ring.c/h` | LED ring (digit display, progress bar) |
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
#include "client_registry.h"
|
||||
#include "cmd_accel_snapshot.h"
|
||||
#include "uart_cmd.h"
|
||||
|
||||
static const char *TAG = "[ACCEL_SNAP]";
|
||||
|
||||
static void fill_accel_snapshot(alox_AccelSnapshotResponse *out,
|
||||
uint32_t filter_client_id) {
|
||||
if (out == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
out->samples_count = 0;
|
||||
size_t count = client_registry_count();
|
||||
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
const client_info_t *client = client_registry_at(i);
|
||||
if (client == NULL) {
|
||||
continue;
|
||||
}
|
||||
if (filter_client_id != 0 && client->id != filter_client_id) {
|
||||
continue;
|
||||
}
|
||||
if (!client->accel_stream_enabled) {
|
||||
continue;
|
||||
}
|
||||
if (out->samples_count >=
|
||||
sizeof(out->samples) / sizeof(out->samples[0])) {
|
||||
break;
|
||||
}
|
||||
|
||||
alox_AccelSample *sample = &out->samples[out->samples_count++];
|
||||
sample->client_id = client->id;
|
||||
sample->valid = client->accel_valid;
|
||||
sample->x = client->accel_x;
|
||||
sample->y = client->accel_y;
|
||||
sample->z = client->accel_z;
|
||||
if (client->accel_valid) {
|
||||
sample->age_ms = client_registry_ms_since(client->accel_updated_at);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void handle_accel_snapshot(const uint8_t *data, size_t len) {
|
||||
uint32_t filter_client_id = 0;
|
||||
|
||||
if (len > 0) {
|
||||
alox_UartMessage req;
|
||||
if (uart_cmd_decode(data, len, &req) == ESP_OK) {
|
||||
alox_AccelSnapshotRequest *snap_req = UART_CMD_REQ(
|
||||
&req, alox_UartMessage_accel_snapshot_request_tag, accel_snapshot_request);
|
||||
if (snap_req != NULL) {
|
||||
filter_client_id = snap_req->client_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
alox_UartMessage response;
|
||||
uart_cmd_init_response(&response, alox_MessageType_ACCEL_SNAPSHOT,
|
||||
alox_UartMessage_accel_snapshot_response_tag);
|
||||
fill_accel_snapshot(&response.payload.accel_snapshot_response, filter_client_id);
|
||||
|
||||
uart_cmd_send(&response, TAG);
|
||||
}
|
||||
|
||||
void cmd_accel_snapshot_register(void) {
|
||||
uart_cmd_register(alox_MessageType_ACCEL_SNAPSHOT, handle_accel_snapshot);
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
#ifndef CMD_ACCEL_SNAPSHOT_H
|
||||
#define CMD_ACCEL_SNAPSHOT_H
|
||||
|
||||
void cmd_accel_snapshot_register(void);
|
||||
|
||||
#endif
|
||||
+29
-20
@@ -28,8 +28,7 @@ static void fill_cache_status(alox_CacheStatusResponse *out) {
|
||||
return;
|
||||
}
|
||||
|
||||
out->accel_count = 0;
|
||||
out->taps_count = 0;
|
||||
out->clients_count = 0;
|
||||
|
||||
size_t count = client_registry_count();
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
@@ -38,31 +37,41 @@ static void fill_cache_status(alox_CacheStatusResponse *out) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (client->accel_stream_enabled &&
|
||||
out->accel_count < sizeof(out->accel) / sizeof(out->accel[0])) {
|
||||
alox_AccelSample *sample = &out->accel[out->accel_count++];
|
||||
sample->client_id = client->id;
|
||||
sample->valid = client->accel_valid;
|
||||
sample->x = client->accel_x;
|
||||
sample->y = client->accel_y;
|
||||
sample->z = client->accel_z;
|
||||
const bool want_accel = client->accel_stream_enabled;
|
||||
const bool want_tap = tap_notify_any(client);
|
||||
if (!want_accel && !want_tap) {
|
||||
continue;
|
||||
}
|
||||
if (out->clients_count >=
|
||||
sizeof(out->clients) / sizeof(out->clients[0])) {
|
||||
break;
|
||||
}
|
||||
|
||||
alox_CacheClientStatus *entry = &out->clients[out->clients_count++];
|
||||
entry->client_id = client->id;
|
||||
entry->has_accel = false;
|
||||
entry->has_tap = false;
|
||||
|
||||
if (want_accel) {
|
||||
entry->has_accel = true;
|
||||
entry->accel.valid = client->accel_valid;
|
||||
if (client->accel_valid) {
|
||||
sample->age_ms = client_registry_ms_since(client->accel_updated_at);
|
||||
entry->accel.x = client->accel_x;
|
||||
entry->accel.y = client->accel_y;
|
||||
entry->accel.z = client->accel_z;
|
||||
entry->accel.age_ms =
|
||||
client_registry_ms_since(client->accel_updated_at);
|
||||
}
|
||||
}
|
||||
|
||||
if (tap_notify_any(client) &&
|
||||
out->taps_count < sizeof(out->taps) / sizeof(out->taps[0])) {
|
||||
if (want_tap) {
|
||||
uint32_t kind = 0;
|
||||
uint32_t age_ms = 0;
|
||||
if (!client_registry_take_tap(client->id, &kind, &age_ms)) {
|
||||
continue;
|
||||
if (client_registry_take_tap(client->id, &kind, &age_ms)) {
|
||||
entry->has_tap = true;
|
||||
entry->tap.kind = tap_kind_from_registry(kind);
|
||||
entry->tap.age_ms = age_ms;
|
||||
}
|
||||
alox_TapEvent *event = &out->taps[out->taps_count++];
|
||||
event->client_id = client->id;
|
||||
event->valid = true;
|
||||
event->kind = tap_kind_from_registry(kind);
|
||||
event->age_ms = age_ms;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,16 +48,12 @@ static const char *message_type_name(uint16_t id) {
|
||||
return "FIND_ME";
|
||||
case alox_MessageType_RESTART:
|
||||
return "RESTART";
|
||||
case alox_MessageType_ACCEL_SNAPSHOT:
|
||||
return "ACCEL_SNAPSHOT";
|
||||
case alox_MessageType_ACCEL_STREAM:
|
||||
return "ACCEL_STREAM";
|
||||
case alox_MessageType_BATTERY_STATUS:
|
||||
return "BATTERY_STATUS";
|
||||
case alox_MessageType_TAP_NOTIFY:
|
||||
return "TAP_NOTIFY";
|
||||
case alox_MessageType_TAP_SNAPSHOT:
|
||||
return "TAP_SNAPSHOT";
|
||||
case alox_MessageType_CACHE_STATUS:
|
||||
return "CACHE_STATUS";
|
||||
default:
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
#include "client_registry.h"
|
||||
#include "cmd_tap_snapshot.h"
|
||||
#include "uart_cmd.h"
|
||||
|
||||
static const char *TAG = "[TAP_SNAP]";
|
||||
|
||||
static alox_TapKind tap_kind_from_registry(uint32_t kind) {
|
||||
switch (kind) {
|
||||
case 1:
|
||||
return alox_TapKind_TAP_SINGLE;
|
||||
case 2:
|
||||
return alox_TapKind_TAP_DOUBLE;
|
||||
case 3:
|
||||
return alox_TapKind_TAP_TRIPLE;
|
||||
default:
|
||||
return alox_TapKind_TAP_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
static bool tap_notify_any(const client_info_t *client) {
|
||||
return client != NULL &&
|
||||
(client->tap_notify_single || client->tap_notify_double ||
|
||||
client->tap_notify_triple);
|
||||
}
|
||||
|
||||
static void fill_tap_snapshot(alox_TapSnapshotResponse *out,
|
||||
uint32_t filter_client_id) {
|
||||
if (out == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
out->events_count = 0;
|
||||
size_t count = client_registry_count();
|
||||
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
const client_info_t *client = client_registry_at(i);
|
||||
if (client == NULL) {
|
||||
continue;
|
||||
}
|
||||
if (filter_client_id != 0 && client->id != filter_client_id) {
|
||||
continue;
|
||||
}
|
||||
if (!tap_notify_any(client)) {
|
||||
continue;
|
||||
}
|
||||
if (out->events_count >= sizeof(out->events) / sizeof(out->events[0])) {
|
||||
break;
|
||||
}
|
||||
|
||||
uint32_t kind = 0;
|
||||
uint32_t age_ms = 0;
|
||||
if (!client_registry_take_tap(client->id, &kind, &age_ms)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
alox_TapEvent *event = &out->events[out->events_count++];
|
||||
event->client_id = client->id;
|
||||
event->valid = true;
|
||||
event->kind = tap_kind_from_registry(kind);
|
||||
event->age_ms = age_ms;
|
||||
}
|
||||
}
|
||||
|
||||
static void handle_tap_snapshot(const uint8_t *data, size_t len) {
|
||||
uint32_t filter_client_id = 0;
|
||||
|
||||
if (len > 0) {
|
||||
alox_UartMessage req;
|
||||
if (uart_cmd_decode(data, len, &req) == ESP_OK) {
|
||||
alox_TapSnapshotRequest *snap_req = UART_CMD_REQ(
|
||||
&req, alox_UartMessage_tap_snapshot_request_tag, tap_snapshot_request);
|
||||
if (snap_req != NULL) {
|
||||
filter_client_id = snap_req->client_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
alox_UartMessage response;
|
||||
uart_cmd_init_response(&response, alox_MessageType_TAP_SNAPSHOT,
|
||||
alox_UartMessage_tap_snapshot_response_tag);
|
||||
fill_tap_snapshot(&response.payload.tap_snapshot_response, filter_client_id);
|
||||
|
||||
uart_cmd_send(&response, TAG);
|
||||
}
|
||||
|
||||
void cmd_tap_snapshot_register(void) {
|
||||
uart_cmd_register(alox_MessageType_TAP_SNAPSHOT, handle_tap_snapshot);
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
#ifndef CMD_TAP_SNAPSHOT_H
|
||||
#define CMD_TAP_SNAPSHOT_H
|
||||
|
||||
void cmd_tap_snapshot_register(void);
|
||||
|
||||
#endif
|
||||
@@ -1,10 +1,8 @@
|
||||
#include "app_config.h"
|
||||
#include "cmd_handler.h"
|
||||
#include "cmd_accel_deadzone.h"
|
||||
#include "cmd_accel_snapshot.h"
|
||||
#include "cmd_accel_stream.h"
|
||||
#include "cmd_tap_notify.h"
|
||||
#include "cmd_tap_snapshot.h"
|
||||
#include "cmd_cache_status.h"
|
||||
#include "cmd_espnow_unicast_test.h"
|
||||
#include "cmd_espnow_find_me.h"
|
||||
@@ -183,10 +181,8 @@ void app_main(void) {
|
||||
cmd_version_register();
|
||||
cmd_client_info_register();
|
||||
cmd_accel_deadzone_register();
|
||||
cmd_accel_snapshot_register();
|
||||
cmd_accel_stream_register();
|
||||
cmd_tap_notify_register();
|
||||
cmd_tap_snapshot_register();
|
||||
cmd_cache_status_register();
|
||||
cmd_espnow_unicast_test_register();
|
||||
cmd_espnow_find_me_register();
|
||||
|
||||
@@ -54,33 +54,30 @@ PB_BIND(alox_BatterySample, alox_BatterySample, AUTO)
|
||||
PB_BIND(alox_BatteryStatusResponse, alox_BatteryStatusResponse, 2)
|
||||
|
||||
|
||||
PB_BIND(alox_AccelSnapshotRequest, alox_AccelSnapshotRequest, AUTO)
|
||||
|
||||
|
||||
PB_BIND(alox_AccelSample, alox_AccelSample, AUTO)
|
||||
|
||||
|
||||
PB_BIND(alox_AccelSnapshotResponse, alox_AccelSnapshotResponse, 2)
|
||||
|
||||
|
||||
PB_BIND(alox_TapNotifyRequest, alox_TapNotifyRequest, AUTO)
|
||||
|
||||
|
||||
PB_BIND(alox_TapNotifyResponse, alox_TapNotifyResponse, AUTO)
|
||||
|
||||
|
||||
PB_BIND(alox_TapSnapshotRequest, alox_TapSnapshotRequest, AUTO)
|
||||
|
||||
|
||||
PB_BIND(alox_TapEvent, alox_TapEvent, AUTO)
|
||||
|
||||
|
||||
PB_BIND(alox_TapSnapshotResponse, alox_TapSnapshotResponse, 2)
|
||||
|
||||
|
||||
PB_BIND(alox_CacheStatusRequest, alox_CacheStatusRequest, AUTO)
|
||||
|
||||
|
||||
PB_BIND(alox_CacheClientAccel, alox_CacheClientAccel, AUTO)
|
||||
|
||||
|
||||
PB_BIND(alox_CacheClientTap, alox_CacheClientTap, AUTO)
|
||||
|
||||
|
||||
PB_BIND(alox_CacheClientStatus, alox_CacheClientStatus, AUTO)
|
||||
|
||||
|
||||
PB_BIND(alox_CacheStatusResponse, alox_CacheStatusResponse, 2)
|
||||
|
||||
|
||||
|
||||
+87
-103
@@ -28,11 +28,9 @@ typedef enum _alox_MessageType {
|
||||
alox_MessageType_OTA_SLAVE_PROGRESS = 21,
|
||||
alox_MessageType_FIND_ME = 22,
|
||||
alox_MessageType_RESTART = 23,
|
||||
alox_MessageType_ACCEL_SNAPSHOT = 24,
|
||||
alox_MessageType_ACCEL_STREAM = 25,
|
||||
alox_MessageType_BATTERY_STATUS = 26,
|
||||
alox_MessageType_TAP_NOTIFY = 27,
|
||||
alox_MessageType_TAP_SNAPSHOT = 28,
|
||||
/* * Combined cached accel + tap poll (one UART round-trip, ~16 ms cadence). */
|
||||
alox_MessageType_CACHE_STATUS = 29
|
||||
} alox_MessageType;
|
||||
@@ -154,12 +152,7 @@ typedef struct _alox_BatteryStatusResponse {
|
||||
alox_BatterySample samples[17];
|
||||
} alox_BatteryStatusResponse;
|
||||
|
||||
/* Host → master: read cached accel samples from slaves (only while stream enabled).
|
||||
client_id 0 = all registered slaves; otherwise one slave. */
|
||||
typedef struct _alox_AccelSnapshotRequest {
|
||||
uint32_t client_id;
|
||||
} alox_AccelSnapshotRequest;
|
||||
|
||||
/* * Legacy host-side sample shape (dashboard helpers); use CACHE_STATUS on the wire. */
|
||||
typedef struct _alox_AccelSample {
|
||||
uint32_t client_id;
|
||||
bool valid;
|
||||
@@ -170,11 +163,6 @@ typedef struct _alox_AccelSample {
|
||||
uint32_t age_ms;
|
||||
} alox_AccelSample;
|
||||
|
||||
typedef struct _alox_AccelSnapshotResponse {
|
||||
pb_size_t samples_count;
|
||||
alox_AccelSample samples[16];
|
||||
} alox_AccelSnapshotResponse;
|
||||
|
||||
/* * Host → master: enable/disable tap ESP-NOW notify per slave (single/double/triple). */
|
||||
typedef struct _alox_TapNotifyRequest {
|
||||
bool write;
|
||||
@@ -194,11 +182,7 @@ typedef struct _alox_TapNotifyResponse {
|
||||
bool triple;
|
||||
} alox_TapNotifyResponse;
|
||||
|
||||
/* * Host → master: read cached tap events (discarded after reply or when age > 16 ms). */
|
||||
typedef struct _alox_TapSnapshotRequest {
|
||||
uint32_t client_id;
|
||||
} alox_TapSnapshotRequest;
|
||||
|
||||
/* * Legacy tap event shape (dashboard helpers); use CACHE_STATUS on the wire. */
|
||||
typedef struct _alox_TapEvent {
|
||||
uint32_t client_id;
|
||||
bool valid;
|
||||
@@ -206,23 +190,39 @@ typedef struct _alox_TapEvent {
|
||||
uint32_t age_ms;
|
||||
} alox_TapEvent;
|
||||
|
||||
typedef struct _alox_TapSnapshotResponse {
|
||||
pb_size_t events_count;
|
||||
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;
|
||||
|
||||
/* * Accel slice inside CACHE_STATUS (no client_id — use parent CacheClientStatus). */
|
||||
typedef struct _alox_CacheClientAccel {
|
||||
bool valid;
|
||||
int32_t x;
|
||||
int32_t y;
|
||||
int32_t z;
|
||||
uint32_t age_ms;
|
||||
} alox_CacheClientAccel;
|
||||
|
||||
/* * Tap slice inside CACHE_STATUS; only present when a pending tap was consumed. */
|
||||
typedef struct _alox_CacheClientTap {
|
||||
alox_TapKind kind;
|
||||
uint32_t age_ms;
|
||||
} alox_CacheClientTap;
|
||||
|
||||
/* * One slave with accel and/or tap notify enabled; only subscribed fields are set. */
|
||||
typedef struct _alox_CacheClientStatus {
|
||||
uint32_t client_id;
|
||||
bool has_accel;
|
||||
alox_CacheClientAccel accel;
|
||||
bool has_tap;
|
||||
alox_CacheClientTap tap;
|
||||
} alox_CacheClientStatus;
|
||||
|
||||
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];
|
||||
/* * Slaves with accel_stream and/or tap notify; omitted fields are not subscribed. */
|
||||
pb_size_t clients_count;
|
||||
alox_CacheClientStatus clients[16];
|
||||
} alox_CacheStatusResponse;
|
||||
|
||||
typedef struct _alox_EspNowUnicastTestRequest {
|
||||
@@ -363,16 +363,12 @@ typedef struct _alox_UartMessage {
|
||||
alox_EspNowFindMeResponse espnow_find_me_response;
|
||||
alox_RestartRequest restart_request;
|
||||
alox_RestartResponse restart_response;
|
||||
alox_AccelSnapshotRequest accel_snapshot_request;
|
||||
alox_AccelSnapshotResponse accel_snapshot_response;
|
||||
alox_AccelStreamRequest accel_stream_request;
|
||||
alox_AccelStreamResponse accel_stream_response;
|
||||
alox_BatteryStatusRequest battery_status_request;
|
||||
alox_BatteryStatusResponse battery_status_response;
|
||||
alox_TapNotifyRequest tap_notify_request;
|
||||
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;
|
||||
@@ -410,15 +406,15 @@ extern "C" {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define alox_TapEvent_kind_ENUMTYPE alox_TapKind
|
||||
|
||||
|
||||
|
||||
#define alox_CacheClientTap_kind_ENUMTYPE alox_TapKind
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -453,16 +449,15 @@ extern "C" {
|
||||
#define alox_LipoReading_init_default {0, 0}
|
||||
#define alox_BatterySample_init_default {0, false, alox_LipoReading_init_default, false, alox_LipoReading_init_default, 0}
|
||||
#define alox_BatteryStatusResponse_init_default {0, 0, {alox_BatterySample_init_default, alox_BatterySample_init_default, alox_BatterySample_init_default, alox_BatterySample_init_default, alox_BatterySample_init_default, alox_BatterySample_init_default, alox_BatterySample_init_default, alox_BatterySample_init_default, alox_BatterySample_init_default, alox_BatterySample_init_default, alox_BatterySample_init_default, alox_BatterySample_init_default, alox_BatterySample_init_default, alox_BatterySample_init_default, alox_BatterySample_init_default, alox_BatterySample_init_default, alox_BatterySample_init_default}}
|
||||
#define alox_AccelSnapshotRequest_init_default {0}
|
||||
#define alox_AccelSample_init_default {0, 0, 0, 0, 0, 0}
|
||||
#define alox_AccelSnapshotResponse_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}}
|
||||
#define alox_TapNotifyRequest_init_default {0, 0, 0, 0, 0, 0}
|
||||
#define alox_TapNotifyResponse_init_default {0, 0, 0, 0, 0, 0}
|
||||
#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_CacheClientAccel_init_default {0, 0, 0, 0, 0}
|
||||
#define alox_CacheClientTap_init_default {_alox_TapKind_MIN, 0}
|
||||
#define alox_CacheClientStatus_init_default {0, false, alox_CacheClientAccel_init_default, false, alox_CacheClientTap_init_default}
|
||||
#define alox_CacheStatusResponse_init_default {0, {alox_CacheClientStatus_init_default, alox_CacheClientStatus_init_default, alox_CacheClientStatus_init_default, alox_CacheClientStatus_init_default, alox_CacheClientStatus_init_default, alox_CacheClientStatus_init_default, alox_CacheClientStatus_init_default, alox_CacheClientStatus_init_default, alox_CacheClientStatus_init_default, alox_CacheClientStatus_init_default, alox_CacheClientStatus_init_default, alox_CacheClientStatus_init_default, alox_CacheClientStatus_init_default, alox_CacheClientStatus_init_default, alox_CacheClientStatus_init_default, alox_CacheClientStatus_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}
|
||||
@@ -494,16 +489,15 @@ extern "C" {
|
||||
#define alox_LipoReading_init_zero {0, 0}
|
||||
#define alox_BatterySample_init_zero {0, false, alox_LipoReading_init_zero, false, alox_LipoReading_init_zero, 0}
|
||||
#define alox_BatteryStatusResponse_init_zero {0, 0, {alox_BatterySample_init_zero, alox_BatterySample_init_zero, alox_BatterySample_init_zero, alox_BatterySample_init_zero, alox_BatterySample_init_zero, alox_BatterySample_init_zero, alox_BatterySample_init_zero, alox_BatterySample_init_zero, alox_BatterySample_init_zero, alox_BatterySample_init_zero, alox_BatterySample_init_zero, alox_BatterySample_init_zero, alox_BatterySample_init_zero, alox_BatterySample_init_zero, alox_BatterySample_init_zero, alox_BatterySample_init_zero, alox_BatterySample_init_zero}}
|
||||
#define alox_AccelSnapshotRequest_init_zero {0}
|
||||
#define alox_AccelSample_init_zero {0, 0, 0, 0, 0, 0}
|
||||
#define alox_AccelSnapshotResponse_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}}
|
||||
#define alox_TapNotifyRequest_init_zero {0, 0, 0, 0, 0, 0}
|
||||
#define alox_TapNotifyResponse_init_zero {0, 0, 0, 0, 0, 0}
|
||||
#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_CacheClientAccel_init_zero {0, 0, 0, 0, 0}
|
||||
#define alox_CacheClientTap_init_zero {_alox_TapKind_MIN, 0}
|
||||
#define alox_CacheClientStatus_init_zero {0, false, alox_CacheClientAccel_init_zero, false, alox_CacheClientTap_init_zero}
|
||||
#define alox_CacheStatusResponse_init_zero {0, {alox_CacheClientStatus_init_zero, alox_CacheClientStatus_init_zero, alox_CacheClientStatus_init_zero, alox_CacheClientStatus_init_zero, alox_CacheClientStatus_init_zero, alox_CacheClientStatus_init_zero, alox_CacheClientStatus_init_zero, alox_CacheClientStatus_init_zero, alox_CacheClientStatus_init_zero, alox_CacheClientStatus_init_zero, alox_CacheClientStatus_init_zero, alox_CacheClientStatus_init_zero, alox_CacheClientStatus_init_zero, alox_CacheClientStatus_init_zero, alox_CacheClientStatus_init_zero, alox_CacheClientStatus_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}
|
||||
@@ -568,14 +562,12 @@ extern "C" {
|
||||
#define alox_BatterySample_age_ms_tag 4
|
||||
#define alox_BatteryStatusResponse_success_tag 1
|
||||
#define alox_BatteryStatusResponse_samples_tag 2
|
||||
#define alox_AccelSnapshotRequest_client_id_tag 1
|
||||
#define alox_AccelSample_client_id_tag 1
|
||||
#define alox_AccelSample_valid_tag 2
|
||||
#define alox_AccelSample_x_tag 3
|
||||
#define alox_AccelSample_y_tag 4
|
||||
#define alox_AccelSample_z_tag 5
|
||||
#define alox_AccelSample_age_ms_tag 6
|
||||
#define alox_AccelSnapshotResponse_samples_tag 1
|
||||
#define alox_TapNotifyRequest_write_tag 1
|
||||
#define alox_TapNotifyRequest_client_id_tag 2
|
||||
#define alox_TapNotifyRequest_all_clients_tag 3
|
||||
@@ -588,14 +580,21 @@ extern "C" {
|
||||
#define alox_TapNotifyResponse_single_tag 4
|
||||
#define alox_TapNotifyResponse_double_tap_tag 5
|
||||
#define alox_TapNotifyResponse_triple_tag 6
|
||||
#define alox_TapSnapshotRequest_client_id_tag 1
|
||||
#define alox_TapEvent_client_id_tag 1
|
||||
#define alox_TapEvent_valid_tag 2
|
||||
#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_CacheClientAccel_valid_tag 1
|
||||
#define alox_CacheClientAccel_x_tag 2
|
||||
#define alox_CacheClientAccel_y_tag 3
|
||||
#define alox_CacheClientAccel_z_tag 4
|
||||
#define alox_CacheClientAccel_age_ms_tag 5
|
||||
#define alox_CacheClientTap_kind_tag 1
|
||||
#define alox_CacheClientTap_age_ms_tag 2
|
||||
#define alox_CacheClientStatus_client_id_tag 1
|
||||
#define alox_CacheClientStatus_accel_tag 2
|
||||
#define alox_CacheClientStatus_tap_tag 3
|
||||
#define alox_CacheStatusResponse_clients_tag 1
|
||||
#define alox_EspNowUnicastTestRequest_client_id_tag 1
|
||||
#define alox_EspNowUnicastTestRequest_seq_tag 2
|
||||
#define alox_EspNowUnicastTestResponse_success_tag 1
|
||||
@@ -664,16 +663,12 @@ extern "C" {
|
||||
#define alox_UartMessage_espnow_find_me_response_tag 20
|
||||
#define alox_UartMessage_restart_request_tag 21
|
||||
#define alox_UartMessage_restart_response_tag 22
|
||||
#define alox_UartMessage_accel_snapshot_request_tag 23
|
||||
#define alox_UartMessage_accel_snapshot_response_tag 24
|
||||
#define alox_UartMessage_accel_stream_request_tag 25
|
||||
#define alox_UartMessage_accel_stream_response_tag 26
|
||||
#define alox_UartMessage_battery_status_request_tag 27
|
||||
#define alox_UartMessage_battery_status_response_tag 28
|
||||
#define alox_UartMessage_tap_notify_request_tag 29
|
||||
#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
|
||||
|
||||
@@ -701,16 +696,12 @@ X(a, STATIC, ONEOF, MESSAGE, (payload,espnow_find_me_request,payload.espno
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload,espnow_find_me_response,payload.espnow_find_me_response), 20) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload,restart_request,payload.restart_request), 21) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload,restart_response,payload.restart_response), 22) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload,accel_snapshot_request,payload.accel_snapshot_request), 23) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload,accel_snapshot_response,payload.accel_snapshot_response), 24) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload,accel_stream_request,payload.accel_stream_request), 25) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload,accel_stream_response,payload.accel_stream_response), 26) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload,battery_status_request,payload.battery_status_request), 27) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload,battery_status_response,payload.battery_status_response), 28) \
|
||||
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,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
|
||||
@@ -736,16 +727,12 @@ X(a, STATIC, ONEOF, MESSAGE, (payload,cache_status_response,payload.cache_
|
||||
#define alox_UartMessage_payload_espnow_find_me_response_MSGTYPE alox_EspNowFindMeResponse
|
||||
#define alox_UartMessage_payload_restart_request_MSGTYPE alox_RestartRequest
|
||||
#define alox_UartMessage_payload_restart_response_MSGTYPE alox_RestartResponse
|
||||
#define alox_UartMessage_payload_accel_snapshot_request_MSGTYPE alox_AccelSnapshotRequest
|
||||
#define alox_UartMessage_payload_accel_snapshot_response_MSGTYPE alox_AccelSnapshotResponse
|
||||
#define alox_UartMessage_payload_accel_stream_request_MSGTYPE alox_AccelStreamRequest
|
||||
#define alox_UartMessage_payload_accel_stream_response_MSGTYPE alox_AccelStreamResponse
|
||||
#define alox_UartMessage_payload_battery_status_request_MSGTYPE alox_BatteryStatusRequest
|
||||
#define alox_UartMessage_payload_battery_status_response_MSGTYPE alox_BatteryStatusResponse
|
||||
#define alox_UartMessage_payload_tap_notify_request_MSGTYPE alox_TapNotifyRequest
|
||||
#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
|
||||
|
||||
@@ -862,11 +849,6 @@ X(a, STATIC, REPEATED, MESSAGE, samples, 2)
|
||||
#define alox_BatteryStatusResponse_DEFAULT NULL
|
||||
#define alox_BatteryStatusResponse_samples_MSGTYPE alox_BatterySample
|
||||
|
||||
#define alox_AccelSnapshotRequest_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, UINT32, client_id, 1)
|
||||
#define alox_AccelSnapshotRequest_CALLBACK NULL
|
||||
#define alox_AccelSnapshotRequest_DEFAULT NULL
|
||||
|
||||
#define alox_AccelSample_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, UINT32, client_id, 1) \
|
||||
X(a, STATIC, SINGULAR, BOOL, valid, 2) \
|
||||
@@ -877,12 +859,6 @@ X(a, STATIC, SINGULAR, UINT32, age_ms, 6)
|
||||
#define alox_AccelSample_CALLBACK NULL
|
||||
#define alox_AccelSample_DEFAULT NULL
|
||||
|
||||
#define alox_AccelSnapshotResponse_FIELDLIST(X, a) \
|
||||
X(a, STATIC, REPEATED, MESSAGE, samples, 1)
|
||||
#define alox_AccelSnapshotResponse_CALLBACK NULL
|
||||
#define alox_AccelSnapshotResponse_DEFAULT NULL
|
||||
#define alox_AccelSnapshotResponse_samples_MSGTYPE alox_AccelSample
|
||||
|
||||
#define alox_TapNotifyRequest_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, BOOL, write, 1) \
|
||||
X(a, STATIC, SINGULAR, UINT32, client_id, 2) \
|
||||
@@ -903,11 +879,6 @@ X(a, STATIC, SINGULAR, BOOL, triple, 6)
|
||||
#define alox_TapNotifyResponse_CALLBACK NULL
|
||||
#define alox_TapNotifyResponse_DEFAULT NULL
|
||||
|
||||
#define alox_TapSnapshotRequest_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, UINT32, client_id, 1)
|
||||
#define alox_TapSnapshotRequest_CALLBACK NULL
|
||||
#define alox_TapSnapshotRequest_DEFAULT NULL
|
||||
|
||||
#define alox_TapEvent_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, UINT32, client_id, 1) \
|
||||
X(a, STATIC, SINGULAR, BOOL, valid, 2) \
|
||||
@@ -916,24 +887,40 @@ X(a, STATIC, SINGULAR, UINT32, age_ms, 4)
|
||||
#define alox_TapEvent_CALLBACK NULL
|
||||
#define alox_TapEvent_DEFAULT NULL
|
||||
|
||||
#define alox_TapSnapshotResponse_FIELDLIST(X, a) \
|
||||
X(a, STATIC, REPEATED, MESSAGE, events, 1)
|
||||
#define alox_TapSnapshotResponse_CALLBACK NULL
|
||||
#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_CacheClientAccel_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, BOOL, valid, 1) \
|
||||
X(a, STATIC, SINGULAR, SINT32, x, 2) \
|
||||
X(a, STATIC, SINGULAR, SINT32, y, 3) \
|
||||
X(a, STATIC, SINGULAR, SINT32, z, 4) \
|
||||
X(a, STATIC, SINGULAR, UINT32, age_ms, 5)
|
||||
#define alox_CacheClientAccel_CALLBACK NULL
|
||||
#define alox_CacheClientAccel_DEFAULT NULL
|
||||
|
||||
#define alox_CacheClientTap_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, UENUM, kind, 1) \
|
||||
X(a, STATIC, SINGULAR, UINT32, age_ms, 2)
|
||||
#define alox_CacheClientTap_CALLBACK NULL
|
||||
#define alox_CacheClientTap_DEFAULT NULL
|
||||
|
||||
#define alox_CacheClientStatus_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, UINT32, client_id, 1) \
|
||||
X(a, STATIC, OPTIONAL, MESSAGE, accel, 2) \
|
||||
X(a, STATIC, OPTIONAL, MESSAGE, tap, 3)
|
||||
#define alox_CacheClientStatus_CALLBACK NULL
|
||||
#define alox_CacheClientStatus_DEFAULT NULL
|
||||
#define alox_CacheClientStatus_accel_MSGTYPE alox_CacheClientAccel
|
||||
#define alox_CacheClientStatus_tap_MSGTYPE alox_CacheClientTap
|
||||
|
||||
#define alox_CacheStatusResponse_FIELDLIST(X, a) \
|
||||
X(a, STATIC, REPEATED, MESSAGE, accel, 1) \
|
||||
X(a, STATIC, REPEATED, MESSAGE, taps, 2)
|
||||
X(a, STATIC, REPEATED, MESSAGE, clients, 1)
|
||||
#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_CacheStatusResponse_clients_MSGTYPE alox_CacheClientStatus
|
||||
|
||||
#define alox_EspNowUnicastTestRequest_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, UINT32, client_id, 1) \
|
||||
@@ -1059,15 +1046,14 @@ extern const pb_msgdesc_t alox_BatteryStatusRequest_msg;
|
||||
extern const pb_msgdesc_t alox_LipoReading_msg;
|
||||
extern const pb_msgdesc_t alox_BatterySample_msg;
|
||||
extern const pb_msgdesc_t alox_BatteryStatusResponse_msg;
|
||||
extern const pb_msgdesc_t alox_AccelSnapshotRequest_msg;
|
||||
extern const pb_msgdesc_t alox_AccelSample_msg;
|
||||
extern const pb_msgdesc_t alox_AccelSnapshotResponse_msg;
|
||||
extern const pb_msgdesc_t alox_TapNotifyRequest_msg;
|
||||
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_CacheClientAccel_msg;
|
||||
extern const pb_msgdesc_t alox_CacheClientTap_msg;
|
||||
extern const pb_msgdesc_t alox_CacheClientStatus_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;
|
||||
@@ -1102,15 +1088,14 @@ extern const pb_msgdesc_t alox_OtaSlaveProgressResponse_msg;
|
||||
#define alox_LipoReading_fields &alox_LipoReading_msg
|
||||
#define alox_BatterySample_fields &alox_BatterySample_msg
|
||||
#define alox_BatteryStatusResponse_fields &alox_BatteryStatusResponse_msg
|
||||
#define alox_AccelSnapshotRequest_fields &alox_AccelSnapshotRequest_msg
|
||||
#define alox_AccelSample_fields &alox_AccelSample_msg
|
||||
#define alox_AccelSnapshotResponse_fields &alox_AccelSnapshotResponse_msg
|
||||
#define alox_TapNotifyRequest_fields &alox_TapNotifyRequest_msg
|
||||
#define alox_TapNotifyResponse_fields &alox_TapNotifyResponse_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_CacheClientAccel_fields &alox_CacheClientAccel_msg
|
||||
#define alox_CacheClientTap_fields &alox_CacheClientTap_msg
|
||||
#define alox_CacheClientStatus_fields &alox_CacheClientStatus_msg
|
||||
#define alox_CacheStatusResponse_fields &alox_CacheStatusResponse_msg
|
||||
#define alox_EspNowUnicastTestRequest_fields &alox_EspNowUnicastTestRequest_msg
|
||||
#define alox_EspNowUnicastTestResponse_fields &alox_EspNowUnicastTestResponse_msg
|
||||
@@ -1139,16 +1124,17 @@ extern const pb_msgdesc_t alox_OtaSlaveProgressResponse_msg;
|
||||
#define alox_AccelDeadzoneRequest_size 16
|
||||
#define alox_AccelDeadzoneResponse_size 20
|
||||
#define alox_AccelSample_size 32
|
||||
#define alox_AccelSnapshotRequest_size 6
|
||||
#define alox_AccelSnapshotResponse_size 544
|
||||
#define alox_AccelStreamRequest_size 12
|
||||
#define alox_AccelStreamResponse_size 16
|
||||
#define alox_Ack_size 0
|
||||
#define alox_BatterySample_size 32
|
||||
#define alox_BatteryStatusRequest_size 8
|
||||
#define alox_BatteryStatusResponse_size 580
|
||||
#define alox_CacheClientAccel_size 26
|
||||
#define alox_CacheClientStatus_size 44
|
||||
#define alox_CacheClientTap_size 8
|
||||
#define alox_CacheStatusRequest_size 0
|
||||
#define alox_CacheStatusResponse_size 832
|
||||
#define alox_CacheStatusResponse_size 736
|
||||
#define alox_ClientInput_size 22
|
||||
#define alox_EspNowFindMeRequest_size 6
|
||||
#define alox_EspNowFindMeResponse_size 8
|
||||
@@ -1169,8 +1155,6 @@ extern const pb_msgdesc_t alox_OtaSlaveProgressResponse_msg;
|
||||
#define alox_TapEvent_size 16
|
||||
#define alox_TapNotifyRequest_size 16
|
||||
#define alox_TapNotifyResponse_size 20
|
||||
#define alox_TapSnapshotRequest_size 6
|
||||
#define alox_TapSnapshotResponse_size 288
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
||||
@@ -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