Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions config/spatial-layout.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"nodes": [
{
"node_id": 1,
"label": "node-1",
"position": [0.65, 0.6, 0.9]
},
{
"node_id": 2,
"label": "node-2",
"position": [-0.7, 0.5, 1.23]
}
],
"zones": [
{
"zone_id": "center",
"label": "center",
"center": [0.0, 0.0, 1.0],
"radius": 0.7
},
{
"zone_id": "entrance",
"label": "entrance",
"center": [1.0, -0.2, 1.0],
"radius": 0.8
},
{
"zone_id": "left-closet",
"label": "left closet",
"center": [-1.5, -0.5, 1.0],
"radius": 0.8
},
{
"zone_id": "behind-closet",
"label": "behind closet",
"center": [0.0, -1.5, 1.0],
"radius": 0.55
}
]
}
1 change: 1 addition & 0 deletions docker/Dockerfile.rust
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ COPY --from=builder /build/target/release/sensing-server /app/sensing-server

# Copy UI assets
COPY ui/ /app/ui/
COPY config/ /app/config/

# HTTP API
EXPOSE 3000
Expand Down
6 changes: 4 additions & 2 deletions firmware/esp32-csi-node/main/csi_collector.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 ---- */
Expand Down
8 changes: 3 additions & 5 deletions firmware/esp32-csi-node/main/display_ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/

#include "display_ui.h"
#include "nvs_config.h"
#include "sdkconfig.h"

#if CONFIG_DISPLAY_ENABLE
Expand All @@ -20,6 +21,7 @@
#include "edge_processing.h"

static const char *TAG = "disp_ui";
extern nvs_config_t g_nvs_config;

/* ---- Theme colors ---- */
#define COLOR_BG lv_color_make(0x0A, 0x0A, 0x0F)
Expand Down Expand Up @@ -347,11 +349,7 @@ void display_ui_update(void)
{
char buf[48];

#ifdef CONFIG_CSI_NODE_ID
snprintf(buf, sizeof(buf), "Node: %d", CONFIG_CSI_NODE_ID);
#else
snprintf(buf, sizeof(buf), "Node: --");
#endif
snprintf(buf, sizeof(buf), "Node: %d", g_nvs_config.node_id);
lv_label_set_text(s_sys_node, buf);

snprintf(buf, sizeof(buf), "Heap: %lu KB free",
Expand Down
14 changes: 4 additions & 10 deletions firmware/esp32-csi-node/main/edge_processing.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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)
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 3 additions & 5 deletions firmware/esp32-csi-node/main/wasm_runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include "rvf_parser.h"
#include "stream_sender.h"
#include "nvs_config.h"

#include <string.h>
#include <math.h>
Expand All @@ -32,6 +33,7 @@
#include "m3_env.h"

static const char *TAG = "wasm_rt";
extern nvs_config_t g_nvs_config;

/* ======================================================================
* Module Slot
Expand Down Expand Up @@ -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;

Expand Down
Loading