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
24 changes: 23 additions & 1 deletion firmware/esp32-csi-node/main/edge_processing.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,14 @@ static uint8_t s_presence_below_count; /**< Consecutive frames below low thres
static bool s_fall_detected;
static int8_t s_latest_rssi;
static uint32_t s_frame_count;
/** Frames process_frame() refused. Counted separately from s_frame_count so
* the two together distinguish "the edge stage is idle" from "the edge stage
* is rejecting everything" -- states that look identical from the outside
* and have completely different causes. EDGE_MAX_SUBCARRIERS is
* target-conditional, so a build that selects the pre-HE 128 on an HE part
* rejects every frame here while the task still starts and logs its
* banner. */
static uint32_t s_frame_rejected;

/** Previous phase velocity for fall detection (acceleration). */
static float s_prev_phase_velocity;
Expand Down Expand Up @@ -1062,7 +1070,10 @@ static void send_feature_vector(void)
static void process_frame(const edge_ring_slot_t *slot)
{
uint16_t n_subcarriers = slot->iq_len / 2;
if (n_subcarriers == 0 || n_subcarriers > EDGE_MAX_SUBCARRIERS) return;
if (n_subcarriers == 0 || n_subcarriers > EDGE_MAX_SUBCARRIERS) {
s_frame_rejected++;
return;
}

s_frame_count++;
s_latest_rssi = slot->rssi;
Expand Down Expand Up @@ -1389,6 +1400,16 @@ void edge_get_variances(float *out_variances, uint16_t n_subcarriers)
}
}

uint32_t edge_processing_get_frames_processed(void)
{
return s_frame_count;
}

uint32_t edge_processing_get_frames_rejected(void)
{
return s_frame_rejected;
}

esp_err_t edge_processing_init(const edge_config_t *cfg)
{
if (cfg == NULL) {
Expand Down Expand Up @@ -1421,6 +1442,7 @@ esp_err_t edge_processing_init(const edge_config_t *cfg)
s_fall_detected = false;
s_latest_rssi = 0;
s_frame_count = 0;
s_frame_rejected = 0;
s_sample_rate_hz = EDGE_CONFIGURED_SAMPLE_RATE_HZ;
s_filter_design_fs = EDGE_CONFIGURED_SAMPLE_RATE_HZ;
s_rate_window_start_us = 0;
Expand Down
17 changes: 17 additions & 0 deletions firmware/esp32-csi-node/main/edge_processing.h
Original file line number Diff line number Diff line change
Expand Up @@ -343,4 +343,21 @@ void edge_get_phase_history(const float **out_buf, uint16_t *out_len,
*/
void edge_get_variances(float *out_variances, uint16_t n_subcarriers);

/**
* Frames the edge pipeline accepted, cumulative since init.
*
* Read with edge_processing_get_frames_rejected(): the pair is what makes an
* idle edge stage distinguishable from one rejecting every frame.
*/
uint32_t edge_processing_get_frames_processed(void);

/**
* Frames process_frame() refused, cumulative since init.
*
* Non-zero and climbing with frames_processed stuck at 0 means every frame is
* failing the EDGE_MAX_SUBCARRIERS guard -- the signature of a build that
* selected the pre-HE 128 on an HE-capable part.
*/
uint32_t edge_processing_get_frames_rejected(void);

#endif /* EDGE_PROCESSING_H */
9 changes: 9 additions & 0 deletions firmware/esp32-csi-node/main/node_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include "c6_sync_espnow.h"
#include "csi_collector.h"
#include "edge_processing.h"
#include "nvs_config.h"
#include "thermal.h"

Expand Down Expand Up @@ -179,6 +180,14 @@ static void fill_health(node_log_periodic_t *h)
h->csi_fps_x100 = csi_collector_get_pkt_yield_per_sec() * 100;
h->tx_send_fail = csi_collector_get_send_fail_count();

/* node_log_periodic_t has declared these two since the log shipped and
* node_log_read.py has always rendered them, but nothing assigned them,
* so every record on every node reported 0/0 -- the memset, not a
* measurement. On the one question this log exists to answer about an
* unreachable node, it returned a plausible constant zero. */
h->frames_processed = edge_processing_get_frames_processed();
h->frames_rejected = edge_processing_get_frames_rejected();

h->disconnect_count = s_disconnect_count;
h->last_disc_reason = s_last_disc_reason;
h->last_disc_rssi = s_last_disc_rssi;
Expand Down
Loading