#include "WiFi_Scanner.h" #include #include "LVGL_Driver.h" #include "HandshakeCapture.h" void WiFiScanner_Refresh(void) { Ui_SetWifiStatus("Scanning..."); Ui_ClearNetworkList(); scanNetworksSortedByRSSI(); int count = 0; int captureable = 0; int offband_secure = 0; for (int i = 0; i < MAX_NETWORKS; i++) { if (networks[i].ssid.isEmpty()) break; count++; if (isCaptureable(i)) { captureable++; } else if (isSupportedCaptureAuth(networks[i].encryption) && !isSupportedCaptureChannel(networks[i].ch)) { offband_secure++; } } if (count <= 0) { Ui_SetWifiStatus("No networks"); WiFi.scanDelete(); return; } static char status_text[64]; if (offband_secure > 0) { snprintf(status_text, sizeof(status_text), "%d nets, %d tgt, %d off-band", count, captureable, offband_secure); } else { snprintf(status_text, sizeof(status_text), "%d nets, %d tgt", count, captureable); } Ui_SetWifiStatus(status_text); for (int i = 0; i < count; i++) { char line[48]; const char* suffix = ""; if (isSupportedCaptureAuth(networks[i].encryption) && !isSupportedCaptureChannel(networks[i].ch)) { suffix = " 5G+"; } snprintf(line, sizeof(line), "%02d. %s ch%d%s", i + 1, networks[i].ssid.c_str(), networks[i].ch, suffix); Ui_AddNetwork(line, i); if (networks[i].handshake_captured) { Ui_SetNetworkColor(i, lv_palette_main(LV_PALETTE_RED)); } else if (isCaptureable(i)) { Ui_SetNetworkColor(i, lv_palette_main(LV_PALETTE_GREEN)); } else { Ui_SetNetworkColor(i, lv_palette_main(LV_PALETTE_GREY)); } } WiFi.scanDelete(); }