refactor: make CodingRate a plain u8 denominator (5-8) on the wire

CodingRate was an enum with repr(u8) values that didn't match postcard's
wire encoding (variant index). Instead of papering over the mismatch,
make cr a plain u8 in RadioConfig. Host sends the denominator directly:
5 for CR 4/5, 6 for CR 4/6, etc. No lookup tables, no index confusion.

Remove CodingRate enum, cr_denom() helper, and the Bandwidth import that
was only needed for cr_denom. ErrorCode repr values also fixed to 0-based.
This commit is contained in:
swaits committed 2026-03-29 20:42:57 -06:00
1 parent 920dd7cef8
commit ece7cbc8ab
4 files changed
+22 -33

No files matched your search

+1 -1
View File
@@ -914,7 +914,7 @@ RADIO_CONFIG = {
"freq_hz": 910_525_000,
"bw": 6, # Khz62 = variant index 6
"sf": 7,
"cr": 0, # Cr4_5 = variant index 0
"cr": 5, # CR 4/5 — denominator value
"sync_word": 0x3444,
"tx_power_dbm": 14,
}