feat(mesh): operator-configurable Meshcore LoRa PHY params (freq/bw/sf/cr)
Archy set no radio params on Meshcore devices — SF/CR/BW/freq lived only in device firmware, so a radio on the wrong preset could not be fixed from the node (it hears RF energy but demodulates nothing; the fleet hit exactly this on an RNode: docs/RETICULUM-TRANSPORT-PROGRESS.md item 4). - protocol.rs: build_set_radio_params — wire format verified against the MeshCore companion firmware handler (CMD_SET_RADIO_PARAMS=11: [11][freq:u32 LE MHz*1000][bw:u32 LE kHz*1000][sf][cr]); byte-layout test pinned to the Portugal preset 869.618 MHz / 62.5 kHz / SF8 / CR8. - serial.rs: MeshcoreDevice::set_radio_params (device reboots on OK). - MeshConfig.lora_radio_params: Option — None (default) leaves the radio untouched, so only explicitly-configured deployments are affected. - session.rs: provision on connect, gated on a persisted last-applied marker (SELF_INFO offsets shift across firmware versions) + the same attempt cap as region/channel so a refusing radio never reboot-loops. - mesh.configure RPC: lora_radio_params arm with firmware-range validation. mesh tests: 114/114 pass. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
c1dfc6672c
commit
4c3cd4b6ad
@@ -164,6 +164,29 @@ impl MeshcoreDevice {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Set the radio's LoRa PHY parameters (freq/bw/sf/cr, firmware field
|
||||
/// units — see `protocol::build_set_radio_params`). On RESP_OK the
|
||||
/// firmware persists the params and reboots to apply them, so the caller
|
||||
/// must treat the session as gone and reconnect.
|
||||
pub async fn set_radio_params(
|
||||
&mut self,
|
||||
freq_khz: u32,
|
||||
bw_hz: u32,
|
||||
sf: u8,
|
||||
cr: u8,
|
||||
) -> Result<()> {
|
||||
self.send_raw(&protocol::build_set_radio_params(freq_khz, bw_hz, sf, cr))
|
||||
.await?;
|
||||
let frame = self.recv_frame_timeout(READ_TIMEOUT).await?;
|
||||
if frame.code == protocol::RESP_ERR {
|
||||
anyhow::bail!(
|
||||
"Set radio params failed: {}",
|
||||
protocol::parse_error(&frame.data)
|
||||
);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Broadcast our advertisement to the mesh.
|
||||
pub async fn send_self_advert(&mut self) -> Result<()> {
|
||||
self.send_raw(&protocol::build_send_self_advert()).await?;
|
||||
|
||||
Reference in New Issue
Block a user