Hide coordinates until GPS has a fix
This commit is contained in:
1 parent
f6cbc11c85
commit
f69fab7759
1 file changed
+3
@@ -442,12 +442,14 @@ public:
|
|||||||
bool hw_gps_state = nmea != NULL && nmea->isHardwareEnabled();
|
bool hw_gps_state = nmea != NULL && nmea->isHardwareEnabled();
|
||||||
uint32_t period = nmea != NULL ? nmea->getGpsPeriod() : 0;
|
uint32_t period = nmea != NULL ? nmea->getGpsPeriod() : 0;
|
||||||
char fix_buf[12] = "";
|
char fix_buf[12] = "";
|
||||||
|
bool hasFix = false;
|
||||||
if (nmea != NULL) {
|
if (nmea != NULL) {
|
||||||
uint32_t fix_age = nmea->getLastFixAge();
|
uint32_t fix_age = nmea->getLastFixAge();
|
||||||
if (fix_age == UINT32_MAX) {
|
if (fix_age == UINT32_MAX) {
|
||||||
strcpy(fix_buf, "no fix");
|
strcpy(fix_buf, "no fix");
|
||||||
} else {
|
} else {
|
||||||
formatFixAge(fix_buf, sizeof(fix_buf), fix_age);
|
formatFixAge(fix_buf, sizeof(fix_buf), fix_age);
|
||||||
|
hasFix = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (nmea != NULL && nmea->hasHardwareEnableState() && gps_state != hw_gps_state) {
|
if (nmea != NULL && nmea->hasHardwareEnableState() && gps_state != hw_gps_state) {
|
||||||
@@ -476,6 +478,7 @@ public:
|
|||||||
display.setColor(UIColor::primary_txt);
|
display.setColor(UIColor::primary_txt);
|
||||||
sprintf(buf, "%d", nmea->satellitesCount());
|
sprintf(buf, "%d", nmea->satellitesCount());
|
||||||
display.drawTextRightAlign(display.width()-1, y, buf);
|
display.drawTextRightAlign(display.width()-1, y, buf);
|
||||||
|
if (!hasFix) return 5000;
|
||||||
y = y + 12;
|
y = y + 12;
|
||||||
display.setColor(UIColor::secondary_txt);
|
display.setColor(UIColor::secondary_txt);
|
||||||
display.drawTextLeftAlign(0, y, "pos");
|
display.drawTextLeftAlign(0, y, "pos");
|
||||||
|
|||||||
Reference in new issue
Block a user