Files
car-key-killer/include/config.h
drjones 656673cffd Jamming: fixed dual carriers 315 + 433.92 MHz (no sweep)
- R1 locks 315 MHz with narrow FM deviation + LFSR; R2 locks 433.92 with max deviation
- Remove VCO sweep tables, tickSweepFast, and hop loop; ~2.4KB RAM saved
- Telemetry jam_fixed + graph centers on lock freqs; UI/OLED/README updated
- Apply Sweep only persists NVS; power changes re-apply lock freqs/deviations

Made-with: Cursor
2026-03-24 19:08:10 -07:00

103 lines
4.4 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#ifndef CONFIG_H
#define CONFIG_H
// CC1101 #1 (315 MHz band)
#define CC1101_1_CS 7
#define CC1101_1_GDO0 4
#define CC1101_1_FREQ_MHZ 315.0f
// CC1101 #2 (433.92 MHz band)
#define CC1101_2_CS 8
#define CC1101_2_GDO0 5
#define CC1101_2_FREQ_MHZ 433.92f
// Shared SPI (FSPI default on ESP32-S3: 11=MOSI, 12=SCK, 13=MISO)
#define SPI_SCK_PIN 12
#define SPI_MISO_PIN 13
#define SPI_MOSI_PIN 11
#define SPI_SPEED_HZ 500000
// WiFi AP for read-only telemetry UI
#define WIFI_AP_SSID "killer"
#define WIFI_AP_PASS "password" // simple demo password
// Web server
#define WEB_PORT 80
// Jamming configuration
#define JAMMING_ENABLED true // Start jamming immediately on boot
// CC1101 only accepts 8 discrete power levels (index 0-7):
// { -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)
// External amplifier gain in dB (used only for display — does not affect CC1101 output)
#define DEFAULT_AMP_GAIN_DB 20
// Modulation parameters for jamming (LFSR drives GDO0 in direct async TX)
#define JAM_BITRATE_KBPS 250.0f // baseband / channel filter context for RadioLib begin()
#define JAM_FREQ_DEV_KHZ 380.0f // default passed to begin(); per-radio deviation applied after init
#define JAM_RX_BW_KHZ 812.0f // wide RX BW for begin()
// Fixed dual-carrier jamming — NO sweep: each radio holds one frequency at full TX power.
// R2 (433.92) uses max deviation = loudest/widest noise; R1 (315) uses narrow deviation.
#define JAM_LOCK_FREQ_1_MHZ 315.0f
#define JAM_LOCK_FREQ_2_MHZ 433.92f
#define JAM_DEV_KHZ_R2_WIDE 380.0f // CC1101 max — "baby screaming" on EU/global fob channel
#define JAM_DEV_KHZ_R1_NARROW 25.0f // minimal FM swing — energy concentrated on NA 315 MHz
// Legacy sweep constants (NVS + API still accept them; firmware no longer hops)
// Frequency sweep — full coverage of all known car-key-fob sub-GHz bands
//
// Radio 1 (CC1101 #1) — 300320 MHz [CC1101 Band 1: 300348 MHz]
// Honda/Acura (US): 303.825 MHz
// Chamberlain/LiftMaster: 310.0 MHz
// Toyota/Lexus/Scion: 314.98 MHz
// Ford/GM/Chrysler/Dodge/Jeep: 315.0 MHz
// Linear Delta-3 / LiftMaster: 318.0 MHz
//
// With 1 MHz/hop: 25 steps × 0.83 MHz spacing → solid overlap, 75ms full cycle at 3ms dwell
#define SWEEP_1_CENTER_MHZ 310.0f
#define SWEEP_1_SPAN_MHZ 20.0f // 300320 MHz
#define SWEEP_1_STEPS 25 // 0.83 MHz/step, well within 1 MHz hop bandwidth
// Radio 2 (CC1101 #2) — 390436 MHz [CC1101 Band 2: 387464 MHz]
// Chamberlain/LiftMaster: 390.0 MHz
// Holtek-based remotes: 418.0 MHz
// Somfy RTS / SMC 5326: 433.42 MHz
// Global standard (BMW/VW/Audi/Mercedes/Hyundai/Kia…): 433.92 MHz
// Nero Radio / some Asian fobs: 434.42 MHz
//
// With 1 MHz/hop: 60 steps × 0.77 MHz spacing → no gaps, 180ms full cycle at 3ms dwell
#define SWEEP_2_CENTER_MHZ 413.0f
#define SWEEP_2_SPAN_MHZ 46.0f // 390436 MHz
#define SWEEP_2_STEPS 60 // increased from 47 for guaranteed overlap
// Dwell per hop — 3ms balances CC1101 lock time vs cycle speed
// Full cycle: R1 = 75ms, R2 = 180ms → any target frequency is jammed at least every 180ms
// Car fob TX window is typically 200500ms so every transmission gets hit
#define SWEEP_DWELL_MS 3
// 0.96" SSD1306 OLED display — I2C via SW_I2C (any free GPIO)
// Wiring: VCC→3V3, GND→GND, SDA→GPIO17, SCL→GPIO18
#define OLED_SDA_PIN 17
#define OLED_SCL_PIN 18
// Rotary encoder — dial to cycle OLED pages
// Wiring: CLK→GPIO14, DT→GPIO21, GND→GND (both pins use internal pull-ups)
#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
// ESP-NOW mesh: auto-discover other boards on same firmware (same AP WiFi channel)
#define ESPNOW_BEACON_MS 750 // broadcast presence interval
#define ESPNOW_PEER_STALE_MS 12000 // drop peer if silent this long
#define ESPNOW_MAX_PEERS 8 // max other nodes tracked (4+ boards)
#endif