Fixed 2 lines display of GPS values

This commit is contained in:
Raphael Coeffic
2021-06-20 10:35:35 +02:00
parent 3b31784872
commit 3472bbdc78
2 changed files with 16 additions and 14 deletions
+10 -5
View File
@@ -323,12 +323,17 @@ coord_t drawGPSCoord(BitmapBuffer * dc, coord_t x, coord_t y, int32_t value, con
void drawGPSPosition(BitmapBuffer * dc, coord_t x, coord_t y, int32_t longitude, int32_t latitude, LcdFlags flags) void drawGPSPosition(BitmapBuffer * dc, coord_t x, coord_t y, int32_t longitude, int32_t latitude, LcdFlags flags)
{ {
if (flags & RIGHT) { if (flags & PREC1) {
x = drawGPSCoord(dc, x, y, longitude, "EW", flags, false); drawGPSCoord(dc, x, y, latitude, "NS", flags, false);
drawGPSCoord(dc, x - 5, y, latitude, "NS", flags, false); drawGPSCoord(dc, x, y + FH, longitude, "EW", flags, false);
} else { } else {
x = drawGPSCoord(dc, x, y, latitude, "NS", flags, false); if (flags & RIGHT) {
drawGPSCoord(dc, x + 5, y, longitude, "EW", flags, false); x = drawGPSCoord(dc, x, y, longitude, "EW", flags, false);
drawGPSCoord(dc, x - 5, y, latitude, "NS", flags, false);
} else {
x = drawGPSCoord(dc, x, y, latitude, "NS", flags, false);
drawGPSCoord(dc, x + 5, y, longitude, "EW", flags, false);
}
} }
} }
+6 -9
View File
@@ -43,7 +43,6 @@ class ValueWidget: public Widget
coord_t xValue, yValue, xLabel, yLabel; coord_t xValue, yValue, xLabel, yLabel;
LcdFlags attrValue, attrLabel = 0; LcdFlags attrValue, attrLabel = 0;
bool twolines = false;
if (width() < 120 && height() < 50) { if (width() < 120 && height() < 50) {
xValue = 0; xValue = 0;
yValue = 14; yValue = 14;
@@ -57,7 +56,7 @@ class ValueWidget: public Widget
yValue = -2; yValue = -2;
xLabel = NUMBERS_PADDING; xLabel = NUMBERS_PADDING;
yLabel = +2; yLabel = +2;
attrValue = RIGHT | NO_UNIT | FONT(XL); attrValue = RIGHT | NO_UNIT | FONT(L);
} }
else { else {
xValue = NUMBERS_PADDING; xValue = NUMBERS_PADDING;
@@ -66,8 +65,7 @@ class ValueWidget: public Widget
yLabel = 2; yLabel = 2;
if (field >= MIXSRC_FIRST_TELEM) { if (field >= MIXSRC_FIRST_TELEM) {
if (isGPSSensor(1 + (field - MIXSRC_FIRST_TELEM) / 3)) { if (isGPSSensor(1 + (field - MIXSRC_FIRST_TELEM) / 3)) {
attrValue = LEFT | FONT(L);// | EXPANDED; // TODO attrValue = LEFT | FONT(L) | PREC1;
twolines = true;
} }
else { else {
attrValue = LEFT | FONT(XL); attrValue = LEFT | FONT(XL);
@@ -75,8 +73,7 @@ class ValueWidget: public Widget
} }
#if defined(INTERNAL_GPS) #if defined(INTERNAL_GPS)
else if (field == MIXSRC_TX_GPS) { else if (field == MIXSRC_TX_GPS) {
attrValue = LEFT | FONT(L);// | EXPANDED; // TODO attrValue = LEFT | FONT(L) | PREC1;
twolines = true;
} }
#endif #endif
else { else {
@@ -87,10 +84,10 @@ class ValueWidget: public Widget
if (field >= MIXSRC_FIRST_TIMER && field <= MIXSRC_LAST_TIMER) { if (field >= MIXSRC_FIRST_TIMER && field <= MIXSRC_LAST_TIMER) {
TimerState & timerState = timersStates[field - MIXSRC_FIRST_TIMER]; TimerState & timerState = timersStates[field - MIXSRC_FIRST_TIMER];
if (timerState.val < 0) { if (timerState.val < 0) {
lcdSetColor(lcdColorTable[ALARM_COLOR_INDEX]); color = ALARM_COLOR;
} }
drawSource(dc, NUMBERS_PADDING, 2, field, CUSTOM_COLOR); drawSource(dc, NUMBERS_PADDING, 2, field, color);
drawSource(dc, NUMBERS_PADDING + 1, 3, field, BLACK); drawSource(dc, NUMBERS_PADDING + 1, 3, field, COLOR2FLAGS(BLACK));
drawTimer(dc, xValue, yValue, abs(timerState.val), attrValue | FONT(XL) | color); drawTimer(dc, xValue, yValue, abs(timerState.val), attrValue | FONT(XL) | color);
} }