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