driveManager gets now the object

This commit is contained in:
2023-09-04 15:25:56 +02:00
parent 6a76470f45
commit befbd898cc
23 changed files with 63 additions and 156 deletions
@@ -210,15 +210,15 @@ void MenuAutopilot::runCommand() const {
case 6:
if (this->targetFreezed) {
this->targetFreezed = false;
this->driveManager->getNavigation()->freezeTargetPoint(false);
this->autopilot->getNavigation()->freezeTargetPoint(false);
} else {
this->targetFreezed = true;
this->driveManager->getNavigation()->freezeTargetPoint();
this->autopilot->getNavigation()->freezeTargetPoint();
}
break;
case 7:
this->minDistance = this->driveManager->getNavigation()->increaseMinDistanceToReachPoint();
this->minDistance = this->autopilot->getNavigation()->increaseMinDistanceToReachPoint();
break;
default:
@@ -229,7 +229,7 @@ void MenuAutopilot::runCommand() const {
void MenuAutopilot::runCommandNo() const {
switch (this->getCurrentPage()) {
case 7:
this->minDistance = this->driveManager->getNavigation()->decreaseMinDistanceToReachPoint();
this->minDistance = this->autopilot->getNavigation()->decreaseMinDistanceToReachPoint();
break;
default:
@@ -247,9 +247,11 @@ void MenuAutopilot::update() {
void MenuAutopilot::init() {
this->setCountPages(8);
this->driveManager->changeModus(Modi::Autopilot);
this->autopilot = (Autopilot*) this->driveManager->getDriveModiPtr();
this->autopilot = new Autopilot();
this->driveManager->changeModus(this->autopilot);
this->routeInfo = this->autopilot->getRouteInfo();
this->driveManager->getNavigation()->increaseMinDistanceToReachPoint();
this->minDistance = this->driveManager->getNavigation()->decreaseMinDistanceToReachPoint();
//dirty hack to get the val, can be better!!! TODO
this->autopilot->getNavigation()->increaseMinDistanceToReachPoint();
this->minDistance = this->autopilot->getNavigation()->decreaseMinDistanceToReachPoint();
}
@@ -13,6 +13,7 @@
#define MENU_AUTOPILOT_DRIVE_H
#include "SpecialMenus/driveModi/menuDriveMode.h"
#include "driveModi/Modi/Autopilot/autopilot.h"
/**
* @brief A class to print informations about the Autopilot
@@ -110,8 +110,8 @@ void MenuCalibrateCompass::printPage() const {
void MenuCalibrateCompass::init() {
this->firstPrint = false;
this->driveManager->changeModus(Modi::CalibrateCompass);
this->caliCompassMode = (CalibrateCompassM*) this->driveManager->getDriveModiPtr();
this->caliCompassMode = new CalibrateCompassM();
this->driveManager->changeModus(this->caliCompassMode);
this->caliCompass = new CalibrateCompass(this->caliCompassMode->getSensorData()->getRealCompass());
this->setCountPages(11);
this->updateDelay = 500;
@@ -94,7 +94,7 @@ void MenuCaptureRoute::printPage() const {
case 7:
lineOne = "Current minimal";
if (this->driveManager->getNavigation()->getMinAccuracy() >= Point::Accuracy::twoDigOfCM)
if (this->captureRoute->getNavigation()->getMinAccuracy() >= Point::Accuracy::twoDigOfCM)
lineTwo = "accuracy is high";
else
lineTwo = "accuracy is low";
@@ -118,10 +118,10 @@ void MenuCaptureRoute::runCommand() const {
switch (this->getCurrentPage())
{
case 7:
if (this->driveManager->getNavigation()->getMinAccuracy() >= Point::Accuracy::twoDigOfCM)
this->driveManager->getNavigation()->setMinAccuracy(Point::Accuracy::none);
if (this->captureRoute->getNavigation()->getMinAccuracy() >= Point::Accuracy::twoDigOfCM)
this->captureRoute->getNavigation()->setMinAccuracy(Point::Accuracy::none);
else
this->driveManager->getNavigation()->setMinAccuracy(Point::Accuracy::twoDigOfCM);
this->captureRoute->getNavigation()->setMinAccuracy(Point::Accuracy::twoDigOfCM);
break;
default:
@@ -132,7 +132,7 @@ void MenuCaptureRoute::runCommand() const {
void MenuCaptureRoute::init() {
this->setCountPages(8);
this->updateDelay = 500;
this->driveManager->changeModus(Modi::CaptureRoute);
this->captureRoute = (CaptureRoute*) this->driveManager->getDriveModiPtr();
this->captureRoute = new CaptureRoute();
this->driveManager->changeModus(this->captureRoute);
}
@@ -12,6 +12,7 @@
#define MENU_MANUAL_DRIVE_H
#include "SpecialMenus/driveModi/menuDriveMode.h"
#include "driveModi/Modi/CaptureRoute/captureRoute.h"
/**
* @brief A class to print informations about the Autopilot
@@ -56,8 +56,8 @@ void MenuManualControl::printPage() const {
void MenuManualControl::init() {
this->firstPrint = false;
this->driveManager->changeModus(Modi::ManualControl);
this->manualControl = (ManualControl*) this->driveManager->getDriveModiPtr();
this->manualControl = new ManualControl();
this->driveManager->changeModus(this->manualControl);
this->setCountPages(4);
this->updateDelay = 500;
}
@@ -13,7 +13,7 @@
#define MENU_MANUAL_DRIVE_H
#include "SpecialMenus/driveModi/menuDriveMode.h"
#include "calibrateCompass.h"
#include "driveModi/Modi/ManualControl/manualControl.h"
/**
* @brief A class to print informations about the class ManualControl
@@ -74,8 +74,8 @@ void MenuTestMode::no() {
}
void MenuTestMode::init() {
this->driveManager->changeModus(Modi::TestMode);
this->testMode = (TestMode*) this->driveManager->getDriveModiPtr();
this->testMode = new TestMode();
this->driveManager->changeModus(this->testMode);
testMode->setMaxSpeed(1);
testMode->setMaxRotation(8);
+1 -1
View File
@@ -18,7 +18,7 @@ MenuDriveMode::MenuDriveMode(DriveManager* driveManager) {
void MenuDriveMode::left() {
this->firstPrint = true;
this->configureOnLeave();
this->driveManager->changeModus(Modi::Off);
this->driveManager->changeModus();
if (parentMenu) {
this->parentMenu->printMenu();
this->leaved = true;