From b17122acf8d75b2e16a8e2571562f91925116977 Mon Sep 17 00:00:00 2001 From: 3djc Date: Sat, 4 Feb 2017 06:33:52 -0800 Subject: [PATCH] Fix GPS display in telem screen for X9. (#4389) * Fix for X9. Right now, it is working, but maybe could be improved later by moving to right aligned * X7 work * X7 and X9 working * Another fix for processTelemetryData --- radio/src/gui/128x64/lcd.cpp | 3 ++- radio/src/gui/212x64/lcd.cpp | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/radio/src/gui/128x64/lcd.cpp b/radio/src/gui/128x64/lcd.cpp index e9c6a55fa..8328bf50b 100644 --- a/radio/src/gui/128x64/lcd.cpp +++ b/radio/src/gui/128x64/lcd.cpp @@ -1119,6 +1119,7 @@ void drawValueWithUnit(coord_t x, coord_t y, lcdint_t val, uint8_t unit, LcdFlag void drawGPSCoord(coord_t x, coord_t y, int32_t value, const char * direction, LcdFlags att, bool seconds=true) { + att &= ~RIGHT & ~BOLD; uint32_t absvalue = abs(value); lcdDrawNumber(x, y, absvalue / 1000000, att); // ddd lcdDrawChar(lcdLastPos, y, '@', att); @@ -1174,7 +1175,7 @@ void drawDate(coord_t x, coord_t y, TelemetryItem & telemetryItem, LcdFlags att) void drawGPSPosition(coord_t x, coord_t y, int32_t longitude, int32_t latitude, LcdFlags flags) { if (flags & DBLSIZE) { - x -= (g_eeGeneral.gpsFormat == 0 ? 54 : 51); + x -= (g_eeGeneral.gpsFormat == 0 ? 62 : 61); flags &= ~0x0F00; // TODO constant drawGPSCoord(x, y, latitude, "NS", flags); drawGPSCoord(x, y+FH, longitude, "EW", flags); diff --git a/radio/src/gui/212x64/lcd.cpp b/radio/src/gui/212x64/lcd.cpp index d5a3459e8..0b4d4c6a6 100644 --- a/radio/src/gui/212x64/lcd.cpp +++ b/radio/src/gui/212x64/lcd.cpp @@ -726,9 +726,10 @@ void drawValueWithUnit(coord_t x, coord_t y, int32_t val, uint8_t unit, LcdFlags void drawGPSCoord(coord_t x, coord_t y, int32_t value, const char * direction, LcdFlags att, bool seconds=true) { uint32_t absvalue = abs(value); + att &= ~RIGHT; + if (x > 10) x-=10; lcdDrawNumber(x, y, absvalue / 1000000, att); // ddd lcdDrawChar(lcdLastPos, y, '@', att); - att &= ~RIGHT; absvalue = absvalue % 1000000; absvalue *= 60; if (g_eeGeneral.gpsFormat == 0 || !seconds) { @@ -738,8 +739,8 @@ void drawGPSCoord(coord_t x, coord_t y, int32_t value, const char * direction, L if (seconds) { absvalue %= 1000000; absvalue *= 60; - absvalue /= 100000; - lcdDrawNumber(lcdLastPos+2, y, absvalue, att|LEFT|PREC1); + absvalue /= 10000; + lcdDrawNumber(lcdLastPos+2, y, absvalue, att|LEFT|PREC2); lcdDrawSolidVerticalLine(lcdLastPos, y, 2); lcdDrawSolidVerticalLine(lcdLastPos+2, y, 2); lcdLastPos += 3;