File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 3434// ----------------------------------------
3535
3636int wifiConnectionAttempts; // Count the number of connection attempts between restarts
37+ bool mdnsIsRunning = false ; // Ending mdns when it was not yet started causes it to fail to start
3738
3839#ifdef COMPILE_WIFI
3940
@@ -255,7 +256,6 @@ bool wifiStartAP(bool forceAP)
255256 WiFi.softAPConfig (local_IP, gateway, subnet);
256257
257258 const char *softApSsid = " RTK Config" ;
258-
259259 if (WiFi.softAP (softApSsid) == false ) // Must be short enough to fit OLED Width
260260 {
261261 systemPrintln (" WiFi AP failed to start" );
@@ -432,8 +432,11 @@ void wifiStop()
432432 stopWebServer ();
433433
434434 // Stop the multicast domain name server
435- if (settings.mdnsEnable == true )
435+ if (mdnsIsRunning == true && settings.mdnsEnable == true )
436+ {
436437 MDNS.end ();
438+ mdnsIsRunning = false ;
439+ }
437440
438441 // Stop the DNS server if we were using the captive portal
439442 if (WiFi.getMode () == WIFI_AP && settings.enableCaptivePortal )
@@ -551,7 +554,10 @@ bool wifiConnect(unsigned long timeout)
551554 if (MDNS.begin (" rtk" ) == false ) // This should make the device findable from 'rtk.local' in a browser
552555 systemPrintln (" Error setting up MDNS responder!" );
553556 else
557+ {
554558 MDNS.addService (" http" , " tcp" , settings.httpPort ); // Add service to MDNS
559+ mdnsIsRunning = true ;
560+ }
555561 }
556562 }
557563
You can’t perform that action at this time.
0 commit comments