From 02efef3aaf7895353172bc541cc044ebc01b4e14 Mon Sep 17 00:00:00 2001 From: ford-jones Date: Tue, 30 Sep 2025 16:36:52 +1300 Subject: [PATCH] Set appropriate mqtt root upon lora region change --- src/modules/AdminModule.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/modules/AdminModule.cpp b/src/modules/AdminModule.cpp index 79ea7bc0c..1cea85d7a 100644 --- a/src/modules/AdminModule.cpp +++ b/src/modules/AdminModule.cpp @@ -770,6 +770,15 @@ void AdminModule::handleSetConfig(const meshtastic_Config &c) changes = SEGMENT_CONFIG | SEGMENT_MODULECONFIG; } } + if (config.lora.region != myRegion->code) { + // Region has changed so check whether there is a regulatory one we should be using instead. + // Additionally as a side-effect, assume a new value under myRegion + initRegion(); + + // subscribe to appropriate MQTT root topic for this region + sprintf(moduleConfig.mqtt.root, "%s/%s", default_mqtt_root, myRegion->name); + changes = SEGMENT_CONFIG | SEGMENT_MODULECONFIG; + } break; case meshtastic_Config_bluetooth_tag: LOG_INFO("Set config: Bluetooth");