mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-14 00:52:05 +00:00
Default mqtt root to msh/region from unset (#3111)
* Default mqtt root to msh/region from unset * Correct segments
This commit is contained in:
parent
a8b7490b6e
commit
e2a3b0306f
@ -280,6 +280,7 @@ void AdminModule::handleSetOwner(const meshtastic_User &o)
|
|||||||
|
|
||||||
void AdminModule::handleSetConfig(const meshtastic_Config &c)
|
void AdminModule::handleSetConfig(const meshtastic_Config &c)
|
||||||
{
|
{
|
||||||
|
auto changes = SEGMENT_CONFIG;
|
||||||
auto existingRole = config.device.role;
|
auto existingRole = config.device.role;
|
||||||
bool isRegionUnset = (config.lora.region == meshtastic_Config_LoRaConfig_RegionCode_UNSET);
|
bool isRegionUnset = (config.lora.region == meshtastic_Config_LoRaConfig_RegionCode_UNSET);
|
||||||
|
|
||||||
@ -320,6 +321,11 @@ void AdminModule::handleSetConfig(const meshtastic_Config &c)
|
|||||||
config.lora = c.payload_variant.lora;
|
config.lora = c.payload_variant.lora;
|
||||||
if (isRegionUnset && config.lora.region > meshtastic_Config_LoRaConfig_RegionCode_UNSET) {
|
if (isRegionUnset && config.lora.region > meshtastic_Config_LoRaConfig_RegionCode_UNSET) {
|
||||||
config.lora.tx_enabled = true;
|
config.lora.tx_enabled = true;
|
||||||
|
initRegion();
|
||||||
|
if (strcmp(moduleConfig.mqtt.root, default_mqtt_root) == 0) {
|
||||||
|
sprintf(moduleConfig.mqtt.root, "%s/%s", default_mqtt_root, myRegion->name);
|
||||||
|
changes = SEGMENT_CONFIG | SEGMENT_MODULECONFIG;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case meshtastic_Config_bluetooth_tag:
|
case meshtastic_Config_bluetooth_tag:
|
||||||
@ -329,7 +335,7 @@ void AdminModule::handleSetConfig(const meshtastic_Config &c)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
saveChanges(SEGMENT_CONFIG);
|
saveChanges(changes);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AdminModule::handleSetModuleConfig(const meshtastic_ModuleConfig &c)
|
void AdminModule::handleSetModuleConfig(const meshtastic_ModuleConfig &c)
|
||||||
@ -715,4 +721,4 @@ AdminModule::AdminModule() : ProtobufModule("Admin", meshtastic_PortNum_ADMIN_AP
|
|||||||
{
|
{
|
||||||
// restrict to the admin channel for rx
|
// restrict to the admin channel for rx
|
||||||
boundChannel = Channels::adminChannel;
|
boundChannel = Channels::adminChannel;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user