-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Reported and triaged by @jojo1212
When using the arduino-libraries/Arduino_GigaDisplayTouch and Arduino_GigaDisplay_GFX libraries together, the GIGA Display Shield shows the previously uploaded sketch content, until you touch the display.
Steps to recreate the issue
- Upload pixels and shape example sketch from GIGA Display shield GFX guide. Four shapes appear on the GIGA Display Shield
#include "Arduino_GigaDisplay_GFX.h"
GigaDisplay_GFX display;
#define WHITE 0xffff
#define BLACK 0x0000
void setup() {
display.begin();
display.fillScreen(WHITE);
display.drawTriangle(100, 200, 300, 400, 300, 600, BLACK);
display.drawCircle(100, 100, 50, BLACK);
display.drawRect(10, 650, 300, 80, BLACK);
display.drawRoundRect(300, 50, 100, 100, 30, BLACK);
}
void loop() {}
- Upload the GFX and Touch example from GIGA Display shield GFX guide
#include "Arduino_GigaDisplay_GFX.h"
#include "Arduino_GigaDisplayTouch.h"
Arduino_GigaDisplayTouch touchDetector;
GigaDisplay_GFX display;
#define WHITE 0xffff
#define BLACK 0x0000
#define screen_size_x 480
#define screen_size_y 800
int touch_x;
int touch_y;
//increase or decrease the sensitivity of the touch.
int trigger_sensitivity = 5;
bool switch_1;
int counter;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
display.begin();
if (touchDetector.begin()) {
Serial.print("Touch controller init - OK");
} else {
Serial.print("Touch controller init - FAILED");
while (1)
;
}
}
void loop() {
uint8_t contacts;
GDTpoint_t points[5];
contacts = touchDetector.getTouchPoints(points);
if (contacts > 0) {
Serial.print("Contacts: ");
Serial.println(contacts);
counter++;
//record the x,y coordinates
for (uint8_t i = 0; i < contacts; i++) {
touch_x = points[i].x;
touch_y = points[i].y;
}
//as the display is 480x800, any time you touch the screen it will trigger
//the trigger sensitivity is set to "5".
if (touch_x < screen_size_x && touch_y < screen_size_y && counter > trigger_sensitivity) {
switch_1 = !switch_1;
Serial.println("switched");
changeSwitch();
delay(250);
}
}
}
void changeSwitch() {
if (switch_1) {
display.fillScreen(BLACK);
display.setTextColor(WHITE);
} else {
display.fillScreen(WHITE);
display.setTextColor(BLACK);
}
display.setCursor(50, screen_size_y/2);
display.setTextSize(5);
display.print("Switched");
counter = 0;
}
- Output IS still displayed from the previously uploaded sketch (four shapes).
- Touch the display to get the output (
SWITCHED
white text on a white background).
Giga.display.mp4
Workaround
Adding the following section to the setup() function. Suggested by @facchinm
display.begin();
display.startWrite();
display.fillScreen(YELLOW);
display.endWrite();
Note: YELLOW needs to be defined.
Metadata
Metadata
Assignees
Labels
No labels