diff --git a/CHANGELOG.md b/CHANGELOG.md index 0237d2c8d..06748a8cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ All notable changes to this project will be documented in this file. - Dingtian define `DINGTIAN_INPUTS_INVERTED` replaced by `SetOption81` (#24364) ### Fixed +- Udisplay SPI driver display dimension parameters regression from v15.1.0.1 (#24376) ### Removed diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 02e7fa1d3..ea64a88eb 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -138,6 +138,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm - ScrubDNS() function [#23886](https://github.com/arendst/Tasmota/issues/23886) - GDK101 power on detection [#24242](https://github.com/arendst/Tasmota/issues/24242) - Udisplay backlight with SPI displays [#24277](https://github.com/arendst/Tasmota/issues/24277) +- Udisplay SPI driver display dimension parameters regression from v15.1.0.1 [#24376](https://github.com/arendst/Tasmota/issues/24376) - Display ST77xx and Parallel issues introduced after refactor UDisplay [#24368](https://github.com/arendst/Tasmota/issues/24368) - DALI watchdog exception - TuyaMCU v1 exception 28 regression from v15.1.0.1 reverted PR24063 [#24220](https://github.com/arendst/Tasmota/issues/24220) diff --git a/lib/lib_display/UDisplay/include/uDisplay_SPI_panel.h b/lib/lib_display/UDisplay/include/uDisplay_SPI_panel.h index ca8cafb97..3326dee73 100644 --- a/lib/lib_display/UDisplay/include/uDisplay_SPI_panel.h +++ b/lib/lib_display/UDisplay/include/uDisplay_SPI_panel.h @@ -98,6 +98,8 @@ private: // ===== Display State ===== uint8_t rotation; // Current rotation (0-3) + uint16_t width; // Current width + uint16_t height; // Current height int16_t window_x0, window_y0, window_x1, window_y1; bool display_on; bool inverted; diff --git a/lib/lib_display/UDisplay/src/uDisplay_SPI_panel.cpp b/lib/lib_display/UDisplay/src/uDisplay_SPI_panel.cpp index 2ed3f47a4..1373dcc88 100644 --- a/lib/lib_display/UDisplay/src/uDisplay_SPI_panel.cpp +++ b/lib/lib_display/UDisplay/src/uDisplay_SPI_panel.cpp @@ -14,6 +14,8 @@ SPIPanel::SPIPanel(const SPIPanelConfig& config, : spi(spi_ctrl), cfg(config), fb_buffer(framebuffer), rotation(0), display_on(true), inverted(false) { + width = cfg.width; + height = cfg.height; // Initialize address window state window_x0 = 0; window_y0 = 0; @@ -31,7 +33,7 @@ SPIPanel::~SPIPanel() { bool SPIPanel::drawPixel(int16_t x, int16_t y, uint16_t color) { // From original uDisplay::drawPixel - only handle direct SPI drawing for color TFTs - if ((x < 0) || (x >= cfg.width) || (y < 0) || (y >= cfg.height)) return true; + if ((x < 0) || (x >= width) || (y < 0) || (y >= height)) return true; // Only handle direct SPI drawing for color displays without framebuffer if (!fb_buffer && cfg.bpp >= 16) { @@ -64,9 +66,9 @@ bool SPIPanel::drawPixel(int16_t x, int16_t y, uint16_t color) { bool SPIPanel::fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color) { // From original uDisplay::fillRect - if((x >= cfg.width) || (y >= cfg.height)) return true; - if((x + w - 1) >= cfg.width) w = cfg.width - x; - if((y + h - 1) >= cfg.height) h = cfg.height - y; + if((x >= width) || (y >= height)) return true; + if((x + w - 1) >= width) w = width - x; + if((y + h - 1) >= height) h = height - y; // Only handle direct SPI drawing for color displays without framebuffer if (!fb_buffer && cfg.bpp >= 16) { @@ -327,6 +329,18 @@ bool SPIPanel::setRotation(uint8_t rot) { } spi->csHigh(); spi->endTransaction(); + switch (rotation) { + case 0: + case 2: + width = cfg.width; + height = cfg.height; + break; + case 1: + case 3: + width = cfg.height; + height = cfg.width; + break; + } return true; } spi->csHigh(); @@ -340,8 +354,8 @@ bool SPIPanel::updateFrame() { if (!fb_buffer || cfg.bpp != 1) return false; // OLED page-based framebuffer update (from original code) - uint8_t ys = cfg.height >> 3; - uint8_t xs = cfg.width >> 3; + uint8_t ys = height >> 3; + uint8_t xs = width >> 3; uint8_t m_row = cfg.cmd_set_addr_y; // saw_2 in original uint8_t m_col = 0; // i2c_col_start in original