Ignore MQTT by default if region has a duty cycle limit (#3277)

Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
This commit is contained in:
GUVWAF 2024-02-25 14:43:44 +01:00 committed by GitHub
parent 02192e1163
commit 824991c178
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -332,6 +332,9 @@ void AdminModule::handleSetConfig(const meshtastic_Config &c)
if (isRegionUnset && config.lora.region > meshtastic_Config_LoRaConfig_RegionCode_UNSET) {
config.lora.tx_enabled = true;
initRegion();
if (myRegion->dutyCycle < 100) {
config.lora.ignore_mqtt = true; // Ignore MQTT by default if region has a duty cycle limit
}
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;