Right-justify all meter values across all display modes
This commit is contained in:
parent
3e697f360a
commit
e4daf02c37
1 changed files with 10 additions and 17 deletions
|
|
@ -153,7 +153,9 @@ void arcMeter(uint8_t cell, uint8_t pid) {
|
||||||
tft.drawCentreString(label.c_str(), x + 80, y + 58,
|
tft.drawCentreString(label.c_str(), x + 80, y + 58,
|
||||||
2); // Comment out to avoid font 4
|
2); // Comment out to avoid font 4
|
||||||
tft.setTextColor(TFT_GREEN);
|
tft.setTextColor(TFT_GREEN);
|
||||||
tft.drawString("---", x + 10, y + 60, 2); // data
|
tft.setTextPadding(65);
|
||||||
|
tft.drawRightString("---", x + 75, y + 60, 2); // data
|
||||||
|
tft.setTextPadding(0);
|
||||||
// draw arc animation
|
// draw arc animation
|
||||||
for (int angle = 135; angle < 225; angle++) {
|
for (int angle = 135; angle < 225; angle++) {
|
||||||
tft.drawSmoothArc(x + 80, y + 90, 80, 60, 134, angle, TFT_GREEN,
|
tft.drawSmoothArc(x + 80, y + 90, 80, 60, 134, angle, TFT_GREEN,
|
||||||
|
|
@ -174,17 +176,6 @@ void plotArc(uint8_t cell, String label, float data, int warn, int min, int max,
|
||||||
int y = cell1_y[cell - 1];
|
int y = cell1_y[cell - 1];
|
||||||
|
|
||||||
String result = String(data, digit);
|
String result = String(data, digit);
|
||||||
switch (result.length()) {
|
|
||||||
case 2:
|
|
||||||
result = result + " ";
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
result = result + " ";
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
result = result + " ";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data < min)
|
if (data < min)
|
||||||
data = min;
|
data = min;
|
||||||
|
|
@ -198,7 +189,9 @@ void plotArc(uint8_t cell, String label, float data, int warn, int min, int max,
|
||||||
else // no warn
|
else // no warn
|
||||||
arcColor = TFT_GREEN; // gren font green arc
|
arcColor = TFT_GREEN; // gren font green arc
|
||||||
tft.setTextColor(arcColor, TFT_BLACK);
|
tft.setTextColor(arcColor, TFT_BLACK);
|
||||||
tft.drawString(result.c_str(), x + 10, y + 60, 2); // data
|
tft.setTextPadding(65);
|
||||||
|
tft.drawRightString(result.c_str(), x + 75, y + 60, 2); // data
|
||||||
|
tft.setTextPadding(0);
|
||||||
int angle = map(data, min, max, 135, 225);
|
int angle = map(data, min, max, 135, 225);
|
||||||
if (data >= old_data[pidIndex]) // new data > old data -> draw only green
|
if (data >= old_data[pidIndex]) // new data > old data -> draw only green
|
||||||
// arc
|
// arc
|
||||||
|
|
@ -524,8 +517,8 @@ void fullScreenMeter(uint8_t cell, uint8_t pid, bool redrawHeader = true) {
|
||||||
|
|
||||||
tft.loadFont(DSEG7_Modern_BoldItalic_80);
|
tft.loadFont(DSEG7_Modern_BoldItalic_80);
|
||||||
tft.setTextColor(TFT_GREEN, TFT_BLACK);
|
tft.setTextColor(TFT_GREEN, TFT_BLACK);
|
||||||
tft.setTextPadding(280);
|
tft.setTextPadding(265);
|
||||||
tft.drawCentreString("---", 160, 155, 1);
|
tft.drawRightString("---", 260, 155, 1);
|
||||||
tft.setTextPadding(0);
|
tft.setTextPadding(0);
|
||||||
tft.unloadFont();
|
tft.unloadFont();
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -565,8 +558,8 @@ void plotFullScreen(uint8_t cell, float data, int warn, int min, int max,
|
||||||
// Value below the arc using DSEG7 Modern smooth font
|
// Value below the arc using DSEG7 Modern smooth font
|
||||||
tft.loadFont(DSEG7_Modern_BoldItalic_80);
|
tft.loadFont(DSEG7_Modern_BoldItalic_80);
|
||||||
tft.setTextColor(col, TFT_BLACK);
|
tft.setTextColor(col, TFT_BLACK);
|
||||||
tft.setTextPadding(280);
|
tft.setTextPadding(265);
|
||||||
tft.drawCentreString(numStr.c_str(), 160, 155, 1);
|
tft.drawRightString(numStr.c_str(), 260, 155, 1);
|
||||||
tft.setTextPadding(0);
|
tft.setTextPadding(0);
|
||||||
tft.unloadFont();
|
tft.unloadFont();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue