[Feature Request]: Report effective bandwidth/spread_factor in LoRaConfig when use_preset is true
Platform
Cross-Platform
Description
When lora.use_preset is true, the bandwidth, spread_factor and coding_rate fields that a node reports in its LoRaConfig don't reflect the modem settings it is actually running. They keep whatever was stored before, often from a previous preset or an earlier custom config.
What I saw. I moved a RAK4631 (2.8.1) from MEDIUM_FAST to MEDIUM_TURBO. Afterward, meshtastic --info reports:
"usePreset": true,
"modemPreset": 16,
"bandwidth": 250,
"spreadFactor": 9,
"codingRate": 5,MEDIUM_TURBO is SF9 / BW500 / CR4/5, so the radio is on 500 kHz, but the config says 250. Anyone auditing a node (a person reading --info, a fleet-management tool, a compliance check) has to know that these fields mean nothing under a preset. The obvious reading here is wrong: it suggests the node is on 250 kHz. That's precisely the setting we moved off to meet the FCC §15.247 500 kHz minimum.
Why. In RadioInterface::applyModemConfig(), the preset path computes bw/sf/cr into member variables via modemPresetToParams() and never writes them back to config.lora:
https://github.com/meshtastic/firmware/blob/8e6a88d06f44cad26f1e8d7cd402939ccacb9b4c/src/mesh/RadioInterface.cpp#L1298-L1318
Request. When use_preset is true, the reported bandwidth and spread_factor should match the effective values derived from the preset (and region / wideLora). Clients would then show what's actually on the air.
One design caveat: coding_rate isn't cosmetic today. Under a preset, a stored coding_rate in 5..8 that is higher than the preset's CR is applied as a custom override (same function, L1304-L1312). So simply persisting the preset's CR into coding_rate would change behavior. After a later switch to a preset with a lower CR, the persisted value would silently act as a custom override. Reading the code, it looks like a stale value could already do that now: if a node's stored coding_rate were left at 8 from earlier settings, it would seem to override any later CR 4/5 preset. I haven't confirmed this on hardware. Some options:
- Write the effective
bw/sfback to config under a preset, and keepcoding_rateas a pure "custom override" field (0 = none), resetting it when the preset changes. - Don't persist anything; fill in the effective values when the config is sent to a client (e.g. in the
AdminModuleget-config response) instead of what's stored. - Add read-only "effective" fields (e.g. in
DeviceMetadataor a new message) so clients can show the real modem parameters without overloading the config fields.
Any of these would make a node's reported LoRa config trustworthy without having to know the preset table.
Source: meshtastic/firmware