TFT_ILI9163 icon indicating copy to clipboard operation
TFT_ILI9163 copied to clipboard

Bug when drawing lines fast

Open adlabac opened this issue 5 years ago • 5 comments

When FAST_LINE is enabled, color of many pixels will be wrong. Here is the example code:

#include <TFT_ILI9163.h>

TFT_ILI9163 tftDisplay = TFT_ILI9163();

void setup() {
  tftDisplay.init();
  tftDisplay.setRotation(1);
  tftDisplay.fillScreen(TFT_BLACK);

  for(int16_t i = 0; i < 128; i++) {
    tftDisplay.drawLine(0, 0, 159, i, 0x018E);
  }

  for(int16_t i = 0; i < 160; i++) {
    tftDisplay.drawLine(0, 0, i, 127, 0x018E);
  }
}

This example will generate the following image:

IMG_20200728_192206

adlabac avatar Jul 28 '20 17:07 adlabac

It is likely that the SPI clock rate is set too high. What rate are you using?

Bodmer avatar Jul 28 '20 21:07 Bodmer

I am using the default values. Since the system clock is 16 MHz, so the SPI speed should be 4 MHz. The MCU is ATmega328P.

adlabac avatar Jul 29 '20 08:07 adlabac

Sorry, that was a daft question. I am so used to folk using my TFT_eSPI library and trying to run displays at 80MHz SPI clock rate!

I suspect the timing optimisation in the library is too tight and thus borderline on failing with some setups. I don't have a test setup to check any changes but I will make some adjustments if you are willing to help experiment with settings.

Bodmer avatar Jul 29 '20 15:07 Bodmer

Sure, I will be glad to help. Also, noticed many warnings (when all compiler warnings are turned on in settings), mostly about unused variables. I can fork the repo and correct this, if you like.

adlabac avatar Jul 29 '20 18:07 adlabac

OK, warning correct would be helpful.

Bodmer avatar Jul 29 '20 19:07 Bodmer