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 34
34
// ----------------------------------------
35
35
36
36
int 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
37
38
38
39
#ifdef COMPILE_WIFI
39
40
@@ -255,7 +256,6 @@ bool wifiStartAP(bool forceAP)
255
256
WiFi.softAPConfig (local_IP, gateway, subnet);
256
257
257
258
const char *softApSsid = " RTK Config" ;
258
-
259
259
if (WiFi.softAP (softApSsid) == false ) // Must be short enough to fit OLED Width
260
260
{
261
261
systemPrintln (" WiFi AP failed to start" );
@@ -432,8 +432,11 @@ void wifiStop()
432
432
stopWebServer ();
433
433
434
434
// Stop the multicast domain name server
435
- if (settings.mdnsEnable == true )
435
+ if (mdnsIsRunning == true && settings.mdnsEnable == true )
436
+ {
436
437
MDNS.end ();
438
+ mdnsIsRunning = false ;
439
+ }
437
440
438
441
// Stop the DNS server if we were using the captive portal
439
442
if (WiFi.getMode () == WIFI_AP && settings.enableCaptivePortal )
@@ -551,7 +554,10 @@ bool wifiConnect(unsigned long timeout)
551
554
if (MDNS.begin (" rtk" ) == false ) // This should make the device findable from 'rtk.local' in a browser
552
555
systemPrintln (" Error setting up MDNS responder!" );
553
556
else
557
+ {
554
558
MDNS.addService (" http" , " tcp" , settings.httpPort ); // Add service to MDNS
559
+ mdnsIsRunning = true ;
560
+ }
555
561
}
556
562
}
557
563
You can’t perform that action at this time.
0 commit comments