Skip to content

Commit c8ea525

Browse files
committed
esp32 esp web tools fix
1 parent ac83ce6 commit c8ea525

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

src/BootstrapManager.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ class BootstrapManager {
5050
// using JsonDocument = StaticJsonDocument<BUFFER_SIZE>;
5151
StaticJsonDocument<BUFFER_SIZE> parseQueueMsg(char* topic, byte* payload, unsigned int length); // print the message arriving from the queue
5252
StaticJsonDocument<BUFFER_SIZE> parseHttpMsg(String payload, unsigned int length); // print the message arriving from HTTP
53-
void littleFsInit();
5453
void bootstrapSetup(void (*manageDisconnectionFunction)(), void (*manageHardwareButton)(), void (*callback)(char*, byte*, unsigned int)); // bootstrap setup()
55-
void bootstrapSetup(void (*manageDisconnectionFunction)(), void (*manageHardwareButton)(), void (*callback)(char*, byte*, unsigned int), bool waitImprov, void (*listener)()); // bootstrap setup()
5654
void bootstrapLoop(void (*manageDisconnectionFunction)(), void (*manageQueueSubscription)(), void (*manageHardwareButton)()); // bootstrap loop()
5755
static void setMQTTWill(const char *topic, const char *payload, int qos, boolean retain, boolean cleanSession); // set the last will parameters for mqtt
5856
static void publish(const char *topic, const char *payload, boolean retained); // send a message on the queue
@@ -71,9 +69,8 @@ class BootstrapManager {
7169
[[maybe_unused]] String readValueFromFile(const String& filenameToUse, const String& paramName); // read a param from a json file
7270
static bool isWifiConfigured(); // check if wifi is correctly configured
7371
void launchWebServerForOTAConfig(); // if no ssid available, launch web server to get config params via browser
74-
void launchWebServerCustom(bool waitImprov, void (*listener)()); // if no ssid available, launch web server to get config params via browser
7572
static int getWifiQuality(); // get the wifi quality
76-
void manageImprov();
73+
7774
};
7875

7976
#endif

src/QueueManager.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,25 @@ void QueueManager::mqttReconnect(void (*manageDisconnections)(), void (*manageQu
100100
Helpers::smartPrintln(F("MQTT attempts="));
101101
Helpers::smartPrintln(mqttReconnectAttemp);
102102
helper.smartDisplay();
103+
104+
if (mqttReconnectAttemp > 15) {
105+
// if fastDisconnectionManagement we need to execute the callback immediately,
106+
// example: power off a watering system can't wait MAX_RECONNECT attemps
107+
if (fastDisconnectionManagement) {
108+
manageDisconnections();
109+
Helpers::smartPrintln(F("Disconnecting WiFi."));
110+
WiFi.reconnect();
111+
}
112+
}
113+
103114
// after MAX_RECONNECT attemps all peripherals are shut down
104-
if (mqttReconnectAttemp >= MAX_RECONNECT || fastDisconnectionManagement) {
115+
if (mqttReconnectAttemp >= MAX_RECONNECT) {
105116
Helpers::smartPrintln(F("Max retry reached, powering off peripherals."));
106117
helper.smartDisplay();
107118
// Manage disconnections, powering off peripherals
108119
manageDisconnections();
120+
Helpers::smartPrintln(F("Disconnecting WiFi."));
121+
WiFi.reconnect();
109122
} else if (mqttReconnectAttemp > 10000) {
110123
mqttReconnectAttemp = 0;
111124
}

src/WifiManager.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ class WifiManager {
120120

121121
static bool isWifiConfigured(); // check if wifi is correctly configured
122122
static void launchWebServerForOTAConfig(); // if no ssid available, launch web server to get config params via browser
123-
static void launchWebServerCustom(void (*listener)()); // if no ssid available, launch web server to get config params via browser
124123
void manageImprovWifi(); // if no ssid available, launch web server to get config params via browser
125124
void handleImprovPacket();
126125

0 commit comments

Comments
 (0)