mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-24 11:16:34 +00:00
Add GUI sensor separators (#20495)
This commit is contained in:
parent
ee4bf86e6a
commit
637fac5ae8
@ -11,7 +11,8 @@ All notable changes to this project will be documented in this file.
|
||||
- SML support for IM350 (#20474)
|
||||
- LVGL `lv.str_arr` (#20480)
|
||||
- ESP32 MI BLE support for Xiaomi LYWSD02MMC (#20381)
|
||||
- LVGL option to add `lv.keyboard` extra widget
|
||||
- LVGL option to add `lv.keyboard` extra widget (#20496)
|
||||
- GUI sensor separators (#20495)
|
||||
|
||||
### Breaking Changed
|
||||
|
||||
|
@ -128,6 +128,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
|
||||
- Support for pipsolar inverter [#20408](https://github.com/arendst/Tasmota/issues/20408)
|
||||
- Support for HardwareSerial invert [#15461](https://github.com/arendst/Tasmota/issues/15461)
|
||||
- SML support for IM350 [#20474](https://github.com/arendst/Tasmota/issues/20474)
|
||||
- GUI sensor separators [#20495](https://github.com/arendst/Tasmota/issues/20495)
|
||||
- ESP32 used UART information
|
||||
- ESP32 experimental support GPIOViewer when ``define USE_ESP32_GPIO_VIEWER`` is enabled
|
||||
- ESP32 MI BLE support for Xiaomi LYWSD02MMC [#20381](https://github.com/arendst/Tasmota/issues/20381)
|
||||
@ -145,6 +146,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
|
||||
- Berry `tasmota.webcolor` [#20454](https://github.com/arendst/Tasmota/issues/20454)
|
||||
- Berry `debug.caller` [#20470](https://github.com/arendst/Tasmota/issues/20470)
|
||||
- LVGL `lv.str_arr` [#20480](https://github.com/arendst/Tasmota/issues/20480)
|
||||
- LVGL option to add `lv.keyboard` extra widget [#20496](https://github.com/arendst/Tasmota/issues/20496)
|
||||
- HASPmota `haspmota.page_show()` to change page [#20333](https://github.com/arendst/Tasmota/issues/20333)
|
||||
- HASPmota type `chart` [#20372](https://github.com/arendst/Tasmota/issues/20372)
|
||||
- Matter support for password for remote Tasmota devices [#20296](https://github.com/arendst/Tasmota/issues/20296)
|
||||
|
@ -934,6 +934,7 @@ const float kSpeedConversionFactor[] = {1, // none
|
||||
// xdrv_02_webserver.ino
|
||||
#ifdef USE_WEBSERVER
|
||||
// {s} = <tr><th>, {m} = </th><td>, {e} = </td></tr>
|
||||
const char HTTP_SNS_HR[] PROGMEM = "<tr><td colspan=2><hr/>{e}";
|
||||
const char HTTP_SNS_F_TEMP[] PROGMEM = "{s}%s " D_TEMPERATURE "{m}%*_f " D_UNIT_DEGREE "%c{e}";
|
||||
const char HTTP_SNS_F_VOLTAGE[] PROGMEM = "{s}%s " D_VOLTAGE "{m}%*_f " D_UNIT_VOLT "{e}";
|
||||
const char HTTP_SNS_F_CURRENT_MA[] PROGMEM = "{s}%s " D_CURRENT "{m}%*_f " D_UNIT_MILLIAMPERE "{e}";
|
||||
|
@ -833,6 +833,8 @@ void _WSContentSendBuffer(bool decimal, const char * formatP, va_list arg) {
|
||||
int len = strlen(content);
|
||||
if (0 == len) { return; } // No content
|
||||
|
||||
WSContentSeparator(2); // Print separator on next WSContentSeparator(1)
|
||||
|
||||
if (decimal && (D_DECIMAL_SEPARATOR[0] != '.')) {
|
||||
for (uint32_t i = 0; i < len; i++) {
|
||||
if ('.' == content[i]) {
|
||||
@ -982,6 +984,24 @@ void WSContentSpaceButton(uint32_t title_index, bool show=true) {
|
||||
WSContentButton(title_index, show);
|
||||
}
|
||||
|
||||
void WSContentSeparator(uint32_t state) {
|
||||
// Send two column separator
|
||||
static bool request = false;
|
||||
switch (state) {
|
||||
case 0: // Print separator (fall through to WSContentSeparator(1))
|
||||
request = true;
|
||||
case 1: // Print separator if needed
|
||||
if (request) {
|
||||
WSContentSend_P(HTTP_SNS_HR); // <tr><td colspan=2><hr/>{e}
|
||||
request = false;
|
||||
}
|
||||
break;
|
||||
case 2: // Print separator on next WSContentSeparator(1)
|
||||
request = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void WSContentSend_Temp(const char *types, float f_temperature) {
|
||||
WSContentSend_PD(HTTP_SNS_F_TEMP, types, Settings->flag2.temperature_resolution, &f_temperature, TempUnit());
|
||||
}
|
||||
@ -1467,12 +1487,14 @@ bool HandleRootStatusRefresh(void)
|
||||
#else
|
||||
WSContentBegin(200, CT_HTML);
|
||||
#endif // USE_WEB_SSE
|
||||
WSContentSend_P(PSTR("{t}"));
|
||||
|
||||
WSContentSend_P(PSTR("{t}")); // <table style='width:100%'>
|
||||
WSContentSeparator(0); // Print separator
|
||||
if (Settings->web_time_end) {
|
||||
WSContentSend_P(PSTR("{s}" D_TIMER_TIME "{m}%s{e}"), GetDateAndTime(DT_LOCAL).substring(Settings->web_time_start, Settings->web_time_end).c_str());
|
||||
WSContentSeparator(0); // Print separator
|
||||
}
|
||||
XsnsXdrvCall(FUNC_WEB_SENSOR);
|
||||
|
||||
WSContentSend_P(PSTR("</table>"));
|
||||
|
||||
if (TasmotaGlobal.devices_present) {
|
||||
|
@ -1409,7 +1409,7 @@ void EnergyShow(bool json) {
|
||||
// {s}</th><th></th><th>Head1</th><th></th><th>Head2</th><th></th><td>{e}
|
||||
// {s}</th><th></th><th>Head1</th><th></th><th>Head2</th><th></th><th>Head3</th><th></th><td>{e}
|
||||
// {s}</th><th></th><th>Head1</th><th></th><th>Head2</th><th></th><th>Head3</th><th></th><th>Head4</th><th></th><td>{e}
|
||||
WSContentSend_P(PSTR("</table><hr/>{t}{s}</th><th></th>")); // First column is empty ({t} = <table style='width:100%'>, {s} = <tr><th>)
|
||||
WSContentSend_P(PSTR("</table>{t}{s}</th><th></th>")); // First column is empty ({t} = <table style='width:100%'>, {s} = <tr><th>)
|
||||
bool label_o = voltage_common;
|
||||
bool no_label = (1 == Energy->phase_count);
|
||||
char number[4];
|
||||
@ -1448,7 +1448,7 @@ void EnergyShow(bool json) {
|
||||
WSContentSend_PD(HTTP_SNS_EXPORT_ACTIVE, WebEnergyFmt(Energy->export_active, Settings->flag2.energy_resolution, single));
|
||||
}
|
||||
XnrgCall(FUNC_WEB_COL_SENSOR);
|
||||
WSContentSend_P(PSTR("</table><hr/>{t}")); // {t} = <table style='width:100%'> - Define for next FUNC_WEB_SENSOR
|
||||
WSContentSend_P(PSTR("</table>{t}")); // {t} = <table style='width:100%'> - Define for next FUNC_WEB_SENSOR
|
||||
XnrgCall(FUNC_WEB_SENSOR);
|
||||
#endif // USE_WEBSERVER
|
||||
}
|
||||
|
@ -1667,7 +1667,7 @@ void EnergyShow(bool json) {
|
||||
Energy->gui_count = relay_show - Energy->gui_offset;
|
||||
if (Energy->gui_count > Energy->Settings.gui_cols) { Energy->gui_count = Energy->Settings.gui_cols; }
|
||||
|
||||
WSContentSend_P(PSTR("</table><hr/>")); // Close current table as we will use different column count
|
||||
WSContentSend_P(PSTR("</table>")); // Close current table as we will use different column count
|
||||
bool label_o = voltage_common;
|
||||
if (ENERGY_DISPLAY_TABS == Energy->Settings.gui_display) {
|
||||
uint32_t tabs = (relay_show -1 + Energy->Settings.gui_cols) / Energy->Settings.gui_cols;
|
||||
@ -1731,7 +1731,7 @@ void EnergyShow(bool json) {
|
||||
}
|
||||
|
||||
XnrgCall(FUNC_WEB_COL_SENSOR);
|
||||
WSContentSend_P(PSTR("</table><hr/>{t}")); // {t} = <table style='width:100%'> - Define for next FUNC_WEB_SENSOR
|
||||
WSContentSend_P(PSTR("</table>{t}")); // {t} = <table style='width:100%'> - Define for next FUNC_WEB_SENSOR
|
||||
XnrgCall(FUNC_WEB_SENSOR);
|
||||
}
|
||||
#endif // USE_WEBSERVER
|
||||
|
@ -2283,7 +2283,7 @@ void SSPMEnergyShow(bool json) {
|
||||
uint32_t offset = (Sspm->rotate >> 2) * 4;
|
||||
uint32_t count = relay_show - offset;
|
||||
if (count > 4) { count = 4; }
|
||||
WSContentSend_P(PSTR("</table><hr/>")); // Close current table as we will use different column count
|
||||
WSContentSend_P(PSTR("</table>")); // Close current table as we will use different column count
|
||||
if (SPM_DISPLAY_TABS == Sspm->Settings.flag.display) {
|
||||
uint32_t modules = relay_show / 4;
|
||||
if (modules > 1) {
|
||||
@ -2317,7 +2317,7 @@ void SSPMEnergyShow(bool json) {
|
||||
WSContentSend_PD(HTTP_SNS_ENERGY_TODAY, SSPMEnergyFormat(value_chr, Sspm->energy_today[0], Settings->flag2.energy_resolution, indirect, offset, count));
|
||||
WSContentSend_PD(HTTP_SNS_ENERGY_YESTERDAY, SSPMEnergyFormat(value_chr, Sspm->Settings.energy_yesterday[0], Settings->flag2.energy_resolution, indirect, offset, count));
|
||||
WSContentSend_PD(HTTP_SNS_ENERGY_TOTAL, SSPMEnergyFormat(value_chr, Sspm->energy_total[0], Settings->flag2.energy_resolution, indirect, offset, count));
|
||||
WSContentSend_P(PSTR("</table><hr/>{t}")); // {t} = <table style='width:100%'> - Define for next FUNC_WEB_SENSOR
|
||||
WSContentSend_P(PSTR("</table>{t}")); // {t} = <table style='width:100%'> - Define for next FUNC_WEB_SENSOR
|
||||
}
|
||||
#endif // USE_WEBSERVER
|
||||
}
|
||||
|
@ -1147,6 +1147,8 @@ bool XdrvCall(uint32_t function) {
|
||||
|
||||
result = xdrv_func_ptr[x](function);
|
||||
|
||||
if (FUNC_WEB_SENSOR == function) { WSContentSeparator(1); } // Show separator if needed
|
||||
|
||||
#ifdef USE_PROFILE_FUNCTION
|
||||
#ifdef XFUNC_PTR_IN_ROM
|
||||
uint32_t index = pgm_read_byte(kXdrvList + x);
|
||||
|
@ -1130,6 +1130,8 @@ bool XsnsCall(uint32_t function) {
|
||||
|
||||
result = xsns_func_ptr[x](function);
|
||||
|
||||
if (FUNC_WEB_SENSOR == function) { WSContentSeparator(1); } // Show separator if needed
|
||||
|
||||
#ifdef USE_PROFILE_FUNCTION
|
||||
#ifdef XFUNC_PTR_IN_ROM
|
||||
uint32_t index = pgm_read_byte(kXsnsList + x);
|
||||
|
Loading…
x
Reference in New Issue
Block a user