You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
log_message((char *)"Reconnecting to WiFi failed. Waiting a few seconds before trying again.");
146
-
WiFi.disconnect();
140
+
WiFi.disconnect(true);
147
141
}
148
142
}
149
-
} else {
150
-
if (softAPenabled) {
143
+
} else {//WiFi connected
144
+
if (WiFi.softAPSSID() != "") {
151
145
log_message((char *)"WiFi (re)connected, shutting down hotspot...");
152
-
softAPenabled = false;
153
-
reconnectingWiFi = false;
154
146
WiFi.softAPdisconnect(true);
147
+
MDNS.notifyAPChange();
155
148
}
149
+
150
+
if (firstConnectSinceBoot) { // this should start only when softap is down or else it will not work properly so run after the routine to disable softap
151
+
firstConnectSinceBoot = false;
152
+
setupOTA();
153
+
MDNS.begin(heishamonSettings.wifi_hostname);
154
+
MDNS.addService("http", "tcp", 80);
155
+
}
156
+
156
157
/*
157
-
* always update if wifi is working so next time on ssid failure
158
-
* it only starts the routine above after this timeout
159
-
*/
158
+
always update if wifi is working so next time on ssid failure
159
+
it only starts the routine above after this timeout
160
+
*/
160
161
nextWifiRetryTimer = millis() + WIFIRETRYTIMER;
162
+
163
+
// Allow MDNS processing
164
+
MDNS.update();
161
165
}
162
166
}
163
167
@@ -172,7 +176,7 @@ void mqtt_reconnect()
172
176
if (mqtt_client.connect(heishamonSettings.wifi_hostname, heishamonSettings.mqtt_username, heishamonSettings.mqtt_password, topic, 1, true, "Offline"))
173
177
{
174
178
mqttReconnects++;
175
-
MDNS.begin(heishamonSettings.wifi_hostname); //assume reconnect on wifi so maybe need mdns restart
0 commit comments