From b39746e945939e51e5f7bb0fd11de8163a22ee58 Mon Sep 17 00:00:00 2001 From: Softwarecrash Date: Thu, 11 Apr 2024 18:39:07 +0200 Subject: [PATCH] fix mdns crash --- src/main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 5685dda..25db294 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -229,6 +229,7 @@ void setup() { // set the device name MDNS.begin(_settings.data.deviceName); + MDNS.addService("http", "tcp", 80); WiFi.hostname(_settings.data.deviceName); @@ -429,8 +430,6 @@ void setup() WebSerial.begin(&server); server.begin(); - MDNS.addService("http", "tcp", 80); - MDNS.update(); } analogWrite(LED_PIN, 255); resetCounter(false); @@ -438,6 +437,7 @@ void setup() void loop() { + MDNS.update(); if (Update.isRunning()) { workerCanRun = false; @@ -446,7 +446,7 @@ void loop() if (WiFi.status() == WL_CONNECTED && workerCanRun) { // No use going to next step unless WIFI is up and running. ws.cleanupClients(); // clean unused client connections - MDNS.update(); + mqttclient.loop(); // Check if we have something to read from MQTT epWorker(); // the loop worker