Improve Wifi Reconnect handling and add outgoing queue for MQTT packets to bridge short connection issues.

This commit is contained in:
Thomas Göttgens
2022-12-16 20:28:28 +01:00
parent 1c8181dc75
commit 68f6cfde0c
4 changed files with 175 additions and 74 deletions

View File

@@ -4,6 +4,7 @@
#include "concurrency/OSThread.h"
#include "mesh/Channels.h"
#include "mesh/generated/mqtt.pb.h"
#include <PubSubClient.h>
#if HAS_WIFI
#include <WiFiClient.h>
@@ -12,6 +13,8 @@
#include <EthernetClient.h>
#endif
#define MAX_MQTT_QUEUE 32
/**
* Our wrapper/singleton for sending/receiving MQTT "udp" packets. This object isolates the MQTT protocol implementation from
* the two components that use it: MQTTPlugin and MQTTSimInterface.
@@ -52,6 +55,10 @@ class MQTT : private concurrency::OSThread
bool connected();
protected:
PointerQueue<ServiceEnvelope> mqttQueue;
int reconnectCount = 0;
virtual int32_t runOnce() override;
private: