formatting

This commit is contained in:
Emanuele Trabattoni
2025-07-23 22:52:53 +02:00
parent 59d8c2c2d4
commit 71c7ff8756
2 changed files with 9 additions and 8 deletions

View File

@@ -1,7 +1,7 @@
#include <mqtt.h>
#define STACK_DEPTH 4096
#define PRIOTITY 0
#define PRIOTITY 2
MQTTwrapper::MQTTwrapper() : m_config(Config::getInstance()), m_tcp(NetworkClient()), m_client(PubSubClient(m_tcp)), m_loopHandle(NULL)
{
@@ -76,7 +76,8 @@ const bool MQTTwrapper::unsubscribe(topic_t topic)
return false;
}
const bool MQTTwrapper::connected() {
const bool MQTTwrapper::connected()
{
return m_loopHandle != NULL;
}
@@ -146,12 +147,12 @@ void MQTTwrapper::clientLoop(void *params)
while (client.connected())
{
client.loop();
vTaskDelay(pdMS_TO_TICKS(loopTime));
delay(loopTime);
}
if (client.state() != MQTT_CONNECTED)
{
LOG_ERROR("MQTT disconnect reason ", stateMap.at(client.state()).c_str());
vTaskDelay(pdMS_TO_TICKS(loopTime * 50));
delay(loopTime * 50);
const bool ok = client.connect(clientName.c_str());
LOG_WARN("MQTT reconnected", ok ? "True" : "False");
if (ok)
@@ -160,7 +161,8 @@ void MQTTwrapper::clientLoop(void *params)
{
const std::string &topic(v.first);
LOG_WARN("MQTT resubscribing to", topic.c_str());
if(!wrapper->m_client.subscribe(topic.c_str())){
if (!wrapper->m_client.subscribe(topic.c_str()))
{
LOG_ERROR("Unable to resubscribe to", topic.c_str());
}
}