Skip to content

Commit

Permalink
fix bug, when too many networks were visible
Browse files Browse the repository at this point in the history
  • Loading branch information
the-butcher committed May 12, 2024
1 parent b091da6 commit a2554dd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion moth_core/moth_core_p22/src/modules/ModuleWifi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,10 @@ bool ModuleWifi::powerup(config_t& config, bool allowApMode) {

int ssidCount = WiFi.scanNetworks();
int ssidIndex = 0;
for (; ssidIndex < max(ssidCount, (int)NETWORKS_BUFFER_SIZE); ssidIndex++) {
for (; ssidIndex < min(ssidCount, (int)NETWORKS_BUFFER_SIZE); ssidIndex++) {
#ifdef USE___SERIAL
Serial.printf("ssidIndex: %d\n", ssidIndex);
#endif
String ssid = WiFi.SSID(ssidIndex);
int32_t rssi = WiFi.RSSI(ssidIndex);
ModuleWifi::discoveredNetworks[ssidIndex] = {rssi};
Expand Down

0 comments on commit a2554dd

Please sign in to comment.