Redesigned GUI

Redesigned GUI by moving non-configuration buttons from ``Configuration`` to new submenu ``Consoles``
This commit is contained in:
Theo Arends 2021-04-16 11:40:38 +02:00
parent 82c7ac37e0
commit f7b45ffddb
8 changed files with 77 additions and 21 deletions

View File

@ -12,6 +12,7 @@ All notable changes to this project will be documented in this file.
- In tasmota-sensors.bin enabled support for VL53L0X and disabled TSL2561 (#11711) - In tasmota-sensors.bin enabled support for VL53L0X and disabled TSL2561 (#11711)
- Add HLW8012/BL0937 average pulse calculation by Alex Lovett (#11722) - Add HLW8012/BL0937 average pulse calculation by Alex Lovett (#11722)
- Redesigned initial GUI wifi configuration by Adrian Scillato (#11693) - Redesigned initial GUI wifi configuration by Adrian Scillato (#11693)
- Redesigned GUI by moving non-configuration buttons from ``Configuration`` to new submenu ``Consoles``
### Fixed ### Fixed
- Telegram chat id incorrect size (#11660) - Telegram chat id incorrect size (#11660)

View File

@ -120,6 +120,7 @@ The attached binaries can also be downloaded from http://ota.tasmota.com/tasmota
- ADC range result from int to float using command ``FreqRes`` for decimal resolution selection [#11545](https://github.com/arendst/Tasmota/issues/11545) - ADC range result from int to float using command ``FreqRes`` for decimal resolution selection [#11545](https://github.com/arendst/Tasmota/issues/11545)
- Removed overtemp detection on external energy monitoring devices [#11628](https://github.com/arendst/Tasmota/issues/11628) - Removed overtemp detection on external energy monitoring devices [#11628](https://github.com/arendst/Tasmota/issues/11628)
- Redesigned initial GUI wifi configuration by Adrian Scillato [#11693](https://github.com/arendst/Tasmota/issues/11693) - Redesigned initial GUI wifi configuration by Adrian Scillato [#11693](https://github.com/arendst/Tasmota/issues/11693)
- Redesigned GUI by moving non-configuration buttons from ``Configuration`` to new submenu ``Consoles``
- In tasmota-sensors.bin enabled support for VL53L0X and disabled TSL2561 [#11711](https://github.com/arendst/Tasmota/issues/11711) - In tasmota-sensors.bin enabled support for VL53L0X and disabled TSL2561 [#11711](https://github.com/arendst/Tasmota/issues/11711)
- Add HLW8012/BL0937 average pulse calculation by Alex Lovett [#11722](https://github.com/arendst/Tasmota/issues/11722) - Add HLW8012/BL0937 average pulse calculation by Alex Lovett [#11722](https://github.com/arendst/Tasmota/issues/11722)

View File

@ -310,7 +310,7 @@ enum XsnsFunctions {FUNC_SETTINGS_OVERRIDE, FUNC_PIN_STATE, FUNC_MODULE_INIT, FU
FUNC_SET_POWER, FUNC_SET_DEVICE_POWER, FUNC_SHOW_SENSOR, FUNC_ANY_KEY, FUNC_SET_POWER, FUNC_SET_DEVICE_POWER, FUNC_SHOW_SENSOR, FUNC_ANY_KEY,
FUNC_ENERGY_EVERY_SECOND, FUNC_ENERGY_RESET, FUNC_ENERGY_EVERY_SECOND, FUNC_ENERGY_RESET,
FUNC_RULES_PROCESS, FUNC_SERIAL, FUNC_FREE_MEM, FUNC_BUTTON_PRESSED, FUNC_RULES_PROCESS, FUNC_SERIAL, FUNC_FREE_MEM, FUNC_BUTTON_PRESSED,
FUNC_WEB_ADD_BUTTON, FUNC_WEB_ADD_MANAGEMENT_BUTTON, FUNC_WEB_ADD_MAIN_BUTTON, FUNC_WEB_ADD_BUTTON, FUNC_WEB_ADD_CONSOLE_BUTTON, FUNC_WEB_ADD_MANAGEMENT_BUTTON, FUNC_WEB_ADD_MAIN_BUTTON,
FUNC_WEB_ADD_HANDLER, FUNC_SET_CHANNELS, FUNC_SET_SCHEME, FUNC_HOTPLUG_SCAN, FUNC_WEB_ADD_HANDLER, FUNC_SET_CHANNELS, FUNC_SET_SCHEME, FUNC_HOTPLUG_SCAN,
FUNC_DEVICE_GROUP_ITEM }; FUNC_DEVICE_GROUP_ITEM };

View File

@ -128,6 +128,7 @@
#define USE_SCRIPT_GLOBVARS #define USE_SCRIPT_GLOBVARS
#define USE_SCRIPT_SUB_COMMAND #define USE_SCRIPT_SUB_COMMAND
#define USE_ANGLE_FUNC #define USE_ANGLE_FUNC
#define USE_SCRIPT_WEB_DISPLAY
#define SCRIPT_FULL_WEBPAGE #define SCRIPT_FULL_WEBPAGE
#define SCRIPT_GET_HTTPS_JP #define SCRIPT_GET_HTTPS_JP
#define USE_GOOGLE_CHARTS #define USE_GOOGLE_CHARTS

View File

@ -361,16 +361,19 @@ const char HTTP_DEVICE_STATE[] PROGMEM = "<td style='width:%d%%;text-align:cente
enum ButtonTitle { enum ButtonTitle {
BUTTON_RESTART, BUTTON_RESET_CONFIGURATION, BUTTON_RESTART, BUTTON_RESET_CONFIGURATION,
BUTTON_MAIN, BUTTON_CONFIGURATION, BUTTON_INFORMATION, BUTTON_FIRMWARE_UPGRADE, BUTTON_CONSOLE, BUTTON_MAIN, BUTTON_CONFIGURATION, BUTTON_INFORMATION, BUTTON_FIRMWARE_UPGRADE, BUTTON_MANAGEMENT,
BUTTON_MODULE, BUTTON_WIFI, BUTTON_LOGGING, BUTTON_OTHER, BUTTON_TEMPLATE, BUTTON_BACKUP, BUTTON_RESTORE }; BUTTON_MODULE, BUTTON_WIFI, BUTTON_LOGGING, BUTTON_OTHER, BUTTON_TEMPLATE, BUTTON_BACKUP, BUTTON_RESTORE,
BUTTON_CONSOLE };
const char kButtonTitle[] PROGMEM = const char kButtonTitle[] PROGMEM =
D_RESTART "|" D_RESET_CONFIGURATION "|" D_RESTART "|" D_RESET_CONFIGURATION "|"
D_MAIN_MENU "|" D_CONFIGURATION "|" D_INFORMATION "|" D_FIRMWARE_UPGRADE "|" D_CONSOLE "|" D_MAIN_MENU "|" D_CONFIGURATION "|" D_INFORMATION "|" D_FIRMWARE_UPGRADE "|" D_MANAGEMENT "|"
D_CONFIGURE_MODULE "|" D_CONFIGURE_WIFI"|" D_CONFIGURE_LOGGING "|" D_CONFIGURE_OTHER "|" D_CONFIGURE_TEMPLATE "|" D_BACKUP_CONFIGURATION "|" D_RESTORE_CONFIGURATION; D_CONFIGURE_MODULE "|" D_CONFIGURE_WIFI"|" D_CONFIGURE_LOGGING "|" D_CONFIGURE_OTHER "|" D_CONFIGURE_TEMPLATE "|" D_BACKUP_CONFIGURATION "|" D_RESTORE_CONFIGURATION "|"
D_CONSOLE;
const char kButtonAction[] PROGMEM = const char kButtonAction[] PROGMEM =
".|rt|" ".|rt|"
".|cn|in|up|cs|" ".|cn|in|up|mn|"
"md|wi|lg|co|tp|dl|rs"; "md|wi|lg|co|tp|dl|rs|"
"cs";
const char kButtonConfirm[] PROGMEM = D_CONFIRM_RESTART "|" D_CONFIRM_RESET_CONFIGURATION; const char kButtonConfirm[] PROGMEM = D_CONFIRM_RESTART "|" D_CONFIRM_RESET_CONFIGURATION;
enum CTypes { CT_HTML, CT_PLAIN, CT_XML, CT_STREAM, CT_APP_JSON, CT_APP_STREAM }; enum CTypes { CT_HTML, CT_PLAIN, CT_XML, CT_STREAM, CT_APP_JSON, CT_APP_STREAM };
@ -452,6 +455,7 @@ const WebServerDispatch_t WebServerDispatch[] PROGMEM = {
{ "u1", HTTP_ANY, HandleUpgradeFirmwareStart }, // OTA { "u1", HTTP_ANY, HandleUpgradeFirmwareStart }, // OTA
{ "u2", HTTP_OPTIONS, HandlePreflightRequest }, { "u2", HTTP_OPTIONS, HandlePreflightRequest },
{ "u3", HTTP_ANY, HandleUploadDone }, { "u3", HTTP_ANY, HandleUploadDone },
{ "mn", HTTP_GET, HandleManagement },
{ "cs", HTTP_GET, HandleConsole }, { "cs", HTTP_GET, HandleConsole },
{ "cs", HTTP_OPTIONS, HandlePreflightRequest }, { "cs", HTTP_OPTIONS, HandlePreflightRequest },
{ "cm", HTTP_ANY, HandleHttpCommand }, { "cm", HTTP_ANY, HandleHttpCommand },
@ -952,6 +956,19 @@ void HandleWifiLogin(void)
WSContentStop(); WSContentStop();
} }
uint32_t WebUseManagementSubmenu(void) {
static uint32_t management_count = 0;
if (!management_count) {
XdrvMailbox.index = 1;
XdrvCall(FUNC_WEB_ADD_CONSOLE_BUTTON);
XsnsCall(FUNC_WEB_ADD_CONSOLE_BUTTON);
XdrvCall(FUNC_WEB_ADD_MANAGEMENT_BUTTON);
management_count = XdrvMailbox.index;
}
return management_count -1;
}
uint32_t WebDeviceColumns(void) { uint32_t WebDeviceColumns(void) {
const uint32_t max_columns = 8; const uint32_t max_columns = 8;
@ -1185,12 +1202,17 @@ void HandleRoot(void)
if (HTTP_ADMIN == Web.state) { if (HTTP_ADMIN == Web.state) {
#ifdef FIRMWARE_MINIMAL #ifdef FIRMWARE_MINIMAL
WSContentSpaceButton(BUTTON_FIRMWARE_UPGRADE); WSContentSpaceButton(BUTTON_FIRMWARE_UPGRADE);
WSContentButton(BUTTON_CONSOLE);
#else #else
WSContentSpaceButton(BUTTON_CONFIGURATION); WSContentSpaceButton(BUTTON_CONFIGURATION);
WSContentButton(BUTTON_INFORMATION); WSContentButton(BUTTON_INFORMATION);
WSContentButton(BUTTON_FIRMWARE_UPGRADE); WSContentButton(BUTTON_FIRMWARE_UPGRADE);
if (!WebUseManagementSubmenu()) {
WSContentButton(BUTTON_CONSOLE);
} else {
WSContentButton(BUTTON_MANAGEMENT);
}
#endif // Not FIRMWARE_MINIMAL #endif // Not FIRMWARE_MINIMAL
WSContentButton(BUTTON_CONSOLE);
WSContentButton(BUTTON_RESTART); WSContentButton(BUTTON_RESTART);
} }
WSContentStop(); WSContentStop();
@ -1412,9 +1434,6 @@ void HandleConfiguration(void)
WSContentButton(BUTTON_BACKUP); WSContentButton(BUTTON_BACKUP);
WSContentButton(BUTTON_RESTORE); WSContentButton(BUTTON_RESTORE);
WSContentSend_P(PSTR("<div></div>")); // 5px padding
XdrvCall(FUNC_WEB_ADD_MANAGEMENT_BUTTON);
WSContentSpaceButton(BUTTON_MAIN); WSContentSpaceButton(BUTTON_MAIN);
WSContentStop(); WSContentStop();
} }
@ -2888,6 +2907,28 @@ void HandleHttpCommand(void)
/*-------------------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------------------*/
void HandleManagement(void)
{
if (!HttpCheckPriviledgedAccess()) { return; }
AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_MANAGEMENT));
WSContentStart_P(PSTR(D_MANAGEMENT));
WSContentSendStyle();
WSContentButton(BUTTON_CONSOLE);
XdrvMailbox.index = 0;
XdrvCall(FUNC_WEB_ADD_CONSOLE_BUTTON);
XsnsCall(FUNC_WEB_ADD_CONSOLE_BUTTON);
WSContentSend_P(PSTR("<div></div>")); // 5px padding
XdrvCall(FUNC_WEB_ADD_MANAGEMENT_BUTTON);
WSContentSpaceButton(BUTTON_MAIN);
WSContentStop();
}
void HandleConsole(void) void HandleConsole(void)
{ {
if (!HttpCheckPriviledgedAccess()) { return; } if (!HttpCheckPriviledgedAccess()) { return; }
@ -2903,7 +2944,7 @@ void HandleConsole(void)
WSContentSend_P(HTTP_SCRIPT_CONSOL, Settings.web_refresh); WSContentSend_P(HTTP_SCRIPT_CONSOL, Settings.web_refresh);
WSContentSendStyle(); WSContentSendStyle();
WSContentSend_P(HTTP_FORM_CMND); WSContentSend_P(HTTP_FORM_CMND);
WSContentSpaceButton(BUTTON_MAIN); WSContentSpaceButton((WebUseManagementSubmenu()) ? BUTTON_MANAGEMENT : BUTTON_MAIN);
WSContentStop(); WSContentStop();
} }

View File

@ -5249,7 +5249,7 @@ void HandleScriptConfiguration(void) {
#endif //USE_SCRIPT_FATFS #endif //USE_SCRIPT_FATFS
WSContentSend_P(HTTP_SCRIPT_FORM_END); WSContentSend_P(HTTP_SCRIPT_FORM_END);
WSContentSpaceButton(BUTTON_CONFIGURATION); WSContentSpaceButton(BUTTON_MANAGEMENT);
WSContentStop(); WSContentStop();
} }
@ -7897,8 +7897,12 @@ bool Xdrv10(uint8_t function)
} }
break; break;
#ifdef USE_WEBSERVER #ifdef USE_WEBSERVER
case FUNC_WEB_ADD_BUTTON: case FUNC_WEB_ADD_CONSOLE_BUTTON:
WSContentSend_P(HTTP_BTN_MENU_RULES); if (XdrvMailbox.index) {
XdrvMailbox.index++;
} else {
WSContentSend_P(HTTP_BTN_MENU_RULES);
}
break; break;
#ifdef USE_SCRIPT_WEB_DISPLAY #ifdef USE_SCRIPT_WEB_DISPLAY
case FUNC_WEB_ADD_MAIN_BUTTON: case FUNC_WEB_ADD_MAIN_BUTTON:

View File

@ -661,7 +661,7 @@ void UfsDirectory(void) {
} }
WSContentSend_P(UFS_FORM_SDC_DIRc); WSContentSend_P(UFS_FORM_SDC_DIRc);
WSContentSend_P(UFS_FORM_FILE_UPGb); WSContentSend_P(UFS_FORM_FILE_UPGb);
WSContentSpaceButton(BUTTON_CONFIGURATION); WSContentSpaceButton(BUTTON_MANAGEMENT);
WSContentStop(); WSContentStop();
Web.upload_file_type = UPL_UFSFILE; Web.upload_file_type = UPL_UFSFILE;
@ -1045,7 +1045,11 @@ bool Xdrv50(uint8_t function) {
#ifdef USE_WEBSERVER #ifdef USE_WEBSERVER
case FUNC_WEB_ADD_MANAGEMENT_BUTTON: case FUNC_WEB_ADD_MANAGEMENT_BUTTON:
if (ufs_type) { if (ufs_type) {
WSContentSend_PD(UFS_WEB_DIR, PSTR(D_MANAGE_FILE_SYSTEM)); if (XdrvMailbox.index) {
XdrvMailbox.index++;
} else {
WSContentSend_PD(UFS_WEB_DIR, PSTR(D_MANAGE_FILE_SYSTEM));
}
} }
break; break;
case FUNC_WEB_ADD_HANDLER: case FUNC_WEB_ADD_HANDLER:

View File

@ -636,7 +636,7 @@ void HandleBerryConsole(void)
WSContentFlush(); WSContentFlush();
_WSContentSend(HTTP_BERRY_STYLE_CMND); _WSContentSend(HTTP_BERRY_STYLE_CMND);
_WSContentSend(HTTP_BERRY_FORM_CMND); _WSContentSend(HTTP_BERRY_FORM_CMND);
WSContentSpaceButton(BUTTON_MAIN); WSContentSpaceButton(BUTTON_MANAGEMENT);
WSContentStop(); WSContentStop();
} }
@ -721,9 +721,13 @@ bool Xdrv52(uint8_t function)
// case FUNC_SET_POWER: // case FUNC_SET_POWER:
// break; // break;
#ifdef USE_WEBSERVER #ifdef USE_WEBSERVER
case FUNC_WEB_ADD_BUTTON: case FUNC_WEB_ADD_CONSOLE_BUTTON:
WSContentSend_P(HTTP_BTN_BERRY_CONSOLE); if (XdrvMailbox.index) {
callBerryEventDispatcher(PSTR("web_add_button"), nullptr, 0, nullptr); XdrvMailbox.index++;
} else {
WSContentSend_P(HTTP_BTN_BERRY_CONSOLE);
callBerryEventDispatcher(PSTR("web_add_button"), nullptr, 0, nullptr);
}
break; break;
case FUNC_WEB_ADD_MAIN_BUTTON: case FUNC_WEB_ADD_MAIN_BUTTON:
callBerryEventDispatcher(PSTR("web_add_main_button"), nullptr, 0, nullptr); callBerryEventDispatcher(PSTR("web_add_main_button"), nullptr, 0, nullptr);