mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-03-06 11:33:38 +00:00
Improve power stability when using MQTT (#1070)
* Changes to improve MQTT and power stability * Re-added the memory leak fix * Re-added the memory leak fix * Stop client before deleting * Fixed potential nullpointer
This commit is contained in:
@@ -902,7 +902,11 @@ void handleCloud() {
|
||||
|
||||
unsigned long handleMqtt() {
|
||||
unsigned long start = millis();
|
||||
if (mqttEnabled || config.isMqttChanged()) {
|
||||
if(!networkConnected) {
|
||||
if(mqttHandler != NULL) {
|
||||
mqttHandler->disconnect();
|
||||
}
|
||||
} else if (mqttEnabled || config.isMqttChanged()) {
|
||||
if(mqttHandler == NULL || !mqttHandler->connected() || config.isMqttChanged()) {
|
||||
if(mqttHandler != NULL && config.isMqttChanged()) {
|
||||
mqttHandler->disconnect();
|
||||
|
||||
Reference in New Issue
Block a user