From a4cf02335705ad1adc2bead9b506b2db3a96ab7b Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Tue, 12 Apr 2022 10:22:32 +0200 Subject: [PATCH] Add command ``SetOption138 1`` Add command ``SetOption138 1`` to switch GUI energy multi-column layout from left/center (0) to right (1) align (#15342) --- CHANGELOG.md | 2 ++ RELEASENOTES.md | 4 +++- tasmota/settings.h | 2 +- tasmota/xdrv_03_energy.ino | 24 +++++++++++++++--------- 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 349a774d5..7dc3ddfa5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ All notable changes to this project will be documented in this file. ## [11.0.0.7] ### Added - HX711 command ``Sensor34 10 0|1|`` to set HX711 fixed tare (0 = use auto tare, 1 = use calibrated tare, Any other value is user selected tare) +- Command ``SetOption138 1`` to switch GUI energy multi-column layout from left/center (0) to right (1) align (#15342) ### Changed - HX711 commands ``Sensor34 11 `` and ``Sensor34 12 `` to use HX711 absolute weight conversion (#15292) @@ -31,6 +32,7 @@ All notable changes to this project will be documented in this file. - Support for improv as used by esp-web-tools - Command ``IfxSensor 1`` to send non-teleperiod data to influxdb - ESP32 Support for OpenHASP v1.0 by Stephan Hadinger (#15307) +- Command ``SetOption137 1`` to avoid MQTT publish of defined Tuya CMDs if SO66 is active (#15267) ### Changed - Remove support for Internet Explorer by allowing ECMAScript6 syntax using less JavaScript code bytes (#15280) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 9d64b6a78..fb870429d 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -107,6 +107,8 @@ The latter links can be used for OTA upgrades too like ``OtaUrl http://ota.tasmo ### Added - Command ``SetOption135 1`` to disable LVGL splash screen - Command ``SetOption136 1`` to disable single sensor reports from Tuya devices while keeping teleperiod reports [#15216](https://github.com/arendst/Tasmota/issues/15216) +- Command ``SetOption137 1`` to avoid MQTT publish of defined Tuya CMDs if SO66 is active [#15267](https://github.com/arendst/Tasmota/issues/15267) +- Command ``SetOption138 1`` to switch GUI energy multi-column layout from left/center (0) to right (1) align [#15342](https://github.com/arendst/Tasmota/issues/15342) - Command ``SspmMap 0`` to reset Sonoff SPM default mapping - Command ``TcpConnect `` to add client connection mode [#14874](https://github.com/arendst/Tasmota/issues/14874) - Command ``RfTimeout 100..60000`` to disable duplicate RfReceive. Default 1000 [#15061](https://github.com/arendst/Tasmota/issues/15061) @@ -132,6 +134,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl http://ota.tasmo - ESP32 TasmotaSerial uart mapping to support multiple ``begin()`` and implement ``getUart()`` [#14981](https://github.com/arendst/Tasmota/issues/14981) ### Breaking Changed +- Remove support for Internet Explorer by allowing ECMAScript6 syntax using less JavaScript code bytes [#15280](https://github.com/arendst/Tasmota/issues/15280) ### Changed - Adafruit BusIO library from v1.0.10 to v1.11.0 @@ -139,7 +142,6 @@ The latter links can be used for OTA upgrades too like ``OtaUrl http://ota.tasmo - Sonoff SPM increase max number of relays supported to 32 (8 SPM-4Relay modules) - Extent number of pulsetimers from 8 to 32 [#8266](https://github.com/arendst/Tasmota/issues/8266) - Consolidate three RTC chip drivers (DS3231, BM8563, PCF85363) into one driver updating RTC as soon as possible after restart -- Remove support for Internet Explorer by allowing ECMAScript6 syntax using less JavaScript code bytes [#15280](https://github.com/arendst/Tasmota/issues/15280) - DS3231 I2C address define ``USE_RTC_ADDR`` into ``DS3231_ADDRESS`` - Display of energy values in GUI use columns when define ``USE_ENERGY_COLUMN_GUI`` is enabled (default) - ESP8266 Shrinked tasmota-minimal.bin by removing all commands except ``Upgrade``, ``Upload``, ``OtaUrl``, ``Seriallog``, ``Weblog`` and ``Restart`` diff --git a/tasmota/settings.h b/tasmota/settings.h index b179e0e14..f53be14d6 100644 --- a/tasmota/settings.h +++ b/tasmota/settings.h @@ -167,7 +167,7 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu uint32_t display_no_splash : 1; // bit 21 (v11.0.0.2) - SetOption135 - (Display & LVGL) forece disbabling default splash screen uint32_t tuyasns_no_immediate : 1; // bit 22 (v11.0.0.4) - SetOption136 - (TuyaSNS) When ON disable publish single SNS value on Tuya Receive (keep Teleperiod) uint32_t tuya_exclude_from_mqtt : 1; // bit 23 (v11.0.0.5) - SetOption137 - (Tuya) When Set, avoid the (MQTT-) publish of defined Tuya CMDs (see xdrv_16_tuyamcu.ino) if SetOption66 is active - uint32_t spare24 : 1; // bit 24 + uint32_t gui_table_align : 1; // bit 24 (v11.0.0.7) - SetOption138 - (GUI) Align (energy) table values left (0) or right (1) uint32_t spare25 : 1; // bit 25 uint32_t spare26 : 1; // bit 26 uint32_t spare27 : 1; // bit 27 diff --git a/tasmota/xdrv_03_energy.ino b/tasmota/xdrv_03_energy.ino index 506bb0238..d42f12c2d 100644 --- a/tasmota/xdrv_03_energy.ino +++ b/tasmota/xdrv_03_energy.ino @@ -178,13 +178,21 @@ char* WebEnergyFormat(char* result, float* input, uint32_t resolution, uint32_t } } #ifdef USE_ENERGY_COLUMN_GUI - ext_snprintf_P(result, TOPSZ *2, PSTR("")); // Skip first column - if ((Energy.phase_count > 1) && single) { // Need to set colspan so need a new column -// ext_snprintf_P(result, TOPSZ *2, PSTR("%s%*_f "), result, (Energy.phase_count *2) -1, resolution, &input[0]); - ext_snprintf_P(result, TOPSZ *2, PSTR("%s%*_f "), result, (Energy.phase_count *2) -1, resolution, &input[0]); + ext_snprintf_P(result, TOPSZ *2, PSTR("")); // Skip first column + if ((Energy.phase_count > 1) && single) { // Need to set colspan so need new columns + // 1.23  + // 1.23  + // 1.23  + ext_snprintf_P(result, TOPSZ *2, PSTR("%s%*_f "), + result, (Energy.phase_count *2) -1, (Settings->flag5.gui_table_align)?PSTR("right"):PSTR("center"), resolution, &input[0]); } else { + // 1.23  + // 1.23 1.23  + // 1.23 1.23 1.23  + // 1.23 1.23 1.23 1.23  for (uint32_t i = 0; i < Energy.phase_count; i++) { - ext_snprintf_P(result, TOPSZ *2, PSTR("%s%*_f "), result, resolution, &input[i]); + ext_snprintf_P(result, TOPSZ *2, PSTR("%s%*_f "), + result, (Settings->flag5.gui_table_align)?PSTR("right"):PSTR("left"), resolution, &input[i]); } } ext_snprintf_P(result, TOPSZ *2, PSTR("%s"), result); @@ -1234,19 +1242,17 @@ void EnergyShow(bool json) { #ifdef USE_WEBSERVER } else { #ifdef USE_ENERGY_COLUMN_GUI - // Need a new table supporting more columns - + // Need a new table supporting more columns using empty columns (with   in data rows) as easy column spacing // {s}Head1{e} // {s}Head1Head2{e} // {s}Head1Head2Head3{e} - + // {s}Head1Head2Head3Head4{e} WSContentSend_P(PSTR("{t}{s}")); // First column is empty ({t} = , {s} = "), (no_label)?"":"L", (no_label)?"":itoa(i +1, value_chr, 10)); } WSContentSend_P(PSTR(") - #endif // USE_ENERGY_COLUMN_GUI if (Energy.voltage_available) { WSContentSend_PD(HTTP_SNS_VOLTAGE, WebEnergyFormat(value_chr, Energy.voltage, Settings->flag2.voltage_resolution, Energy.voltage_common));
) bool no_label = Energy.voltage_common || (1 == Energy.phase_count); for (uint32_t i = 0; i < Energy.phase_count; i++) { WSContentSend_P(PSTR("%s%s{e}")); // Last column is units ({e} =