From 7b0748c86896ffd10ebe01d236b3f652a14d959e Mon Sep 17 00:00:00 2001 From: archipelago Date: Mon, 29 Jun 2026 08:36:04 -0400 Subject: [PATCH] fix(mesh): respect the radio's flashed LoRa region (don't force ours) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- core/archipelago/src/mesh/meshtastic.rs | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/core/archipelago/src/mesh/meshtastic.rs b/core/archipelago/src/mesh/meshtastic.rs index 29206870..d8127ede 100644 --- a/core/archipelago/src/mesh/meshtastic.rs +++ b/core/archipelago/src/mesh/meshtastic.rs @@ -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), } }