From 1ba65a59df63b34db7fc19a8c796a8f60b2aa920 Mon Sep 17 00:00:00 2001 From: drjones Date: Fri, 3 Apr 2026 21:34:35 -0700 Subject: [PATCH] Add +30dB external PA gain to ERP calculations and web UI display Made-with: Cursor --- include/config.h | 3 ++- src/main.cpp | 14 +++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/include/config.h b/include/config.h index 001a975..889f0a9 100644 --- a/include/config.h +++ b/include/config.h @@ -24,9 +24,10 @@ // Web server #define WEB_PORT 80 -// Jamming: max CC1101 TX (+10 dBm). External PA removed — radiated power is chip + antenna gain only. +// Jamming: max CC1101 TX (+10 dBm). External PA gain added to ERP calculation. // Jam always starts after boot self-test; use web “Stop Jamming” (or capture REC) to pause for RX/capture. #define DEFAULT_AUTO_START_JAM true +#define JAM_EXT_PA_GAIN_DB 30 // Gain of external RF amplifier (e.g. 30 dB / 1 Watt) // CC1101 only accepts 8 discrete power levels (index 0-7); jam path always uses max (10 dBm). #define JAM_POWER_LEVELS 8 #define DEFAULT_JAM_POWER_IDX 7 // 10 dBm — full device output (see TI SWRS061 PATABLE / output power) diff --git a/src/main.cpp b/src/main.cpp index 296d150..565fbe8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1481,9 +1481,9 @@ static void oledDrawHealth() { (unsigned)(up/3600000), (unsigned)((up/60000)%60), (unsigned)((up/1000)%60)); u8g2.drawStr(0, 44, buf); - const int effDbm = (int)jamPower; + const int effDbm = (int)jamPower + JAM_EXT_PA_GAIN_DB; const uint32_t effMw = (uint32_t)roundf(powf(10.0f, effDbm / 10.0f)); - snprintf(buf, sizeof(buf), "PWR %ddBm / %umW", effDbm, min(effMw, (uint32_t)9999)); + snprintf(buf, sizeof(buf), "PWR %ddBm / %umW", effDbm, min(effMw, (uint32_t)999999)); u8g2.drawStr(0, 55, buf); snprintf(buf, sizeof(buf), "WIFI %d ESPNOW %u", @@ -1736,8 +1736,8 @@ textarea:focus{border-color:#4fbf59;outline:none}

System Metrics

Uptime
-
CC1101 TX (max)
dBm
-
ERP (chip only)
dBm
+
CC1101 TX (chip)
dBm
+
ERP (with PA)
dBm
ERP Watts
mW
R1 hardware
R2 hardware
@@ -1812,7 +1812,7 @@ textarea:focus{border-color:#4fbf59;outline:none}

Controls

-

TX power is fixed at +10 dBm (CC1101 max, TI SWRS061). Radiated level includes your antenna gain only — no external PA.

+

TX power is fixed at +10 dBm chip max. Radiated level displayed is ERP including the configured +30 dBm external PA.

Jamming starts automatically on every power-up. Press Stop Jamming to go standby for capture (REC), then start jam again when done.

Jam strategy — Direct: wide LFSR + async TX. Precision: narrower deviation / key rate. Flood: bursty random packets (hypothesis for burst-sensitive links; verify in your chamber). CW: unmodulated carrier. Pulse: slow square wave (spoofs preamble AGC). Special: 60-byte blocking packet TX with 10ms delay (cypher-pulse clone).

@@ -2039,7 +2039,7 @@ function applyTelemetry(t){ const jm=t.jam_mode_str||({0:'direct',1:'precision',2:'flood',3:'cw',4:'pulse',5:'special'}[t.jam_mode])||'direct'; parts.push(jm+' | '+b.join(' + ')); } - document.getElementById('bs').textContent=parts.length?parts.join(' | ')+' | '+t.jam_power+' dBm chip (ERP + antenna only)' + document.getElementById('bs').textContent=parts.length?parts.join(' | ')+' | '+t.eff_power_dbm+' dBm ERP (chip + PA)' :(jam?'Jamming on but no TX':'Standby — Stop Jamming to capture'); document.getElementById('bs').style.color=(jam&&(tx1||tx2))?'#86f28a':(!bstall||!ok1||!ok2||jam||(lran&&!lstall))?'#f28a86':'#4fbf59'; document.getElementById('tog').textContent=jam?'Stop Jamming':'Start Jamming'; @@ -2287,7 +2287,7 @@ static void handleLog() { static void handleTelemetry() { float tempC = temperatureRead(); - const int8_t effDbm = jamPower; + const int8_t effDbm = jamPower + JAM_EXT_PA_GAIN_DB; const float effWatts = powf(10.0f, effDbm / 10.0f) / 1000.0f; String err1 = jsonEscape(radio1Error);