Repeater, room server, sensor, companion: set commands refuse out-of-range or non-numeric values instead of saving them

Changelog: Repeater, room server, sensor, companion: `set tx`, `set radio`, `set freq` and other number settings now refuse a value that is out of range or not a number, instead of saving it and answering OK.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
tthandClaude Opus 5.5 committed 2026-11-27 17:33:42 +01:00
1 parent c58274a2e1
commit 14f5892033
9 files changed
+260 -56

No files matched your search

+1 -1
View File
@@ -274,7 +274,7 @@ Refer to the node's manual for the correct settings to use.
- `set tx <dbm>`
**Parameters:**
- `dbm`: Power level in dBm (1-22)
- `dbm`: Power level in dBm (-9 to 22 on SX126x; meshcore-tth refuses values out of range or not taken by the radio)
**Set by build flag:** `LORA_TX_POWER`
+1 -1
View File
@@ -123,7 +123,7 @@ Radio parameters are common to all roles and handled by `CommonRadioPrefs`.
- `set tx <dbm>`
**Parameters:**
- `dbm`: Power level in dBm (1-22)
- `dbm`: Power level in dBm (-9 to 22 on SX126x; meshcore-tth refuses values out of range or not taken by the radio)
**Set by build flag:** `LORA_TX_POWER`
+16 -1
View File
@@ -106,12 +106,27 @@ stall watchdog", "Reboot into the bootloader" and "Why the board last reset".
| `dfu [uf2\|serial\|ota]` | *local only*: reboot into the bootloader -- UF2 drive (default), CDC port for `adafruit-nrfutil`, or BLE DFU |
| `fw ...` | `-ota` images only: admin-pushed firmware update, see [ota.md](ota.md) |
## Number arguments of `set` (all, and the companion's serial CLI)
Upstream parses the value of a `set` with `atoi()`/`atof()`: text became 0,
`300` became 44 in a one-byte setting, and the result was saved with `OK`. This
fork refuses a value that is not a number or lies outside the range and keeps
the old one (`Error, must be ...`). It applies to `set tx` (-9 up to the
board's `MAX_LORA_TX_POWER`, else 30, and saved only if the radio takes it:
SX1262 -9..22), `set radio` and `tempradio` (each field; the timeout 1-10080
min), `set freq`, `set lat`/`set lon`, `set flood.max`, `set
flood.max.unscoped`, `set flood.max.advert` (0-64), `set int.thresh` (0-255),
`set multi.acks` (0-1), `set path.hash.mode` (0-2), `set agc.reset.interval`
(0-1020), `set rxdelay`, `set txdelay`, `set direct.txdelay`, `set
adc.multiplier`, and on the companion `set pin`, `set adc.multiplier`, `set
tz.offset`. No exponent (`1e3`), no `nan`/`inf`.
## Diagnostics
| command | where | |
|---|---|---|
| `blink [n]` / `blink on\|off` | repeater | flash a spare LED (not the BLE or TX one) `n` times (default 6, max 999), or until `blink off` (gives up after 10 min); finds a board on a bench or a node on a mast |
| `txpwr [dBm]` | repeater | LoRa output power until reboot, with RadioLib's status (`set tx` saves and says OK even when the radio refused) |
| `txpwr [dBm]` | repeater | LoRa output power until reboot, with RadioLib's status; takes -9..30 |
| `i2c` | all | scan the I2C bus |
| `get chip` | nRF52 (repeater, room server, sensor) | the silicon (`nRF52840 AAD0`; variant `xxF0` and later = rev3) and `UICR.APPROTECT`: `open` means SWD can read the whole flash, keys included ([locked-bootloader.md](locked-bootloader.md)) |
| `dio1` | own build: `PIN_DIAG` | has the SX1262 raise TX_DONE and compares its IRQ register with the level on the DIO1 pin -- which end of a dead IRQ line is broken |