Stream slave accel via ESP-NOW with master snapshot cache.
Slaves push BMA456 samples at 16ms when enabled; the master caches per client and exposes ACCEL_SNAPSHOT and ACCEL_STREAM over UART. goTool adds dashboard stream controls, HTTP accel-stream routes, and an external WebSocket API with per-connection receive/interval and slave stream commands. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -21,6 +21,14 @@ typedef struct {
|
||||
uint32_t version;
|
||||
/** Accel deadzone in raw LSB per axis (master copy for ESP-NOW config). */
|
||||
uint32_t accel_deadzone;
|
||||
/** Latest accel from slave ESP-NOW stream (master only). */
|
||||
bool accel_valid;
|
||||
int16_t accel_x;
|
||||
int16_t accel_y;
|
||||
int16_t accel_z;
|
||||
uint32_t accel_updated_at;
|
||||
/** Host-enabled ESP-NOW accel stream to master. */
|
||||
bool accel_stream_enabled;
|
||||
} client_info_t;
|
||||
|
||||
#define CLIENT_REGISTRY_DEFAULT_ACCEL_DEADZONE 100u
|
||||
@@ -63,4 +71,13 @@ esp_err_t client_registry_get_accel_deadzone(uint32_t client_id,
|
||||
/** Push deadzone to all active registry entries; returns count updated. */
|
||||
size_t client_registry_set_accel_deadzone_all(uint32_t deadzone);
|
||||
|
||||
/** Store latest accel sample from a slave (matched by sender MAC). */
|
||||
esp_err_t client_registry_update_accel(const uint8_t mac[CLIENT_MAC_LEN],
|
||||
uint32_t slave_id, int16_t x, int16_t y,
|
||||
int16_t z);
|
||||
|
||||
esp_err_t client_registry_set_accel_stream(uint32_t client_id, bool enabled);
|
||||
esp_err_t client_registry_get_accel_stream(uint32_t client_id, bool *enabled_out);
|
||||
size_t client_registry_set_accel_stream_all(bool enabled);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user