From 61cecdef2f63a81c7a89239b5e89f61e381749cf Mon Sep 17 00:00:00 2001 From: s-hadinger <49731213+s-hadinger@users.noreply.github.com> Date: Mon, 26 Apr 2021 13:49:42 +0200 Subject: [PATCH] Udisplay finegrain delay (#11894) * uDisplay add 10ms delay and log * Silly bug Co-authored-by: Stephan Hadinger --- lib/lib_display/UDisplay/uDisplay.cpp | 17 ++++++++++++++--- tasmota/displaydesc/ST7789_desc.txt | 3 +-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/lib/lib_display/UDisplay/uDisplay.cpp b/lib/lib_display/UDisplay/uDisplay.cpp index 61d578b43..b8830636a 100755 --- a/lib/lib_display/UDisplay/uDisplay.cpp +++ b/lib/lib_display/UDisplay/uDisplay.cpp @@ -514,9 +514,20 @@ Renderer *uDisplay::Init(void) { #ifdef UDSP_DEBUG Serial.printf("\n"); #endif - if (args & 0x80) { - if (args&0x60) delay(500); - else delay(150); + if (args & 0x80) { // delay after the command + uint32_t delay_ms = 0; + switch (args & 0xE0) { + case 0x80: delay_ms = 150; break; + case 0xA0: delay_ms = 10; break; + case 0xE0: delay_ms = 500; break; + } + if (delay_ms > 0) { + delay(delay_ms); +#ifdef UDSP_DEBUG + Serial.printf("delay %d ms\n", delay_ms); +#endif + } + } if (index >= dsp_ncmds) break; } diff --git a/tasmota/displaydesc/ST7789_desc.txt b/tasmota/displaydesc/ST7789_desc.txt index 6b21397ac..be21b135f 100644 --- a/tasmota/displaydesc/ST7789_desc.txt +++ b/tasmota/displaydesc/ST7789_desc.txt @@ -1,4 +1,3 @@ - :H,ST7789,240,240,16,SPI,1,*,*,*,*,*,*,*,40 :S,2,1,3,0,80,30 :I @@ -17,6 +16,6 @@ :1,A0,50,00,01 :2,00,00,00,02 :3,60,00,00,03 -i:20,21 +:i,20,21 :TI2,38,32,23 #