-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Hi
When using NetWizard with a Raspberry Pi Pico, the network discovery does not work. The list on the captive page stays empty. This is the code I am using:
#include <WebServer.h>
#include <NetWizard.h>
WebServer server(80);
// Initialize NetWizard
NetWizard NW(&server);
void setup() {
delay(3000);
Serial.begin(115200);
Serial.println("Starting NetWizard Demo...");
// Start NetWizard
NW.autoConnect("My Network", "12345678");
// Check if configured
if (NW.isConfigured()) {
Serial.println("Device is configured");
} else {
Serial.println("Device is not configured!");
}
}
void loop() {
NW.loop();
}
When looking at the code starting at line 934 in NetWizard.cpp, I suppose that there is a "_restartScan()" missing.
// return scan data
int16_t n = WiFi.scanComplete();
#if defined(ESP8266) || defined(ESP32)
if (n == WIFI_SCAN_RUNNING) {
_server->send(202, "application/json", "[]");
return _server->client().stop(); // Stop is needed because we sent no content length
} else if (n == WIFI_SCAN_FAILED) {
// restart scan
_restartScan(); // <--------------------------- restart scan here when scan yields no result
_server->send(202, "application/json", "[]");
return _server->client().stop(); // Stop is needed because we sent no content length
#elif defined (TARGET_RP2040) || defined(TARGET_RP2350) || defined(PICO_RP2040) || defined(PICO_RP2350)
if (!n) { // <--------------------------- no restart scan here when scan yields no result
_server->send(202, "application/json", "[]");
return _server->client().stop(); // Stop is needed because we sent no content length
#endif
} else {
// serialize scan data
String output;
_generateScanJson(output);
// restart scan
_restartScan();
return _server->send(200, "application/json", output);
}
}).setFilter(this->_onAPFilter);So I added "_restartScan()" before "_server->send..." in order to copy the logic of the code for ESP8266 and ESP32 to the code for the RP2040 and RP2350 devices.
With this modification, the networks appear on the list and the list ist constantly updated. But after about 4 updates, the program freezes. You can scroll up and down the networks list on the captive page, but you can not select a network or even press the "Skip" button.
Could you please have a look at this?
Thanks!
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working