more sensorData menu
This commit is contained in:
@@ -1,159 +0,0 @@
|
||||
/**
|
||||
* @file menuGPS.cpp
|
||||
* @author Alexander Klein (alex@kleiax.de)
|
||||
* @brief Contains an implementation of the class MenuGPS
|
||||
* @version 0.1
|
||||
* @date 2022-01-29
|
||||
*
|
||||
* @copyright Copyright (c) 2022
|
||||
*
|
||||
*/
|
||||
|
||||
#include "menuGPS.h"
|
||||
|
||||
MenuGPS::MenuGPS(SensorData* sensorData) :
|
||||
MenuInformationSites(10) {
|
||||
this->sensorData = sensorData;
|
||||
// this->ntripClient = this->navigation->getNTRIPClient();
|
||||
}
|
||||
|
||||
void MenuGPS::printPage() const {
|
||||
const UBX_NAV_PVT_data_t* gpsData = this->sensorData->getGnssData();
|
||||
uint8_t fixType = 0;
|
||||
if (gpsData)
|
||||
fixType = gpsData->fixType;
|
||||
|
||||
String lineOne = "Data isn't valid";
|
||||
String lineTwo = "or no GPS signal";
|
||||
|
||||
switch (this->getCurrentPage()) {
|
||||
case 0:
|
||||
if (fixType) {
|
||||
lineOne = "Sats: ";
|
||||
lineOne.concat(gpsData->numSV);
|
||||
lineTwo = "PDOP: ";
|
||||
lineTwo.concat(gpsData->pDOP);
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
if (fixType) {
|
||||
lineOne = "Lat: ";
|
||||
lineOne.concat(gpsData->lat);
|
||||
lineTwo = "Lon: ";
|
||||
lineTwo.concat(gpsData->lon);
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
lineOne = "Time: ";
|
||||
lineTwo = "";
|
||||
if (fixType) {
|
||||
if (gpsData->hour < 10)
|
||||
lineTwo.concat("0");
|
||||
lineTwo.concat(gpsData->hour);
|
||||
lineTwo.concat(":");
|
||||
if (gpsData->min < 10)
|
||||
lineTwo.concat("0");
|
||||
lineTwo.concat(gpsData->min);
|
||||
lineTwo.concat(":");
|
||||
if (gpsData->sec < 10)
|
||||
lineTwo.concat("0");
|
||||
lineTwo.concat(gpsData->sec);
|
||||
} else
|
||||
lineTwo = "00:00:00";
|
||||
|
||||
break;
|
||||
|
||||
case 3: {
|
||||
// NTRIPClientStates status = this->ntripClient->getClientState();
|
||||
// lineOne = "NTRIP Client is";
|
||||
|
||||
// if (status == NTRIPClientStates::pushData)
|
||||
// lineTwo = "enabled";
|
||||
// else if (status == NTRIPClientStates::notAvailable)
|
||||
// lineTwo = "not available";
|
||||
// else
|
||||
// lineTwo = "disabled";
|
||||
}
|
||||
break;
|
||||
|
||||
case 4:
|
||||
lineOne = "Fix type:";
|
||||
if (fixType == 0)
|
||||
lineTwo = "None";
|
||||
else if (fixType == 1)
|
||||
lineTwo = "Dead Reckoning";
|
||||
else if (fixType == 2)
|
||||
lineTwo = "2D";
|
||||
else if (fixType == 3)
|
||||
lineTwo = "3D";
|
||||
else if (fixType == 3)
|
||||
lineTwo = "GNSS + Dead Reck";
|
||||
else if (fixType == 5)
|
||||
lineTwo = "Time Only";
|
||||
else
|
||||
lineTwo = "UNKNOWN";
|
||||
break;
|
||||
|
||||
case 5: {
|
||||
lineOne = "Carrier Solution";
|
||||
uint8_t carrSoln = gpsData->flags.bits.carrSoln;
|
||||
if (carrSoln == 0)
|
||||
lineTwo = "None";
|
||||
else if (carrSoln == 1)
|
||||
lineTwo = "Floating";
|
||||
else if (carrSoln == 2)
|
||||
lineTwo = "Fixed";
|
||||
else
|
||||
lineTwo = "UNKNOWN";
|
||||
}
|
||||
break;
|
||||
|
||||
case 6:
|
||||
lineOne = "Hrizntl Accuracy";
|
||||
if (fixType) {
|
||||
lineTwo = "";
|
||||
lineTwo.concat(gpsData->hAcc);
|
||||
} else
|
||||
lineTwo = "0";
|
||||
break;
|
||||
|
||||
case 7:
|
||||
lineOne = "magDec: ";
|
||||
lineTwo = "magAcc: ";
|
||||
if (fixType) {
|
||||
lineOne.concat(gpsData->magDec);
|
||||
lineTwo.concat(gpsData->magAcc);
|
||||
} else {
|
||||
lineOne.concat("---");
|
||||
lineTwo.concat("---");
|
||||
}
|
||||
break;
|
||||
|
||||
case 8:
|
||||
lineOne = "Azimuth: ";
|
||||
lineTwo = "";
|
||||
lineTwo.concat(this->sensorData->getRealAzimuth());
|
||||
break;
|
||||
|
||||
default:
|
||||
this->printDefault();
|
||||
return;
|
||||
}
|
||||
|
||||
this->print(lineOne, lineTwo);
|
||||
}
|
||||
|
||||
void MenuGPS::runCommand() const {
|
||||
switch (this->getCurrentPage()) {
|
||||
case 3: {
|
||||
// // std::cout << "MenuGPS::runCommand " << this->ntripClient->getClientState() << std::endl;
|
||||
// if (this->ntripClient->getClientState() == NTRIPClientStates::pushData)
|
||||
// this->ntripClient->setActivated(false);
|
||||
// else if (this->ntripClient->getClientState() != NTRIPClientStates::notAvailable)
|
||||
// this->ntripClient->setActivated(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
/**
|
||||
* @file menuGPS.h
|
||||
* @author Alexander Klein (alex@kleiax.de)
|
||||
* @brief Contains a class to print informations about the GPS object
|
||||
* @version 0.1
|
||||
* @date 2022-01-29
|
||||
*
|
||||
* @copyright Copyright (c) 2022
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MENU_GPS_H
|
||||
#define MENU_GPS_H
|
||||
|
||||
#include <SparkFun_u-blox_GNSS_Arduino_Library.h>
|
||||
|
||||
#include "menuInformationSites.h"
|
||||
#include "sensorData.h"
|
||||
#include "ntripClient.h"
|
||||
|
||||
/**
|
||||
* @brief A class to print informations about the GPS object
|
||||
*
|
||||
*/
|
||||
class MenuGPS : public MenuInformationSites {
|
||||
public:
|
||||
/**
|
||||
* @brief Construct a new Menu GPS object
|
||||
*
|
||||
* @param gps
|
||||
*/
|
||||
MenuGPS(SensorData* sensorData);
|
||||
|
||||
private:
|
||||
void printPage() const override;
|
||||
void runCommand() const override;
|
||||
|
||||
// NTRIPClient* ntripClient;
|
||||
SensorData* sensorData;
|
||||
};
|
||||
|
||||
#endif // MENU_GPS_H
|
||||
@@ -12,28 +12,102 @@
|
||||
#include "menuSensorData.h"
|
||||
|
||||
MenuSensorData::MenuSensorData(SensorData* sensorData) :
|
||||
MenuInformationSites(4) {
|
||||
MenuInformationSites(7) {
|
||||
this->sensorData = sensorData;
|
||||
}
|
||||
|
||||
void MenuSensorData::printPage() const {
|
||||
const UBX_NAV_PVT_data_t* gpsData = this->sensorData->getGnssData();
|
||||
uint8_t fixType = 0;
|
||||
if (gpsData)
|
||||
fixType = gpsData->fixType;
|
||||
|
||||
String lineOne = "";
|
||||
String lineTwo = "";
|
||||
|
||||
switch (this->getCurrentPage()) {
|
||||
case 0:
|
||||
lineOne = "Yaw:";
|
||||
lineOne = " Y P R :";
|
||||
lineTwo.concat(this->sensorData->getGyroData()[0]);
|
||||
lineTwo.concat(" ");
|
||||
lineTwo.concat(this->sensorData->getGyroData()[1]);
|
||||
lineTwo.concat(" ");
|
||||
lineTwo.concat(this->sensorData->getGyroData()[2]);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
lineOne = "Pitch:";
|
||||
lineTwo.concat(this->sensorData->getGyroData()[1]);
|
||||
lineOne = "Real Azimuth:";
|
||||
lineTwo.concat(this->sensorData->getRealAzimuth());
|
||||
break;
|
||||
|
||||
case 2:
|
||||
lineOne = "Roll:";
|
||||
lineTwo.concat(this->sensorData->getGyroData()[2]);
|
||||
lineOne = "Calc Azimuth:";
|
||||
lineTwo.concat(this->sensorData->getCalcAzimuth());
|
||||
lineTwo.concat(" ");
|
||||
lineTwo.concat(CalcAzimuth::stateToString(this->sensorData->getCalcAzimuthState));
|
||||
break;
|
||||
|
||||
case 3: {
|
||||
lineOne = "Lat:";
|
||||
lineTwo = "Lon:";
|
||||
Point pos = this->sensorData->getCurrentPos();
|
||||
lineOne.concat(pos.getLatitude());
|
||||
lineTwo.concat(pos.getLongitude());
|
||||
}
|
||||
break;
|
||||
|
||||
case 4:
|
||||
lineOne = "Time: ";
|
||||
lineTwo = "";
|
||||
if (fixType) {
|
||||
if (gpsData->hour < 10)
|
||||
lineTwo.concat("0");
|
||||
lineTwo.concat(gpsData->hour);
|
||||
lineTwo.concat(":");
|
||||
if (gpsData->min < 10)
|
||||
lineTwo.concat("0");
|
||||
lineTwo.concat(gpsData->min);
|
||||
lineTwo.concat(":");
|
||||
if (gpsData->sec < 10)
|
||||
lineTwo.concat("0");
|
||||
lineTwo.concat(gpsData->sec);
|
||||
} else
|
||||
lineTwo = "00:00:00";
|
||||
|
||||
break;
|
||||
|
||||
case 5: {
|
||||
lineOne = "CarSol: ";
|
||||
lineTwo = "Ntrip: ";
|
||||
uint8_t carrSoln = gpsData->flags.bits.carrSoln;
|
||||
if (carrSoln == 0)
|
||||
lineOne = "None";
|
||||
else if (carrSoln == 1)
|
||||
lineOne = "Floating";
|
||||
else if (carrSoln == 2)
|
||||
lineOne = "Fixed";
|
||||
else
|
||||
lineOne = "UNKNOWN";
|
||||
NTRIPClientStates status = this->sensorData->getNtripState();
|
||||
if (status == NTRIPClientStates::pushData)
|
||||
lineTwo = "enabled";
|
||||
else if (status == NTRIPClientStates::notAvailable)
|
||||
lineTwo = " N/A";
|
||||
else
|
||||
lineTwo = "disabled";
|
||||
}
|
||||
break;
|
||||
|
||||
case 6:
|
||||
lineOne = "HAcc: ";
|
||||
lineTwo = "Sats: ";
|
||||
if (fixType) {
|
||||
lineOne.concat(gpsData->hAcc);
|
||||
lineTwo.concat(gpsData->numSV);
|
||||
} else {
|
||||
lineOne = "-/-";
|
||||
lineTwo = "-/-";
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user