Fix ESP-NOW unicast by using sender MAC in client registry.
Register slaves from recv src_addr instead of protobuf mac bytes, add ESPNOW_UNICAST_TEST for path verification, restore unicast deadzone, and expose unicast-test in goTool. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+14
-2
@@ -186,10 +186,20 @@ Filters BMA456 logs: a new accel line is emitted only when any axis changes by m
|
||||
| `write` | `false` = read, `true` = write |
|
||||
| `deadzone` | Threshold in LSB (write) |
|
||||
| `client_id` | `0` = local sensor on this node; `>0` = slave id (master) |
|
||||
| `all_clients` | Master: ESP-NOW push to every registered slave |
|
||||
| `all_clients` | Master: ESP-NOW unicast to every registered slave |
|
||||
|
||||
**Response:** `accel_deadzone_response` with applied `deadzone`, `success`, and `slaves_updated` (ESP-NOW count).
|
||||
|
||||
### ESPNOW_UNICAST_TEST command
|
||||
|
||||
Minimal master→slave ESP-NOW unicast check (no BMA456). Use this before debugging `ACCEL_DEADZONE` unicast.
|
||||
|
||||
**Request:** framed `07` + `espnow_unicast_test_request` (`client_id`, `seq`).
|
||||
|
||||
**Response:** `espnow_unicast_test_response` (`success`, `seq`).
|
||||
|
||||
**Firmware logs:** master `unicast TEST to … seq=N`; slave `UNICAST TEST OK from master … seq=N`.
|
||||
|
||||
### CLIENT_INFO command
|
||||
|
||||
**Request:** framed payload `04` only (`MessageType.CLIENT_INFO`).
|
||||
@@ -208,7 +218,9 @@ Fields per client: `id`, `mac`, `version`, `available`, `used`, `last_ping`, `la
|
||||
| `client_registry_check_timeouts(timeout_ms)` | Mark stale clients inactive (master monitor task) |
|
||||
| `client_registry_count()` / `client_registry_at(i)` | Iterate for UART encoding |
|
||||
|
||||
Slaves register when the master receives `SLAVE_INFO` on the matching network; `HEARTBEAT` keeps them marked available.
|
||||
Slaves register when the master receives `SLAVE_INFO` on the matching network; `HEARTBEAT` keeps them marked available. The registry **MAC is always the ESP-NOW source address** (`recv_info.src_addr`), not the optional `mac` bytes in the protobuf (used only on the wire for debugging).
|
||||
|
||||
`slave_id` is the sender’s WiFi STA address last octet (`mac[5]`); it can collide across devices — use `gotool clients` and match the full MAC.
|
||||
|
||||
## Host tool (`goTool/`)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user