added freeze target point

This commit is contained in:
2023-05-23 21:01:27 +02:00
parent ca8d9bb963
commit 3a2c5b90f8
4 changed files with 21 additions and 2 deletions
+1 -1
View File
@@ -128,7 +128,7 @@ bool Navigation::getCourseCorrection(CourseCorrection& correction) {
return false; return false;
// Check if I need a new Point // Check if I need a new Point
if (distance < MIN_DISTANCE_TO_REACH_POINT) { if (distance < MIN_DISTANCE_TO_REACH_POINT && !this->preventNextPoint) {
if (!this->nextPoint()) { if (!this->nextPoint()) {
this->navigationFinished = true; this->navigationFinished = true;
this->navigationStarted = false; this->navigationStarted = false;
+2
View File
@@ -108,6 +108,7 @@ class Navigation {
* @return false route can not be started * @return false route can not be started
*/ */
bool startNavigation(); bool startNavigation();
void freezeTargetPoint(bool val = true) { this->preventNextPoint = val; };
/** /**
* @brief Get the Course Correction object * @brief Get the Course Correction object
@@ -218,6 +219,7 @@ class Navigation {
bool navigationStarted = false; bool navigationStarted = false;
bool navigationFinished = false; bool navigationFinished = false;
bool isNtripInit = false; bool isNtripInit = false;
bool preventNextPoint = false;
char* host; char* host;
char* mountPoint; char* mountPoint;
@@ -145,6 +145,14 @@ void MenuAutopilot::printPage() const {
this->autopilot->restart(); this->autopilot->restart();
break; break;
case 7:
lineOne = "Freeze target is";
if (this->targetFreezed)
lineTwo = "activated";
else
lineTwo = "deactivated";
break;
default: default:
this->printDefault(); this->printDefault();
return; return;
@@ -158,6 +166,13 @@ void MenuAutopilot::runCommand() const {
case 6: case 6:
this->autopilot->restart(); this->autopilot->restart();
break; break;
case 7:
if (this->targetFreezed)
this->driveManager->getNavigation()->freezeTargetPoint(false);
else
this->driveManager->getNavigation()->freezeTargetPoint();
break;
default: default:
break; break;
@@ -173,7 +188,7 @@ void MenuAutopilot::update() {
} }
void MenuAutopilot::init() { void MenuAutopilot::init() {
this->setCountPages(7); this->setCountPages(8);
this->driveManager->changeModus(Modi::Autopilot); this->driveManager->changeModus(Modi::Autopilot);
this->autopilot = (Autopilot*) this->driveManager->getDriveModiPtr(); this->autopilot = (Autopilot*) this->driveManager->getDriveModiPtr();
this->routeInfo = this->autopilot->getRouteInfo(); this->routeInfo = this->autopilot->getRouteInfo();
@@ -47,6 +47,8 @@ class MenuAutopilot : public MenuDriveMode {
private: private:
void init() override; void init() override;
bool targetFreezed = false;
Autopilot* autopilot; Autopilot* autopilot;
RouteInfo routeInfo; RouteInfo routeInfo;
}; };