@@ -171,7 +171,7 @@ void menuWiFi()
171
171
// Display the WiFi IP address
172
172
void wifiDisplayIpAddress ()
173
173
{
174
- systemPrintf (" WiFi %s IP address: " , WiFi.SSID ());
174
+ systemPrintf (" WiFi '%s' IP address: " , WiFi.SSID ());
175
175
systemPrint (WiFi.localIP ());
176
176
systemPrintf (" RSSI: %d\r\n " , WiFi.RSSI ());
177
177
@@ -253,12 +253,14 @@ bool wifiStartAP(bool forceAP)
253
253
IPAddress subnet (255 , 255 , 255 , 0 );
254
254
255
255
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
257
259
{
258
260
systemPrintln (" WiFi AP failed to start" );
259
261
return (false );
260
262
}
261
- systemPrint (" WiFi AP Started with IP: " );
263
+ systemPrintf (" WiFi AP '%s' started with IP: " , softApSsid );
262
264
systemPrintln (WiFi.softAPIP ());
263
265
264
266
// Start DNS Server
@@ -527,39 +529,18 @@ bool wifiConnect(unsigned long timeout)
527
529
528
530
int wifiResponse = WL_DISCONNECTED;
529
531
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;
535
534
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++)
549
537
{
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 );
561
540
}
562
541
542
+ wifiResponse = wifiMulti.run (timeout);
543
+
563
544
if (wifiResponse == WL_CONNECTED)
564
545
{
565
546
if (settings.enableTcpClient == true || settings.enableTcpServer == true || settings.enableUdpServer == true )
@@ -708,4 +689,9 @@ int wifiGetRssi()
708
689
return WiFi.RSSI ();
709
690
}
710
691
692
+ String wifiGetSsid ()
693
+ {
694
+ return WiFi.SSID ();
695
+ }
696
+
711
697
#endif // COMPILE_WIFI
0 commit comments