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:
@@ -27,6 +27,10 @@ enum EspNowMessageType {
|
||||
ESPNOW_ECHO_PING = 19;
|
||||
ESPNOW_ECHO_PONG = 20;
|
||||
ESPNOW_SET_TAP_CONFIG = 21;
|
||||
/** Master → slave: assigned logical client id after join/presence. */
|
||||
ESPNOW_ASSIGN_ID = 22;
|
||||
/** Master → slave: forget persisted master/id binding (debug reset). */
|
||||
ESPNOW_CLEAR_ID_BINDING = 23;
|
||||
}
|
||||
|
||||
message EspNowUnicastTest {
|
||||
@@ -67,11 +71,20 @@ message EspNowSlavePresence {
|
||||
uint32 network = 1;
|
||||
bytes mac = 2;
|
||||
uint32 version = 3;
|
||||
/** Preferred id from NVS for this master (0 = none / unbound). */
|
||||
uint32 slave_id = 4;
|
||||
bool available = 5;
|
||||
bool used = 6;
|
||||
}
|
||||
|
||||
/** Master → slave: definitive logical client id for this session/master. */
|
||||
message EspNowAssignId {
|
||||
uint32 assigned_id = 1;
|
||||
}
|
||||
|
||||
/** Master → slave: clear persisted {master_mac, assigned_id} binding. */
|
||||
message EspNowClearIdBinding {}
|
||||
|
||||
message EspNowAccelDeadzone {
|
||||
uint32 deadzone = 1;
|
||||
uint32 client_id = 2; // 0 = all slaves; otherwise only matching slave_id applies
|
||||
@@ -193,5 +206,7 @@ message EspNowMessage {
|
||||
EspNowEchoPing echo_ping = 20;
|
||||
EspNowEchoPong echo_pong = 21;
|
||||
EspNowTapConfig tap_config = 22;
|
||||
EspNowAssignId assign_id = 23;
|
||||
EspNowClearIdBinding clear_id_binding = 24;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user