175 lines
3.9 KiB
C++
175 lines
3.9 KiB
C++
/**
|
|
* @file menuCaptureRoute.cpp
|
|
* @author Alexander Klein (alex@kleiax.de)
|
|
* @brief Contains an implementation of the class MenuCaptureRoute
|
|
* @version 0.1
|
|
* @date 2022-01-31
|
|
*
|
|
* @copyright Copyright (c) 2022
|
|
*
|
|
*/
|
|
#include "menuCaptureRoute.h"
|
|
|
|
void MenuCaptureRoute::printPage() const
|
|
{
|
|
const RouteInfo routeInfo = this->captureRoute->getRouteInfo();
|
|
const UBX_NAV_PVT_data_t *gpsData = this->captureRoute->getSensorData()->getGnssData();
|
|
|
|
String lineOne = "";
|
|
String lineTwo = "";
|
|
|
|
switch (this->getCurrentPage())
|
|
{
|
|
case 0:
|
|
lineOne = "Capture Route";
|
|
lineTwo = "You can drive";
|
|
break;
|
|
|
|
case 1:
|
|
lineOne = "Saved waypoints";
|
|
lineTwo.concat(routeInfo.totalPoints);
|
|
break;
|
|
|
|
case 2:
|
|
lineOne = "Last status:";
|
|
switch (this->captureRoute->getLastStatus())
|
|
{
|
|
case Navigation::Status::InsufficientAccuracy:
|
|
lineTwo = "Poor Accuracy";
|
|
break;
|
|
|
|
case Navigation::Status::Updated:
|
|
lineTwo = "Point added";
|
|
break;
|
|
|
|
case Navigation::Status::Unchanged:
|
|
lineTwo = "Point too close";
|
|
break;
|
|
|
|
default:
|
|
lineTwo = "---";
|
|
break;
|
|
}
|
|
break;
|
|
|
|
case 3:
|
|
lineOne = "Distance to last";
|
|
lineTwo = "point: ";
|
|
lineTwo.concat(this->captureRoute->getDistanceToLastPoint());
|
|
break;
|
|
|
|
case 4:
|
|
{
|
|
NTRIPClientStates status = this->captureRoute->getSensorData()->getNtripClient()->getClientState();
|
|
lineOne = "NTRIP Client is";
|
|
|
|
if (status == NTRIPClientStates::pushingData)
|
|
{
|
|
lineTwo = "enabled";
|
|
}
|
|
else if (status == NTRIPClientStates::notAvailable)
|
|
{
|
|
lineTwo = "not available";
|
|
}
|
|
else
|
|
{
|
|
lineTwo = "disabled";
|
|
}
|
|
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 = "hAccuracy: ";
|
|
lineTwo = "Azimuth: ";
|
|
lineTwo.concat(this->captureRoute->getSensorData()->getRealAzimuth());
|
|
if (gpsData->fixType)
|
|
{
|
|
lineOne.concat(gpsData->hAcc);
|
|
}
|
|
else
|
|
{
|
|
lineOne.concat("0");
|
|
}
|
|
break;
|
|
|
|
case 7:
|
|
lineOne = "Current minimal";
|
|
if (this->captureRoute->getNavigation()->getMinAccuracy() >= Point::Accuracy::twoDigOfCM)
|
|
{
|
|
lineTwo = "accuracy is high";
|
|
}
|
|
else
|
|
{
|
|
lineTwo = "accuracy is low";
|
|
}
|
|
break;
|
|
|
|
default:
|
|
this->printDefault();
|
|
return;
|
|
}
|
|
|
|
this->print(lineOne, lineTwo);
|
|
}
|
|
|
|
void MenuCaptureRoute::update()
|
|
{
|
|
if (!this->captureRoute->shouldUpdate())
|
|
{
|
|
return;
|
|
}
|
|
this->printMenu();
|
|
}
|
|
|
|
void MenuCaptureRoute::runCommand()
|
|
{
|
|
switch (this->getCurrentPage())
|
|
{
|
|
case 7:
|
|
if (this->captureRoute->getNavigation()->getMinAccuracy() >= Point::Accuracy::twoDigOfCM)
|
|
{
|
|
this->captureRoute->getNavigation()->setMinAccuracy(Point::Accuracy::none);
|
|
}
|
|
else
|
|
{
|
|
this->captureRoute->getNavigation()->setMinAccuracy(Point::Accuracy::twoDigOfCM);
|
|
}
|
|
break;
|
|
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
|
|
void MenuCaptureRoute::init()
|
|
{
|
|
this->setCountPages(8);
|
|
MenuDriveMode::updateDelay = MenuCaptureRoute::updateDelay;
|
|
this->captureRoute = new CaptureRoute();
|
|
this->driveManager->changeModus(this->captureRoute);
|
|
MenuDriveMode::init();
|
|
}
|