Anyway, here's my modified Scan_Wifi_networks function.
I modified it to:
-display the # of APs found
-display 8 at a time AP SSID + RSSI value with a little pause between them
-if > 8 APs then clear the display and then display the next 8, etc.
I think it would be really neat if it could sort the APs by RSSI - show the strongest first on through the weakest.
Hopefully this post makes it through and I haven't messed it up some how again.
void Scan_Wifi_Networks()
{
int c = 0;
char myStr[13];
char mySSIDstr[20];
// Set WiFi to station mode and disconnect from an AP if it was previously connected
// Need to be in dicsonected mode to Run network Scan!
WiFi.mode(WIFI_STA);
WiFi.disconnect();
delay(100);
// WiFi.scanNetworks will return the number of networks found
int n = WiFi.scanNetworks();
sprintf(myStr,"%d APs found\0",n);
clear_display();
sendStrXY(myStr,3,0); // display the number of APs found
delay(2000);
if (n == 0)
{
clear_display();
sendStrXY("No networks found",3,0);
delay(1000);
}
else
{
clear_display(); // Clear OLED
for (int i = 0; i < n; ++i)
{
// Print SSID and RSSI for each network found
sprintf(myStr,"%s",WiFi.SSID(i)); // copy in the SSID
strncpy(mySSIDstr,myStr,12); // then truncate it
myStr[12] = 0;
sprintf(myStr,"%s %2d\0",myStr,WiFi.RSSI(i)); // append the RSSI
sendStrXY(myStr,c,0);
c++;
if (c > 7){
delay(2000);
clear_display(); // Clear OLED
c = 0 ;
}
delay(2000);
} // end of for loop
} // end of else
} // end of ScanWifiNetworks function