From 5f47fff2c3ec20251df703bc172852d3f5fb1eec Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Sun, 29 Mar 2026 15:00:32 -0600 Subject: [PATCH] feat: per-board TX power range, TX_POWER_MAX sentinel (-128) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Each board exports TX_POWER_RANGE constant (min, max dBm) - RadioConfig::validate() uses the board's range, not hardcoded limits - TX_POWER_MAX sentinel (-128 on the wire) means "use board's maximum" — resolved to the actual max before storing config - GetConfig returns the resolved actual power, not the sentinel - Default configs in examples use TX_POWER_MAX - Protocol docs updated --- donglora.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/donglora.py b/donglora.py index a80789f..3d1259d 100644 --- a/donglora.py +++ b/donglora.py @@ -197,12 +197,15 @@ def connect(port: str | None = None, timeout: float = 2.0) -> serial.Serial: return ser -# Default radio config: 915 MHz, 125 kHz BW, SF7, CR 4/5 +# Sentinel: set TX power to the board's maximum +TX_POWER_MAX = -128 # i8::MIN on the wire + +# Default radio config: 915 MHz, 125 kHz BW, SF7, CR 4/5, max power DEFAULT_CONFIG = { "freq_hz": 915_000_000, "bw": 7, # 125 kHz "sf": 7, "cr": 5, # CR 4/5 "sync_word": 0x1424, - "tx_power_dbm": 14, + "tx_power_dbm": TX_POWER_MAX, }