ESPectre SDK 2.8.0-280-gac7af68
Wi-Fi CSI motion sensing for ESP32 firmware
Loading...
Searching...
No Matches
detector_limits.h
Go to the documentation of this file.
1/*
2 * ESPectre - Detector Limits
3 *
4 * Shared detector window size and calibration buffer limits.
5 *
6 * Author: Francesco Pace <francesco.pace@gmail.com>
7 * SPDX-License-Identifier: GPL-3.0-only
8 * Commercial licensing available under separate agreement; see LICENSING.md.
9 */
10#pragma once
11
12#include <cstdint>
13
14namespace espectre {
15
16// The public contract is temporal. These packet counts are only the resolved
17// storage bounds used after the runtime has measured the CSI cadence.
18constexpr uint32_t DETECTOR_WINDOW_SIZE_MS_MIN = 1000U;
19constexpr uint32_t DETECTOR_WINDOW_SIZE_MS_MAX = 2000U;
20constexpr uint32_t DETECTOR_WINDOW_SIZE_MS_DEFAULT = 1000U;
21constexpr uint16_t DETECTOR_DEFAULT_WINDOW_SIZE = 100;
22// A target-rate/window pair may resolve to a single slot. Readiness is governed
23// by the derived temporal occupancy floor, never by an absolute packet count.
24constexpr uint16_t DETECTOR_MIN_WINDOW_SIZE = 1;
25// Bounded by measurement, not stack: detector working buffers are allocated
26// to the resolved window, and the ceiling limits drift away from the feature
27// geometry used during fitting.
28constexpr uint16_t DETECTOR_MAX_WINDOW_SIZE = 1000;
29
30constexpr uint16_t CALIBRATION_NUM_WINDOWS = 10;
33
34// Detector timing contract, in microseconds. The packet counts above and in
35// csi_features.h are what these durations resolve to at the nominal 100 pps; on
36// a stream that runs faster or slower they are re-derived from the measured
37// cadence. Keep aligned with src/python/micro_espectre/config.py.
38constexpr uint32_t EVALUATION_INTERVAL_US = 250000U; // Time between evaluations
39constexpr uint32_t L1_DELTA_LAG_US = 100000U; // Profile-displacement lag
40constexpr uint32_t TURB_AUTOCORR_LAG_US = 10000U; // Autocorrelation lag
41constexpr uint16_t DETECTOR_L1_DELTA_LAG_DEFAULT = 10U;
42constexpr uint16_t DETECTOR_AUTOCORR_LAG_DEFAULT = 1U;
43// The L1 profile ring is statically sized in firmware, so the displacement
44// lag is capped. 32 packets covers the 100 ms contract up to ~320 pps, well
45// past what any supported chip sustains; above that the lag saturates and
46// spans less than 100 ms. Measured cost at 1000 pps is a few points of
47// recall, and the decisive high-rate lag is the autocorrelation one, which
48// stays far below this bound.
49//
50// The ring costs L1_DELTA_LAG_MAX x HT20_SELECTED_BAND_SIZE floats, i.e.
51// 32 x 12 x 4 = 1536 bytes. An earlier revision of this comment said 4.5 KB,
52// which never matched the declaration.
53constexpr uint16_t L1_DELTA_LAG_MAX = 32;
54// A cadence faster than this is not a CSI stream, it is a batch delivered
55// faster than real time. The packet-rate estimator ignores it when deriving
56// feature geometry; evaluation cadence still follows the packet timestamps.
57// There is no upper bound because a stream slower than one window is already
58// handled as a hole by the configured detector window duration.
59constexpr uint32_t MIN_PLAUSIBLE_PACKET_INTERVAL_US = 200U; // 5000 pps
60
61} // namespace espectre
constexpr uint32_t L1_DELTA_LAG_US
constexpr uint16_t DETECTOR_DEFAULT_WINDOW_SIZE
constexpr uint32_t DETECTOR_WINDOW_SIZE_MS_MAX
constexpr uint32_t MIN_PLAUSIBLE_PACKET_INTERVAL_US
constexpr uint16_t L1_DELTA_LAG_MAX
constexpr uint32_t DETECTOR_WINDOW_SIZE_MS_DEFAULT
constexpr uint32_t DETECTOR_WINDOW_SIZE_MS_MIN
constexpr uint16_t CALIBRATION_NUM_WINDOWS
constexpr uint16_t CALIBRATION_DEFAULT_BUFFER_SIZE
constexpr uint16_t DETECTOR_L1_DELTA_LAG_DEFAULT
constexpr uint16_t DETECTOR_MAX_WINDOW_SIZE
constexpr uint16_t DETECTOR_AUTOCORR_LAG_DEFAULT
constexpr uint32_t EVALUATION_INTERVAL_US
constexpr uint32_t TURB_AUTOCORR_LAG_US
constexpr uint16_t DETECTOR_MIN_WINDOW_SIZE