- shiftet moveControl States in the class namespace - added auto reconeect to NtripClient - a lot of refactor
116 lines
3.3 KiB
C++
116 lines
3.3 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 {
|
|
RouteInfo routeInfo = this->captureRoute->getRouteInfo();
|
|
UBX_NAV_PVT_data_t* gpsData = this->driveManager->getNavigation()->getUbxData();
|
|
|
|
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->driveManager->getNavigation()->getNTRIPClient()->getClientState();
|
|
lineOne = "NTRIP Client is";
|
|
|
|
if (status == NTRIPClientStates::pushData)
|
|
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->driveManager->getNavigation()->getAzimuth());
|
|
if (gpsData->fixType)
|
|
lineOne.concat(gpsData->hAcc);
|
|
else
|
|
lineOne.concat("0");
|
|
break;
|
|
|
|
default:
|
|
this->printDefault();
|
|
return;
|
|
}
|
|
|
|
this->print(lineOne, lineTwo);
|
|
}
|
|
|
|
void MenuCaptureRoute::update() {
|
|
if (!this->captureRoute->shouldUpdate())
|
|
return;
|
|
this->printMenu();
|
|
}
|
|
|
|
void MenuCaptureRoute::init() {
|
|
this->setCountPages(7);
|
|
this->updateDelay = 500;
|
|
this->driveManager->changeModus(Modi::CaptureRoute);
|
|
this->captureRoute = (CaptureRoute*) this->driveManager->getDriveModiPtr();
|
|
|
|
}
|