fixes for OTA

This commit is contained in:
technyon
2023-03-04 13:51:26 +01:00
parent befb0f8851
commit 82f8e91036
16 changed files with 99 additions and 14 deletions

View File

@@ -142,13 +142,15 @@ ReconnectStatus WifiDevice::reconnect()
void WifiDevice::update()
{
if(_useEncryption)
if(_mqttEnabled)
{
_mqttClientSecure->loop();
}
else
{
_mqttClient->loop();
if (_useEncryption)
{
_mqttClientSecure->loop();
} else
{
_mqttClient->loop();
}
}
}
@@ -327,3 +329,16 @@ uint16_t WifiDevice::mqttSubscribe(const char *topic, uint8_t qos)
return _mqttClient->subscribe(topic, qos);
}
}
void WifiDevice::disableMqtt()
{
if (_useEncryption)
{
_mqttClientSecure->disconnect();
} else
{
_mqttClient->disconnect();
}
_mqttEnabled = false;
}