Not sure if this is a Giga display problem, or something in the underlying Adafruit GFX library...
I ran the demo in the Arduino_GigaDisplay_GFX repo and noticed that one section
(the tests for drawFastH/VLine) was not being displayed.
The sketch is a cut down version of the demo in the Arduino_GigaDisplay_GFX gitbug repo.
EDIT: References to memory corruption removed. My mistake here.
#include "Arduino_GigaDisplay_GFX.h"
GigaDisplay_GFX tft;
#define GC9A01A_CYAN (uint16_t)0x07FF
#define GC9A01A_RED (uint16_t)0xf800
#define GC9A01A_BLUE (uint16_t)0x001F
#define GC9A01A_GREEN (uint16_t)0x07E0
#define GC9A01A_MAGENTA (uint16_t)0xF81F
#define GC9A01A_WHITE (uint16_t)0xffff
#define GC9A01A_BLACK (uint16_t)0x0000
#define GC9A01A_YELLOW (uint16_t)0xFFE0
unsigned long testFillScreen() {
unsigned long start = micros();
tft.fillScreen(GC9A01A_BLACK);
yield();
return micros() - start;
}
unsigned long testFastLines(uint16_t color1, uint16_t color2) {
unsigned long start;
int16_t x, y;
int16_t w = tft.width();
int16_t h = tft.height();
Serial.println(w);
Serial.println(h);
//tft.fillScreen(GC9A01A_BLACK);
//yield();
Serial.println(w);
Serial.println(h);
start = micros();
// no need for drawfast routines as they are called automatically in adafruitGFX
// for (y = 0; y < h; y += 6) tft.drawFastHLine(0, y, w, color1);
// for (x = 0; x < w; x += 6) tft.drawFastVLine(x, 0, h, color2);
for (y = 0; y < h; y += 6) tft.drawLine(0, y, w, y, color1);
for (x = 0; x < w; x += 6) tft.drawLine(x, 0, x, h, color2);
//yield();
return micros() - start;
}
void setup() {
Serial.begin(9600);
Serial.println("GC9A01A Test!");
tft.begin();
Serial.println(tft.width());
Serial.println(tft.height()); // verify correct width/height
Serial.println(F("Benchmark Time (microseconds)"));
delay(10);
//Serial.print(F("Screen fill "));
//Serial.println(testFillScreen());
//delay(500);
Serial.print(F("Horiz/Vert Lines "));
Serial.println(testFastLines(GC9A01A_RED, GC9A01A_BLUE));
delay(500);
Serial.println(F("Done!"));
}
void loop(void) {
}
Thanks Kurt, will apply that and see what happens. Might need to be sprinkled around in other places too. Of more concern is that local variables seem to be corrupted by another thread.
EDIT: The local variables are fine. My bad - I was confused by the order of the printfs.
Applying PR #3 allowed the fillScreen to work, but no lines came out unless I put a display.print("Done") right at the end. So other kinds of graphics calls need the endWrite() treatment too, it seems. Probably explains why the original demo appeared to work but when it was cut down to finish on the line test it didn't.
Problem solved. The changes to PR #3 need to be also applied to drawFastRawHLine and drawFastRawVline. I'll put a comment to that effect in the PR if I can. Any calls that don't drop down to the Adafruit GFX will be similar, but I don't think there are any apart from drawPixel, which tends to be called as part of other things.
In order to make all relevant information available to any who are interested in this subject, I'll share a link to the pull request submitted by @aegidius: