Final review fixes: capture state, stopJamming idempotency, code cleanup

Critical bug fixes:
- stopJamming() was returning early when jammingEnabled=false, leaving radios
  in unknown state and breaking capture when jamming was off
- stopJamming() now idempotent: always stops noise timer (+ nulls pointer),
  drives GDO0 low, puts transmitting radios to standby — safe to call anytime
- Add capPrevJamming flag saved before stopJamming() clears jammingEnabled;
  used by stopCapture() and buffer-full handler to correctly restart jamming
  after capture/replay sessions end

Code quality:
- capAnalyze() called twice per /api/capture/status request — now called once
- Remove unused JAM_NOISE_PATTERN_LEN define (leftover from LEDC era)
- Fix stale "LEDC 120 kHz square wave" comment in startJamming()
- Web UI: show rec_bits (final stored count) instead of capIdx in Bits cell;
  progress bar shows 100% when in RECORDED/REPLAYING state

Made-with: Cursor
This commit is contained in:
drjones
2026-03-11 10:47:37 -07:00
parent 651af39211
commit 05dfde60e9
2 changed files with 40 additions and 34 deletions

View File

@@ -30,8 +30,6 @@
// { -30, -20, -15, -10, 0, 5, 7, 10 } dBm
#define JAM_POWER_LEVELS 8
#define DEFAULT_JAM_POWER_IDX 7 // index into power table (7 = 10 dBm, max)
#define JAM_NOISE_PATTERN_LEN 64
// External amplifier gain in dB (used only for display — does not affect CC1101 output)
#define DEFAULT_AMP_GAIN_DB 20