Add signal capture and replay feature

Records raw demodulated CC1101 GDO0 output at 100 kHz into a 50 KB
bit-packed static buffer (up to 4 seconds). Replay drives GDO0 in
direct TX mode at the same sample rate, looping until stopped.

- config.h: CAP_SAMPLE_HZ / CAP_DURATION_S / CAP_BUF_BYTES defines
- main.cpp: capRecordISR / capReplayISR using hw_timer_t on timer 3
- main.cpp: startCapture / startReplay / stopCapture management functions
- main.cpp: capAnalyze() estimates bitrate and duty cycle from transitions
- main.cpp: five HTTP endpoints under /api/capture/*
- main.cpp: loop() state machine auto-finalises buffer-full capture
- kHtml: Capture / Replay card with freq input, radio selector,
  REC/STOP/REPLAY buttons, progress bar, stats grid, waveform canvas

Made-with: Cursor
This commit is contained in:
drjones
2026-03-11 08:05:37 -07:00
parent eb94d611c9
commit 055073fc9d
2 changed files with 350 additions and 0 deletions

View File

@@ -84,4 +84,11 @@
#define ENC_CLK_PIN 14
#define ENC_DT_PIN 21
// Signal capture / replay
// Samples GDO0 (CC1101 demodulated output) at CAP_SAMPLE_HZ during direct RX mode.
// Bit-packed into a static buffer. Replay drives GDO0 in direct TX mode at same rate.
#define CAP_SAMPLE_HZ 100000 // 100 kHz sample clock
#define CAP_DURATION_S 4 // max capture window (seconds)
#define CAP_BUF_BYTES ((CAP_SAMPLE_HZ * CAP_DURATION_S) / 8 + 8) // ~50 KB
#endif