diff --git a/WiFiManager.cpp b/WiFiManager.cpp index ce72e44..1ecc949 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -2350,7 +2350,7 @@ void WiFiManager::setMenu(const char * menu[], uint8_t size){ } } } - // DEBUG_WM(getMenuOut()); + DEBUG_WM(getMenuOut()); } /** @@ -2373,7 +2373,7 @@ void WiFiManager::setMenu(std::vector& menu){ } } } - // DEBUG_WM(getMenuOut()); + DEBUG_WM(getMenuOut()); } @@ -2384,9 +2384,8 @@ void WiFiManager::setMenu(std::vector& menu){ * @since $dev */ void WiFiManager::setParamsPage(bool enable){ - _paramsInWifi= false; - _menuIdsDefault = {"wifi","param","info","exit"}; - setMenu(_menuIdsDefault); + _paramsInWifi = !enable; + setMenu(enable ? _menuIdsParams : _menuIdsDefault); } // GETTERS diff --git a/WiFiManager.h b/WiFiManager.h index 9691135..97f6784 100644 --- a/WiFiManager.h +++ b/WiFiManager.h @@ -307,6 +307,7 @@ class WiFiManager private: std::vector _menuIds; + std::vector _menuIdsParams = {"wifi","param","info","exit"}; std::vector _menuIdsDefault = {"wifi","info","exit"}; // ip configs @todo struct ? diff --git a/examples/DEV/OnDemandConfigPortal/OnDemandConfigPortal.ino b/examples/DEV/OnDemandConfigPortal/OnDemandConfigPortal.ino index 58f5e9e..34c4d75 100644 --- a/examples/DEV/OnDemandConfigPortal/OnDemandConfigPortal.ino +++ b/examples/DEV/OnDemandConfigPortal/OnDemandConfigPortal.ino @@ -173,9 +173,9 @@ void setup() { // wm.setMenu(menu,9); // custom menu array must provide length std::vector menu = {"wifi","wifinoscan","info","param","close","sep","erase","restart","exit"}; - wm.setMenu(menu); // custom menu, pass vector + // wm.setMenu(menu); // custom menu, pass vector - // wm.setParamsPage(true); // move params to seperate page, not wifi, do not combine with setmenu! + wm.setParamsPage(true); // move params to seperate page, not wifi, do not combine with setmenu! // set static sta ip // wm.setSTAStaticIPConfig(IPAddress(10,0,1,99), IPAddress(10,0,1,1), IPAddress(255,255,255,0)); @@ -244,6 +244,7 @@ void loop() { if ( digitalRead(TRIGGER_PIN) == LOW ){ Serial.println("BUTTON PRESSED"); wm.setConfigPortalTimeout(140); + wm.setParamsPage(false); // move params to seperate page, not wifi, do not combine with setmenu! // disable captive portal redirection // wm.setCaptivePortalEnable(false);