I may have the color worked out for the tilt/grade. @_JurZzang2749 was kind enough to toss in a variable called “negative” in the grade calculation that we can use to change the font color. No additional checks should be necessary.
void update_grade(void) {
// tft.drawString(grade, 140, 10, 4);
tft.fillRect(100,90,tft.width() - 100,90,TFT_BLACK); // fillRect to clear lower part of screen
if(negative == 1 ) // variable used in gear calculation
{
tft.setTextColor(TFT_GREEN, TFT_BLACK);
}
else
{
tft.setTextColor(TFT_RED, TFT_BLACK);
}
tft.drawString(grade, 80, 90, 6);
}
You’ll need to set the font color for the gear display, too, since it refreshes all the time as well, and the board likes to stick with the last font color it knew about.
void update_gear(void){
// tft.drawString(frontgear, 0, 0, 7);
// tft.drawString(“:”, 35, 0, 7);
// tft.fillRect(50,0,tft.width() - 50,50,TFT_BLACK);
// tft.drawString(reargear, 50, 0, 7);
tft.setTextColor(TFT_SKYBLUE, TFT_BLACK); // Set gear font color
tft.drawString(String(frontgear), 15, 5, 8);
tft.drawString(“:”, 75, 5, 8);
tft.fillRect(100,5,tft.width() - 80,80,TFT_BLACK);
tft.drawString(String(reargear), 110, 5,8);
}
I think that will work. This also incorporates the fillRect to get rid of that pesky artifact.
I’m also keeping the original code there, just commented out.