clear up menuGPS
This commit is contained in:
@@ -23,136 +23,70 @@ void MenuGPS::printPage() const {
|
||||
if (gpsData)
|
||||
fixType = gpsData->fixType;
|
||||
|
||||
switch (this->getCurrentPage()) {
|
||||
case 0: {
|
||||
uint8_t siv = 0;
|
||||
uint32_t pDOP = 0;
|
||||
if (fixType) {
|
||||
siv = gpsData->numSV;
|
||||
pDOP = gpsData->pDOP;
|
||||
}
|
||||
String lineOne = "Data isn't valid";
|
||||
String lineTwo = "or no GPS signal";
|
||||
|
||||
if (this->lcd) {
|
||||
lcd->clear();
|
||||
lcd->setCursor(0, 0);
|
||||
if (fixType) {
|
||||
lcd->printf("Sats: %3.u", siv);
|
||||
lcd->setCursor(0, 1);
|
||||
lcd->printf("PDOP: %u", pDOP);
|
||||
} else {
|
||||
lcd->printf("Data isn't valid");
|
||||
lcd->setCursor(0, 1);
|
||||
lcd->printf("or no GPS signal");
|
||||
}
|
||||
}
|
||||
if (fixType)
|
||||
std::cout << "Sats: " << (int) siv
|
||||
<< " PDOP: " << (int) pDOP << std::endl;
|
||||
else
|
||||
std::cout << "Data isn't valid or no GPS signal" << std::endl;
|
||||
switch (this->getCurrentPage()) {
|
||||
case 0:
|
||||
if (fixType) {
|
||||
lineOne = "Sats: ";
|
||||
lineOne.concat(gpsData->numSV);
|
||||
lineTwo = "PDOP: ";
|
||||
lineTwo.concat(gpsData->pDOP);
|
||||
}
|
||||
break;
|
||||
|
||||
case 1: {
|
||||
int32_t lat = 0;
|
||||
int32_t lng = 0;
|
||||
|
||||
case 1:
|
||||
if (fixType) {
|
||||
lat = gpsData->lat;
|
||||
lng = gpsData->lon;
|
||||
}
|
||||
|
||||
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;
|
||||
lineOne = "Lat: ";
|
||||
lineOne.concat(gpsData->lat);
|
||||
lineTwo = "Lon: ";
|
||||
lineTwo.concat(gpsData->lon);
|
||||
}
|
||||
break;
|
||||
|
||||
case 2: {
|
||||
uint32_t unixEpoch = 0;
|
||||
case 2:
|
||||
lineOne = "Time: ";
|
||||
lineTwo = "";
|
||||
if (fixType) {
|
||||
lineTwo.concat(gpsData->hour);
|
||||
lineTwo.concat(":");
|
||||
lineTwo.concat(gpsData->min);
|
||||
lineTwo.concat(":");
|
||||
lineTwo.concat(gpsData->sec);
|
||||
} else
|
||||
lineTwo = "00:00:00";
|
||||
|
||||
if (fixType)
|
||||
unixEpoch = gpsData->sec;
|
||||
|
||||
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;
|
||||
|
||||
case 3: {
|
||||
NTRIPClientStates status = this->ntripClient->getClientState();
|
||||
lineOne = "NTRIP Client is";
|
||||
|
||||
if (this->lcd) {
|
||||
lcd->clear();
|
||||
lcd->setCursor(0, 0);
|
||||
lcd->print("NTRIP Client");
|
||||
lcd->setCursor(0, 1);
|
||||
if (status == NTRIPClientStates::pushData)
|
||||
lcd->print("enabled");
|
||||
else if (status == NTRIPClientStates::notAvailable)
|
||||
lcd->print("not available");
|
||||
else
|
||||
lcd->print("disabled");
|
||||
}
|
||||
if (status == NTRIPClientStates::pushData)
|
||||
std::cout << "NTRIP Client is enabled." << std::endl;
|
||||
else if (status == NTRIPClientStates::notAvailable)
|
||||
std::cout << "NTRIP Client is not available." << std::endl;
|
||||
if (status == NTRIPClientStates::pushData)
|
||||
lineTwo = "enabled";
|
||||
else if (status == NTRIPClientStates::notAvailable)
|
||||
lineTwo = "not available";
|
||||
else
|
||||
std::cout << "NTRIP Client is disabled" << std::endl;
|
||||
lineTwo = "disabled";
|
||||
}
|
||||
break;
|
||||
|
||||
case 4: {
|
||||
uint32_t accuracy = 0;
|
||||
|
||||
if (fixType)
|
||||
accuracy = gpsData->hAcc;
|
||||
|
||||
if (this->lcd) {
|
||||
lcd->clear();
|
||||
lcd->setCursor(0, 0);
|
||||
lcd->printf("Hrizntl Accuracy");
|
||||
lcd->setCursor(0, 1);
|
||||
lcd->printf("-> %u", accuracy);
|
||||
}
|
||||
std::cout << "Horizontal Accuracy Estimate: " << (int) accuracy << std::endl;
|
||||
}
|
||||
case 4:
|
||||
lineOne = "Hrizntl Accuracy";
|
||||
if (fixType) {
|
||||
lineTwo = "";
|
||||
lineTwo.concat(gpsData->hAcc);
|
||||
} else
|
||||
lineTwo = "0";
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
if (this->lcd) {
|
||||
lcd->clear();
|
||||
lcd->setCursor(0, 0);
|
||||
lcd->printf("Page: %u", this->getCurrentPage() + 1);
|
||||
lcd->setCursor(0, 1);
|
||||
lcd->printf("of %u", this->getCountPages());
|
||||
}
|
||||
std::cout << "Page: " << (int) this->getCurrentPage() + 1 << " of " << (int) this->getCountPages() << std::endl;
|
||||
break;
|
||||
this->printDefault();
|
||||
return;
|
||||
}
|
||||
|
||||
this->print(lineOne, lineTwo);
|
||||
}
|
||||
|
||||
void MenuGPS::runCommand() const {
|
||||
|
||||
Reference in New Issue
Block a user