ntrip, testMode, zed9 gnss modul

This commit is contained in:
2022-09-13 20:31:52 +02:00
parent c7cb0d3895
commit af6cb98898
43 changed files with 907 additions and 262 deletions
+74 -64
View File
@@ -13,7 +13,7 @@
MenuGPS::MenuGPS(SFE_UBLOX_GNSS* gps) {
this->gps = gps;
this->last_millis = millis();
this->lastMillis = millis();
}
void MenuGPS::up() {
@@ -54,76 +54,86 @@ void MenuGPS::printMenu() {
}
void MenuGPS::update() {
if (millis() - this->last_millis < this->delay) {
if (millis() - this->lastMillis < this->delay) {
return;
}
this->printMenu();
this->last_millis = millis();
this->lastMillis = millis();
}
void MenuGPS::printPage(uint8_t page) const {
//FIXME: new gpslib
// switch (this->currentPage) {
// case 0:
// if (this->lcd) {
// lcd->clear();
// lcd->setCursor(0, 0);
// if (gps->satellites.isValid() && gps->satellites.value() > 2) {
// lcd->printf("Sats: %3.d", gps->satellites.value());
// lcd->setCursor(0, 1);
// lcd->printf("HDOP: %f", gps->hdop.hdop());
// } else {
// lcd->printf("Data isn't valid");
// lcd->setCursor(0, 1);
// lcd->printf("or no GPS signal");
// }
// }
// if (gps->satellites.isValid() && gps->satellites.value() > 2)
// std::cout << "Sats: " << gps->satellites.value()
// << "HDOP: " << gps->hdop.hdop() << std::endl;
// else
// std::cout << "Data isn't valid or no GPS signal" << std::endl;
// break;
uint8_t fixType = gps->getFixType();
switch (this->currentPage) {
case 0: {
uint8_t siv = gps->getSIV();
uint16_t hdop = gps->getHorizontalDOP();
if (this->lcd) {
lcd->clear();
lcd->setCursor(0, 0);
if (fixType) {
lcd->printf("Sats: %3.u", siv);
lcd->setCursor(0, 1);
lcd->printf("HDOP: %u", hdop);
} else {
lcd->printf("Data isn't valid");
lcd->setCursor(0, 1);
lcd->printf("or no GPS signal");
}
}
if (fixType)
std::cout << "Sats: " << (int) siv
<< "HDOP: " << (int) hdop << std::endl;
else
std::cout << "Data isn't valid or no GPS signal" << std::endl;
}
break;
// case 1:
// if (this->lcd) {
// lcd->clear();
// lcd->setCursor(0, 0);
// if (gps->location.isValid() && gps->satellites.value() > 2) {
// lcd->printf("Lat: %9.6f", gps->location.lat());
// lcd->setCursor(0, 1);
// lcd->printf("Lng: %9.6f", gps->location.lng());
// } else {
// lcd->printf("Data isn't valid");
// lcd->setCursor(0, 1);
// lcd->printf("or NO GPS signal");
// }
// }
// if (gps->satellites.isValid() && gps->satellites.value() > 2)
// std::cout << "Lat: " << gps->location.lat()
// << "Lng: " << gps->location.lng() << std::endl;
// else
// std::cout << "Data isn't valid or NO GPS signal" << std::endl;
// break;
case 1: {
int32_t lat = gps->getLatitude();
int32_t lng = gps->getLongitude();
if (this->lcd) {
lcd->clear();
lcd->setCursor(0, 0);
if (fixType) {
lcd->printf("Lat: %d", lat);
lcd->setCursor(0, 1);
lcd->printf("Lng: %d", lng);
} else {
lcd->printf("Data isn't valid");
lcd->setCursor(0, 1);
lcd->printf("or NO GPS signal");
}
}
if (fixType)
std::cout << "Lat: " << lat
<< "Lng: " << lng << std::endl;
else
std::cout << "Data isn't valid or NO GPS signal" << std::endl;
}
break;
// case 2:
// if (this->lcd) {
// lcd->clear();
// lcd->setCursor(0, 0);
// lcd->printf("Chars processed");
// lcd->setCursor(0, 1);
// lcd->printf("-> %u", gps->charsProcessed());
// }
// std::cout << "Chars processed: " << gps->charsProcessed() << std::endl;
// break;
case 2: {
uint32_t unixEpoch = gps->getUnixEpoch();
if (this->lcd) {
lcd->clear();
lcd->setCursor(0, 0);
lcd->printf("Unix Epoch");
lcd->setCursor(0, 1);
lcd->printf("-> %u", unixEpoch);
}
std::cout << "Unix Epoch: " << (int) unixEpoch << std::endl;
}
break;
// default:
// if (this->lcd) {
// lcd->clear();
// lcd->setCursor(0, 0);
// lcd->printf("Page: %u", page);
// }
// std::cout << "Page: " << (int) page << std::endl;
// break;
// }
default:
if (this->lcd) {
lcd->clear();
lcd->setCursor(0, 0);
lcd->printf("Page: %u", page);
}
std::cout << "Page: " << (int) page << std::endl;
break;
}
}
+1 -1
View File
@@ -82,7 +82,7 @@ class MenuGPS : public MenuControl {
SFE_UBLOX_GNSS* gps;
const uint16_t delay = 5000;
uint32_t last_millis = 0;
uint32_t lastMillis = 0;
};
#endif // MENU_GPS_H