diff --git a/mkdocs/advancedusage.md b/mkdocs/advancedusage.md index 58c0e02..e62e905 100644 --- a/mkdocs/advancedusage.md +++ b/mkdocs/advancedusage.md @@ -191,6 +191,19 @@ Executing the above sketch will rewrite the menu title for the **FSBrowser** as
+### Change the menu labels + +You can change the label of the AutoConnect menu item by rewriting the default label letter in [AutoConnectLabels.h](https://github.com/Hieromon/AutoConnect/blob/master/src/AutoConnectLabels.h) macros. However, changing menu items letter influences all the sketch's build scenes. + +```cpp +#define AUTOCONNECT_MENULABEL_CONFIGNEW "Configure new AP" +#define AUTOCONNECT_MENULABEL_OPENSSIDS "Open SSIDs" +#define AUTOCONNECT_MENULABEL_DISCONNECT "Disconnect" +#define AUTOCONNECT_MENULABEL_RESET "Reset..." +#define AUTOCONNECT_MENULABEL_HOME "HOME" +#define AUTOCONNECT_BUTTONLABEL_RESET "RESET" +``` + ### Combination with mDNS With [mDNS library](https://github.com/esp8266/Arduino/tree/master/libraries/ESP8266mDNS), you can access to ESP8266 by name instead of IP address after connection. The sketch can start the MDNS responder after [*AutoConnect::begin*](api.md#begin). diff --git a/src/AutoConnect.cpp b/src/AutoConnect.cpp index 2feb7eb..b30fbf3 100644 --- a/src/AutoConnect.cpp +++ b/src/AutoConnect.cpp @@ -668,7 +668,7 @@ void AutoConnect::_handleNotFound(void) { String AutoConnect::_induceReset(PageArgument& args) { AC_UNUSED(args); _rfReset = true; - return String(F("Reset in progress...")); + return String(F(AUTOCONNECT_BUTTONLABEL_RESET " in progress...")); } /** diff --git a/src/AutoConnectLabels.h b/src/AutoConnectLabels.h new file mode 100644 index 0000000..1591ed4 --- /dev/null +++ b/src/AutoConnectLabels.h @@ -0,0 +1,65 @@ +/** + * AutoConnect proper menu label constant definition. + * @file AutoConnectLabels.h + * @author hieromon@gmail.com + * @version 0.9.8 + * @date 2019-03-11 + * @copyright MIT license. + */ + +#ifndef _AUTOCONNECTLABELS_H_ +#define _AUTOCONNECTLABELS_H_ + +/** + * The upper row of each of the following definition items is the + * default value. The lower row is an alternative label string as + * a sample and can be changed you wish. + * + * Notes: + * You can find some tokens for the PageBuilder if you parse + * AutoConnectPage.cpp. Some of the tokens are valid at the time + * the AutoConnect menu will generate. For example, the token + * `{{CUR_SSID}}` returns the SSID of the currently participating + * AP by AutoConnect::_token_CURRENT_SSID function. + * You can use these tokens to display dynamic menus showing the + * current situation, but you need to know the internal structure + * of AutoConnect in order to display the appropriate menu. + */ + +// Menu item: Configure new AP +#ifndef AUTOCONNECT_MENULABEL_CONFIGNEW +#define AUTOCONNECT_MENULABEL_CONFIGNEW "Configure new AP" +//#define AUTOCONNECT_MENULABEL_CONFIGNEW "Establish a new AP" +#endif // !AUTOCONNECT_MENULABEL_CONFIGNEW + +// Menu item: Open SSIDs +#ifndef AUTOCONNECT_MENULABEL_OPENSSIDS +#define AUTOCONNECT_MENULABEL_OPENSSIDS "Open SSIDs" +//#define AUTOCONNECT_MENULABEL_OPENSSIDS "Open credentials" +#endif // !AUTOCONNECT_MENULABEL_OPENSSIDS + +// Menu item: Disconnect +#ifndef AUTOCONNECT_MENULABEL_DISCONNECT +#define AUTOCONNECT_MENULABEL_DISCONNECT "Disconnect" +//#define AUTOCONNECT_MENULABEL_DISCONNECT "Leave {{CUR_SSID}}" +#endif // !AUTOCONNECT_MENULABEL_DISCONNECT + +// Menu item: Reset... +#ifndef AUTOCONNECT_MENULABEL_RESET +#define AUTOCONNECT_MENULABEL_RESET "Reset..." +//#define AUTOCONNECT_MENULABEL_RESET "Reboot..." +#endif // !AUTOCONNECT_MENULABEL_RESET + +// Menu item: HOME +#ifndef AUTOCONNECT_MENULABEL_HOME +#define AUTOCONNECT_MENULABEL_HOME "HOME" +//#define AUTOCONNECT_MENULABEL_HOME "Main" +#endif // !AUTOCONNECT_MENULABEL_HOME + +// Button label: RESET +#ifndef AUTOCONNECT_BUTTONLABEL_RESET +#define AUTOCONNECT_BUTTONLABEL_RESET "RESET" +//#define AUTOCONNECT_BUTTONLABEL_RESET "Reboot" +#endif // !AUTOCONNECT_BUTTONLABEL_RESET + +#endif diff --git a/src/AutoConnectPage.cpp b/src/AutoConnectPage.cpp index 84796b7..6e983a5 100644 --- a/src/AutoConnectPage.cpp +++ b/src/AutoConnectPage.cpp @@ -525,10 +525,10 @@ const char AutoConnect::_ELM_MENU_PRE[] PROGMEM = { "MENU_TITLE" "" "" - "