Removed magic numbers

This commit is contained in:
ford-jones 2025-10-02 10:24:32 +13:00
parent dae9b1c024
commit f82667d71e
2 changed files with 4 additions and 4 deletions

View File

@ -145,11 +145,11 @@ void menuHandler::LoraRegionPicker(uint32_t duration)
config.lora.ignore_mqtt = true; // Ignore MQTT by default if region has a duty cycle limit
}
if (strncmp(moduleConfig.mqtt.root, default_mqtt_root, 3) == 0) {
if (strncmp(moduleConfig.mqtt.root, default_mqtt_root, strlen(default_mqtt_root)) == 0) {
// Default broker is in use, so subscribe to the appropriate MQTT root topic for this region
sprintf(moduleConfig.mqtt.root, "%s/%s", default_mqtt_root, myRegion->name);
changes |= SEGMENT_MODULECONFIG;
};
}
service->reloadConfig(changes);
rebootAtMsec = (millis() + DEFAULT_REBOOT_SECONDS * 1000);

View File

@ -776,8 +776,8 @@ void AdminModule::handleSetConfig(const meshtastic_Config &c)
// Additionally as a side-effect, assume a new value under myRegion
initRegion();
if (strncmp(moduleConfig.mqtt.root, default_mqtt_root, 3) == 0) {
// Default broker is in use, so subscribe to the appropriate MQTT root topic for this region
if (strncmp(moduleConfig.mqtt.root, default_mqtt_root, strlen(default_mqtt_root)) == 0) {
// Default root is in use, so subscribe to the appropriate MQTT topic for this region
sprintf(moduleConfig.mqtt.root, "%s/%s", default_mqtt_root, myRegion->name);
}