@@ -171,7 +171,7 @@ void menuWiFi()
171171// Display the WiFi IP address
172172void wifiDisplayIpAddress ()
173173{
174- systemPrintf (" WiFi %s IP address: " , WiFi.SSID ());
174+ systemPrintf (" WiFi '%s' IP address: " , WiFi.SSID ());
175175 systemPrint (WiFi.localIP ());
176176 systemPrintf (" RSSI: %d\r\n " , WiFi.RSSI ());
177177
@@ -253,12 +253,14 @@ bool wifiStartAP(bool forceAP)
253253 IPAddress subnet (255 , 255 , 255 , 0 );
254254
255255 WiFi.softAPConfig (local_IP, gateway, subnet);
256- if (WiFi.softAP (" RTK Config" ) == false ) // Must be short enough to fit OLED Width
256+
257+ const char *softApSsid = " RTK Config" ;
258+ if (WiFi.softAP (softApSsid) == false ) // Must be short enough to fit OLED Width
257259 {
258260 systemPrintln (" WiFi AP failed to start" );
259261 return (false );
260262 }
261- systemPrint (" WiFi AP Started with IP: " );
263+ systemPrintf (" WiFi AP '%s' started with IP: " , softApSsid );
262264 systemPrintln (WiFi.softAPIP ());
263265
264266 // Start DNS Server
@@ -527,39 +529,18 @@ bool wifiConnect(unsigned long timeout)
527529
528530 int wifiResponse = WL_DISCONNECTED;
529531
530- // WiFi.begin() is much faster than wifiMulti (requires scan time)
531- // Use wifiMulti only if multiple credentials exist
532- if (wifiNetworkCount () == 1 )
533- {
534- systemPrint (" Connecting WiFi" );
532+ systemPrint (" Connecting WiFi... " );
533+ WiFiMulti wifiMulti;
535534
536- // Load SSID - may not be in spot 0
537- for (int x = 0 ; x < MAX_WIFI_NETWORKS; x++)
538- {
539- if (strlen (settings.wifiNetworks [x].ssid ) > 0 )
540- {
541- WiFi.begin (settings.wifiNetworks [x].ssid , settings.wifiNetworks [x].password );
542- break ;
543- }
544- }
545-
546- wifiResponse = WiFi.waitForConnectResult ();
547- }
548- else
535+ // Load SSIDs
536+ for (int x = 0 ; x < MAX_WIFI_NETWORKS; x++)
549537 {
550- systemPrint (" Connecting WiFi... " );
551- WiFiMulti wifiMulti;
552-
553- // Load SSIDs
554- for (int x = 0 ; x < MAX_WIFI_NETWORKS; x++)
555- {
556- if (strlen (settings.wifiNetworks [x].ssid ) > 0 )
557- wifiMulti.addAP (settings.wifiNetworks [x].ssid , settings.wifiNetworks [x].password );
558- }
559-
560- wifiResponse = wifiMulti.run (timeout);
538+ if (strlen (settings.wifiNetworks [x].ssid ) > 0 )
539+ wifiMulti.addAP (settings.wifiNetworks [x].ssid , settings.wifiNetworks [x].password );
561540 }
562541
542+ wifiResponse = wifiMulti.run (timeout);
543+
563544 if (wifiResponse == WL_CONNECTED)
564545 {
565546 if (settings.enableTcpClient == true || settings.enableTcpServer == true || settings.enableUdpServer == true )
@@ -708,4 +689,9 @@ int wifiGetRssi()
708689 return WiFi.RSSI ();
709690}
710691
692+ String wifiGetSsid ()
693+ {
694+ return WiFi.SSID ();
695+ }
696+
711697#endif // COMPILE_WIFI
0 commit comments