simplify menus
This commit is contained in:
@@ -178,11 +178,6 @@ void MenuAutopilot::printPage() const {
|
||||
break;
|
||||
|
||||
case 6:
|
||||
lineOne = "Restart the";
|
||||
lineTwo = "Autopilot";
|
||||
break;
|
||||
|
||||
case 7:
|
||||
lineOne = "Freeze target is";
|
||||
if (this->targetFreezed)
|
||||
lineTwo = "activated";
|
||||
@@ -190,46 +185,11 @@ void MenuAutopilot::printPage() const {
|
||||
lineTwo = "deactivated";
|
||||
break;
|
||||
|
||||
case 8:
|
||||
case 7:
|
||||
lineOne = "MinDisToPoint:";
|
||||
lineTwo = "";
|
||||
lineTwo = "<- ";
|
||||
lineTwo.concat(this->minDistance);
|
||||
lineTwo.concat(" - Increase");
|
||||
break;
|
||||
|
||||
case 9:
|
||||
lineOne = "MinDisToPoint:";
|
||||
lineTwo = "";
|
||||
lineTwo.concat(this->minDistance);
|
||||
lineTwo.concat(" - Decrease");
|
||||
break;
|
||||
|
||||
case 10:
|
||||
lineOne = "Current minimal";
|
||||
if (this->driveManager->getNavigation()->getMinAccuracy() >= Point::Accuracy::twoDigOfCM)
|
||||
lineTwo = "accuracy is high";
|
||||
else
|
||||
lineTwo = "accuracy is low";
|
||||
break;
|
||||
|
||||
case 12:
|
||||
lineOne = "Test rotate";
|
||||
lineTwo = "180 degree";
|
||||
break;
|
||||
|
||||
case 13:
|
||||
lineOne = "Test rotate";
|
||||
lineTwo = "270 degree";
|
||||
break;
|
||||
|
||||
case 14:
|
||||
lineOne = "Test rotate";
|
||||
lineTwo = "45 degree";
|
||||
break;
|
||||
|
||||
case 15:
|
||||
lineOne = "Test rotate";
|
||||
lineTwo = "20 degree";
|
||||
lineTwo.concat(" ->");
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -247,10 +207,6 @@ void MenuAutopilot::runCommand() const {
|
||||
break;
|
||||
|
||||
case 6:
|
||||
this->autopilot->restart();
|
||||
break;
|
||||
|
||||
case 7:
|
||||
if (this->targetFreezed) {
|
||||
this->targetFreezed = false;
|
||||
this->driveManager->getNavigation()->freezeTargetPoint(false);
|
||||
@@ -260,42 +216,26 @@ void MenuAutopilot::runCommand() const {
|
||||
}
|
||||
break;
|
||||
|
||||
case 8:
|
||||
case 7:
|
||||
this->minDistance = this->driveManager->getNavigation()->increaseMinDistanceToReachPoint();
|
||||
break;
|
||||
|
||||
case 9:
|
||||
this->minDistance = this->driveManager->getNavigation()->decreaseMinDistanceToReachPoint();
|
||||
break;
|
||||
|
||||
case 10:
|
||||
if (this->driveManager->getNavigation()->getMinAccuracy() >= Point::Accuracy::twoDigOfCM)
|
||||
this->driveManager->getNavigation()->setMinAccuracy(Point::Accuracy::none);
|
||||
else
|
||||
this->driveManager->getNavigation()->setMinAccuracy(Point::Accuracy::twoDigOfCM);
|
||||
break;
|
||||
|
||||
case 12:
|
||||
this->autopilot->testRotate(180);
|
||||
break;
|
||||
|
||||
case 13:
|
||||
this->autopilot->testRotate(270);
|
||||
break;
|
||||
|
||||
case 14:
|
||||
this->autopilot->testRotate(45);
|
||||
break;
|
||||
|
||||
case 15:
|
||||
this->autopilot->testRotate(20);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void MenuAutopilot::runCommandNo() const {
|
||||
switch (this->getCurrentPage()) {
|
||||
case 7:
|
||||
this->minDistance = this->driveManager->getNavigation()->decreaseMinDistanceToReachPoint();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void MenuAutopilot::update() {
|
||||
if (!this->autopilot->shouldUpdate())
|
||||
return;
|
||||
@@ -305,7 +245,7 @@ void MenuAutopilot::update() {
|
||||
}
|
||||
|
||||
void MenuAutopilot::init() {
|
||||
this->setCountPages(16);
|
||||
this->setCountPages(8);
|
||||
this->driveManager->changeModus(Modi::Autopilot);
|
||||
this->autopilot = (Autopilot*) this->driveManager->getDriveModiPtr();
|
||||
this->routeInfo = this->autopilot->getRouteInfo();
|
||||
|
||||
@@ -37,7 +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
|
||||
@@ -46,6 +46,8 @@ class MenuAutopilot : public MenuDriveMode {
|
||||
|
||||
private:
|
||||
void init() override;
|
||||
void runCommand() const override;
|
||||
void runCommandNo() const override;
|
||||
|
||||
bool mutable targetFreezed = false;
|
||||
double mutable minDistance;
|
||||
|
||||
@@ -37,25 +37,13 @@ void MenuManualControl::printPage() const {
|
||||
case 2:
|
||||
lineOne = "Speed: ";
|
||||
lineOne.concat(this->manualControl->getMaxSpeed());
|
||||
lineTwo = "Increase by 0.1";
|
||||
lineTwo = "- dec 0.1 inc +";
|
||||
break;
|
||||
|
||||
case 3:
|
||||
lineOne = "Speed: ";
|
||||
lineOne.concat(this->manualControl->getMaxSpeed());
|
||||
lineTwo = "Decrease by 0.1";
|
||||
break;
|
||||
|
||||
case 4:
|
||||
lineOne = "RotSpeed: ";
|
||||
lineOne.concat(this->manualControl->getMaxRotation());
|
||||
lineTwo = "Increase by 0.1";
|
||||
break;
|
||||
|
||||
case 5:
|
||||
lineOne = "RotSpeed: ";
|
||||
lineOne.concat(this->manualControl->getMaxRotation());
|
||||
lineTwo = "Decrease by 0.1";
|
||||
lineTwo = "- dec 0.1 inc +";
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -70,7 +58,7 @@ void MenuManualControl::init() {
|
||||
this->firstPrint = false;
|
||||
this->driveManager->changeModus(Modi::ManualControl);
|
||||
this->manualControl = (ManualControl*) this->driveManager->getDriveModiPtr();
|
||||
this->setCountPages(6);
|
||||
this->setCountPages(4);
|
||||
this->updateDelay = 500;
|
||||
}
|
||||
|
||||
@@ -85,14 +73,6 @@ void MenuManualControl::runCommand() const {
|
||||
break;
|
||||
|
||||
case 3:
|
||||
this->manualControl->decreaseMaxSpeed();
|
||||
break;
|
||||
|
||||
case 4:
|
||||
this->manualControl->increaseMaxRotation();
|
||||
break;
|
||||
|
||||
case 5:
|
||||
this->manualControl->increaseMaxRotation();
|
||||
break;
|
||||
|
||||
@@ -100,3 +80,19 @@ void MenuManualControl::runCommand() const {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void MenuManualControl::runCommandNo() const {
|
||||
switch (this->getCurrentPage())
|
||||
{
|
||||
case 2:
|
||||
this->manualControl->decreaseMaxSpeed();
|
||||
break;
|
||||
|
||||
case 3:
|
||||
this->manualControl->decreaseMaxRotation();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ class MenuManualControl : public MenuDriveMode {
|
||||
protected:
|
||||
void init() override;
|
||||
void runCommand() const override;
|
||||
void runCommandNo() const override;
|
||||
|
||||
private:
|
||||
ManualControl* manualControl;
|
||||
|
||||
Reference in New Issue
Block a user