From 6d015d6e7c73a315eae435ad93c72c2a17c21926 Mon Sep 17 00:00:00 2001 From: Bodmer Date: Sun, 12 Feb 2023 19:30:46 +0000 Subject: [PATCH] Fix #2400 for GC9A01 An odd one this. Pixels get lost in a stream with the GC9A01. It appears the GC9A01 has a pixel stream time-out that stops new pixels in a started stream from being rendered. No other supported display behaves this way! This is a GC9A01 specific patch. --- TFT_eSPI.cpp | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/TFT_eSPI.cpp b/TFT_eSPI.cpp index 07e86c3..5c46bc8 100644 --- a/TFT_eSPI.cpp +++ b/TFT_eSPI.cpp @@ -4464,16 +4464,25 @@ void TFT_eSPI::drawWedgeLine(float ax, float ay, float bx, float by, float ar, f // Track edge to minimise calculations if (!endX) { endX = true; xs = xp; } if (alpha > HiAlphaTheshold) { - if (swin) { setWindow(xp, yp, width()-1, yp); swin = false; } - pushColor(fg_color); + #ifdef GC9A01_DRIVER + drawPixel(xp, yp, fg_color); + #else + if (swin) { setWindow(xp, yp, x1, yp); swin = false; } + pushColor(fg_color); + #endif continue; } //Blend color with background and plot if (bg_color == 0x00FFFFFF) { bg = readPixel(xp, yp); swin = true; } - if (swin) { setWindow(xp, yp, width()-1, yp); swin = false; } - pushColor(alphaBlend((uint8_t)(alpha * PixelAlphaGain), fg_color, bg)); + #ifdef GC9A01_DRIVER + uint16_t pcol = alphaBlend((uint8_t)(alpha * PixelAlphaGain); + drawPixel(xp, yp, pcol, fg_color, bg)); + #else + if (swin) { setWindow(xp, yp, x1, yp); swin = false; } + pushColor(alphaBlend((uint8_t)(alpha * PixelAlphaGain), fg_color, bg)); + #endif } } @@ -4492,16 +4501,25 @@ void TFT_eSPI::drawWedgeLine(float ax, float ay, float bx, float by, float ar, f // Track line boundary if (!endX) { endX = true; xs = xp; } if (alpha > HiAlphaTheshold) { - if (swin) { setWindow(xp, yp, width()-1, yp); swin = false; } - pushColor(fg_color); + #ifdef GC9A01_DRIVER + drawPixel(xp, yp, fg_color); + #else + if (swin) { setWindow(xp, yp, x1, yp); swin = false; } + pushColor(fg_color); + #endif continue; } //Blend colour with background and plot if (bg_color == 0x00FFFFFF) { bg = readPixel(xp, yp); swin = true; } - if (swin) { setWindow(xp, yp, width()-1, yp); swin = false; } - pushColor(alphaBlend((uint8_t)(alpha * PixelAlphaGain), fg_color, bg)); + #ifdef GC9A01_DRIVER + uint16_t pcol = alphaBlend((uint8_t)(alpha * PixelAlphaGain); + drawPixel(xp, yp, pcol, fg_color, bg)); + #else + if (swin) { setWindow(xp, yp, x1, yp); swin = false; } + pushColor(alphaBlend((uint8_t)(alpha * PixelAlphaGain), fg_color, bg)); + #endif } }