Skip to content

Commit 5c20ab5

Browse files
authored
Update local color mid-grey to RGB565
A hardcoded value of 0x808080 was in the code for a mid-level grey. This is an RGB888 value, but the ST77XX library uses RGB565 values. A mid-grey in RGB565 is 0x8410. A local define was done to define this as STS77XX_GREY and the new value placed in the calls previously using 0x808080. This solves a compiler integer overflow warning preventing CI from completing.
1 parent 890431b commit 5c20ab5

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

FunHouse_Arduino_Demos/selftest/selftest.ino

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
#define NUM_DOTSTAR 5
1212
#define BG_COLOR ST77XX_BLACK
13+
#define ST77XX_GREY 0x8410 // Colors are in RGB565 format
1314

1415
// display!
1516
Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RESET);
@@ -125,23 +126,23 @@ void loop() {
125126
tft.setTextColor(ST77XX_YELLOW);
126127
tft.print("Buttons: ");
127128
if (! digitalRead(BUTTON_DOWN)) {
128-
tft.setTextColor(0x808080);
129+
tft.setTextColor(ST77XX_GREY);
129130
} else {
130131
Serial.println("DOWN pressed");
131132
tft.setTextColor(ST77XX_WHITE);
132133
}
133134
tft.print("DOWN ");
134135

135136
if (! digitalRead(BUTTON_SELECT)) {
136-
tft.setTextColor(0x808080);
137+
tft.setTextColor(ST77XX_GREY);
137138
} else {
138139
Serial.println("SELECT pressed");
139140
tft.setTextColor(ST77XX_WHITE);
140141
}
141142
tft.print("SEL ");
142143

143144
if (! digitalRead(BUTTON_UP)) {
144-
tft.setTextColor(0x808080);
145+
tft.setTextColor(ST77XX_GREY);
145146
} else {
146147
Serial.println("UP pressed");
147148
tft.setTextColor(ST77XX_WHITE);
@@ -156,7 +157,7 @@ void loop() {
156157
tft.print("Captouch 6: ");
157158
touchread = touchRead(6);
158159
if (touchread < 10000 ) {
159-
tft.setTextColor(0x808080, BG_COLOR);
160+
tft.setTextColor(ST77XX_GREY, BG_COLOR);
160161
} else {
161162
tft.setTextColor(ST77XX_WHITE, BG_COLOR);
162163
}
@@ -169,7 +170,7 @@ void loop() {
169170
tft.print("Captouch 7: ");
170171
touchread = touchRead(7);
171172
if (touchread < 20000 ) {
172-
tft.setTextColor(0x808080, BG_COLOR);
173+
tft.setTextColor(ST77XX_GREY, BG_COLOR);
173174
} else {
174175
tft.setTextColor(ST77XX_WHITE, BG_COLOR);
175176
}
@@ -183,7 +184,7 @@ void loop() {
183184
tft.print("Captouch 8: ");
184185
touchread = touchRead(8);
185186
if (touchread < 20000 ) {
186-
tft.setTextColor(0x808080, BG_COLOR);
187+
tft.setTextColor(ST77XX_GREY, BG_COLOR);
187188
} else {
188189
tft.setTextColor(ST77XX_WHITE, BG_COLOR);
189190
}

0 commit comments

Comments
 (0)