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:
2026-11-01 17:25:07 +01:00
co-authored by Cursor
parent af20635047
commit 567dab6d0a
26 changed files with 1261 additions and 163 deletions
+35
View File
@@ -0,0 +1,35 @@
#include "cmd_client_id_map_reset.h"
#include "esp_log.h"
#include "esp_now_comm.h"
#include "esp_now_core.h"
#include "uart_cmd.h"
static const char *TAG = "[ID_MAP_RESET]";
static void reply(bool success) {
alox_UartMessage response;
uart_cmd_init_response(&response, alox_MessageType_CLIENT_ID_MAP_RESET,
alox_UartMessage_client_id_map_reset_response_tag);
response.payload.client_id_map_reset_response.success = success;
uart_cmd_send(&response, TAG);
}
static void handle_client_id_map_reset(const uint8_t *data, size_t len) {
(void)data;
(void)len;
esp_err_t err;
if (esp_now_core_is_master()) {
ESP_LOGI(TAG, "reset master id map + notify online slaves");
err = esp_now_comm_reset_client_id_map();
} else {
ESP_LOGI(TAG, "clear local slave id binding");
err = esp_now_comm_clear_local_id_binding();
}
reply(err == ESP_OK);
}
void cmd_client_id_map_reset_register(void) {
uart_cmd_register(alox_MessageType_CLIENT_ID_MAP_RESET,
handle_client_id_map_reset);
}
+3
View File
@@ -0,0 +1,3 @@
#pragma once
void cmd_client_id_map_reset_register(void);