Skip to content

Commit 4ee2f82

Browse files
committed
fix flicker label
1 parent 3e0f385 commit 4ee2f82

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/DisplayManager.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,21 +167,27 @@ void drawDataBox(int x, int y, const char *label, const float value, uint16_t la
167167
const int LABEL_HEIGHT = BOX_HEIGHT / 2;
168168

169169
if (setup) {
170+
// Clear the entire data box area first only during setup
171+
display.fillRect(x, y, BOX_WIDTH, BOX_HEIGHT, TFT_BLACK);
172+
170173
spr.loadFont(AA_FONT_SMALL);
171174
spr.createSprite(BOX_WIDTH, LABEL_HEIGHT);
175+
spr.fillSprite(TFT_BLACK); // Clear sprite background
172176
spr.setTextColor(labelColor, TFT_BLACK, true);
173-
spr.drawString(label, 50, 5);
174177
spr.setTextDatum(TC_DATUM);
178+
spr.drawString(label, 50, 5);
175179
if (label == "AFR") {
176180
spr.pushSprite(x - 10, y);
177181
} else {
178182
spr.pushSprite(x, y);
179183
}
184+
spr.deleteSprite();
180185
}
181186

182-
if (valueToCompare != value) {
187+
if (setup || valueToCompare != value) {
183188
spr.loadFont(AA_FONT_LARGE);
184189
spr.createSprite(BOX_WIDTH, LABEL_HEIGHT);
190+
spr.fillSprite(TFT_BLACK); // Clear sprite background
185191
spr.setTextDatum(TC_DATUM);
186192
spr_width = spr.textWidth("333");
187193
spr.setTextColor(labelColor, TFT_BLACK, true);

0 commit comments

Comments
 (0)