[GH-ISSUE #1380] Insecure onDemandAP #1183

Closed
opened 2026-02-28 01:28:54 +03:00 by kerem · 29 comments
Owner

Originally created by @Desat on GitHub (Mar 28, 2022).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1380

First of all: My English is not that good but I'm trying my best.

Basic Infos

Hardware

WiFimanager Branch/Release: Master or 2.0.10-beta

Esp8266/Esp32: ESP32

Hardware: ESP-Wroom-32

Core Version: Espressif 1.0.6

Description

Problem description

Settings in IDE

Module: AZ-Delivery ESP32 Dev Board

Additional libraries: none

Sketch

A slightly modified advanced example version.

#include <WiFiManager.h> // https://github.com/tzapu/WiFiManager
#define TRIGGER_PIN 0

bool wm_nonblocking = true; // change to true to use non blocking
WiFiManager wm; // global wm instance

void setup() {
WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP
Serial.begin(115200);
while(!Serial);
Serial.setDebugOutput(true);
Serial.println("\n Starting");

pinMode(TRIGGER_PIN, INPUT);

// wm.resetSettings(); // wipe settings

if(wm_nonblocking) wm.setConfigPortalBlocking(false);

const char* menu[] = {"wifi","info","param","sep","close","exit","restart","erase"};
wm.setMenu(menu,8);

wm.setClass("invert");

wm.setConfigPortalTimeout(60); // auto close configportal after n seconds
wm.setCaptivePortalEnable(true); // disable captive portal redirection
wm.setAPClientCheck(true); // avoid timeout if client connected to softap

wm.setShowInfoErase(true); // do not show erase button on info page
wm.setScanDispPerc(true); // show RSSI as percentage not graph icons

bool res;
res = wm.autoConnect("AutoConnectAP","password"); // password protected ap

if(!res) {
Serial.println("Failed to connect or hit timeout");
}
else {
Serial.println("connected...yeey :)");
}
}

void checkButton(){
if ( digitalRead(TRIGGER_PIN) == LOW ) {
delay(500);
if( digitalRead(TRIGGER_PIN) == LOW ){
Serial.println("Button Pressed");
delay(3000); // reset delay hold
if( digitalRead(TRIGGER_PIN) == LOW ){
Serial.println("Button Held");
Serial.println("Erasing Config, restarting");
wm.resetSettings();
ESP.restart();
}

  Serial.println("Starting config portal");
  wm.setConfigPortalTimeout(120);
  
  bool res;
  res = wm.startConfigPortal("OnDemandAP","password"); 
  
  if (!res) {
    Serial.println("failed to connect or hit timeout");
    delay(3000);
  } else {
    //if you get here you have connected to the WiFi
    Serial.println("connected...yeey :)");
  }
}

}
}

void loop() {
if(wm_nonblocking) wm.process(); // avoid delays() in loop when non-blocking and other long running code
checkButton();
}
#END


### Debug Messages
none

When I start the "onDemandAP" for the first time after storing the WiFi credentials, it is started with a password query.
If I now let the time-out elapse or log in with a password and then also log off with "Exit", an insecure access without a password query is started when "onDemandAP" is activated again.
Restarting the dev board or leaving it without power does not change the situation, which from the second "onDemandAP" I only create an insecure access.
Do you have an idea or are you not aware of the error yet?
If you need more information about my system, I'll be happy to answer it.
First of all, I just set up my system again a few days ago with the new Arduino IDE and also Visual Studio Code with PlatformIO.
But I also have to say thank you because I finally found a WiFi manager that also saves the credentials.
Two years ago I gave up because I hadn't found anything useful.
Only the " captive portal redirection" on the PC (Opera) is unfortunately not the IP of the AP but the MSN start page.
However , it works perfectly on the mobile phone .

Originally created by @Desat on GitHub (Mar 28, 2022). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1380 First of all: My English is not that good but I'm trying my best. ### Basic Infos #### Hardware WiFimanager Branch/Release: Master or 2.0.10-beta Esp8266/Esp32: ESP32 Hardware: ESP-Wroom-32 Core Version: Espressif 1.0.6 ### Description Problem description ### Settings in IDE Module: AZ-Delivery ESP32 Dev Board Additional libraries: none ### Sketch A slightly modified advanced example version. #include <WiFiManager.h> // https://github.com/tzapu/WiFiManager #define TRIGGER_PIN 0 bool wm_nonblocking = true; // change to true to use non blocking WiFiManager wm; // global wm instance void setup() { WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP Serial.begin(115200); while(!Serial); Serial.setDebugOutput(true); Serial.println("\n Starting"); pinMode(TRIGGER_PIN, INPUT); // wm.resetSettings(); // wipe settings if(wm_nonblocking) wm.setConfigPortalBlocking(false); const char* menu[] = {"wifi","info","param","sep","close","exit","restart","erase"}; wm.setMenu(menu,8); wm.setClass("invert"); wm.setConfigPortalTimeout(60); // auto close configportal after n seconds wm.setCaptivePortalEnable(true); // disable captive portal redirection wm.setAPClientCheck(true); // avoid timeout if client connected to softap wm.setShowInfoErase(true); // do not show erase button on info page wm.setScanDispPerc(true); // show RSSI as percentage not graph icons bool res; res = wm.autoConnect("AutoConnectAP","password"); // password protected ap if(!res) { Serial.println("Failed to connect or hit timeout"); } else { Serial.println("connected...yeey :)"); } } void checkButton(){ if ( digitalRead(TRIGGER_PIN) == LOW ) { delay(500); if( digitalRead(TRIGGER_PIN) == LOW ){ Serial.println("Button Pressed"); delay(3000); // reset delay hold if( digitalRead(TRIGGER_PIN) == LOW ){ Serial.println("Button Held"); Serial.println("Erasing Config, restarting"); wm.resetSettings(); ESP.restart(); } Serial.println("Starting config portal"); wm.setConfigPortalTimeout(120); bool res; res = wm.startConfigPortal("OnDemandAP","password"); if (!res) { Serial.println("failed to connect or hit timeout"); delay(3000); } else { //if you get here you have connected to the WiFi Serial.println("connected...yeey :)"); } } } } void loop() { if(wm_nonblocking) wm.process(); // avoid delays() in loop when non-blocking and other long running code checkButton(); } #END ``` ### Debug Messages none ``` When I start the "onDemandAP" for the first time after storing the WiFi credentials, it is started with a password query. If I now let the time-out elapse or log in with a password and then also log off with "Exit", an insecure access without a password query is started when "onDemandAP" is activated again. Restarting the dev board or leaving it without power does not change the situation, which from the second "onDemandAP" I only create an insecure access. Do you have an idea or are you not aware of the error yet? If you need more information about my system, I'll be happy to answer it. First of all, I just set up my system again a few days ago with the new Arduino IDE and also Visual Studio Code with PlatformIO. But I also have to say thank you because I finally found a WiFi manager that also saves the credentials. Two years ago I gave up because I hadn't found anything useful. Only the " captive portal redirection" on the PC (Opera) is unfortunately not the IP of the AP but the MSN start page. However , it works perfectly on the mobile phone .
kerem 2026-02-28 01:28:54 +03:00
Author
Owner

@tablatronix commented on GitHub (Mar 29, 2022):

WiFi.mode(WiFi_STA); in setup

esp auto starts in ap mode on its own

<!-- gh-comment-id:1081313811 --> @tablatronix commented on GitHub (Mar 29, 2022): WiFi.mode(WiFi_STA); in setup esp auto starts in ap mode on its own
Author
Owner

@Desat commented on GitHub (Mar 29, 2022):

Yes, that's correct, but that's not the problem.
The problem is that if the ESP has no network credentials stored, the ESP starts the "AutoConnectAP" with a secure connection.
Here I now enter my network credentials and it starts as expected in station mode.
If I now request an "onDemandAP" it will also be started as a secure connection with the specified network credentials, in addition to the "station mode".
Up to here everything is as expected.
But if the login timeout expires or I log in "with a password" and then log out via "exit", it still behaves as expected.
However, from now on every further requested "onDemandAP" (even after a reboot of the ESP) will be established with an insecure connection although a secure connection should actually be established.
I, and theoretically anyone who is not authorized to do so, can connect to the ESP "without a password".
Either the ESP is not able to create a secure access again, even after a reboot, or the library has taken the wrong path somewhere.
I hope I was able to explain the problem clearly with my "Google" translated English.

<!-- gh-comment-id:1081908407 --> @Desat commented on GitHub (Mar 29, 2022): Yes, that's correct, but that's not the problem. The problem is that if the ESP has no network credentials stored, the ESP starts the "AutoConnectAP" with a secure connection. Here I now enter my network credentials and it starts as expected in station mode. If I now request an "onDemandAP" it will also be started as a secure connection with the specified network credentials, in addition to the "station mode". Up to here everything is as expected. But if the login timeout expires or I log in "with a password" and then log out via "exit", it still behaves as expected. However, from now on every further requested "onDemandAP" (even after a reboot of the ESP) will be established with an insecure connection although a secure connection should actually be established. I, and theoretically anyone who is not authorized to do so, can connect to the ESP "without a password". Either the ESP is not able to create a secure access again, even after a reboot, or the library has taken the wrong path somewhere. I hope I was able to explain the problem clearly with my "Google" translated English.
Author
Owner

@tablatronix commented on GitHub (Mar 29, 2022):

Are you sure your device is not just saving the password and resusing it again? Like osx does

wm.startConfigPortal("OnDemandAP","12345678")
should always be wpa2

<!-- gh-comment-id:1081945847 --> @tablatronix commented on GitHub (Mar 29, 2022): Are you sure your device is not just saving the password and resusing it again? Like osx does wm.startConfigPortal("OnDemandAP","12345678") should always be wpa2
Author
Owner

@tablatronix commented on GitHub (Mar 29, 2022):

can you show screenshots or a video, I do not understand exactly

<!-- gh-comment-id:1081952911 --> @tablatronix commented on GitHub (Mar 29, 2022): can you show screenshots or a video, I do not understand exactly
Author
Owner

@Desat commented on GitHub (Mar 29, 2022):

Yes i am sure. :) my devices show the wifi icon without the small lock icon. also i remove the known ESP AP networks before testing.
At the first onDemandAP it is WPA2 but all following onDemandAP are without security. i can make a screenshot from the network scan on my mobile phone where you can see that the wifi icon has no lock icon. But i see you have the same problem. the first onDemandAP is secure btw ;) Do you still need the screenshots?

<!-- gh-comment-id:1081961587 --> @Desat commented on GitHub (Mar 29, 2022): Yes i am sure. :) my devices show the wifi icon without the small lock icon. also i remove the known ESP AP networks before testing. At the first onDemandAP it is WPA2 but all following onDemandAP are without security. i can make a screenshot from the network scan on my mobile phone where you can see that the wifi icon has no lock icon. But i see you have the same problem. the first onDemandAP is secure btw ;) Do you still need the screenshots?
Author
Owner

@tablatronix commented on GitHub (Mar 29, 2022):

I do not reproduce, that was a mistake, I forgot I was starting that one anonymous in my test.

When you say the following? What do you mean?

Like if I press a button and do wm.startConfigPortal("OnDemandAP","12345678")
everytime I press it its the same..

Have you done a full erase? Have you made sure you are setting wifi mode to sta only in your code?

<!-- gh-comment-id:1082198528 --> @tablatronix commented on GitHub (Mar 29, 2022): I do not reproduce, that was a mistake, I forgot I was starting that one anonymous in my test. When you say the following? What do you mean? Like if I press a button and do wm.startConfigPortal("OnDemandAP","12345678") everytime I press it its the same.. Have you done a full erase? Have you made sure you are setting wifi mode to sta only in your code?
Author
Owner

@Desat commented on GitHub (Mar 29, 2022):

its the original WiFiManager-2.0.10-beta library with the original example "Advanced". but i see now the "AutoConnectAP" makes an insecure wifi network. i hope i have another unused ESP32 board at home. My test outside the WiFiManager works fine with "onDemandAP". on off on off all times no problem.

<!-- gh-comment-id:1082220632 --> @Desat commented on GitHub (Mar 29, 2022): its the original WiFiManager-2.0.10-beta library with the original example "Advanced". but i see now the "AutoConnectAP" makes an insecure wifi network. i hope i have another unused ESP32 board at home. My test outside the WiFiManager works fine with "onDemandAP". on off on off all times no problem.
Author
Owner

@tablatronix commented on GitHub (Mar 29, 2022):

hmm
advanced.ino
res = wm.autoConnect("AutoConnectAP","password"); // password protected ap

<!-- gh-comment-id:1082242481 --> @tablatronix commented on GitHub (Mar 29, 2022): hmm advanced.ino res = wm.autoConnect("AutoConnectAP","password"); // password protected ap
Author
Owner

@Desat commented on GitHub (Mar 29, 2022):

I know, but I have no idea how to erase all potentially corrupted data from the ESP. You can hardly find reasonable Wifi managers or explanations in my language and the English help has rarely been successful in realizing my actual project.
Unfortunately, I can no longer use the WiFi manager for myself, which does not necessarily have to be due to the library. I would search the library myself for the error, but unfortunately my knowledge is too weak and the library too "powerful". But otherwise a very strong tool if the hardware plays along. Thumbs up for all the work that went into it. But I'll leave it at that and don't want to keep other important projects from happening. Keep it up and maybe I'll try it again with different hardware.

<!-- gh-comment-id:1082255149 --> @Desat commented on GitHub (Mar 29, 2022): I know, but I have no idea how to erase all potentially corrupted data from the ESP. You can hardly find reasonable Wifi managers or explanations in my language and the English help has rarely been successful in realizing my actual project. Unfortunately, I can no longer use the WiFi manager for myself, which does not necessarily have to be due to the library. I would search the library myself for the error, but unfortunately my knowledge is too weak and the library too "powerful". But otherwise a very strong tool if the hardware plays along. Thumbs up for all the work that went into it. But I'll leave it at that and don't want to keep other important projects from happening. Keep it up and maybe I'll try it again with different hardware.
Author
Owner

@tablatronix commented on GitHub (Mar 29, 2022):

Ok I might be seeing the same issue, let me keep testing.

<!-- gh-comment-id:1082255655 --> @tablatronix commented on GitHub (Mar 29, 2022): Ok I might be seeing the same issue, let me keep testing.
Author
Owner

@tablatronix commented on GitHub (Mar 29, 2022):

This seems to be something in the ESP lib, and unknown bug, maybe corrupt memory, I will keep testing for a workaround.
I tried another esp and its fine, so its a strange issue.

E][WiFiAP.cpp:128] softAP(): WIFI_AUTH_WPA2_PSK
*wm:[1] SoftAP Configuration 
*wm:[1] -------------------- 
*wm:[1] ssid:             OnDemandAP
*wm:[1] password:         12345678
*wm:[1] ssid_len:         10
*wm:[1] channel:          1
*wm:[1] authmode:         3
*wm:[1] ssid_hidden:     
*wm:[1] max_connection:   4
*wm:[1] country:          CN �?
*wm:[1] beacon_interval:  100(ms)
*wm:[1] -------------------- 
*wm:[1] AP IP address: 192.168.4.1
<!-- gh-comment-id:1082317763 --> @tablatronix commented on GitHub (Mar 29, 2022): This seems to be something in the ESP lib, and unknown bug, maybe corrupt memory, I will keep testing for a workaround. I tried another esp and its fine, so its a strange issue. ``` E][WiFiAP.cpp:128] softAP(): WIFI_AUTH_WPA2_PSK *wm:[1] SoftAP Configuration *wm:[1] -------------------- *wm:[1] ssid: OnDemandAP *wm:[1] password: 12345678 *wm:[1] ssid_len: 10 *wm:[1] channel: 1 *wm:[1] authmode: 3 *wm:[1] ssid_hidden: *wm:[1] max_connection: 4 *wm:[1] country: CN �? *wm:[1] beacon_interval: 100(ms) *wm:[1] -------------------- *wm:[1] AP IP address: 192.168.4.1 ```
Author
Owner

@Desat commented on GitHub (Mar 29, 2022):

i have tested several times with the following code:
The code snippets were taken from "Wifi-Manager Library".

The "onDemandAP" build alway a secure wifi connection.
I think an error in the ESP32 Lib could be ruled out with this.
But my knowledge of the ESP32 is at lower level.

#include <WiFi.h>
#include <esp_wifi.h>
#define TRIGGER_PIN 0

wifi_config_t conf;

char* _SSID;
char* _PASSWORD;

void setup() {
  pinMode(TRIGGER_PIN, INPUT);
  Serial.begin(115200);
  while(!Serial);
  Serial.setDebugOutput(true);
  Serial.println("\n Starting");

  WiFi.mode(WIFI_STA);
  WiFi.persistent(false);
  WiFi.begin();
  
  esp_wifi_get_config(WIFI_IF_STA, &conf);

  Serial.println("SSID: " + (String)reinterpret_cast<char*>(conf.sta.ssid));
}

void checkButton() {
 int startTime = millis();
  int endTime = startTime;

  while(digitalRead(TRIGGER_PIN) == LOW ) {
    if(millis() % 1000 == 0) Serial.print(".");
    endTime = millis();
  }
  
  if(endTime > startTime) {
    Serial.println("-");
    int buttonPressedTime = endTime-startTime;
    Serial.println("Button Pressed");

    if( buttonPressedTime >= 50 && buttonPressedTime < 500) {
      _SSID = "LOCAL_WIFI_NETWORK";
      _PASSWORD = "LOCAL_WIFI_PASSWORD";
      Serial.println("Create Access");
      setAccess(_SSID, _PASSWORD);
    }

    if( buttonPressedTime >= 500 && buttonPressedTime < 3000) {
      Serial.println("Starting AccessPoint");

      String _apName = "onDemandAP";
      String _apPassword = "password";
      int channel = 0;
      
      IPAddress _ap_static_ip(192,168,4,1);
      IPAddress _ap_static_gw(192,168,4,1);
      IPAddress _ap_static_sn(255,255,255,0);
  
      WiFi.softAPConfig(_ap_static_ip, _ap_static_gw, _ap_static_sn);
      WiFi.softAP(_apName.c_str(), _apPassword.c_str(),channel);
    }

    if( buttonPressedTime >= 3000 && buttonPressedTime < 6000) {
      Serial.println("Stop AccessPoint");
      WiFi.softAPdisconnect(true);
    }

    if( buttonPressedTime >= 6000 && buttonPressedTime < 9000) {
      Serial.println("Deactivate WLAN");
      WiFi.disconnect();
    }

    if( buttonPressedTime >= 9000 && buttonPressedTime < 12000) {
      Serial.println("Activate WLAN");
      WiFi.begin(reinterpret_cast<char*>(conf.sta.ssid), reinterpret_cast<char*>(conf.sta.password));
    }
  }
}

void setAccess(char const *_ssid, const char *_password) {
   WiFi.begin(_ssid, _password);
}

void loop() {
  // put your main code here, to run repeatedly:
  checkButton();
}
<!-- gh-comment-id:1082343268 --> @Desat commented on GitHub (Mar 29, 2022): i have tested several times with the following code: The code snippets were taken from "Wifi-Manager Library". The "onDemandAP" build alway a secure wifi connection. I think an error in the ESP32 Lib could be ruled out with this. But my knowledge of the ESP32 is at lower level. ```C++ #include <WiFi.h> #include <esp_wifi.h> #define TRIGGER_PIN 0 wifi_config_t conf; char* _SSID; char* _PASSWORD; void setup() { pinMode(TRIGGER_PIN, INPUT); Serial.begin(115200); while(!Serial); Serial.setDebugOutput(true); Serial.println("\n Starting"); WiFi.mode(WIFI_STA); WiFi.persistent(false); WiFi.begin(); esp_wifi_get_config(WIFI_IF_STA, &conf); Serial.println("SSID: " + (String)reinterpret_cast<char*>(conf.sta.ssid)); } void checkButton() { int startTime = millis(); int endTime = startTime; while(digitalRead(TRIGGER_PIN) == LOW ) { if(millis() % 1000 == 0) Serial.print("."); endTime = millis(); } if(endTime > startTime) { Serial.println("-"); int buttonPressedTime = endTime-startTime; Serial.println("Button Pressed"); if( buttonPressedTime >= 50 && buttonPressedTime < 500) { _SSID = "LOCAL_WIFI_NETWORK"; _PASSWORD = "LOCAL_WIFI_PASSWORD"; Serial.println("Create Access"); setAccess(_SSID, _PASSWORD); } if( buttonPressedTime >= 500 && buttonPressedTime < 3000) { Serial.println("Starting AccessPoint"); String _apName = "onDemandAP"; String _apPassword = "password"; int channel = 0; IPAddress _ap_static_ip(192,168,4,1); IPAddress _ap_static_gw(192,168,4,1); IPAddress _ap_static_sn(255,255,255,0); WiFi.softAPConfig(_ap_static_ip, _ap_static_gw, _ap_static_sn); WiFi.softAP(_apName.c_str(), _apPassword.c_str(),channel); } if( buttonPressedTime >= 3000 && buttonPressedTime < 6000) { Serial.println("Stop AccessPoint"); WiFi.softAPdisconnect(true); } if( buttonPressedTime >= 6000 && buttonPressedTime < 9000) { Serial.println("Deactivate WLAN"); WiFi.disconnect(); } if( buttonPressedTime >= 9000 && buttonPressedTime < 12000) { Serial.println("Activate WLAN"); WiFi.begin(reinterpret_cast<char*>(conf.sta.ssid), reinterpret_cast<char*>(conf.sta.password)); } } } void setAccess(char const *_ssid, const char *_password) { WiFi.begin(_ssid, _password); } void loop() { // put your main code here, to run repeatedly: checkButton(); } ```
Author
Owner

@tablatronix commented on GitHub (Mar 29, 2022):

you will want to be checking the return of WiFi.softAP()
should be boolean true on success or false,

same for softAPdisconnect

<!-- gh-comment-id:1082388089 --> @tablatronix commented on GitHub (Mar 29, 2022): you will want to be checking the return of WiFi.softAP() should be boolean true on success or false, same for softAPdisconnect
Author
Owner

@Desat commented on GitHub (Mar 29, 2022):

yes of cours but i check it with network scan on my mobile phone. The softAPdisconnect return value is every time false.
if have now added the Wifi.getMode() before and after the softAPdisconnect. Before the value is 3 (WIFI_MODE_APSTA) after the value is 1 (WIFI_MODE_STA) . everything as expected.
You could actually use it as feedback for "startConfigPortal", right? As far as I've read and I remember correctly, the return value there is always false, I think.

<!-- gh-comment-id:1082418166 --> @Desat commented on GitHub (Mar 29, 2022): yes of cours but i check it with network scan on my mobile phone. The softAPdisconnect return value is every time false. if have now added the Wifi.getMode() before and after the softAPdisconnect. Before the value is 3 (WIFI_MODE_APSTA) after the value is 1 (WIFI_MODE_STA) . everything as expected. You could actually use it as feedback for "startConfigPortal", right? As far as I've read and I remember correctly, the return value there is always false, I think.
Author
Owner

@tablatronix commented on GitHub (Mar 30, 2022):

Yeah softapdisconnect fails alot not sure why

image

<!-- gh-comment-id:1082501231 --> @tablatronix commented on GitHub (Mar 30, 2022): Yeah softapdisconnect fails alot not sure why ![image](https://user-images.githubusercontent.com/807787/160728549-0149b385-3b2a-4afd-99c6-f00f29d240a6.png)
Author
Owner

@tablatronix commented on GitHub (Mar 30, 2022):

still debugging, are you calling resetsettings at all? It seems to be hit or miss here, let me try your code

<!-- gh-comment-id:1082514038 --> @tablatronix commented on GitHub (Mar 30, 2022): still debugging, are you calling resetsettings at all? It seems to be hit or miss here, let me try your code
Author
Owner

@Desat commented on GitHub (Mar 30, 2022):

Did you mean "erase" in config portal?
If so, yes several times.

Which kind of code? My last code that i posted yesterday? But with the return value from "softApdisconnect" and the AP start command?

<!-- gh-comment-id:1082996570 --> @Desat commented on GitHub (Mar 30, 2022): Did you mean "erase" in config portal? If so, yes several times. Which kind of code? My last code that i posted yesterday? But with the return value from "softApdisconnect" and the AP start command?
Author
Owner

@tablatronix commented on GitHub (Mar 30, 2022):

I am just trying to find what can cause this, I can reproduce very rarely in my own code, and never in your example.
I am on 1.0.6 also

Ill keep testing

<!-- gh-comment-id:1083104348 --> @tablatronix commented on GitHub (Mar 30, 2022): I am just trying to find what can cause this, I can reproduce very rarely in my own code, and never in your example. I am on 1.0.6 also Ill keep testing
Author
Owner

@Desat commented on GitHub (Mar 30, 2022):

I have now installed the ESP32 Core Version 2.0.2. There, the "onDemandAP" seems to always work securely now (tested 4 times first). The error message "[ERROR] disconnect configportal - softAPdisconnect FAILED" when exiting the softAP has also disappeared.
just the part
if (!wm.startConfigPortal("OnDemandAP","password")) {
Serial.println("failed to connect or hit timeout");
still seems to just return False. But it can also be because of "bool wm_nonblocking = true; ".

I will continue to test the secure access point.

Maybe it's because of this highlighted original ESP32 library code


Extract Core1.0.6 WiFiAP.cpp Line 196
`
bool WiFiAPClass::softAPdisconnect(bool wifioff)
{
bool ret;
wifi_config_tconf;

if(WiFiGenericClass::getMode() == WIFI_MODE_NULL){
    return false;
}

**
*conf.ap.ssid = 0;
*conf.ap.password = 0;
conf.ap.authmode = WIFI_AUTH_OPEN; // auth must be open if pass=0
ret = esp_wifi_set_config(WIFI_IF_AP, &conf) == ESP_OK;
**

if(wifioff) {
    ret = WiFi.enableAP(false) == ESP_OK;
}

return ret;

}
`

Extract Core 2.0.2 WiFi.cpp Line 213
`
bool WiFiAPClass::softAPdisconnect(bool wifioff)
{
bool ret;
wifi_config_tconf;
wifi_softap_config(&conf);

if(WiFiGenericClass::getMode() == WIFI_MODE_NULL){
    return false;
}

**ret = esp_wifi_set_config((wifi_interface_t)WIFI_IF_AP, &conf) == ESP_OK;**

if(ret && wifioff) {
    ret = WiFi.enableAP(false) == ESP_OK;
}

return ret;

} `

<!-- gh-comment-id:1083259783 --> @Desat commented on GitHub (Mar 30, 2022): I have now installed the ESP32 Core Version 2.0.2. There, the "onDemandAP" seems to always work securely now (tested 4 times first). The error message "[ERROR] disconnect configportal - softAPdisconnect FAILED" when exiting the softAP has also disappeared. just the part if (!wm.startConfigPortal("OnDemandAP","password")) { Serial.println("failed to connect or hit timeout"); still seems to just return False. But it can also be because of "bool wm_nonblocking = true; ". I will continue to test the secure access point. Maybe it's because of this highlighted original ESP32 library code -------------------------------------------------- ------------------------------------------------ Extract Core1.0.6 WiFiAP.cpp Line 196 ` bool WiFiAPClass::softAPdisconnect(bool wifioff) { bool ret; wifi_config_tconf; if(WiFiGenericClass::getMode() == WIFI_MODE_NULL){ return false; } ** *conf.ap.ssid = 0; *conf.ap.password = 0; conf.ap.authmode = WIFI_AUTH_OPEN; // auth must be open if pass=0 ret = esp_wifi_set_config(WIFI_IF_AP, &conf) == ESP_OK; ** if(wifioff) { ret = WiFi.enableAP(false) == ESP_OK; } return ret; } ` Extract Core 2.0.2 WiFi.cpp Line 213 ` bool WiFiAPClass::softAPdisconnect(bool wifioff) { bool ret; wifi_config_tconf; wifi_softap_config(&conf); if(WiFiGenericClass::getMode() == WIFI_MODE_NULL){ return false; } **ret = esp_wifi_set_config((wifi_interface_t)WIFI_IF_AP, &conf) == ESP_OK;** if(ret && wifioff) { ret = WiFi.enableAP(false) == ESP_OK; } return ret; } `
Author
Owner

@tablatronix commented on GitHub (Mar 30, 2022):

That is where I have been debugging, I think the issue is in the sdk inside esp_wifi_set_config, because everything passes.
If i had to guess Its a race condition, with enableap/setconfig , I would bet adding a delay somewhere would fix this..

Also theres this..
authmode appears to be blank in config, So I am not about to debug dumping the flash memory to test this more especially if its fixed in 2.0

Screen Shot 2022-03-29 at 1 45 13 PM

<!-- gh-comment-id:1083442483 --> @tablatronix commented on GitHub (Mar 30, 2022): That is where I have been debugging, I think the issue is in the sdk inside esp_wifi_set_config, because everything passes. If i had to guess Its a race condition, with enableap/setconfig , I would bet adding a delay somewhere would fix this.. Also theres this.. authmode appears to be blank in config, So I am not about to debug dumping the flash memory to test this more especially if its fixed in 2.0 ![Screen Shot 2022-03-29 at 1 45 13 PM](https://user-images.githubusercontent.com/807787/160901063-9438a8c2-d684-4ea0-961a-bf9c45f8ef34.png)
Author
Owner

@Desat commented on GitHub (Mar 30, 2022):

in the core 2.0.2 of the esp32 the problem doesn't exist anymore, so it's ok for me.
Of course there could be another error in Core 2.0.2, namely that the station mode logs off after about 7 minutes because of "Reason: 2 - AUTH_EXPIRE" but that wasn't the real problem and I think everyone can live with that .
The auto mode also has a small problem when connecting, but by and large at least the security of the "onDemandAP" works with the core 2.0.2.
But since my knowledge is not yet big enough to confirm that, it's just a guess on my part ;)

<!-- gh-comment-id:1083454946 --> @Desat commented on GitHub (Mar 30, 2022): in the core 2.0.2 of the esp32 the problem doesn't exist anymore, so it's ok for me. Of course there could be another error in Core 2.0.2, namely that the station mode logs off after about 7 minutes because of "Reason: 2 - AUTH_EXPIRE" but that wasn't the real problem and I think everyone can live with that . The auto mode also has a small problem when connecting, but by and large at least the security of the "onDemandAP" works with the core 2.0.2. But since my knowledge is not yet big enough to confirm that, it's just a guess on my part ;)
Author
Owner

@tablatronix commented on GitHub (Mar 30, 2022):

Yeah I will note this to espressif only because its a major issue, so ill log all my info and bin and report it.

I have not heard of the auth expire, only the reboot auth fail/expire issue

<!-- gh-comment-id:1083458199 --> @tablatronix commented on GitHub (Mar 30, 2022): Yeah I will note this to espressif only because its a major issue, so ill log all my info and bin and report it. I have not heard of the auth expire, only the reboot auth fail/expire issue
Author
Owner

@tablatronix commented on GitHub (Mar 30, 2022):

https://github.com/espressif/arduino-esp32/issues/5038

<!-- gh-comment-id:1083466446 --> @tablatronix commented on GitHub (Mar 30, 2022): https://github.com/espressif/arduino-esp32/issues/5038
Author
Owner

@Desat commented on GitHub (Mar 30, 2022):

this is also new in core 2.0.2
every second boot of the esp32 in unable to connect in station mode (see timestamp 20:16:50.605)

20:16:38.627 -> ets Jun  8 2016 00:22:57
20:16:38.627 -> 
20:16:38.627 -> rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
20:16:38.673 -> configsip: 0, SPIWP:0xee
20:16:38.673 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
20:16:38.673 -> mode:DIO, clock div:1
20:16:38.673 -> load:0x3fff0030,len:1324
20:16:38.673 -> ho 0 tail 12 room 4
20:16:38.673 -> load:0x40078000,len:13508
20:16:38.673 -> load:0x40080400,len:3604
20:16:38.673 -> entry 0x400805f0
20:16:38.906 -> [2-hal-cpu.c:211] setCpuFrequencyMhz(): PLL: 480 / 2 = 240 Mhz, APB: 80000000 Hz
20:16:38.953 -> 
20:16:38.953 ->  Starting
20:16:39.000 -> [    57][D][WiFiGeneric.cpp:831] _eventCallback(): Arduino Event: 0 - WIFI_READY
20:16:39.095 -> [   149][V][WiFiGeneric.cpp:272] _arduino_event_cb(): STA Started
20:16:39.095 -> [   149][D][WiFiGeneric.cpp:831] _eventCallback(): Arduino Event: 2 - STA_START
20:16:41.086 -> *wm:[1] AutoConnect 
20:16:41.086 -> *wm:[2] ESP32 event handler enabled 
20:16:41.086 -> *wm:[2] Connecting as wifi client... 
20:16:41.086 -> *wm:[2] setSTAConfig static ip not set, skipping 
20:16:41.086 -> *wm:[1] Connecting to SAVED AP: Desat-Wifi
20:16:41.596 -> [  2661][V][WiFiGeneric.cpp:96] set_esp_interface_ip(): Configuring Station static IP: 0.0.0.0, MASK: 0.0.0.0, GW: 0.0.0.0
20:16:41.596 -> *wm:[2] 20000 ms timeout, waiting for connect...
20:16:41.596 -> *wm:[2] . 
20:16:41.689 -> *wm:[2] . 
20:16:41.781 -> *wm:[2] . 
20:16:41.872 -> *wm:[2] . 
20:16:42.011 -> *wm:[2] . 
20:16:42.104 -> *wm:[2] . 
20:16:42.197 -> *wm:[2] . 
20:16:42.291 -> *wm:[2] . 
20:16:42.384 -> *wm:[2] . 
20:16:42.475 -> *wm:[2] . 
20:16:42.571 -> *wm:[2] . 
20:16:42.710 -> *wm:[2] . 
20:16:42.802 -> *wm:[2] . 
20:16:42.896 -> *wm:[2] . 
20:16:42.989 -> *wm:[2] . 
20:16:43.082 -> *wm:[2] . 
20:16:43.173 -> *wm:[2] . 
20:16:43.312 -> *wm:[2] . 
20:16:43.406 -> *wm:[2] . 
20:16:43.497 -> *wm:[2] . 
20:16:43.590 -> *wm:[2] . 
20:16:43.683 -> [  4764][V][WiFiGeneric.cpp:284] _arduino_event_cb(): STA Connected: SSID: Desat-Wifi, BSSID: 2c:3a:fd:a3:38:af, Channel: 6, Auth: UNKNOWN
20:16:43.683 -> [  4765][D][WiFiGeneric.cpp:831] _eventCallback(): Arduino Event: 4 - STA_CONNECTED
20:16:43.683 -> *wm:[  4780][V][WiFiGeneric.cpp:294] _arduino_event_cb(): STA Got New IP:192.168.178.40
20:16:43.728 -> [2] .[  4783][D][WiFiGeneric.cpp:831] _eventCallback(): Arduino Event: 7 - STA_GOT_IP
20:16:43.728 -> [  4788][D][WiFiGeneric.cpp:880] _eventCallback(): STA IP: 192.168.178.40, MASK: 255.255.255.0, GW: 192.168.178.1
20:16:43.728 ->  
20:16:43.821 -> *wm:[2] Connection result: WL_CONNECTED
20:16:43.821 -> *wm:[1] AutoConnect: SUCCESS 
20:16:43.821 -> *wm:[2] Connected in 2759 ms
20:16:43.821 -> *wm:[1] STA IP Address: 192.168.178.40
20:16:43.821 -> connected...yeey :)
20:16:45.588 -> ets Jun  8 2016 00:22:57
20:16:45.634 -> 
20:16:45.634 -> rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
20:16:45.634 -> configsip: 0, SPIWP:0xee
20:16:45.634 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
20:16:45.634 -> mode:DIO, clock div:1
20:16:45.634 -> load:0x3fff0030,len:1324
20:16:45.634 -> ho 0 tail 12 room 4
20:16:45.634 -> load:0x40078000,len:13508
20:16:45.634 -> load:0x40080400,len:3604
20:16:45.634 -> entry 0x400805f0
20:16:45.866 -> [2-hal-cpu.c:211] setCpuFrequencyMhz(): PLL: 480 / 2 = 240 Mhz, APB: 80000000 Hz
20:16:45.912 -> 
20:16:45.912 ->  Starting
20:16:45.959 -> [    58][D][WiFiGeneric.cpp:831] _eventCallback(): Arduino Event: 0 - WIFI_READY
20:16:46.053 -> [   148][V][WiFiGeneric.cpp:272] _arduino_event_cb(): STA Started
20:16:46.053 -> [   148][D][WiFiGeneric.cpp:831] _eventCallback(): Arduino Event: 2 - STA_START
20:16:48.051 -> *wm:[1] AutoConnect 
20:16:48.051 -> *wm:[2] ESP32 event handler enabled 
20:16:48.051 -> *wm:[2] Connecting as wifi client... 
20:16:48.051 -> *wm:[2] setSTAConfig static ip not set, skipping 
20:16:48.051 -> *wm:[1] Connecting to SAVED AP: Desat-Wifi
20:16:48.562 -> [  2660][V][WiFiGeneric.cpp:96] set_esp_interface_ip(): Configuring Station static IP: 0.0.0.0, MASK: 0.0.0.0, GW: 0.0.0.0
20:16:48.562 -> *wm:[2] 20000 ms timeout, waiting for connect...
20:16:48.562 -> *wm:[2] . 
20:16:48.655 -> *wm:[2] . 
20:16:48.747 -> *wm:[2] . 
20:16:48.841 -> *wm:[2] . 
20:16:48.980 -> *wm:[2] . 
20:16:49.075 -> *wm:[2] . 
20:16:49.167 -> *wm:[2] . 
20:16:49.258 -> *wm:[2] . 
20:16:49.353 -> *wm:[2] . 
20:16:49.445 -> *wm:[2] . 
20:16:49.538 -> *wm:[2] . 
20:16:49.674 -> *wm:[2] . 
20:16:49.766 -> *wm:[2] . 
20:16:49.860 -> *wm:[2] . 
20:16:49.952 -> *wm:[2] . 
20:16:50.047 -> *wm:[2] . 
20:16:50.139 -> *wm:[2] . 
20:16:50.279 -> *wm:[2] . 
20:16:50.372 -> *wm:[2] . 
20:16:50.465 -> *wm:[2] . 
20:16:50.559 -> *wm:[2] . 
20:16:50.605 -> E (9643) wifi:Association refused temporarily, comeback time 1024 mSec
20:16:50.651 -> *wm:[2] . 
20:16:50.743 -> *wm:[2] . 
20:16:50.838 -> *wm:[2] . 
20:16:50.976 -> *wm:[2] . 
20:16:51.068 -> *wm:[2] . 
20:16:51.162 -> *wm:[2] . 
20:16:51.253 -> *wm:[2] . 
20:16:51.346 -> *wm:[2] . 
20:16:51.438 -> *wm:[2] . 
20:16:51.577 -> *wm:[2] . 
20:16:51.670 -> *wm:[2] . 
20:16:51.764 -> *wm:[2] . 
20:16:51.857 -> *wm:[2] . 
20:16:51.949 -> *wm:[2] . 
20:16:52.041 -> *wm:[2] . 
20:16:52.179 -> *wm:[2] . 
20:16:52.272 -> *wm:[2] . 
20:16:52.364 -> *wm:[2] . 
20:16:52.457 -> *wm:[2] . 
20:16:52.551 -> *wm:[2] . 
20:16:52.644 -> [  6756][V][WiFiGeneric.cpp:289] _arduino_event_cb(): STA Disconnected: SSID: Desat-Wifi, BSSID: 2c:3a:fd:a3:38:af, Reason: 203
20:16:52.644 -> [  6756][D][WiFiGeneric.cpp:831] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED
20:16:52.644 -> [  6764][W][WiFiGeneric.cpp:852] _eventCallback(): Reason: 203 - ASSOC_FAIL
20:16:52.690 -> [  6772][V][WiFiGeneric.cpp:96] set_esp_interface_ip(): Configuring Station static IP: 0.0.0.0, MASK: 0.0.0.0, GW: 0.0.0.0
20:16:52.690 -> *wm:*wm:[2] [EVENT] WIFI_REASON:  203
20:16:52.690 -> *wm:[2] [EVENT] WIFI_REASON: AUTH FAIL 
20:16:52.690 -> [2] Connection result: WL_CONNECT_FAILED
20:16:52.690 -> *wm:[1] AutoConnect: FAILED 
20:16:52.690 -> *wm:[2] Starting Config Portal 
20:16:52.690 -> *wm:[2] AccessPoint set password is VALID 
20:16:52.690 -> [  6803][V][WiFiGeneric.cpp:275] _arduino_event_cb(): STA Stopped
20:16:52.690 -> *wm:[  6807][D][WiFiGeneric.cpp:831] _eventCallback(): Arduino Event: 3 - STA_STOP
20:16:52.690 -> [2] Disabling STA 
20:16:52.736 -> *wm:[2] Enabling AP 
20:16:52.736 -> *wm:[1] StartAP with SSID:  AutoConnectAP
20:16:52.736 -> [  6846][D][WiFiGeneric.cpp:831] _eventCallback(): Arduino Event: 0 - WIFI_READY
20:16:52.736 -> [  6852][V][WiFiGeneric.cpp:314] _arduino_event_cb(): AP Started
20:16:52.736 -> [  6852][D][WiFiGeneric.cpp:831] _eventCallback(): Arduino Event: 10 - AP_START
20:16:53.246 -> *wm:[1] AP IP address: 192.168.4.1
20:16:53.246 -> *wm:[1] Starting Web Portal 
20:16:53.246 -> [  7352][V][WiFiServer.h:42] WiFiServer(): WiFiServer::WiFiServer(port=80, ...)
20:16:53.246 -> [  7354][V][WebServer.cpp:85] WebServer(): WebServer::Webserver(port=80)
20:16:53.246 -> *wm:[2] HTTP server started 
20:16:53.246 -> *wm:[2] Config Portal Running, non blocking/processing 
20:16:53.246 -> *wm:[2] Portal Timeout In 60 seconds
20:16:53.246 -> Failed to connect or hit timeout
20:17:15.905 -> *wm:[2] Portal Timeout In 36 seconds
20:17:45.877 -> *wm:[2] Portal Timeout In 6 seconds
20:17:52.699 -> *wm:[1] config portal has timed out 
20:17:52.699 -> *wm:[2] shutdownConfigPortal 
20:17:52.699 -> [ 66832][V][WiFiGeneric.cpp:317] _arduino_event_cb(): AP Stopped
20:17:52.747 -> [ 66832][D][WiFiGeneric.cpp:831] _eventCallback(): Arduino Event: 11 - AP_STOP
20:17:52.747 -> *wm:[2] restoring usermode STA
20:17:52.747 -> [ 66836][V][WiFiGeneric.cpp:314] _arduino_event_cb(): AP Started
20:17:52.747 -> [ 66847][D][WiFiGeneric.cpp:831] _eventCallback(): Arduino Event: 10 - AP_START
20:17:53.718 -> [ 67847][V][WiFiGeneric.cpp:317] _arduino_event_cb(): AP Stopped
20:17:53.718 -> [ 67847][D][WiFiGeneric.cpp:831] _eventCallback(): Arduino Event: 11 - AP_STOP
20:17:53.765 -> [ 67848][V][WiFiGeneric.cpp:272] _arduino_event_cb(): STA Started
20:17:53.765 -> *wm:[ 67855][D][WiFiGeneric.cpp:831] _eventCallback(): Arduino Event: 2 - STA_START
20:17:53.765 -> [2] wifi status: Unknown
20:17:53.765 -> *wm:[2] wifi mode: STA
20:17:53.765 -> *wm:[2] configportal closed 
<!-- gh-comment-id:1083466595 --> @Desat commented on GitHub (Mar 30, 2022): this is also new in core 2.0.2 every second boot of the esp32 in unable to connect in station mode (see timestamp 20:16:50.605) ```php 20:16:38.627 -> ets Jun 8 2016 00:22:57 20:16:38.627 -> 20:16:38.627 -> rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) 20:16:38.673 -> configsip: 0, SPIWP:0xee 20:16:38.673 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 20:16:38.673 -> mode:DIO, clock div:1 20:16:38.673 -> load:0x3fff0030,len:1324 20:16:38.673 -> ho 0 tail 12 room 4 20:16:38.673 -> load:0x40078000,len:13508 20:16:38.673 -> load:0x40080400,len:3604 20:16:38.673 -> entry 0x400805f0 20:16:38.906 -> [2-hal-cpu.c:211] setCpuFrequencyMhz(): PLL: 480 / 2 = 240 Mhz, APB: 80000000 Hz 20:16:38.953 -> 20:16:38.953 -> Starting 20:16:39.000 -> [ 57][D][WiFiGeneric.cpp:831] _eventCallback(): Arduino Event: 0 - WIFI_READY 20:16:39.095 -> [ 149][V][WiFiGeneric.cpp:272] _arduino_event_cb(): STA Started 20:16:39.095 -> [ 149][D][WiFiGeneric.cpp:831] _eventCallback(): Arduino Event: 2 - STA_START 20:16:41.086 -> *wm:[1] AutoConnect 20:16:41.086 -> *wm:[2] ESP32 event handler enabled 20:16:41.086 -> *wm:[2] Connecting as wifi client... 20:16:41.086 -> *wm:[2] setSTAConfig static ip not set, skipping 20:16:41.086 -> *wm:[1] Connecting to SAVED AP: Desat-Wifi 20:16:41.596 -> [ 2661][V][WiFiGeneric.cpp:96] set_esp_interface_ip(): Configuring Station static IP: 0.0.0.0, MASK: 0.0.0.0, GW: 0.0.0.0 20:16:41.596 -> *wm:[2] 20000 ms timeout, waiting for connect... 20:16:41.596 -> *wm:[2] . 20:16:41.689 -> *wm:[2] . 20:16:41.781 -> *wm:[2] . 20:16:41.872 -> *wm:[2] . 20:16:42.011 -> *wm:[2] . 20:16:42.104 -> *wm:[2] . 20:16:42.197 -> *wm:[2] . 20:16:42.291 -> *wm:[2] . 20:16:42.384 -> *wm:[2] . 20:16:42.475 -> *wm:[2] . 20:16:42.571 -> *wm:[2] . 20:16:42.710 -> *wm:[2] . 20:16:42.802 -> *wm:[2] . 20:16:42.896 -> *wm:[2] . 20:16:42.989 -> *wm:[2] . 20:16:43.082 -> *wm:[2] . 20:16:43.173 -> *wm:[2] . 20:16:43.312 -> *wm:[2] . 20:16:43.406 -> *wm:[2] . 20:16:43.497 -> *wm:[2] . 20:16:43.590 -> *wm:[2] . 20:16:43.683 -> [ 4764][V][WiFiGeneric.cpp:284] _arduino_event_cb(): STA Connected: SSID: Desat-Wifi, BSSID: 2c:3a:fd:a3:38:af, Channel: 6, Auth: UNKNOWN 20:16:43.683 -> [ 4765][D][WiFiGeneric.cpp:831] _eventCallback(): Arduino Event: 4 - STA_CONNECTED 20:16:43.683 -> *wm:[ 4780][V][WiFiGeneric.cpp:294] _arduino_event_cb(): STA Got New IP:192.168.178.40 20:16:43.728 -> [2] .[ 4783][D][WiFiGeneric.cpp:831] _eventCallback(): Arduino Event: 7 - STA_GOT_IP 20:16:43.728 -> [ 4788][D][WiFiGeneric.cpp:880] _eventCallback(): STA IP: 192.168.178.40, MASK: 255.255.255.0, GW: 192.168.178.1 20:16:43.728 -> 20:16:43.821 -> *wm:[2] Connection result: WL_CONNECTED 20:16:43.821 -> *wm:[1] AutoConnect: SUCCESS 20:16:43.821 -> *wm:[2] Connected in 2759 ms 20:16:43.821 -> *wm:[1] STA IP Address: 192.168.178.40 20:16:43.821 -> connected...yeey :) 20:16:45.588 -> ets Jun 8 2016 00:22:57 20:16:45.634 -> 20:16:45.634 -> rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) 20:16:45.634 -> configsip: 0, SPIWP:0xee 20:16:45.634 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 20:16:45.634 -> mode:DIO, clock div:1 20:16:45.634 -> load:0x3fff0030,len:1324 20:16:45.634 -> ho 0 tail 12 room 4 20:16:45.634 -> load:0x40078000,len:13508 20:16:45.634 -> load:0x40080400,len:3604 20:16:45.634 -> entry 0x400805f0 20:16:45.866 -> [2-hal-cpu.c:211] setCpuFrequencyMhz(): PLL: 480 / 2 = 240 Mhz, APB: 80000000 Hz 20:16:45.912 -> 20:16:45.912 -> Starting 20:16:45.959 -> [ 58][D][WiFiGeneric.cpp:831] _eventCallback(): Arduino Event: 0 - WIFI_READY 20:16:46.053 -> [ 148][V][WiFiGeneric.cpp:272] _arduino_event_cb(): STA Started 20:16:46.053 -> [ 148][D][WiFiGeneric.cpp:831] _eventCallback(): Arduino Event: 2 - STA_START 20:16:48.051 -> *wm:[1] AutoConnect 20:16:48.051 -> *wm:[2] ESP32 event handler enabled 20:16:48.051 -> *wm:[2] Connecting as wifi client... 20:16:48.051 -> *wm:[2] setSTAConfig static ip not set, skipping 20:16:48.051 -> *wm:[1] Connecting to SAVED AP: Desat-Wifi 20:16:48.562 -> [ 2660][V][WiFiGeneric.cpp:96] set_esp_interface_ip(): Configuring Station static IP: 0.0.0.0, MASK: 0.0.0.0, GW: 0.0.0.0 20:16:48.562 -> *wm:[2] 20000 ms timeout, waiting for connect... 20:16:48.562 -> *wm:[2] . 20:16:48.655 -> *wm:[2] . 20:16:48.747 -> *wm:[2] . 20:16:48.841 -> *wm:[2] . 20:16:48.980 -> *wm:[2] . 20:16:49.075 -> *wm:[2] . 20:16:49.167 -> *wm:[2] . 20:16:49.258 -> *wm:[2] . 20:16:49.353 -> *wm:[2] . 20:16:49.445 -> *wm:[2] . 20:16:49.538 -> *wm:[2] . 20:16:49.674 -> *wm:[2] . 20:16:49.766 -> *wm:[2] . 20:16:49.860 -> *wm:[2] . 20:16:49.952 -> *wm:[2] . 20:16:50.047 -> *wm:[2] . 20:16:50.139 -> *wm:[2] . 20:16:50.279 -> *wm:[2] . 20:16:50.372 -> *wm:[2] . 20:16:50.465 -> *wm:[2] . 20:16:50.559 -> *wm:[2] . 20:16:50.605 -> E (9643) wifi:Association refused temporarily, comeback time 1024 mSec 20:16:50.651 -> *wm:[2] . 20:16:50.743 -> *wm:[2] . 20:16:50.838 -> *wm:[2] . 20:16:50.976 -> *wm:[2] . 20:16:51.068 -> *wm:[2] . 20:16:51.162 -> *wm:[2] . 20:16:51.253 -> *wm:[2] . 20:16:51.346 -> *wm:[2] . 20:16:51.438 -> *wm:[2] . 20:16:51.577 -> *wm:[2] . 20:16:51.670 -> *wm:[2] . 20:16:51.764 -> *wm:[2] . 20:16:51.857 -> *wm:[2] . 20:16:51.949 -> *wm:[2] . 20:16:52.041 -> *wm:[2] . 20:16:52.179 -> *wm:[2] . 20:16:52.272 -> *wm:[2] . 20:16:52.364 -> *wm:[2] . 20:16:52.457 -> *wm:[2] . 20:16:52.551 -> *wm:[2] . 20:16:52.644 -> [ 6756][V][WiFiGeneric.cpp:289] _arduino_event_cb(): STA Disconnected: SSID: Desat-Wifi, BSSID: 2c:3a:fd:a3:38:af, Reason: 203 20:16:52.644 -> [ 6756][D][WiFiGeneric.cpp:831] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED 20:16:52.644 -> [ 6764][W][WiFiGeneric.cpp:852] _eventCallback(): Reason: 203 - ASSOC_FAIL 20:16:52.690 -> [ 6772][V][WiFiGeneric.cpp:96] set_esp_interface_ip(): Configuring Station static IP: 0.0.0.0, MASK: 0.0.0.0, GW: 0.0.0.0 20:16:52.690 -> *wm:*wm:[2] [EVENT] WIFI_REASON: 203 20:16:52.690 -> *wm:[2] [EVENT] WIFI_REASON: AUTH FAIL 20:16:52.690 -> [2] Connection result: WL_CONNECT_FAILED 20:16:52.690 -> *wm:[1] AutoConnect: FAILED 20:16:52.690 -> *wm:[2] Starting Config Portal 20:16:52.690 -> *wm:[2] AccessPoint set password is VALID 20:16:52.690 -> [ 6803][V][WiFiGeneric.cpp:275] _arduino_event_cb(): STA Stopped 20:16:52.690 -> *wm:[ 6807][D][WiFiGeneric.cpp:831] _eventCallback(): Arduino Event: 3 - STA_STOP 20:16:52.690 -> [2] Disabling STA 20:16:52.736 -> *wm:[2] Enabling AP 20:16:52.736 -> *wm:[1] StartAP with SSID: AutoConnectAP 20:16:52.736 -> [ 6846][D][WiFiGeneric.cpp:831] _eventCallback(): Arduino Event: 0 - WIFI_READY 20:16:52.736 -> [ 6852][V][WiFiGeneric.cpp:314] _arduino_event_cb(): AP Started 20:16:52.736 -> [ 6852][D][WiFiGeneric.cpp:831] _eventCallback(): Arduino Event: 10 - AP_START 20:16:53.246 -> *wm:[1] AP IP address: 192.168.4.1 20:16:53.246 -> *wm:[1] Starting Web Portal 20:16:53.246 -> [ 7352][V][WiFiServer.h:42] WiFiServer(): WiFiServer::WiFiServer(port=80, ...) 20:16:53.246 -> [ 7354][V][WebServer.cpp:85] WebServer(): WebServer::Webserver(port=80) 20:16:53.246 -> *wm:[2] HTTP server started 20:16:53.246 -> *wm:[2] Config Portal Running, non blocking/processing 20:16:53.246 -> *wm:[2] Portal Timeout In 60 seconds 20:16:53.246 -> Failed to connect or hit timeout 20:17:15.905 -> *wm:[2] Portal Timeout In 36 seconds 20:17:45.877 -> *wm:[2] Portal Timeout In 6 seconds 20:17:52.699 -> *wm:[1] config portal has timed out 20:17:52.699 -> *wm:[2] shutdownConfigPortal 20:17:52.699 -> [ 66832][V][WiFiGeneric.cpp:317] _arduino_event_cb(): AP Stopped 20:17:52.747 -> [ 66832][D][WiFiGeneric.cpp:831] _eventCallback(): Arduino Event: 11 - AP_STOP 20:17:52.747 -> *wm:[2] restoring usermode STA 20:17:52.747 -> [ 66836][V][WiFiGeneric.cpp:314] _arduino_event_cb(): AP Started 20:17:52.747 -> [ 66847][D][WiFiGeneric.cpp:831] _eventCallback(): Arduino Event: 10 - AP_START 20:17:53.718 -> [ 67847][V][WiFiGeneric.cpp:317] _arduino_event_cb(): AP Stopped 20:17:53.718 -> [ 67847][D][WiFiGeneric.cpp:831] _eventCallback(): Arduino Event: 11 - AP_STOP 20:17:53.765 -> [ 67848][V][WiFiGeneric.cpp:272] _arduino_event_cb(): STA Started 20:17:53.765 -> *wm:[ 67855][D][WiFiGeneric.cpp:831] _eventCallback(): Arduino Event: 2 - STA_START 20:17:53.765 -> [2] wifi status: Unknown 20:17:53.765 -> *wm:[2] wifi mode: STA 20:17:53.765 -> *wm:[2] configportal closed ```
Author
Owner

@tablatronix commented on GitHub (Mar 30, 2022):

I linked an issue above for this that suggests it is the lack of authmode comparison in the equals assertion check that causes startap to return true even if auth setting failed.

<!-- gh-comment-id:1083467662 --> @tablatronix commented on GitHub (Mar 30, 2022): I linked an issue above for this that suggests it is the lack of authmode comparison in the equals assertion check that causes startap to return true even if auth setting failed.
Author
Owner

@tablatronix commented on GitHub (Mar 30, 2022):

also this issue is known and fixes are in the works for it in the ESP sdk and in lib
I added a fix to wm to workaround it also

#1067

_aggresiveReconn

<!-- gh-comment-id:1083469113 --> @tablatronix commented on GitHub (Mar 30, 2022): also this issue is known and fixes are in the works for it in the ESP sdk and in lib I added a fix to wm to workaround it also #1067 `_aggresiveReconn`
Author
Owner

@Desat commented on GitHub (Mar 30, 2022):

It's funny, actually I just wanted to have a simple way of entering the WiFi credentials via a Nextion display and the ESP32 then using them for the next restart. Haven't had any success so far, because the credentials are only accepted as "const" and my programming skills are really on the lower level. Let alone understand the "persistent" feature.

<!-- gh-comment-id:1083474344 --> @Desat commented on GitHub (Mar 30, 2022): It's funny, actually I just wanted to have a simple way of entering the WiFi credentials via a Nextion display and the ESP32 then using them for the next restart. Haven't had any success so far, because the credentials are only accepted as "const" and my programming skills are really on the lower level. Let alone understand the "persistent" feature.
Author
Owner

@tablatronix commented on GitHub (Mar 30, 2022):

ah, you might want to try making a const char* in your sketch, and memcpy them from the inputs, not sure how you are getting them in , as strings? etc. but you will probably have to do a copy to make sure the memory is safe when you pass it to the begin()

or if you want to just use WM then you can use

    // to preload autoconnect for test fixtures or other uses that skip esp sta config
    bool          preloadWiFi(String ssid, String pass);
<!-- gh-comment-id:1083480631 --> @tablatronix commented on GitHub (Mar 30, 2022): ah, you might want to try making a const char* in your sketch, and memcpy them from the inputs, not sure how you are getting them in , as strings? etc. but you will probably have to do a copy to make sure the memory is safe when you pass it to the begin() or if you want to just use WM then you can use ```C++ // to preload autoconnect for test fixtures or other uses that skip esp sta config bool preloadWiFi(String ssid, String pass); ```
Author
Owner

@Desat commented on GitHub (Mar 30, 2022):

Actually, I would like to use as few libraries as possible because my project is a "digital analogue clock" with addressable LEDs and the memory on the ESP is also limited. In addition to the clock function, temperature, humidity and air pressure should also be shown on the display. The WiFi access was originally only intended to be used for time synchronization, but I'm thinking about an OTA update function. Furthermore, a calendar function with public holidays, sunrise and sunset and moon phases was planned for the display. In addition, a spectrum analyzer as a "decoration effect" and a brightness sensor to adjust the luminosity of the LEDs depending on the interior brightness.
Yes, it's "just" a small project for someone whose programming skills are on the lower level / simplest basics.
Oh I forgot the gyroscope :oD

<!-- gh-comment-id:1083491630 --> @Desat commented on GitHub (Mar 30, 2022): Actually, I would like to use as few libraries as possible because my project is a "digital analogue clock" with addressable LEDs and the memory on the ESP is also limited. In addition to the clock function, temperature, humidity and air pressure should also be shown on the display. The WiFi access was originally only intended to be used for time synchronization, but I'm thinking about an OTA update function. Furthermore, a calendar function with public holidays, sunrise and sunset and moon phases was planned for the display. In addition, a spectrum analyzer as a "decoration effect" and a brightness sensor to adjust the luminosity of the LEDs depending on the interior brightness. Yes, it's "just" a small project for someone whose programming skills are on the lower level / simplest basics. Oh I forgot the gyroscope :oD
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#1183
No description provided.