107 lines
2.3 KiB
C++
107 lines
2.3 KiB
C++
/**
|
|
* @file menuSensorData.cpp
|
|
* @author Alexander Klein (alex@kleiax.de)
|
|
* @brief
|
|
* @version 0.1
|
|
* @date 2023-09-04
|
|
*
|
|
* @copyright Copyright (c) 2023
|
|
*
|
|
*/
|
|
|
|
#include "menuSensorData.h"
|
|
|
|
MenuSensorData::MenuSensorData(SensorData *sensorData) : MenuInformationSites(7), sensorData{sensorData}
|
|
{
|
|
this->noEqualLeft = true;
|
|
}
|
|
|
|
void MenuSensorData::printPage() const
|
|
{
|
|
const UBX_NAV_PVT_data_t *gpsData = this->sensorData->getGnssData();
|
|
uint8_t fixType = 0;
|
|
if (static_cast<bool>(gpsData))
|
|
{
|
|
fixType = gpsData->fixType;
|
|
}
|
|
|
|
String lineOne = "";
|
|
String lineTwo = "";
|
|
|
|
switch (this->getCurrentPage())
|
|
{
|
|
case 1:
|
|
lineOne = "Real Azimuth:";
|
|
lineTwo.concat(this->sensorData->getRealAzimuth());
|
|
break;
|
|
|
|
case 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:";
|
|
const Point pos = this->sensorData->getCurrentPos();
|
|
lineOne.concat(pos.getLatitude());
|
|
lineTwo.concat(pos.getLongitude());
|
|
}
|
|
break;
|
|
|
|
case 4:
|
|
lineOne = "Time: ";
|
|
lineTwo = "";
|
|
if (static_cast<bool>(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 6:
|
|
lineOne = "HAcc: ";
|
|
lineTwo = "Sats: ";
|
|
if (static_cast<bool>(fixType))
|
|
{
|
|
lineOne.concat(gpsData->hAcc);
|
|
lineTwo.concat(gpsData->numSV);
|
|
}
|
|
else
|
|
{
|
|
lineOne.concat("-/-");
|
|
lineTwo.concat("-/-");
|
|
}
|
|
break;
|
|
|
|
default:
|
|
this->printDefault();
|
|
return;
|
|
}
|
|
|
|
this->print(lineOne, lineTwo);
|
|
}
|