arduino-libraries / Arduino_GigaDisplay_GFX

Mozilla Public License 2.0
7 stars 4 forks source link

fillScreen: trigger a redraw of the screen #3

Open KurtE opened 8 months ago

KurtE commented 8 months ago

From the Forum thread: https://forum.arduino.cc/t/problem-with-fillscreen/1218319

The following sketch does not show anything on the screen:

#include "Arduino.h"
//#include "SPI.h"
#include "Arduino_GigaDisplay_GFX.h"

GigaDisplay_GFX tft;

#define GC9A01A_CYAN    0x07FF
#define GC9A01A_RED     0xf800
#define GC9A01A_BLUE    0x001F
#define GC9A01A_GREEN   0x07E0
#define GC9A01A_MAGENTA 0xF81F
#define GC9A01A_WHITE   0xffff
#define GC9A01A_BLACK   0x0000
#define GC9A01A_YELLOW  0xFFE0
#define WHITE 0xffff
#define BLACK 0x0000

void setup() {

  Serial.begin(115200);

  tft.begin();

  tft.fillScreen(GC9A01A_GREEN);
  yield();
  delay(3000);
  tft.fillScreen(GC9A01A_BLUE);
  yield();
  delay(3000);
  tft.fillScreen(GC9A01A_YELLOW);
  Serial.println("Done");

}

void loop() {
  // put your main code here, to run repeatedly:

}

Problem was you implemented your own version of fillScreen, which did not have the startWrite() and more specific endWrite() calls in it, and as such your dirty flag was not set.

gilesp1729 commented 5 months ago

The same fix also needs to be applied to drawFastRawH/Vline.