diff --git a/keywords.txt b/keywords.txt index 3f12cc4..5b661b7 100644 --- a/keywords.txt +++ b/keywords.txt @@ -5,14 +5,13 @@ AutoConnect KEYWORD1 AutoConnectConfig KEYWORD1 AutoConnectCredential KEYWORD1 AutoConnectAux KEYWORD1 -AutoConnectText KEYWORD1 +AutoConnectButton KEYWORD1 +AutoConnectCheckbox KEYWORD1 +AutoConnectElement KEYWORD1 AutoConnectInput KEYWORD1 -AutoConnectButon KEYWORD1 +AutoConnectSelect KEYWORD1 AutoConnectSubmit KEYWORD1 -ACText KEYWORD1 -ACInput KEYWORD1 -ACButton KEYWORD1 -ACSubmit KEYWORD1 +AutoConnectText KEYWORD1 ####################################### # Methods and Functions (KEYWORD2) @@ -29,11 +28,15 @@ home KEYWORD2 host KEYWORD2 join KEYWORD2 load KEYWORD2 +menu KEYWORD2 name KEYWORD2 on KEYWORD2 onDetect KEYWORD2 onNotFound KEYWORD2 +release KEYWORD2 save KEYWORD2 +setTitle KEYWORD2 +toHTML KEYWORD2 value KEYWORD2 ####################################### @@ -43,3 +46,14 @@ AC_WEBSERVER_PARASITIC LITERAL1 AC_WEBSERVER_HOSTED LITERAL1 AC_SAVECREDENTIAL_NEVER LITERAL1 AC_SAVECREDENTIAL_AUTO LITERAL1 + +####################################### +# PREPROCESSOR (KEYWORD3) +####################################### +ACButton PREPROCESSOR +ACCheckbox PREPROCESSOR +ACElement PREPROCESSOR +ACInput PREPROCESSOR +ACSelect PREPROCESSOR +ACSubmit PREPROCESSOR +ACText PREPROCESSOR diff --git a/src/AutoConnect.cpp b/src/AutoConnect.cpp index 3c90d48..64a6372 100644 --- a/src/AutoConnect.cpp +++ b/src/AutoConnect.cpp @@ -274,12 +274,12 @@ WebServerClass& AutoConnect::host() { * the auxiliary page to be added. */ void AutoConnect::join(AutoConnectAux& aux) { - aux._join(*this); - AC_DBG("%s on hands\n", aux.uri()); if (_aux) _aux->_concat(aux); else _aux.reset(&aux); + aux._join(*this); + AC_DBG("%s on hands\n", aux.uri()); } /** @@ -289,7 +289,7 @@ void AutoConnect::join(AutoConnectAux& aux) { */ void AutoConnect::join(std::vector> aux) { for (std::size_t n = 0; n < aux.size(); n++) { - AutoConnectAux& addon = aux[n + 1].get(); + AutoConnectAux& addon = aux[n].get(); join(addon); } } @@ -397,9 +397,8 @@ void AutoConnect::handleRequest() { _stopPortal(); _disconnectWiFi(true); AC_DBG("Disconnected\n"); - // Reset disconnection request //, restore the menu title. + // Reset disconnection request _rfDisconnect = false; -// _menuTitle = String(AUTOCONNECT_MENU_TITLE); if (_apConfig.autoReset) { delay(1000); diff --git a/src/AutoConnect.h b/src/AutoConnect.h index 05030ec..605ad1e 100644 --- a/src/AutoConnect.h +++ b/src/AutoConnect.h @@ -105,6 +105,8 @@ using WebServerClass = WebServer; #define AUTOCONNECT_DNSPORT 53 #endif +#define AC_UNUSED(expr) do { (void)(expr); } while (0) + /**< A type to save established credential at WiFi.begin automatically. */ typedef enum AC_SAVECREDENTIAL { AC_SAVECREDENTIAL_NEVER, diff --git a/src/AutoConnectAux.cpp b/src/AutoConnectAux.cpp index 4288a2a..8471fc3 100644 --- a/src/AutoConnectAux.cpp +++ b/src/AutoConnectAux.cpp @@ -39,24 +39,114 @@ const char AutoConnectAux::_PAGE_AUX[] PROGMEM = { "{{MENU_PRE}}" "{{MENU_AUX}}" "{{MENU_POST}}" - "
" + "
" "
" "
    " "{{AUX_ELEMENT}}" "
" "
" - "
" + "
" "" "" "" "" }; +/** + * Generate an HTML ")); +} + +/** + * Generate an HTML element. + * A "value" is associated with the input tag and sent by the form + * action as the value of "name". If the label member is contained, it + * is placed to the right side of the checkbox to be labeled. + * If the label member is empty, only the checkbox is placed. + * @return String an HTML string. + */ +const String AutoConnectCheckbox::toHTML(void) const { + String html; + + html = String(FPSTR("