diff --git a/firmware/esp32-csi-node/main/Kconfig.projbuild b/firmware/esp32-csi-node/main/Kconfig.projbuild index 18d7ed1e..18c32ebf 100644 --- a/firmware/esp32-csi-node/main/Kconfig.projbuild +++ b/firmware/esp32-csi-node/main/Kconfig.projbuild @@ -402,6 +402,20 @@ menu "ESP32-C6 capabilities (ADR-110)" range 1 13 depends on C6_SOFTAP_HE_ENABLE + config C6_SYNC_EVERY_N_FRAMES + int "Sync-packet emission cadence (CSI frames per sync)" + default 20 + range 1 1000 + help + How many CSI callbacks fire before csi_collector emits one + ADR-110 §A0.11 sync packet (magic 0xC511A110) carrying the + mesh-aligned epoch + sequence high-water for the host + aggregator to pair against incoming CSI frames. + + Default 20 = ~2 s between sync packets at the bench's + observed 10 fps CSI rate. Raise for less wire overhead; + lower for tighter multistatic alignment windows. + endmenu menu "ADR-018 frame extensions (ADR-110)" diff --git a/firmware/esp32-csi-node/main/csi_collector.c b/firmware/esp32-csi-node/main/csi_collector.c index 96daf67f..48279e0d 100644 --- a/firmware/esp32-csi-node/main/csi_collector.c +++ b/firmware/esp32-csi-node/main/csi_collector.c @@ -296,14 +296,21 @@ static void wifi_csi_callback(void *ctx, wifi_csi_info_t *info) (int8_t)info->rx_ctrl.rssi, info->rx_ctrl.channel); } - /* ADR-110 §A0.11 — Emit a sync-packet every SYNC_EVERY_N CSI frames so the + /* ADR-110 §A0.11/§A0.12 — Emit a sync-packet every N CSI frames so the * host aggregator can pair node-local sequence numbers with the mesh-aligned * epoch coming out of c6_sync_espnow_get_epoch_us(). Backwards-compatible * with the ADR-018 frame format: new packet uses a distinct magic so the - * existing CSI parser can dispatch by first 4 bytes. */ + * existing CSI parser can dispatch by first 4 bytes. + * + * Cadence is operator-tunable via CONFIG_C6_SYNC_EVERY_N_FRAMES (default 20). + * At 10 Hz observed CSI rate that's ~2 s between sync packets; raise to 50 + * for ~5 s (less overhead, slower convergence), lower to 5 for ~0.5 s + * (heavier wire, tighter ADR-029/030 multistatic alignment window). */ { - #define SYNC_EVERY_N_FRAMES 20 /* ~1 Hz at the 20 Hz send-rate gate */ - if ((s_cb_count % SYNC_EVERY_N_FRAMES) == 0) { +#ifndef CONFIG_C6_SYNC_EVERY_N_FRAMES +#define CONFIG_C6_SYNC_EVERY_N_FRAMES 20 +#endif + if ((s_cb_count % CONFIG_C6_SYNC_EVERY_N_FRAMES) == 0) { uint8_t sync[32]; uint32_t sync_magic = 0xC511A110u; /* CSI-ADR-110 sync packet */ uint64_t local_us = (uint64_t)esp_timer_get_time(); diff --git a/firmware/esp32-csi-node/version.txt b/firmware/esp32-csi-node/version.txt index fae59cac..1a5ac0d4 100644 --- a/firmware/esp32-csi-node/version.txt +++ b/firmware/esp32-csi-node/version.txt @@ -1 +1 @@ -0.6.8 +0.6.9