From 2f7eefa8f48249b5ef3a957ad10473a5c7e0e7bd Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Wed, 17 Mar 2021 17:26:00 +0100 Subject: [PATCH] Fix some display issues Fix some display issues (#11358) --- tasmota/tasmota_template.h | 3 ++- tasmota/xdrv_13_display.ino | 2 +- tasmota/xdsp_04_ili9341.ino | 13 ++++++------- tasmota/xdsp_interface.ino | 2 -- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/tasmota/tasmota_template.h b/tasmota/tasmota_template.h index bffb281bf..41df68ff8 100644 --- a/tasmota/tasmota_template.h +++ b/tasmota/tasmota_template.h @@ -410,11 +410,13 @@ const uint16_t kGpioNiceList[] PROGMEM = { AGPIO(GPIO_SDCARD_CS), #endif // USE_SDCARD #endif // USE_SPI + AGPIO(GPIO_SSPI_MISO), // Software SPI Master Input Client Output AGPIO(GPIO_SSPI_MOSI), // Software SPI Master Output Client Input AGPIO(GPIO_SSPI_SCLK), // Software SPI Serial Clock AGPIO(GPIO_SSPI_CS), // Software SPI Chip Select AGPIO(GPIO_SSPI_DC), // Software SPI Data or Command + #ifdef USE_DISPLAY #ifdef USE_DISPLAY_ILI9341 AGPIO(GPIO_ILI9341_CS), @@ -422,7 +424,6 @@ const uint16_t kGpioNiceList[] PROGMEM = { #ifdef USE_XPT2046 AGPIO(GPIO_XPT2046_CS), // XPT2046 SPI Chip Select #endif - #endif // USE_DISPLAY_ILI9341 #ifdef USE_DISPLAY_ILI9488 AGPIO(GPIO_ILI9488_CS), diff --git a/tasmota/xdrv_13_display.ino b/tasmota/xdrv_13_display.ino index e73b611e4..a3586c14d 100755 --- a/tasmota/xdrv_13_display.ino +++ b/tasmota/xdrv_13_display.ino @@ -1932,7 +1932,7 @@ void CmndDisplayFont(void) void CmndDisplayILIMOde(void) { - if ((XdrvMailbox.payload >= 1) && (XdrvMailbox.payload < 16)) { + if ((XdrvMailbox.payload >= 1) && (XdrvMailbox.payload <= 7)) { Settings.display_options.ilimode = XdrvMailbox.payload; TasmotaGlobal.restart_flag = 2; } diff --git a/tasmota/xdsp_04_ili9341.ino b/tasmota/xdsp_04_ili9341.ino index 599964ab9..737b9376f 100644 --- a/tasmota/xdsp_04_ili9341.ino +++ b/tasmota/xdsp_04_ili9341.ino @@ -23,6 +23,8 @@ #define XDSP_04 4 +enum IliModes { ILIMODE_9341 = 1, ILIMODE_9342, ILIMODE_MAX }; + #include extern uint8_t *buffer; @@ -37,13 +39,10 @@ uint8_t ili9342_ctouch_counter = 0; uint8_t ili9342_ctouch_counter = 0; #endif // USE_FT5206 - bool tft_init_done = false; -#define ILI9341_ID 1 -#define ILI9342_ID 2 -//Settings.display_options.ilimode = ILI9341_ID; +//Settings.display_options.ilimode = ILIMODE_9341; /*********************************************************************************************/ @@ -66,8 +65,8 @@ void ILI9341_InitDriver() // disable screen buffer buffer = NULL; - if (!Settings.display_options.ilimode) { - Settings.display_options.ilimode = ILI9341_ID; + if (!Settings.display_options.ilimode || (Settings.display_options.ilimode >= ILIMODE_MAX)) { + Settings.display_options.ilimode = ILIMODE_9341; } // default colors @@ -102,7 +101,7 @@ void ILI9341_InitDriver() renderer->setTextFont(2); renderer->setTextSize(1); renderer->setTextColor(ILI9341_WHITE, ILI9341_BLACK); - renderer->DrawStringAt(50, (Settings.display_height/2)-12, (Settings.display_options.ilimode & 3)==ILI9341_ID?"ILI9341 TFT!":"ILI9342 TFT!", ILI9341_WHITE, 0); + renderer->DrawStringAt(50, (Settings.display_height/2)-12, (Settings.display_options.ilimode & 3)==ILIMODE_9341?"ILI9341 TFT!":"ILI9342 TFT!", ILI9341_WHITE, 0); delay(1000); #endif // SHOW_SPLASH diff --git a/tasmota/xdsp_interface.ino b/tasmota/xdsp_interface.ino index 3ca49f3d6..d404e169e 100644 --- a/tasmota/xdsp_interface.ino +++ b/tasmota/xdsp_interface.ino @@ -17,7 +17,6 @@ along with this program. If not, see . */ -#if defined(USE_I2C) || defined(USE_SPI) #ifdef USE_DISPLAY #ifdef XFUNC_PTR_IN_ROM @@ -201,4 +200,3 @@ bool XdspCall(uint8_t Function) } #endif // USE_DISPLAY -#endif // USE_I2C or USE_SPI