TFT_eSPI icon indicating copy to clipboard operation
TFT_eSPI copied to clipboard

Anti-Aliasing not always working in 8-Bit parallel mode

Open melektron opened this issue 3 years ago • 1 comments

Problem: When using 8-Bit parallel mode to interface the ILI9341 (or in theory any other) driver, some anti aliased drawing methods (specifically the ones using the drawWedgeLine() method under the hood) don't work when not supplying a fixed background color but rather reading the color from the display.

This is due to an oversight in the readPixel() method which always sets the CS pin of the display to high (using the CS_H macro) after it is done reading the pixel in PARALLEL mode. In SPI mode, the inTransaction flag is saved and the write transaction restored after the read operation of the pixel has been completed. This also reselects the display by pulling the CS pin low. In addition to that, in SPI mode the CS line and other status flags are controlled using the begin_tft_read() and end_tft_read() methods while the parallel implementation simply sets the CS value using the CS_L and CS_H macro, ignoring the other status flags. (Have I missed a good reason for this implementation or was it simply an oversight?)

Effects: When trying to draw to the screen using the drawWedgeLine() method or methods that utilize drawWedgeLine(), only a few pixels will be drawn to the screen until the first edge pixel is reached where the previous color has to be read from the screen. Any subsequent operations until the method returns show no effect because the CS line will not be set low again after reading the pixel. Sometimes nothing might show up on the screen at all, when the first pixel to be drawn already requires an alpha blend.

Fix: To fix the issue, I have modified the readPixel() method and created a pull request where I will explain what I have changed in more detail.

Some more information about my setup: IDE: PlatformIO TFT_eSPI library version: 2.4.75 (latest at time of writing) Processor: ESP32 (WROOM32 on Generic ESP32 Dev Module) TFT driver: ILI9341 Interface type: parallel

melektron avatar Aug 15 '22 15:08 melektron

Thanks for identifying the problem. I will look at your pull request when I am able to run some tests.

Bodmer avatar Aug 17 '22 20:08 Bodmer