Assign sequential pod IDs from the master with NVS-stable bindings.
Replaces MAC-byte self-IDs with master allocation (1–255), slave preferred-ID reconnect, debug reset via UART/UI, and rate-limited ASSIGN to avoid ESP-NOW NO_MEM storms. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -40,7 +40,11 @@ typedef enum _alox_MessageType {
|
||||
/* * Host → master: get/set BMA456H multitap detection parameters. */
|
||||
alox_MessageType_TAP_CONFIG = 32,
|
||||
/* * Master → host (BLE only): periodic pushed cache snapshot with ESP timestamp. */
|
||||
alox_MessageType_BLE_STREAM_TICK = 33
|
||||
alox_MessageType_BLE_STREAM_TICK = 33,
|
||||
/* *
|
||||
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;
|
||||
|
||||
typedef enum _alox_TapKind {
|
||||
@@ -323,6 +327,15 @@ typedef struct _alox_RestartResponse {
|
||||
uint32_t client_id;
|
||||
} alox_RestartResponse;
|
||||
|
||||
/* * Host → master or slave: clear persisted client-id assignment state. */
|
||||
typedef struct _alox_ClientIdMapResetRequest {
|
||||
char dummy_field;
|
||||
} alox_ClientIdMapResetRequest;
|
||||
|
||||
typedef struct _alox_ClientIdMapResetResponse {
|
||||
bool success;
|
||||
} alox_ClientIdMapResetResponse;
|
||||
|
||||
/* * Host → master: read/write global log level (esp_log_level_set("*", …)). */
|
||||
typedef struct _alox_SetLogLevelRequest {
|
||||
bool write;
|
||||
@@ -456,6 +469,8 @@ typedef struct _alox_UartMessage {
|
||||
alox_TapConfigRequest tap_config_request;
|
||||
alox_TapConfigResponse tap_config_response;
|
||||
alox_BleStreamTick ble_stream_tick;
|
||||
alox_ClientIdMapResetRequest client_id_map_reset_request;
|
||||
alox_ClientIdMapResetResponse client_id_map_reset_response;
|
||||
} payload;
|
||||
} alox_UartMessage;
|
||||
|
||||
@@ -466,8 +481,8 @@ extern "C" {
|
||||
|
||||
/* Helper constants for enums */
|
||||
#define _alox_MessageType_MIN alox_MessageType_UNKNOWN
|
||||
#define _alox_MessageType_MAX alox_MessageType_BLE_STREAM_TICK
|
||||
#define _alox_MessageType_ARRAYSIZE ((alox_MessageType)(alox_MessageType_BLE_STREAM_TICK+1))
|
||||
#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_TapKind_MIN alox_TapKind_TAP_NONE
|
||||
#define _alox_TapKind_MAX alox_TapKind_TAP_TRIPLE
|
||||
@@ -521,6 +536,8 @@ extern "C" {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -561,6 +578,8 @@ extern "C" {
|
||||
#define alox_EspNowFindMeResponse_init_default {0, 0}
|
||||
#define alox_RestartRequest_init_default {0}
|
||||
#define alox_RestartResponse_init_default {0, 0}
|
||||
#define alox_ClientIdMapResetRequest_init_default {0}
|
||||
#define alox_ClientIdMapResetResponse_init_default {0}
|
||||
#define alox_SetLogLevelRequest_init_default {0, 0}
|
||||
#define alox_SetLogLevelResponse_init_default {0, 0}
|
||||
#define alox_TapConfigRequest_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||
@@ -608,6 +627,8 @@ extern "C" {
|
||||
#define alox_EspNowFindMeResponse_init_zero {0, 0}
|
||||
#define alox_RestartRequest_init_zero {0}
|
||||
#define alox_RestartResponse_init_zero {0, 0}
|
||||
#define alox_ClientIdMapResetRequest_init_zero {0}
|
||||
#define alox_ClientIdMapResetResponse_init_zero {0}
|
||||
#define alox_SetLogLevelRequest_init_zero {0, 0}
|
||||
#define alox_SetLogLevelResponse_init_zero {0, 0}
|
||||
#define alox_TapConfigRequest_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||
@@ -739,6 +760,7 @@ extern "C" {
|
||||
#define alox_RestartRequest_client_id_tag 1
|
||||
#define alox_RestartResponse_success_tag 1
|
||||
#define alox_RestartResponse_client_id_tag 2
|
||||
#define alox_ClientIdMapResetResponse_success_tag 1
|
||||
#define alox_SetLogLevelRequest_write_tag 1
|
||||
#define alox_SetLogLevelRequest_level_tag 2
|
||||
#define alox_SetLogLevelResponse_success_tag 1
|
||||
@@ -822,6 +844,8 @@ extern "C" {
|
||||
#define alox_UartMessage_tap_config_request_tag 39
|
||||
#define alox_UartMessage_tap_config_response_tag 40
|
||||
#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
|
||||
|
||||
/* Struct field encoding specification for nanopb */
|
||||
#define alox_UartMessage_FIELDLIST(X, a) \
|
||||
@@ -861,7 +885,9 @@ X(a, STATIC, ONEOF, MESSAGE, (payload,set_log_level_request,payload.set_lo
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload,set_log_level_response,payload.set_log_level_response), 38) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payload,tap_config_request,payload.tap_config_request), 39) \
|
||||
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,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)
|
||||
#define alox_UartMessage_CALLBACK NULL
|
||||
#define alox_UartMessage_DEFAULT NULL
|
||||
#define alox_UartMessage_payload_ack_payload_MSGTYPE alox_Ack
|
||||
@@ -900,6 +926,8 @@ X(a, STATIC, ONEOF, MESSAGE, (payload,ble_stream_tick,payload.ble_stream_t
|
||||
#define alox_UartMessage_payload_tap_config_request_MSGTYPE alox_TapConfigRequest
|
||||
#define alox_UartMessage_payload_tap_config_response_MSGTYPE alox_TapConfigResponse
|
||||
#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_Ack_FIELDLIST(X, a) \
|
||||
|
||||
@@ -1170,6 +1198,16 @@ X(a, STATIC, SINGULAR, UINT32, client_id, 2)
|
||||
#define alox_RestartResponse_CALLBACK NULL
|
||||
#define alox_RestartResponse_DEFAULT NULL
|
||||
|
||||
#define alox_ClientIdMapResetRequest_FIELDLIST(X, a) \
|
||||
|
||||
#define alox_ClientIdMapResetRequest_CALLBACK NULL
|
||||
#define alox_ClientIdMapResetRequest_DEFAULT NULL
|
||||
|
||||
#define alox_ClientIdMapResetResponse_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, BOOL, success, 1)
|
||||
#define alox_ClientIdMapResetResponse_CALLBACK NULL
|
||||
#define alox_ClientIdMapResetResponse_DEFAULT NULL
|
||||
|
||||
#define alox_SetLogLevelRequest_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, BOOL, write, 1) \
|
||||
X(a, STATIC, SINGULAR, UINT32, level, 2)
|
||||
@@ -1298,6 +1336,8 @@ extern const pb_msgdesc_t alox_EspNowFindMeRequest_msg;
|
||||
extern const pb_msgdesc_t alox_EspNowFindMeResponse_msg;
|
||||
extern const pb_msgdesc_t alox_RestartRequest_msg;
|
||||
extern const pb_msgdesc_t alox_RestartResponse_msg;
|
||||
extern const pb_msgdesc_t alox_ClientIdMapResetRequest_msg;
|
||||
extern const pb_msgdesc_t alox_ClientIdMapResetResponse_msg;
|
||||
extern const pb_msgdesc_t alox_SetLogLevelRequest_msg;
|
||||
extern const pb_msgdesc_t alox_SetLogLevelResponse_msg;
|
||||
extern const pb_msgdesc_t alox_TapConfigRequest_msg;
|
||||
@@ -1347,6 +1387,8 @@ extern const pb_msgdesc_t alox_OtaSlaveProgressResponse_msg;
|
||||
#define alox_EspNowFindMeResponse_fields &alox_EspNowFindMeResponse_msg
|
||||
#define alox_RestartRequest_fields &alox_RestartRequest_msg
|
||||
#define alox_RestartResponse_fields &alox_RestartResponse_msg
|
||||
#define alox_ClientIdMapResetRequest_fields &alox_ClientIdMapResetRequest_msg
|
||||
#define alox_ClientIdMapResetResponse_fields &alox_ClientIdMapResetResponse_msg
|
||||
#define alox_SetLogLevelRequest_fields &alox_SetLogLevelRequest_msg
|
||||
#define alox_SetLogLevelResponse_fields &alox_SetLogLevelResponse_msg
|
||||
#define alox_TapConfigRequest_fields &alox_TapConfigRequest_msg
|
||||
@@ -1382,6 +1424,8 @@ extern const pb_msgdesc_t alox_OtaSlaveProgressResponse_msg;
|
||||
#define alox_CacheClientTap_size 8
|
||||
#define alox_CacheStatusRequest_size 0
|
||||
#define alox_CacheStatusResponse_size 736
|
||||
#define alox_ClientIdMapResetRequest_size 0
|
||||
#define alox_ClientIdMapResetResponse_size 2
|
||||
#define alox_ClientInput_size 22
|
||||
#define alox_EspNowEchoPingRequest_size 17
|
||||
#define alox_EspNowEchoPingResponse_size 25
|
||||
|
||||
Reference in New Issue
Block a user