mirror of
https://github.com/alexhopeoconnor/WiFiManager.git
synced 2026-10-20 01:41:28 +10:00
+14
-4
@@ -752,7 +752,7 @@ boolean WiFiManager::startConfigPortal(char const *apName, char const *apPasswo
|
||||
/**
|
||||
* [process description]
|
||||
* @access public
|
||||
* @return {[type]} [description]
|
||||
* @return bool connected
|
||||
*/
|
||||
boolean WiFiManager::process(){
|
||||
// process mdns, esp32 not required
|
||||
@@ -765,13 +765,23 @@ boolean WiFiManager::process(){
|
||||
}
|
||||
|
||||
if(webPortalActive || (configPortalActive && !_configPortalIsBlocking)){
|
||||
uint8_t state = processConfigPortal();
|
||||
return state == WL_CONNECTED;
|
||||
|
||||
// if timed out or abort, break
|
||||
if(_allowExit && (configPortalHasTimeout() || abort)){
|
||||
#ifdef WM_DEBUG_LEVEL
|
||||
DEBUG_WM(DEBUG_DEV,F("process loop abort"));
|
||||
#endif
|
||||
shutdownConfigPortal();
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t state = processConfigPortal();
|
||||
return state == WL_CONNECTED;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//using esp enums returns for now, should be fine
|
||||
//using esp wl_status enums as returns for now, should be fine
|
||||
uint8_t WiFiManager::processConfigPortal(){
|
||||
if(configPortalActive){
|
||||
//DNS handler
|
||||
|
||||
@@ -462,6 +462,7 @@ class WiFiManager
|
||||
unsigned long _startconn = 0; // ms for timing wifi connects
|
||||
bool _aggresiveReconn = false; // use an agrressive reconnect strategy, WILL delay conxs
|
||||
// on some conn failure modes will add delays and many retries to work around esp and ap bugs, ie, anti de-auth protections
|
||||
bool _allowExit = true; // allow exit non blocking
|
||||
|
||||
#ifdef ESP32
|
||||
wifi_event_id_t wm_event_id;
|
||||
|
||||
@@ -29,6 +29,7 @@ int TESP_CP_TIMEOUT = 90; // test cp timeout
|
||||
bool TEST_NET = true; // do a network test after connect, (gets ntp time)
|
||||
bool ALLOWONDEMAND = true; // enable on demand
|
||||
int ONDDEMANDPIN = 0; // gpio for button
|
||||
bool WMISBLOCKING = false; // use blocking or non blocking mode
|
||||
|
||||
// char ssid[] = "*************"; // your network SSID (name)
|
||||
// char pass[] = "********"; // your network password
|
||||
@@ -161,6 +162,13 @@ void setup() {
|
||||
// show password publicly in form
|
||||
// wm.setShowPassword(true);
|
||||
|
||||
// sets wether wm configportal is a blocking loop(legacy) or not, use wm.process() in loop if false
|
||||
// wm.setConfigPortalBlocking(false);
|
||||
|
||||
if(!WMISBLOCKING){
|
||||
wm.setConfigPortalBlocking(false);
|
||||
}
|
||||
|
||||
//sets timeout until configuration portal gets turned off
|
||||
//useful to make it all retry or go to sleep in seconds
|
||||
wm.setConfigPortalTimeout(120);
|
||||
@@ -233,6 +241,10 @@ void wifiInfo(){
|
||||
|
||||
void loop() {
|
||||
|
||||
if(!WMISBLOCKING){
|
||||
wm.process();
|
||||
}
|
||||
|
||||
#ifdef USEOTA
|
||||
ArduinoOTA.handle();
|
||||
#endif
|
||||
@@ -241,6 +253,13 @@ void loop() {
|
||||
delay(100);
|
||||
if ( digitalRead(ONDDEMANDPIN) == LOW ){
|
||||
Serial.println("BUTTON PRESSED");
|
||||
|
||||
// button reset/reboot
|
||||
// wm.resetSettings();
|
||||
// wm.reboot();
|
||||
// delay(200);
|
||||
// return;
|
||||
|
||||
wm.setConfigPortalTimeout(140);
|
||||
wm.setParamsPage(false); // move params to seperate page, not wifi, do not combine with setmenu!
|
||||
|
||||
|
||||
Reference in New Issue
Block a user