From ec181d37c37d2ef1330689a8c344589db3dfdcaa Mon Sep 17 00:00:00 2001 From: gemu2015 Date: Fri, 4 Dec 2020 08:55:43 +0100 Subject: [PATCH] fix st7789 esp8266 --- lib/lib_display/Arduino_ST7789-gemu-1.0/Arduino_ST7789.cpp | 3 +++ tasmota/xdsp_12_ST7789.ino | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/lib_display/Arduino_ST7789-gemu-1.0/Arduino_ST7789.cpp b/lib/lib_display/Arduino_ST7789-gemu-1.0/Arduino_ST7789.cpp index 487af20de..f45b33095 100644 --- a/lib/lib_display/Arduino_ST7789-gemu-1.0/Arduino_ST7789.cpp +++ b/lib/lib_display/Arduino_ST7789-gemu-1.0/Arduino_ST7789.cpp @@ -212,6 +212,8 @@ void Arduino_ST7789::writedata(uint8_t c) { SPI_END_TRANSACTION(); } + + // Companion code to the above tables. Reads and issues // a series of LCD commands stored in PROGMEM byte array. void Arduino_ST7789::displayInit(const uint8_t *addr) { @@ -473,6 +475,7 @@ void Arduino_ST7789::fillRect(int16_t x, int16_t y, int16_t w, int16_t h, spiwrite(hi); spiwrite(lo); } + delay(0); } CS_HIGH(); SPI_END_TRANSACTION(); diff --git a/tasmota/xdsp_12_ST7789.ino b/tasmota/xdsp_12_ST7789.ino index cd0a20d69..3c85f168a 100644 --- a/tasmota/xdsp_12_ST7789.ino +++ b/tasmota/xdsp_12_ST7789.ino @@ -114,7 +114,11 @@ void ST7789_InitDriver() st7789 = new Arduino_ST7789(Pin(GPIO_SPI_DC), reset, cs, bppin); } else { if ((PinUsed(GPIO_SSPI_CS) || PinUsed(GPIO_OLED_RESET)) && PinUsed(GPIO_SSPI_MOSI) && PinUsed(GPIO_SSPI_SCLK) && PinUsed(GPIO_SSPI_DC)) { - st7789 = new Arduino_ST7789(Pin(GPIO_SSPI_DC), reset, Pin(GPIO_SSPI_MOSI), Pin(GPIO_SSPI_SCLK), cs, bppin); + if ((Pin(GPIO_SSPI_MOSI)==HW_SPI_MOSI) && (Pin(GPIO_SSPI_SCLK)==HW_SPI_CLK)) { + st7789 = new Arduino_ST7789(Pin(GPIO_SSPI_DC), reset, cs, bppin); + } else { + st7789 = new Arduino_ST7789(Pin(GPIO_SSPI_DC), reset, Pin(GPIO_SSPI_MOSI), Pin(GPIO_SSPI_SCLK), cs, bppin); + } } else { return; } @@ -122,6 +126,7 @@ void ST7789_InitDriver() st7789->init(Settings.display_width,Settings.display_height); renderer = st7789; renderer->DisplayInit(DISPLAY_INIT_MODE,Settings.display_size,Settings.display_rotate,Settings.display_font); + renderer->dim(Settings.display_dimmer); #ifdef SHOW_SPLASH // Welcome text