fix(mesh): respect the radio's flashed LoRa region (don't force ours)
ensure_lora_region previously force-overrode the device's region with the mesh-config region (EU_868) whenever they differed — which would shove a US/ANZ user's radio onto EU_868: an illegal band that also cuts it off from its local mesh. Off-the-shelf interop must respect whatever region the user flashed. Now: a radio that already reports a REAL region (US, EU_868, ANZ, …) is left untouched. We only set a region when the device reports UNSET (a fresh radio is RF-silent and can't mesh at all), using the operator-configured region as the fallback. Unknown/None (never reported) is also left alone. Pairs with the default-channel change so a meshtastic archy node behaves like a stock device. cargo check green (built into the same binary as the channel fix). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
810127fd3e
commit
7b0748c868
@ -296,11 +296,31 @@ impl MeshtasticDevice {
|
||||
return Ok(false);
|
||||
}
|
||||
match self.current_region {
|
||||
Some(cur) if cur == code => Ok(false),
|
||||
_ => {
|
||||
// The radio already has a REAL region (US, EU_868, ANZ, …). RESPECT
|
||||
// it — never override the region the user flashed/configured. Forcing
|
||||
// our configured region onto, say, a US radio would put it on an
|
||||
// illegal band and cut it off from its local mesh. Off-the-shelf
|
||||
// devices keep whatever region they came with; `code` (the
|
||||
// mesh-config region) is only the fallback for a fresh radio below.
|
||||
Some(cur) if cur != REGION_UNSET => {
|
||||
if cur != code {
|
||||
debug!(
|
||||
device_region = cur,
|
||||
configured_region = code,
|
||||
"Respecting the radio's own LoRa region (not overriding with the configured one)"
|
||||
);
|
||||
}
|
||||
Ok(false)
|
||||
}
|
||||
// Region is UNSET → a fresh radio is RF-silent and can't mesh at all.
|
||||
// Set the operator-configured region so it can transmit/receive.
|
||||
Some(_) => {
|
||||
self.set_lora_region(code).await?;
|
||||
Ok(true)
|
||||
}
|
||||
// Region unknown (never reported in want_config) — don't guess /
|
||||
// don't override; leave it for the user to set.
|
||||
None => Ok(false),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user