mirror of
https://github.com/meshtastic/firmware.git
synced 2025-08-03 04:15:53 +00:00
Fix mqtt config bugs
This commit is contained in:
parent
66a831dfa8
commit
098a341b96
@ -798,8 +798,11 @@ void AdminModule::handleSetConfig(const meshtastic_Config &c)
|
|||||||
|
|
||||||
bool AdminModule::handleSetModuleConfig(const meshtastic_ModuleConfig &c)
|
bool AdminModule::handleSetModuleConfig(const meshtastic_ModuleConfig &c)
|
||||||
{
|
{
|
||||||
if (!hasOpenEditTransaction)
|
// If we are in an open transaction or configuring MQTT, defer Disable Bluetooth
|
||||||
|
// Otherwise, disable Bluetooth to prevent any other module from sending data
|
||||||
|
if (!hasOpenEditTransaction && c.which_payload_variant != meshtastic_ModuleConfig_mqtt_tag)
|
||||||
disableBluetooth();
|
disableBluetooth();
|
||||||
|
|
||||||
switch (c.which_payload_variant) {
|
switch (c.which_payload_variant) {
|
||||||
case meshtastic_ModuleConfig_mqtt_tag:
|
case meshtastic_ModuleConfig_mqtt_tag:
|
||||||
#if MESHTASTIC_EXCLUDE_MQTT
|
#if MESHTASTIC_EXCLUDE_MQTT
|
||||||
@ -810,6 +813,8 @@ bool AdminModule::handleSetModuleConfig(const meshtastic_ModuleConfig &c)
|
|||||||
if (!MQTT::isValidConfig(c.payload_variant.mqtt)) {
|
if (!MQTT::isValidConfig(c.payload_variant.mqtt)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
// Resume disabled bluetooth
|
||||||
|
disableBluetooth();
|
||||||
moduleConfig.has_mqtt = true;
|
moduleConfig.has_mqtt = true;
|
||||||
moduleConfig.mqtt = c.payload_variant.mqtt;
|
moduleConfig.mqtt = c.payload_variant.mqtt;
|
||||||
#endif
|
#endif
|
||||||
|
@ -630,10 +630,6 @@ bool MQTT::isValidConfig(const meshtastic_ModuleConfig_MQTTConfig &config, MQTTC
|
|||||||
}
|
}
|
||||||
|
|
||||||
const bool defaultServer = isDefaultServer(parsed.serverAddr);
|
const bool defaultServer = isDefaultServer(parsed.serverAddr);
|
||||||
if (defaultServer && config.tls_enabled) {
|
|
||||||
LOG_ERROR("Invalid MQTT config: TLS was enabled, but the default server does not support TLS");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (defaultServer && parsed.serverPort != PubSubConfig::defaultPort) {
|
if (defaultServer && parsed.serverPort != PubSubConfig::defaultPort) {
|
||||||
LOG_ERROR("Invalid MQTT config: Unsupported port '%d' for the default MQTT server", parsed.serverPort);
|
LOG_ERROR("Invalid MQTT config: Unsupported port '%d' for the default MQTT server", parsed.serverPort);
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user