From b3b969978283df8da352e9d7580642caaeddbb28 Mon Sep 17 00:00:00 2001
From: Theo Arends <11044339+arendst@users.noreply.github.com>
Date: Sun, 15 Dec 2024 00:32:51 +0100
Subject: [PATCH] Display related fixes
- CHange Display removed PWM control of backlight GPIO for universal display regression from v14.1.0
- Fix Display DisplayMode adds a display device while not configured
- Fix GUI intermittent exception on screen updates due to flash access
---
CHANGELOG.md | 5 +-
RELEASENOTES.md | 5 +-
tasmota/tasmota_support/support.ino | 3 +
.../xdrv_01_9_webserver.ino | 20 ++++---
.../tasmota_xdrv_driver/xdrv_13_display.ino | 56 ++++++++++---------
5 files changed, 52 insertions(+), 37 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e14afd0d6..e705f0533 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,18 +6,21 @@ All notable changes to this project will be documented in this file.
## [14.4.0.1]
### Added
- MCP23XXX_DRV control register IOCON in template (#22622)
-- TLS add support for ECDSA on ESP32
+- ESP32 support for TLS ECDSA (#22649)
### Breaking Changed
### Changed
- Berry make Leds animate calls reentrant (#22643)
- SSL clean up remnants of old fingerprint algorithm (#22645)
+- Display removed PWM control of backlight GPIO for universal display regression from v14.1.0
### Fixed
- ESP32 rules operation priority regression from v13.3.0.4 (#22636)
- GUI display power button regression from v14.3.0.5 (#15788)
- MCP23xxx, PCF8574 and Shift595 power control when a display is configured regression from v14.3.0.7
+- Display DisplayMode adds a display device while not configured
+- GUI intermittent exception on screen updates due to flash access
### Removed
diff --git a/RELEASENOTES.md b/RELEASENOTES.md
index d2433f585..89ec06e2f 100644
--- a/RELEASENOTES.md
+++ b/RELEASENOTES.md
@@ -117,14 +117,17 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
## Changelog v14.4.0.1
### Added
- MCP23XXX_DRV control register IOCON in template [#22622](https://github.com/arendst/Tasmota/issues/22622)
+- ESP32 support for TLS ECDSA [#22649](https://github.com/arendst/Tasmota/issues/22649)
### Breaking Changed
### Changed
+- Display removed PWM control of backlight GPIO for universal display regression from v14.1.0
+- SSL clean up remnants of old fingerprint algorithm [#22645](https://github.com/arendst/Tasmota/issues/22645)
- Berry make Leds animate calls reentrant [#22643](https://github.com/arendst/Tasmota/issues/22643)
-- SSL clean up remnants of old fingerprint algorithm (#22645)[#22645](https://github.com/arendst/Tasmota/issues/22645)
### Fixed
+- Display DisplayMode adds a display device while not configured
- GUI display power button regression from v14.3.0.5 [#15788](https://github.com/arendst/Tasmota/issues/15788)
- MCP23xxx, PCF8574 and Shift595 power control when a display is configured regression from v14.3.0.7
- ESP32 rules operation priority regression from v13.3.0.4 [#22636](https://github.com/arendst/Tasmota/issues/22636)
diff --git a/tasmota/tasmota_support/support.ino b/tasmota/tasmota_support/support.ino
index 7d34b6c51..4caa4bdf4 100755
--- a/tasmota/tasmota_support/support.ino
+++ b/tasmota/tasmota_support/support.ino
@@ -835,6 +835,9 @@ int32_t UpdateDevicesPresent(int32_t change) {
// AddLog(LOG_LEVEL_DEBUG, PSTR("APP: Max 32 devices supported"));
}
TasmotaGlobal.devices_present = devices_present;
+
+// AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("DVC: DevicesPresent %d, Change %d"), TasmotaGlobal.devices_present, change);
+
return difference;
}
diff --git a/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino b/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino
index db4e9540c..5c9f55e5a 100644
--- a/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino
+++ b/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino
@@ -1289,7 +1289,7 @@ void WebGetDeviceCounts(void) {
}
#endif // USE_SHUTTER
-// AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("HTP: DP %d, BNLNS %d, SB %08X"), TasmotaGlobal.devices_present, Web.buttons_non_light_non_shutter, Web.light_shutter_button_mask);
+// AddLog(LOG_LEVEL_DEBUG, PSTR("HTP: DP %d, BNLNS %d, SB %08X"), TasmotaGlobal.devices_present, Web.buttons_non_light_non_shutter, Web.light_shutter_button_mask);
}
#ifdef USE_LIGHT
@@ -1374,7 +1374,6 @@ void HandleRoot(void) {
if (TasmotaGlobal.devices_present) {
WebGetDeviceCounts();
- uint32_t button_idx = 1;
if (Web.buttons_non_light_non_shutter) { // Any non light AND non shutter button - Show toggle buttons
WSContentSend_P(HTTP_TABLE100); // "
"
WSContentSend_P(PSTR(""));
@@ -1400,7 +1399,7 @@ void HandleRoot(void) {
if (Web.buttons_non_light_non_shutter % rows) { cols++; }
uint32_t button_ptr = 0;
- for (button_idx = 1; button_idx <= TasmotaGlobal.devices_present; button_idx++) {
+ for (uint32_t button_idx = 1; button_idx <= TasmotaGlobal.devices_present; button_idx++) {
if (bitRead(Web.light_shutter_button_mask, button_idx -1)) { continue; } // Skip non-sequential light and/or shutter button
bool set_button = ((button_idx <= MAX_BUTTON_TEXT) && strlen(GetWebButton(button_idx -1)));
snprintf_P(stemp, sizeof(stemp), PSTR(" %d"), button_idx);
@@ -1457,7 +1456,7 @@ void HandleRoot(void) {
if (TasmotaGlobal.light_type) { // Any light - Show light button and slider(s)
uint32_t light_device = LightDevice();
uint32_t light_devices = LightDevices();
- button_idx = light_device;
+ uint32_t button_idx = light_device;
WSContentSend_P(HTTP_TABLE100); // ""
@@ -1904,11 +1903,14 @@ bool HandleRootStatusRefresh(void) {
WSContentSend_P(PSTR("{t}"));
uint32_t cols = Web.buttons_non_light_non_shutter;
uint32_t fontsize = (cols < 5) ? 70 - (cols * 8) : 32;
- for (uint32_t idx = 1; idx <= Web.buttons_non_light_non_shutter; idx++) {
- if (bitRead(Web.light_shutter_button_mask, idx -1)) { continue; } // Skip non-sequential shutter button
- snprintf_P(svalue, sizeof(svalue), PSTR("%d"), bitRead(TasmotaGlobal.power, idx -1));
- WSContentSend_P(HTTP_DEVICE_STATE, 100 / cols, (bitRead(TasmotaGlobal.power, idx -1)) ? PSTR("bold") : PSTR("normal"), fontsize,
- (cols < 5) ? GetStateText(bitRead(TasmotaGlobal.power, idx -1)) : svalue);
+ uint32_t button_ptr = 0;
+ for (uint32_t button_idx = 1; button_idx <= TasmotaGlobal.devices_present; button_idx++) {
+ if (bitRead(Web.light_shutter_button_mask, button_idx -1)) { continue; } // Skip non-sequential shutter button
+ bool power_state = bitRead(TasmotaGlobal.power, button_idx -1);
+ snprintf_P(svalue, sizeof(svalue), PSTR("%d"), power_state);
+ WSContentSend_P(HTTP_DEVICE_STATE, 100 / cols, (power_state) ? "bold" : "normal", fontsize, (cols < 5) ? GetStateText(power_state) : svalue);
+ button_ptr++;
+ if (button_ptr == Web.buttons_non_light_non_shutter) { break; }
}
WSContentSend_P(PSTR("
"));
}
diff --git a/tasmota/tasmota_xdrv_driver/xdrv_13_display.ino b/tasmota/tasmota_xdrv_driver/xdrv_13_display.ino
index 9d2381a61..a6ebf1e6f 100644
--- a/tasmota/tasmota_xdrv_driver/xdrv_13_display.ino
+++ b/tasmota/tasmota_xdrv_driver/xdrv_13_display.ino
@@ -1852,57 +1852,61 @@ void DisplayLocalSensor(void)
\*********************************************************************************************/
void DisplayInitDriver(void) {
+ Settings->display_model = 0;
XdspCall(FUNC_DISPLAY_INIT_DRIVER);
// AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "Display model %d"), Settings->display_model);
- if (Settings->display_model) {
-// ApplyDisplayDimmer(); // Not allowed here. Way too early in init sequence. Global power state has not been set at this point in time
+ if (!Settings->display_model) { return; }
+
+// AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("DSP: Model %d"), Settings->display_model);
+
+// ApplyDisplayDimmer(); // Not allowed here. Way too early in init sequence. Global power state has not been set at this point in time
#ifdef USE_MULTI_DISPLAY
- Set_display(0);
+ Set_display(0);
#endif // USE_MULTI_DISPLAY
- if (renderer) {
- renderer->setTextFont(Settings->display_font);
- renderer->setTextSize(Settings->display_size);
- // force opaque mode
- renderer->setDrawMode(0);
+ if (renderer) {
+ renderer->setTextFont(Settings->display_font);
+ renderer->setTextSize(Settings->display_size);
+ // force opaque mode
+ renderer->setDrawMode(0);
- for (uint32_t cnt = 0; cnt < (MAX_INDEXCOLORS - PREDEF_INDEXCOLORS); cnt++) {
- index_colors[cnt] = 0;
- }
+ for (uint32_t cnt = 0; cnt < (MAX_INDEXCOLORS - PREDEF_INDEXCOLORS); cnt++) {
+ index_colors[cnt] = 0;
}
+ }
#ifdef USE_DT_VARS
- free_dt_vars();
+ free_dt_vars();
#endif
#ifdef USE_UFILESYS
- Display_Text_From_File(DISP_BATCH_FILE);
+ Display_Text_From_File(DISP_BATCH_FILE);
#endif
#ifdef USE_GRAPH
- for (uint8_t count = 0; count < NUM_GRAPHS; count++) { graph[count] = 0; }
+ for (uint8_t count = 0; count < NUM_GRAPHS; count++) { graph[count] = 0; }
#endif
- UpdateDevicesPresent(1);
- if (!PinUsed(GPIO_BACKLIGHT)) {
- if ((LT_PWM1 == TasmotaGlobal.light_type) && // Single PWM light channel
- ((4 == Settings->display_model) || // ILI9341 legacy
- (17 == Settings->display_model)) // Universal
- ) {
- UpdateDevicesPresent(-1); // Assume PWM channel is used for backlight
- }
+ UpdateDevicesPresent(1);
+ if (!PinUsed(GPIO_BACKLIGHT)) {
+ if ((LT_PWM1 == TasmotaGlobal.light_type) && // Single PWM light channel
+ (4 == Settings->display_model) // ILI9341 legacy
+// ((4 == Settings->display_model) || // ILI9341 legacy
+// (17 == Settings->display_model)) // Universal - Too invasive in case displays have no backlight pin
+ ) {
+ UpdateDevicesPresent(-1); // Assume PWM channel is used for backlight
}
- disp_device = TasmotaGlobal.devices_present;
+ }
+ disp_device = TasmotaGlobal.devices_present;
#ifndef USE_DISPLAY_MODES1TO5
- Settings->display_mode = 0;
+ Settings->display_mode = 0;
#else
- DisplayLogBufferInit();
+ DisplayLogBufferInit();
#endif // USE_DISPLAY_MODES1TO5
- }
}
void DisplaySetPower(void) {