[GH-ISSUE #1096] wm.startConfigPortal and wm.resetSettings cause crash #935

Open
opened 2026-02-28 01:27:45 +03:00 by kerem · 2 comments
Owner

Originally created by @alfo on GitHub (Jul 13, 2020).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1096

Basic Infos

Hardware

WiFimanager Branch/Release:

  • Master
  • Development

Esp8266/Esp32:

  • ESP8266
  • ESP32

Hardware: ESP-12e, esp01, esp25

  • ESP01
  • ESP12 E/F/S (nodemcu, wemos, feather)
  • Other

ESP Core Version: 2.4.0, staging

  • 2.3.0
  • 2.4.0
  • staging (master/dev)

Description

I'm trying to add the reset button functionality from the Advanced example sketch, but either a long press or a short press causes a crash. I've omitted some code because it's an enormous sketch, but can you see anything blatantly wrong below? I can provide the whole thing if it's needed.

Settings in IDE

Module: D1 Mini 32

Additional libraries:

  • PubSubClient
  • PxMatrix
  • HTTPClient
  • ArduinoJson
  • SPIFFS

Sketch


#include <Arduino.h>

const int resetPin = 26;

void setup() {
  // WiFiManager bits and pieces
  WiFiManager wm;
  wm.setSaveConfigCallback(saveConfigCallback);
  wm.setAPCallback(configModeCallback);
  wm.setAPClientCheck(true);
  wm.setConnectTimeout(CONNECT_TIMEOUT);
  wm.setTimeout(AP_TIMEOUT);
  wm.setCountry("GB");
  wm.setClass("invert"); // Dark theme

  // Set hostname from settings
  wm.setHostname(hostname);

  // WiFiManager param stuff omitted here

  //reset settings - wipe credentials for testing, if defined
  #if defined(START_ANEW)
    Serial.println("^^^^^^^^ Clearing WiFi credentials");
    wm.resetSettings();
  #endif

  // Run the routine to connect to the network
  if (!wm.autoConnect(hostname, "glowingsquare")) {

    // If we've hit the config portal timeout, then retstart

    Serial.println("%%% Failed to connect and hit timeout, restarting");
    delay(100);
    ESP.restart();

    // Not sure if this line is necessary
    delay(5000);
  }

  // Keeping this line cos it's cute
  Serial.println("Connected ...yeey :)");

}

void checkButton(){

  WiFiManager wm;

  // check for button press
  if (digitalRead(resetPin) == LOW) {
    // poor mans debounce/press-hold, code not ideal for production
    delay(50);
    if( digitalRead(resetPin) == LOW ){
      Serial.println("Button Pressed");
      // still holding button for 3000 ms, reset settings, code not ideaa for production
      delay(3000); // reset delay hold
      if( digitalRead(resetPin) == LOW ){
        Serial.println("Button Held");
        Serial.println("Erasing Config, restarting");
        wm.resetSettings();
        ESP.restart();
      }

      // start portal w delay
      Serial.println("Starting config portal");
      wm.setConfigPortalTimeout(120);

      if (!wm.startConfigPortal("OnDemandAP","password")) {
        Serial.println("failed to connect or hit timeout");
        delay(3000);
        // ESP.restart();
      } else {
        //if you get here you have connected to the WiFi
        Serial.println("connected...yeey :)");
      }
    }
  }
}

void loop() {

  checkButton();

}

Debug Messages

On short press:

Button Pressed
Starting config portal
*WM: [2] Starting Config Portal 
*WM: [2] AccessPoint set password is VALID 
*WM: [1] password 
*WM: [3] WiFi station enable 
*WM: [2] Enabling AP 
*WM: [1] StartAP with SSID:  OnDemandAP
/home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/queue.c:1446 (xQueueGenericReceive)- assert failed!
abort() was called at PC 0x40088bb7 on core 1

Backtrace: 0x4008c8d4:0x3ffbe690 0x4008cb05:0x3ffbe6b0 0x40088bb7:0x3ffbe6d0 0x400ee33a:0x3ffbe710 0x400ed649:0x3ffbe730 0x400d2ee8:0x3ffbe750 0x40080f61:0x3ffbe790 0x400815b1:0x3ffbe7b0 0x40084a85:0x3ffbe7d0 0x40086d3d:0x3ffba190 0x40082e7f:0x3ffba1b0 0x40088e91:0x3ffba1d0

Rebooting...

On long press:

Button Pressed
Button Held
Erasing Config, restarting
*WM: [1] resetSettings 
*WM: [3] WiFi station enable 
Guru Meditation Error: Core  1 panic'ed (Cache disabled but cached memory region accessed)
Core 1 register dump:
PC      : 0x400d2de4  PS      : 0x00060034  A0      : 0x800815b4  A1      : 0x3ffbe790  
A2      : 0x3ffbec3c  A3      : 0x20000000  A4      : 0x00000400  A5      : 0x00000000  
A6      : 0x3ffc80d0  A7      : 0xffffffff  A8      : 0x80080f64  A9      : 0x3ffbe760  
A10     : 0x3ffc3f5c  A11     : 0x00000046  A12     : 0x00000001  A13     : 0x00000001  
A14     : 0x00060021  A15     : 0x00000000  SAR     : 0x0000001e  EXCCAUSE: 0x00000007  
EXCVADDR: 0x00000000  LBEG    : 0x00000000  LEND    : 0x00000000  LCOUNT  : 0x00000000  
Core 1 was running in ISR context:
EPC1    : 0x40086d40  EPC2    : 0x00000000  EPC3    : 0x00000000  EPC4    : 0x400d2de4

Backtrace: 0x400d2de4:0x3ffbe790 0x400815b1:0x3ffbe7b0 0x40084a85:0x3ffbe7d0 0x40086d3d:0x3ffba190 0x40082e7f:0x3ffba1b0 0x40088e91:0x3ffba1d0

Rebooting...
Originally created by @alfo on GitHub (Jul 13, 2020). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1096 ### Basic Infos #### Hardware **WiFimanager Branch/Release:** - [ ] Master - [x] Development **Esp8266/Esp32:** - [ ] ESP8266 - [x] ESP32 **Hardware: ESP-12e, esp01, esp25** - [ ] ESP01 - [ ] ESP12 E/F/S (nodemcu, wemos, feather) - [x] Other **ESP Core Version: 2.4.0, staging** - [ ] 2.3.0 - [x] 2.4.0 - [ ] staging (master/dev) ### Description I'm trying to add the reset button functionality from the Advanced example sketch, but either a long press or a short press causes a crash. I've omitted some code because it's an enormous sketch, but can you see anything blatantly wrong below? I can provide the whole thing if it's needed. ### Settings in IDE Module: D1 Mini 32 Additional libraries: * PubSubClient * PxMatrix * HTTPClient * ArduinoJson * SPIFFS ### Sketch ```cpp #include <Arduino.h> const int resetPin = 26; void setup() { // WiFiManager bits and pieces WiFiManager wm; wm.setSaveConfigCallback(saveConfigCallback); wm.setAPCallback(configModeCallback); wm.setAPClientCheck(true); wm.setConnectTimeout(CONNECT_TIMEOUT); wm.setTimeout(AP_TIMEOUT); wm.setCountry("GB"); wm.setClass("invert"); // Dark theme // Set hostname from settings wm.setHostname(hostname); // WiFiManager param stuff omitted here //reset settings - wipe credentials for testing, if defined #if defined(START_ANEW) Serial.println("^^^^^^^^ Clearing WiFi credentials"); wm.resetSettings(); #endif // Run the routine to connect to the network if (!wm.autoConnect(hostname, "glowingsquare")) { // If we've hit the config portal timeout, then retstart Serial.println("%%% Failed to connect and hit timeout, restarting"); delay(100); ESP.restart(); // Not sure if this line is necessary delay(5000); } // Keeping this line cos it's cute Serial.println("Connected ...yeey :)"); } void checkButton(){ WiFiManager wm; // check for button press if (digitalRead(resetPin) == LOW) { // poor mans debounce/press-hold, code not ideal for production delay(50); if( digitalRead(resetPin) == LOW ){ Serial.println("Button Pressed"); // still holding button for 3000 ms, reset settings, code not ideaa for production delay(3000); // reset delay hold if( digitalRead(resetPin) == LOW ){ Serial.println("Button Held"); Serial.println("Erasing Config, restarting"); wm.resetSettings(); ESP.restart(); } // start portal w delay Serial.println("Starting config portal"); wm.setConfigPortalTimeout(120); if (!wm.startConfigPortal("OnDemandAP","password")) { Serial.println("failed to connect or hit timeout"); delay(3000); // ESP.restart(); } else { //if you get here you have connected to the WiFi Serial.println("connected...yeey :)"); } } } } void loop() { checkButton(); } ``` ### Debug Messages On short press: ``` Button Pressed Starting config portal *WM: [2] Starting Config Portal *WM: [2] AccessPoint set password is VALID *WM: [1] password *WM: [3] WiFi station enable *WM: [2] Enabling AP *WM: [1] StartAP with SSID: OnDemandAP /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/queue.c:1446 (xQueueGenericReceive)- assert failed! abort() was called at PC 0x40088bb7 on core 1 Backtrace: 0x4008c8d4:0x3ffbe690 0x4008cb05:0x3ffbe6b0 0x40088bb7:0x3ffbe6d0 0x400ee33a:0x3ffbe710 0x400ed649:0x3ffbe730 0x400d2ee8:0x3ffbe750 0x40080f61:0x3ffbe790 0x400815b1:0x3ffbe7b0 0x40084a85:0x3ffbe7d0 0x40086d3d:0x3ffba190 0x40082e7f:0x3ffba1b0 0x40088e91:0x3ffba1d0 Rebooting... ``` On long press: ``` Button Pressed Button Held Erasing Config, restarting *WM: [1] resetSettings *WM: [3] WiFi station enable Guru Meditation Error: Core 1 panic'ed (Cache disabled but cached memory region accessed) Core 1 register dump: PC : 0x400d2de4 PS : 0x00060034 A0 : 0x800815b4 A1 : 0x3ffbe790 A2 : 0x3ffbec3c A3 : 0x20000000 A4 : 0x00000400 A5 : 0x00000000 A6 : 0x3ffc80d0 A7 : 0xffffffff A8 : 0x80080f64 A9 : 0x3ffbe760 A10 : 0x3ffc3f5c A11 : 0x00000046 A12 : 0x00000001 A13 : 0x00000001 A14 : 0x00060021 A15 : 0x00000000 SAR : 0x0000001e EXCCAUSE: 0x00000007 EXCVADDR: 0x00000000 LBEG : 0x00000000 LEND : 0x00000000 LCOUNT : 0x00000000 Core 1 was running in ISR context: EPC1 : 0x40086d40 EPC2 : 0x00000000 EPC3 : 0x00000000 EPC4 : 0x400d2de4 Backtrace: 0x400d2de4:0x3ffbe790 0x400815b1:0x3ffbe7b0 0x40084a85:0x3ffbe7d0 0x40086d3d:0x3ffba190 0x40082e7f:0x3ffba1b0 0x40088e91:0x3ffba1d0 Rebooting... ```
Author
Owner

@IDkonnecT commented on GitHub (Oct 3, 2020):

Same issue ! Still no solution ?

<!-- gh-comment-id:703120846 --> @IDkonnecT commented on GitHub (Oct 3, 2020): Same issue ! Still no solution ?
Author
Owner

@tablatronix commented on GitHub (Oct 3, 2020):

If you are getting issue like this it almost always an esp bug, or you are doing something wrong, or are trying to do stuff in interrupts, or using unsafe memory functions. Try to update your esplib

Without a stack decode trace, I have no idea

<!-- gh-comment-id:703126708 --> @tablatronix commented on GitHub (Oct 3, 2020): If you are getting issue like this it almost always an esp bug, or you are doing something wrong, or are trying to do stuff in interrupts, or using unsafe memory functions. Try to update your esplib Without a stack decode trace, I have no idea
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/WiFiManager#935
No description provided.