feat: decode Config response in donglora.py, add all_commands.py example

Config response (GetConfig) now returns decoded RadioConfig fields instead
of raw hex. New all_commands.py exercises all 8 protocol commands in
sequence — Ping, SetConfig, GetConfig, StartRx, StopRx, Transmit,
DisplayOff, DisplayOn.
This commit is contained in:
swaits committed 2026-03-29 22:24:46 -06:00
1 parent 84be92f263
commit 6359b16135
2 files changed
+56

No files matched your search

+5
View File
@@ -125,6 +125,11 @@ def decode_response(data: bytes) -> dict:
if tag == 0:
return {"type": "Pong"}
elif tag == 1:
if len(rest) >= 10:
freq_hz, bw, sf, cr, sync_word, pwr = struct.unpack_from("<IBBBHB", rest, 0)
tx_power_dbm = struct.unpack_from("<b", rest, 9)[0]
return {"type": "Config", "freq_hz": freq_hz, "bw": bw, "sf": sf,
"cr": cr, "sync_word": sync_word, "tx_power_dbm": tx_power_dbm}
return {"type": "Config", "raw": rest.hex()}
elif tag == 2:
rssi = struct.unpack_from("<h", rest, 0)[0]