From e3b7dc264191ea924828711e11530a3076f2c48b Mon Sep 17 00:00:00 2001 From: Shawn A Date: Fri, 16 Mar 2018 14:18:48 -0500 Subject: [PATCH] kludge setmenu with size so it works Prboably going to add a vector for this, I do not want to add the overhead of std::array for something optional --- WiFiManager.cpp | 11 ++++++----- WiFiManager.h | 10 ++++++---- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/WiFiManager.cpp b/WiFiManager.cpp index d63e6de..55c56e6 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -156,7 +156,6 @@ void WiFiManager::WiFiManagerInit(){ _usermode = WiFi.getMode(); WiFi.persistent(false); // disable persistent so scannetworks and mode switching do not cause overwrites - setMenu(_menuIds); _max_params = WIFI_MANAGER_MAX_PARAMS; } @@ -810,7 +809,8 @@ String WiFiManager::getMenuOut(){ String page; int i; for(i=0;i= n) _menuIds[i] = MENU_END; + else _menuIds[i] = menu[i]; } } diff --git a/WiFiManager.h b/WiFiManager.h index 293f7d9..9144167 100644 --- a/WiFiManager.h +++ b/WiFiManager.h @@ -135,7 +135,8 @@ class WiFiManager MENU_RESTART = 5, MENU_EXIT = 6, MENU_ERASE = 7, - MENU_SEP = 8 + MENU_SEP = 8, + MENU_END = 255 } menu_page_t; // auto connect to saved wifi, or custom, and start config portal on failures @@ -219,7 +220,9 @@ class WiFiManager // show erase wifi onfig button on info page, true void setShowInfoErase(boolean enabled); // set custom menu - void setMenu(uint8_t menu[]); + + // void setMenu(const std:vector& menu); + void setMenu(menu_page_t menu[], uint8_t size); // get last connection result, includes autoconnect and wifisave uint8_t getLastConxResult(); @@ -250,8 +253,7 @@ class WiFiManager DEBUG_MAX = 4 } wm_debuglevel_t; - // std:vector _menuids; - uint8_t _menuIds[10] = {MENU_WIFI,MENU_INFO,MENU_EXIT}; + menu_page_t _menuIds[10] = {MENU_WIFI,MENU_INFO,MENU_EXIT,MENU_END}; // ip configs @todo struct ? IPAddress _ap_static_ip;