From 16ac28e9973bb16471c4777d293500d7874beaae Mon Sep 17 00:00:00 2001 From: Alexander Klein Date: Tue, 20 Dec 2022 21:27:00 +0100 Subject: [PATCH] lol --- src/SpecialMenus/GPS/menuGPS.cpp | 33 +++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/src/SpecialMenus/GPS/menuGPS.cpp b/src/SpecialMenus/GPS/menuGPS.cpp index 2537f44..ff7a4f2 100644 --- a/src/SpecialMenus/GPS/menuGPS.cpp +++ b/src/SpecialMenus/GPS/menuGPS.cpp @@ -65,12 +65,19 @@ void MenuGPS::update() { void MenuGPS::printPage() const { UBX_NAV_PVT_data_t* gpsData = this->navigation->getUbxData(); - uint8_t fixType = gpsData->fixType; + uint8_t fixType = 0; + if (gpsData) + fixType = gpsData->fixType; switch (this->currentPage) { case 0: { - uint8_t siv = gpsData->numSV; - uint32_t pDOP = gpsData->pDOP; + uint8_t siv = 0; + uint32_t pDOP = 0; + if (fixType) { + siv = gpsData->numSV; + pDOP = gpsData->pDOP; + } + if (this->lcd) { lcd->clear(); lcd->setCursor(0, 0); @@ -93,8 +100,14 @@ void MenuGPS::printPage() const { break; case 1: { - int32_t lat = gpsData->lat; - int32_t lng = gpsData->lon; + int32_t lat = 0; + int32_t lng = 0; + + if (fixType) { + lat = gpsData->lat; + lng = gpsData->lon; + } + if (this->lcd) { lcd->clear(); lcd->setCursor(0, 0); @@ -117,7 +130,10 @@ void MenuGPS::printPage() const { break; case 2: { - uint32_t unixEpoch = gpsData->sec; + uint32_t unixEpoch = 0; + + if (fixType) + unixEpoch = gpsData->sec; if (this->lcd) { lcd->clear(); @@ -155,7 +171,10 @@ void MenuGPS::printPage() const { break; case 4: { - uint32_t accuracy = gpsData->hAcc; + uint32_t accuracy = 0; + + if (fixType) + accuracy = gpsData->hAcc; if (this->lcd) { lcd->clear();