Add selectable ESP-NOW send path for accel/tap input.

Expose best_effort/fast/wait/reliable via UART, dashboard, and CLI so
loss vs latency can be compared under real multi-pod load.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-11-01 22:34:03 +01:00
co-authored by Cursor
parent 178ab46cec
commit 1adaddd6c8
25 changed files with 1178 additions and 255 deletions
+86 -5
View File
@@ -44,9 +44,23 @@ typedef enum _alox_MessageType {
/* *
Host → device: clear master client-id NVS map + live registry (and notify
online slaves), or on a slave clear local master/id binding only. */
alox_MessageType_CLIENT_ID_MAP_RESET = 34
alox_MessageType_CLIENT_ID_MAP_RESET = 34,
/* *
Host → master: get/set slave ESP-NOW send path for accel/tap
(best_effort / fast / wait / reliable). */
alox_MessageType_INPUT_SEND_MODE = 35
} alox_MessageType;
/* *
Slave ESP-NOW TX path for ACCEL_SAMPLE / TAP_EVENT (debug A/B).
Maps 1:1 to esp_now_core_send_*. */
typedef enum _alox_InputSendMode {
alox_InputSendMode_INPUT_SEND_BEST_EFFORT = 0,
alox_InputSendMode_INPUT_SEND_FAST = 1,
alox_InputSendMode_INPUT_SEND_WAIT = 2,
alox_InputSendMode_INPUT_SEND_RELIABLE = 3
} alox_InputSendMode;
typedef enum _alox_TapKind {
alox_TapKind_TAP_NONE = 0,
alox_TapKind_TAP_SINGLE = 1,
@@ -136,6 +150,23 @@ typedef struct _alox_AccelStreamResponse {
uint32_t slaves_updated;
} alox_AccelStreamResponse;
/* Host → master: get/set input send mode on slaves.
write=false: return last mode remembered on master (client_id ignored).
write=true: push mode via ESP-NOW (all_clients or one client_id). */
typedef struct _alox_InputSendModeRequest {
bool write;
alox_InputSendMode mode;
uint32_t client_id;
bool all_clients;
} alox_InputSendModeRequest;
typedef struct _alox_InputSendModeResponse {
bool success;
alox_InputSendMode mode;
uint32_t client_id;
uint32_t slaves_updated;
} alox_InputSendModeResponse;
/* * Host → master: read LiPo ADC voltages (master local and/or slaves via ESP-NOW). */
typedef struct _alox_BatteryStatusRequest {
/* * 0 = master only; >0 = one slave; ignored when all_clients */
@@ -380,7 +411,7 @@ typedef struct _alox_TapConfigResponse {
bool enable_triple;
} alox_TapConfigResponse;
/* Host → device: begin UART OTA (erase inactive OTA slot; device replies OTA_STATUS). */
/* Host → device: begin host OTA over UART or BLE (erase inactive OTA slot; device replies OTA_STATUS). */
typedef struct _alox_OtaStartPayload {
uint32_t total_size;
} alox_OtaStartPayload;
@@ -471,6 +502,8 @@ typedef struct _alox_UartMessage {
alox_BleStreamTick ble_stream_tick;
alox_ClientIdMapResetRequest client_id_map_reset_request;
alox_ClientIdMapResetResponse client_id_map_reset_response;
alox_InputSendModeRequest input_send_mode_request;
alox_InputSendModeResponse input_send_mode_response;
} payload;
} alox_UartMessage;
@@ -481,8 +514,12 @@ extern "C" {
/* Helper constants for enums */
#define _alox_MessageType_MIN alox_MessageType_UNKNOWN
#define _alox_MessageType_MAX alox_MessageType_CLIENT_ID_MAP_RESET
#define _alox_MessageType_ARRAYSIZE ((alox_MessageType)(alox_MessageType_CLIENT_ID_MAP_RESET+1))
#define _alox_MessageType_MAX alox_MessageType_INPUT_SEND_MODE
#define _alox_MessageType_ARRAYSIZE ((alox_MessageType)(alox_MessageType_INPUT_SEND_MODE+1))
#define _alox_InputSendMode_MIN alox_InputSendMode_INPUT_SEND_BEST_EFFORT
#define _alox_InputSendMode_MAX alox_InputSendMode_INPUT_SEND_RELIABLE
#define _alox_InputSendMode_ARRAYSIZE ((alox_InputSendMode)(alox_InputSendMode_INPUT_SEND_RELIABLE+1))
#define _alox_TapKind_MIN alox_TapKind_TAP_NONE
#define _alox_TapKind_MAX alox_TapKind_TAP_TRIPLE
@@ -501,6 +538,10 @@ extern "C" {
#define alox_InputSendModeRequest_mode_ENUMTYPE alox_InputSendMode
#define alox_InputSendModeResponse_mode_ENUMTYPE alox_InputSendMode
@@ -554,6 +595,8 @@ extern "C" {
#define alox_AccelDeadzoneResponse_init_default {0, 0, 0, 0}
#define alox_AccelStreamRequest_init_default {0, 0, 0, 0, 0}
#define alox_AccelStreamResponse_init_default {0, 0, 0, 0}
#define alox_InputSendModeRequest_init_default {0, _alox_InputSendMode_MIN, 0, 0}
#define alox_InputSendModeResponse_init_default {0, _alox_InputSendMode_MIN, 0, 0}
#define alox_BatteryStatusRequest_init_default {0, 0}
#define alox_LipoReading_init_default {0, 0}
#define alox_BatterySample_init_default {0, false, alox_LipoReading_init_default, false, alox_LipoReading_init_default, 0}
@@ -603,6 +646,8 @@ extern "C" {
#define alox_AccelDeadzoneResponse_init_zero {0, 0, 0, 0}
#define alox_AccelStreamRequest_init_zero {0, 0, 0, 0, 0}
#define alox_AccelStreamResponse_init_zero {0, 0, 0, 0}
#define alox_InputSendModeRequest_init_zero {0, _alox_InputSendMode_MIN, 0, 0}
#define alox_InputSendModeResponse_init_zero {0, _alox_InputSendMode_MIN, 0, 0}
#define alox_BatteryStatusRequest_init_zero {0, 0}
#define alox_LipoReading_init_zero {0, 0}
#define alox_BatterySample_init_zero {0, false, alox_LipoReading_init_zero, false, alox_LipoReading_init_zero, 0}
@@ -680,6 +725,14 @@ extern "C" {
#define alox_AccelStreamResponse_client_id_tag 2
#define alox_AccelStreamResponse_success_tag 3
#define alox_AccelStreamResponse_slaves_updated_tag 4
#define alox_InputSendModeRequest_write_tag 1
#define alox_InputSendModeRequest_mode_tag 2
#define alox_InputSendModeRequest_client_id_tag 3
#define alox_InputSendModeRequest_all_clients_tag 4
#define alox_InputSendModeResponse_success_tag 1
#define alox_InputSendModeResponse_mode_tag 2
#define alox_InputSendModeResponse_client_id_tag 3
#define alox_InputSendModeResponse_slaves_updated_tag 4
#define alox_BatteryStatusRequest_client_id_tag 1
#define alox_BatteryStatusRequest_all_clients_tag 2
#define alox_LipoReading_valid_tag 1
@@ -846,6 +899,8 @@ extern "C" {
#define alox_UartMessage_ble_stream_tick_tag 41
#define alox_UartMessage_client_id_map_reset_request_tag 42
#define alox_UartMessage_client_id_map_reset_response_tag 43
#define alox_UartMessage_input_send_mode_request_tag 44
#define alox_UartMessage_input_send_mode_response_tag 45
/* Struct field encoding specification for nanopb */
#define alox_UartMessage_FIELDLIST(X, a) \
@@ -887,7 +942,9 @@ X(a, STATIC, ONEOF, MESSAGE, (payload,tap_config_request,payload.tap_confi
X(a, STATIC, ONEOF, MESSAGE, (payload,tap_config_response,payload.tap_config_response), 40) \
X(a, STATIC, ONEOF, MESSAGE, (payload,ble_stream_tick,payload.ble_stream_tick), 41) \
X(a, STATIC, ONEOF, MESSAGE, (payload,client_id_map_reset_request,payload.client_id_map_reset_request), 42) \
X(a, STATIC, ONEOF, MESSAGE, (payload,client_id_map_reset_response,payload.client_id_map_reset_response), 43)
X(a, STATIC, ONEOF, MESSAGE, (payload,client_id_map_reset_response,payload.client_id_map_reset_response), 43) \
X(a, STATIC, ONEOF, MESSAGE, (payload,input_send_mode_request,payload.input_send_mode_request), 44) \
X(a, STATIC, ONEOF, MESSAGE, (payload,input_send_mode_response,payload.input_send_mode_response), 45)
#define alox_UartMessage_CALLBACK NULL
#define alox_UartMessage_DEFAULT NULL
#define alox_UartMessage_payload_ack_payload_MSGTYPE alox_Ack
@@ -928,6 +985,8 @@ X(a, STATIC, ONEOF, MESSAGE, (payload,client_id_map_reset_response,payload
#define alox_UartMessage_payload_ble_stream_tick_MSGTYPE alox_BleStreamTick
#define alox_UartMessage_payload_client_id_map_reset_request_MSGTYPE alox_ClientIdMapResetRequest
#define alox_UartMessage_payload_client_id_map_reset_response_MSGTYPE alox_ClientIdMapResetResponse
#define alox_UartMessage_payload_input_send_mode_request_MSGTYPE alox_InputSendModeRequest
#define alox_UartMessage_payload_input_send_mode_response_MSGTYPE alox_InputSendModeResponse
#define alox_Ack_FIELDLIST(X, a) \
@@ -1014,6 +1073,22 @@ X(a, STATIC, SINGULAR, UINT32, slaves_updated, 4)
#define alox_AccelStreamResponse_CALLBACK NULL
#define alox_AccelStreamResponse_DEFAULT NULL
#define alox_InputSendModeRequest_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, BOOL, write, 1) \
X(a, STATIC, SINGULAR, UENUM, mode, 2) \
X(a, STATIC, SINGULAR, UINT32, client_id, 3) \
X(a, STATIC, SINGULAR, BOOL, all_clients, 4)
#define alox_InputSendModeRequest_CALLBACK NULL
#define alox_InputSendModeRequest_DEFAULT NULL
#define alox_InputSendModeResponse_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, BOOL, success, 1) \
X(a, STATIC, SINGULAR, UENUM, mode, 2) \
X(a, STATIC, SINGULAR, UINT32, client_id, 3) \
X(a, STATIC, SINGULAR, UINT32, slaves_updated, 4)
#define alox_InputSendModeResponse_CALLBACK NULL
#define alox_InputSendModeResponse_DEFAULT NULL
#define alox_BatteryStatusRequest_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, UINT32, client_id, 1) \
X(a, STATIC, SINGULAR, BOOL, all_clients, 2)
@@ -1312,6 +1387,8 @@ extern const pb_msgdesc_t alox_AccelDeadzoneRequest_msg;
extern const pb_msgdesc_t alox_AccelDeadzoneResponse_msg;
extern const pb_msgdesc_t alox_AccelStreamRequest_msg;
extern const pb_msgdesc_t alox_AccelStreamResponse_msg;
extern const pb_msgdesc_t alox_InputSendModeRequest_msg;
extern const pb_msgdesc_t alox_InputSendModeResponse_msg;
extern const pb_msgdesc_t alox_BatteryStatusRequest_msg;
extern const pb_msgdesc_t alox_LipoReading_msg;
extern const pb_msgdesc_t alox_BatterySample_msg;
@@ -1363,6 +1440,8 @@ extern const pb_msgdesc_t alox_OtaSlaveProgressResponse_msg;
#define alox_AccelDeadzoneResponse_fields &alox_AccelDeadzoneResponse_msg
#define alox_AccelStreamRequest_fields &alox_AccelStreamRequest_msg
#define alox_AccelStreamResponse_fields &alox_AccelStreamResponse_msg
#define alox_InputSendModeRequest_fields &alox_InputSendModeRequest_msg
#define alox_InputSendModeResponse_fields &alox_InputSendModeResponse_msg
#define alox_BatteryStatusRequest_fields &alox_BatteryStatusRequest_msg
#define alox_LipoReading_fields &alox_LipoReading_msg
#define alox_BatterySample_fields &alox_BatterySample_msg
@@ -1433,6 +1512,8 @@ extern const pb_msgdesc_t alox_OtaSlaveProgressResponse_msg;
#define alox_EspNowFindMeResponse_size 8
#define alox_EspNowUnicastTestRequest_size 12
#define alox_EspNowUnicastTestResponse_size 8
#define alox_InputSendModeRequest_size 12
#define alox_InputSendModeResponse_size 16
#define alox_LedRingProgressRequest_size 64
#define alox_LedRingProgressResponse_size 32
#define alox_LipoReading_size 8