Skip to content

feat: self-calibrate the falling-back floor from the group's live RSSI baseline - #15

Merged
bin101 merged 1 commit into
mainfrom
feat/adaptive-falling-back-calibration
Jul 24, 2026
Merged

feat: self-calibrate the falling-back floor from the group's live RSSI baseline#15
bin101 merged 1 commit into
mainfrom
feat/adaptive-falling-back-calibration

Conversation

@bin101

@bin101 bin101 commented Jul 24, 2026

Copy link
Copy Markdown
Owner

Summary

  • Replaces the fixed, hand-picked falling-back floor with a self-calibrated one: floor = group_baseline - margin, where the baseline is the median slow-EMA RSSI across the intact group (src/calibration.{h,cpp}, pure/testable). Falls back to the historical fixed −105 dBm floor until ≥2 peers are present to calibrate against.
  • Sensitivity (0–10) keeps its familiar ruler but now sets the margin (0–30 dB) below the live baseline instead of an absolute dBm number.
  • Range-test screen (Settings → Test) now also shows the live baseline/floor/trend per peer, marked with the local (pre-consensus) falling-back verdict — the field-calibration tool this feature needed.
  • New opt-in onboard trace ring buffer (trace on/off/dump/clear on the serial console, PSRAM-backed with a RAM fallback) for post-ride CSV analysis of raw/fast/slow RSSI + baseline/floor.
  • No wire-format change (Protocol::kVersion untouched), no NVS migration — sensLvl key and status console output unchanged (Flasher settings panel unaffected).

Test plan

  • pio test -e native — 78/78 passing, including 16 new tests for calibration.h (median robustness/outlier resistance, floor clamping, fallback, margin mapping)
  • pio run — firmware builds clean (RAM 7.2%, Flash 10.8%)
  • flasher/flasher.py --check — flasher self-test passes
  • On-device field test with ≥2 devices: range-test screen shows a stable baseline that tracks the group and a floor that follows it as terrain/formation changes (see README "Verification" steps 10, 12, 13)

🤖 Generated with Claude Code

…I baseline

The falling-back floor used to be a fixed dBm value picked by hand via the
Sensitivity setting -- the right number depends on terrain, group size and
antenna placement and changes every ride, making field calibration slow and
imprecise. The floor now derives automatically as `baseline - margin`, where
the baseline is the median slow-EMA RSSI across the intact group (see
src/calibration.{h,cpp}), falling back to the historical fixed -105 dBm floor
until at least 2 peers are present to calibrate against. Sensitivity 0-10
keeps its familiar ruler but now sets the margin (0-30 dB) below that
baseline instead of an absolute dBm number.

To make the calibration observable in the field: the range-test screen now
also shows the live baseline/floor/trend per peer, and a new opt-in onboard
trace ring buffer (`trace on/off/dump/clear` on the serial console) records
raw/fast/slow RSSI plus baseline/floor for post-ride CSV analysis.

No wire-format change (Protocol::kVersion untouched) and no NVS migration --
the `sensLvl` key and the `status` console output stay exactly as before.
@bin101
bin101 merged commit 2c04a6b into main Jul 24, 2026
2 checks passed
@bin101
bin101 deleted the feat/adaptive-falling-back-calibration branch July 24, 2026 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant