Hide hidden networks for improv

This commit is contained in:
Theo Arends 2022-04-02 16:09:18 +02:00
parent 2eca93e021
commit 30eebf9f31

View File

@ -79,7 +79,6 @@ void ImprovWriteData(uint8_t* data, uint32_t size) {
AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("IMP: Send '%*_H'"), size, data); AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("IMP: Send '%*_H'"), size, data);
// Serial.write(data, size);
for (uint32_t i = 0; i < size; i++) { for (uint32_t i = 0; i < size; i++) {
Serial.write(data[i]); Serial.write(data[i]);
} }
@ -223,7 +222,7 @@ bool ImprovParseSerialByte(void) {
} }
case IMPROV_GET_WIFI_NETWORKS: { // 0x04 case IMPROV_GET_WIFI_NETWORKS: { // 0x04
char data[200]; char data[200];
int n = WiFi.scanNetworks(); int n = WiFi.scanNetworks(false, false); // Wait for scan result, hide hidden
if (n) { if (n) {
int indices[n]; int indices[n];
// Sort RSSI - strongest first // Sort RSSI - strongest first
@ -254,7 +253,6 @@ bool ImprovParseSerialByte(void) {
if (!ssid_copy.length()) { ssid_copy = F("no_name"); } if (!ssid_copy.length()) { ssid_copy = F("no_name"); }
int32_t rssi = WiFi.RSSI(indices[i]); int32_t rssi = WiFi.RSSI(indices[i]);
bool encryption = (ENC_TYPE_NONE == WiFi.encryptionType(indices[i])); bool encryption = (ENC_TYPE_NONE == WiFi.encryptionType(indices[i]));
// Send each ssid separately to avoid overflowing the buffer // Send each ssid separately to avoid overflowing the buffer
uint32_t len = snprintf_P(data, sizeof(data), PSTR("01\n%s\n%d\n%s\n"), uint32_t len = snprintf_P(data, sizeof(data), PSTR("01\n%s\n%d\n%s\n"),
ssid_copy.c_str(), rssi, (encryption)?"NO":"YES"); ssid_copy.c_str(), rssi, (encryption)?"NO":"YES");