Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updating ESP32 arduino core to 3.1.0 seems to break wm.startConfigPortal() #1797

Open
GrantSando opened this issue Feb 1, 2025 · 6 comments

Comments

@GrantSando
Copy link

If I call wm.startConfigPortal(ssid, pass) with arduino-esp32 3.0.7 or earlier it creates the portal.

If I call it with arduino-esp32 3.1.0 or later installed it causes a "Guru Meditation Error: Core 1 panic'ed." and restarts device.

code looks like this,

#include "Arduino.h"
#include <WiFiManager.h>
#include <string.h>
#include <Preferences.h>

Preferences preferences;
WiFiManager wm;
char ssidString[50] = "";
char pwString[50] = "";
const int setupPin = 21;

void setup() {
Serial.begin(9600);
delay(1500);
pinMode(setupPin, INPUT_PULLUP);
getWiFiCredentials();
// InitWiFi();
}

void loop() {
// put your main code here, to run repeatedly:

}

void getWiFiCredentials(){

//load ssid and password from preferences
preferences.begin("credentials", false);
String ssid = preferences.getString("ssid", "");
ssid.toCharArray(ssidString, sizeof(ssidString));
String pw = preferences.getString("password", "");
pw.toCharArray(pwString, sizeof(pwString));
preferences.end();

WiFi.mode(WIFI_STA);

//if ssid and password have not been setup then start portal for user input
if (ssid == "" | digitalRead(setupPin) == 0)
{
if (!wm.startConfigPortal("MY_WIFI", "PASS1234"))
{
Serial.println("failed to connect and hit timeout");
delay(3000);
ESP.restart();
delay(5000);
}
else
{
//get ssid and password from portal
String ssid = wm.getWiFiSSID();
ssid.toCharArray(ssidString, sizeof(ssidString));
String pw = wm.getWiFiPass();
pw.toCharArray(pwString, sizeof(pwString));

  //save ssid and password to preferences
  preferences.begin("credentials", false);
    preferences.putString("ssid", ssidString); 
    preferences.putString("password", pwString);
  preferences.end();
}

}
}

@tablatronix
Copy link
Collaborator

If you remove getwificredentials?

@GrantSando
Copy link
Author

Thanks for your reply. I have now simplified the code and uninstalled all additional libraries apart from WiFiManager.h and still get the same result. (starts portal with 3.0.7, crashes chip with 3.1.0). I should add this is Arduino IDE 2.3.4

Are there some other files I should delete before testing?

Code now is,

#include <WiFiManager.h>
WiFiManager wm;

void setup() {
Serial.begin(9600);
delay(1500);

WiFi.mode(WIFI_STA);
wm.startConfigPortal("MY_WIFI", "PASS1234");

}

void loop() {
// put your main code here, to run repeatedly:

}

@GrantSando
Copy link
Author

chip is: ESP32-S3-WROOM-1-N8
partition scheme is: 8mb with spiffs (or 4mb with spiffs - same result)

@tablatronix
Copy link
Collaborator

tablatronix commented Feb 9, 2025

Works for me, super example

*wm:[2] [SYS] WM version:  v2.0.17 D:4
*wm:[2] [SYS] Arduino version:  3.1.1
*wm:[2] [SYS] ESP SDK version:  5.3.2.250120
*wm:[2] [SYS] Free heap:        347712
*wm:[2] [SYS] Chip ID: 3245692124
*wm:[2] [SYS] Chip Model: ESP32-S3
*wm:[2] [SYS] Chip Cores: 2
*wm:[2] [SYS] Chip Rev: 1
[  4003][V][AP.cpp:108] _onApEvent(): AP Started
[  4007][V][NetworkEvents.cpp:113] _checkForEvent(): Network Event: 130 - AP_START
[  4015][V][AP.cpp:88] _onApArduinoEvent(): Arduino AP Event: 130 - AP_START
*wm:[2] AP IP address: 192.168.4.1
*wm:[3] [CB] _apcallback calling 
[CALLBACK] configModeCallback fired
*wm:[4] setupConfigPortal 
*wm:[2] Starting Web Portal 
[  4503][V][NetworkServer.h:41] NetworkServer(): NetworkServer::NetworkServer(port=80, ...)
[  4512][V][WebServer.cpp:49] WebServer(): WebServer::Webserver(port=80)
*wm:[3] [CB] _webservercallback calling 
*wm:[3] HTTP server started 
*wm:[4] setupDNSD 
*wm:[4] dns server started with ip:  192.168.4.1
*wm:[3] Config Portal Running, blocking, waiting for clients... 
*wm:[3] Portal Timeout In 90 seconds
*wm:[3] Portal Timeout In 63 seconds

@GrantSando
Copy link
Author

OK thanks, just tested that and it worked for me also.

I noticed WiFi.mode(WIFI_STA) was removed from the super example. When I remove this from my examples above they also work without issue.

Seems that with core 3.1.0 and higher this line shouldn't be called.

Thanks for your help and the work you've done with this library.

@tablatronix
Copy link
Collaborator

Ah good point, could be a race condition
But that also is working for me without issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants