added restart to autopilot menu and
disable autopilot by pressing the actionbutton
This commit is contained in:
@@ -86,13 +86,21 @@ void MenuAutopilot::printPage() const {
|
||||
lineTwo.concat(correction.correction);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
lineOne = "Target waypoint";
|
||||
lineTwo = "";
|
||||
lineTwo.concat(this->autopilot->getRouteInfo().currentPoint);
|
||||
lineTwo.concat(" from ");
|
||||
lineTwo.concat(this->autopilot->getRouteInfo().totalPoints);
|
||||
case 2: {
|
||||
uint16_t currentPoint = this->autopilot->getRouteInfo().currentPoint;
|
||||
uint16_t totalPoints = this->autopilot->getRouteInfo().totalPoints;
|
||||
if (currentPoint > totalPoints) {
|
||||
lineOne = "Target reached";
|
||||
lineTwo = "";
|
||||
} else {
|
||||
lineOne = "Target waypoint";
|
||||
lineTwo = "";
|
||||
lineTwo.concat(currentPoint);
|
||||
lineTwo.concat(" from ");
|
||||
lineTwo.concat(totalPoints);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 3: {
|
||||
NTRIPClientStates status = this->driveManager->getNavigation()->getNTRIPClient()->getClientState();
|
||||
@@ -131,6 +139,12 @@ void MenuAutopilot::printPage() const {
|
||||
lineOne.concat("0");
|
||||
break;
|
||||
|
||||
case 6:
|
||||
lineOne = "Restart the";
|
||||
lineTwo = "Autopilot";
|
||||
this->autopilot->restart();
|
||||
break;
|
||||
|
||||
default:
|
||||
this->printDefault();
|
||||
return;
|
||||
@@ -139,6 +153,17 @@ void MenuAutopilot::printPage() const {
|
||||
this->print(lineOne, lineTwo);
|
||||
}
|
||||
|
||||
void MenuAutopilot::runCommand() const {
|
||||
switch (this->getCountPages()) {
|
||||
case 6:
|
||||
this->autopilot->restart();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void MenuAutopilot::update() {
|
||||
if (!this->autopilot->shouldUpdate())
|
||||
return;
|
||||
@@ -148,7 +173,7 @@ void MenuAutopilot::update() {
|
||||
}
|
||||
|
||||
void MenuAutopilot::init() {
|
||||
this->setCountPages(6);
|
||||
this->setCountPages(7);
|
||||
this->driveManager->changeModus(Modi::Autopilot);
|
||||
this->autopilot = (Autopilot*) this->driveManager->getDriveModiPtr();
|
||||
this->routeInfo = this->autopilot->getRouteInfo();
|
||||
|
||||
@@ -37,6 +37,7 @@ class MenuAutopilot : public MenuDriveMode {
|
||||
* and save the Autopilot object.
|
||||
*/
|
||||
void printPage() const override;
|
||||
void runCommand() const override;
|
||||
|
||||
/**
|
||||
* @brief can be called to update shown data
|
||||
|
||||
Reference in New Issue
Block a user