fix: move anchor arrays before ESP-NOW RX callback
This commit is contained in:
parent
d687ef5242
commit
6807f418ee
@ -95,6 +95,12 @@ struct EspNowPacket {
|
|||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
/* ── Anchor tracking (declared early for ESP-NOW RX callback) ──── */
|
||||||
|
|
||||||
|
static int32_t g_anchor_range_mm[NUM_ANCHORS];
|
||||||
|
static float g_anchor_rssi[NUM_ANCHORS];
|
||||||
|
static uint32_t g_anchor_last_ok[NUM_ANCHORS];
|
||||||
|
|
||||||
/* ── ESP-NOW RX: receive range data from anchors ────────────────── */
|
/* ── ESP-NOW RX: receive range data from anchors ────────────────── */
|
||||||
|
|
||||||
static void IRAM_ATTR espnow_rx_cb(const esp_now_recv_info_t *info,
|
static void IRAM_ATTR espnow_rx_cb(const esp_now_recv_info_t *info,
|
||||||
@ -131,16 +137,14 @@ static void espnow_send(uint8_t msg_type, uint8_t anchor_id,
|
|||||||
esp_now_send(broadcast_mac, (uint8_t *)&pkt, sizeof(pkt));
|
esp_now_send(broadcast_mac, (uint8_t *)&pkt, sizeof(pkt));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── Anchor tracking ────────────────────────────────────────────── */
|
/* ── Anchor tracking (DW1000 address mapping) ──────────────────── */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* DW1000Ranging gives us callbacks with a device short address.
|
* DW1000Ranging gives us callbacks with a device short address.
|
||||||
* We map the first 2 unique addresses we see to anchor 0 and 1.
|
* We map the first 2 unique addresses we see to anchor 0 and 1.
|
||||||
|
* g_anchor_range_mm/rssi/last_ok declared above (before ESP-NOW RX callback).
|
||||||
*/
|
*/
|
||||||
static uint16_t g_anchor_addrs[NUM_ANCHORS] = {0, 0};
|
static uint16_t g_anchor_addrs[NUM_ANCHORS] = {0, 0};
|
||||||
static int32_t g_anchor_range_mm[NUM_ANCHORS];
|
|
||||||
static float g_anchor_rssi[NUM_ANCHORS];
|
|
||||||
static uint32_t g_anchor_last_ok[NUM_ANCHORS];
|
|
||||||
static int g_num_known_anchors = 0;
|
static int g_num_known_anchors = 0;
|
||||||
|
|
||||||
static int anchor_index(uint16_t addr) {
|
static int anchor_index(uint16_t addr) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user