fix(esp32): use runtime node_id from NVS in outgoing packets
This commit is contained in:
parent
bc5408bd80
commit
2a0f2b1a40
|
|
@ -14,6 +14,7 @@
|
|||
#include "csi_collector.h"
|
||||
#include "stream_sender.h"
|
||||
#include "edge_processing.h"
|
||||
#include "nvs_config.h"
|
||||
|
||||
#include <string.h>
|
||||
#include "esp_log.h"
|
||||
|
|
@ -22,6 +23,7 @@
|
|||
#include "sdkconfig.h"
|
||||
|
||||
static const char *TAG = "csi_collector";
|
||||
extern nvs_config_t g_nvs_config;
|
||||
|
||||
static uint32_t s_sequence = 0;
|
||||
static uint32_t s_cb_count = 0;
|
||||
|
|
@ -104,7 +106,7 @@ size_t csi_serialize_frame(const wifi_csi_info_t *info, uint8_t *buf, size_t buf
|
|||
memcpy(&buf[0], &magic, 4);
|
||||
|
||||
/* Node ID */
|
||||
buf[4] = (uint8_t)CONFIG_CSI_NODE_ID;
|
||||
buf[4] = g_nvs_config.node_id;
|
||||
|
||||
/* Number of antennas */
|
||||
buf[5] = n_antennas;
|
||||
|
|
@ -221,7 +223,7 @@ void csi_collector_init(void)
|
|||
ESP_ERROR_CHECK(esp_wifi_set_csi(true));
|
||||
|
||||
ESP_LOGI(TAG, "CSI collection initialized (node_id=%d, channel=%d)",
|
||||
CONFIG_CSI_NODE_ID, CONFIG_CSI_WIFI_CHANNEL);
|
||||
g_nvs_config.node_id, CONFIG_CSI_WIFI_CHANNEL);
|
||||
}
|
||||
|
||||
/* ---- ADR-029: Channel hopping ---- */
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
#include "edge_processing.h"
|
||||
#include "wasm_runtime.h"
|
||||
#include "stream_sender.h"
|
||||
#include "nvs_config.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
|
@ -30,6 +31,7 @@
|
|||
#include "sdkconfig.h"
|
||||
|
||||
static const char *TAG = "edge_proc";
|
||||
extern nvs_config_t g_nvs_config;
|
||||
|
||||
/* ======================================================================
|
||||
* SPSC Ring Buffer (lock-free, single-producer single-consumer)
|
||||
|
|
@ -421,11 +423,7 @@ static void send_compressed_frame(const uint8_t *iq_data, uint16_t iq_len,
|
|||
uint32_t magic = EDGE_COMPRESSED_MAGIC;
|
||||
memcpy(&pkt[0], &magic, 4);
|
||||
|
||||
#ifdef CONFIG_CSI_NODE_ID
|
||||
pkt[4] = (uint8_t)CONFIG_CSI_NODE_ID;
|
||||
#else
|
||||
pkt[4] = 0;
|
||||
#endif
|
||||
pkt[4] = g_nvs_config.node_id;
|
||||
pkt[5] = channel;
|
||||
memcpy(&pkt[6], &iq_len, 2);
|
||||
memcpy(&pkt[8], &comp_len, 2);
|
||||
|
|
@ -543,11 +541,7 @@ static void send_vitals_packet(void)
|
|||
memset(&pkt, 0, sizeof(pkt));
|
||||
|
||||
pkt.magic = EDGE_VITALS_MAGIC;
|
||||
#ifdef CONFIG_CSI_NODE_ID
|
||||
pkt.node_id = (uint8_t)CONFIG_CSI_NODE_ID;
|
||||
#else
|
||||
pkt.node_id = 0;
|
||||
#endif
|
||||
pkt.node_id = g_nvs_config.node_id;
|
||||
|
||||
pkt.flags = 0;
|
||||
if (s_presence_detected) pkt.flags |= 0x01;
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
#include "rvf_parser.h"
|
||||
#include "stream_sender.h"
|
||||
#include "nvs_config.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
|
@ -32,6 +33,7 @@
|
|||
#include "m3_env.h"
|
||||
|
||||
static const char *TAG = "wasm_rt";
|
||||
extern nvs_config_t g_nvs_config;
|
||||
|
||||
/* ======================================================================
|
||||
* Module Slot
|
||||
|
|
@ -380,11 +382,7 @@ static void send_wasm_output(uint8_t slot_id)
|
|||
memset(&pkt, 0, sizeof(pkt));
|
||||
|
||||
pkt.magic = WASM_OUTPUT_MAGIC;
|
||||
#ifdef CONFIG_CSI_NODE_ID
|
||||
pkt.node_id = (uint8_t)CONFIG_CSI_NODE_ID;
|
||||
#else
|
||||
pkt.node_id = 0;
|
||||
#endif
|
||||
pkt.node_id = g_nvs_config.node_id;
|
||||
pkt.module_id = slot_id;
|
||||
pkt.event_count = n_filtered;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue