Hi All, I always get ESP32-WROOM-32D module reset when calling scanNetworks function asynchronously (with parameter: true).
Below is a code snippet.
(Entire sketch taken from: https://arduino-esp8266.readthedocs.io/ ... mples.html, please refer to the last example on this page)
The code is for ESP8266 but I assumed it would work the same for ESP32.
An asynchronous call is useful because it does not block other functions during a long network scan.
Unfortunately it always crashes while scanning.
Has anyone experienced something like this?
void loop()
{
..................
// trigger Wi-Fi network scan
if (currentMillis - lastScanMillis > SCAN_PERIOD)
{
WiFi.scanNetworks(true);
Serial.print("\nScan start ... ");
lastScanMillis = currentMillis;
}
// print out Wi-Fi network scan result upon completion
int n = WiFi.scanComplete();
if(n >= 0)
{
Serial.printf("%d network(s) found\n", n);
for (int i = 0; i < n; i++)
{
Serial.printf("%d: %s, Ch:%d (%ddBm) %s\n", i+1, WiFi.SSID(i).c_str(), WiFi.channel(i), WiFi.RSSI(i), WiFi.encryptionType(i));
}
WiFi.scanDelete();
}
}
esp now: scanNetworks invoked asynchronously generates reset
-
- Posts: 6
- Joined: Sun Apr 11, 2021 6:34 pm
-
- Posts: 6
- Joined: Sun Apr 11, 2021 6:34 pm
Re: esp now: scanNetworks invoked asynchronously generates reset
ok, I found a problem: Serial.printf was the culprit.
Who is online
Users browsing this forum: No registered users and 36 guests