ready to test capture Route and Autopiloz

This commit is contained in:
2022-02-03 19:50:48 +01:00
parent 5ca21b09b2
commit bc37abcb66
20 changed files with 226 additions and 39 deletions
@@ -1,24 +1,25 @@
/**
* @file menuCaptureRoute.cpp
* @file menuAutopilot.cpp
* @author Alexander Klein (alex@kleiax.de)
* @brief
* @version 0.1
* @date 2022-01-31
* @date 2022-02-03
*
* @copyright Copyright (c) 2022
*
*/
#include "menuCaptureRoute.h"
void MenuCaptureRoute::printMenu() {
this->driveManager->changeModus(Modi::CaptureRoute);
#include "menuAutopilot.h"
void MenuAutopilot::printMenu() {
this->driveManager->changeModus(Modi::Autopilot);
if (this->lcd) {
this->lcd->clear();
this->lcd->setCursor(0, 0);
this->lcd->print("Jetzt kannst");
this->lcd->print("Autopilot");
this->lcd->setCursor(0, 1);
this->lcd->print("du fahren. :-)");
} else
std::cout << "Jetzt kannst du\n fahren. :-)" << std::endl;
std::cout << "Autopilot du\n fahren. :-)" << std::endl;
}
@@ -0,0 +1,23 @@
/**
* @file menuAutopilot.h
* @author Alexander Klein (alex@kleiax.de)
* @brief
* @version 0.1
* @date 2022-02-03
*
* @copyright Copyright (c) 2022
*
*/
#ifndef MENU_AUTOPILOT_DRIVE_H
#define MENU_AUTOPILOT_DRIVE_H
#include "SpecialMenus/menuDriveMode.h"
class MenuAutopilot : public MenuDriveMode {
public:
MenuAutopilot(DriveManager* driveManager) : MenuDriveMode(driveManager) {}
void printMenu();
};
#endif // MENU_AUTOPILOT_DRIVE_H
@@ -0,0 +1,46 @@
/**
* @file menuCaptureRoute.cpp
* @author Alexander Klein (alex@kleiax.de)
* @brief
* @version 0.1
* @date 2022-01-31
*
* @copyright Copyright (c) 2022
*
*/
#include "menuCaptureRoute.h"
MenuCaptureRoute::MenuCaptureRoute(DriveManager* driveManager)
: MenuDriveMode(driveManager) {
}
void MenuCaptureRoute::printMenu() {
if (this->firstPrint)
this->init();
if (this->lcd) {
this->lcd->clear();
this->lcd->setCursor(0, 0);
this->lcd->printf("Points: %u", this->routeInfo.totalPoints);
this->lcd->setCursor(0, 1);
this->lcd->print("du fahren. :-)");
} else
std::cout << "Capture du\n fahren. :-)" << std::endl;
}
void MenuCaptureRoute::update() {
if (millis() - this->last_millis < this->delay && !this->captureRoute->shouldUpdate())
return;
this->routeInfo = this->captureRoute->getRouteInfo();
this->printMenu();
this->last_millis = millis();
}
void MenuCaptureRoute::init() {
this->firstPrint = false;
this->driveManager->changeModus(Modi::CaptureRoute);
this->captureRoute = (CaptureRoute*) this->driveManager->getDriveModiPtr();
this->routeInfo = this->captureRoute->getRouteInfo();
}
@@ -11,12 +11,22 @@
#ifndef MENU_CAPTURE_ROUTE_H
#define MENU_MANUAL_DRIVE_H
#include "menuDriveMode.h"
#include "SpecialMenus/menuDriveMode.h"
class MenuCaptureRoute : public MenuDriveMode {
public:
MenuCaptureRoute(DriveManager* driveManager) : MenuDriveMode(driveManager) {}
MenuCaptureRoute(DriveManager* driveManager);
void printMenu();
void update();
private:
void init();
CaptureRoute* captureRoute;
RouteInfo routeInfo;
uint32_t last_millis = 0;
const uint16_t delay = 5000;
};
#endif // MENU_MANUAL_DRIVE_H
@@ -12,7 +12,7 @@
#ifndef MENU_MANUAL_DRIVE_H
#define MENU_MANUAL_DRIVE_H
#include "menuDriveMode.h"
#include "SpecialMenus/menuDriveMode.h"
class MenuManualControl : public MenuDriveMode {
public:
+1
View File
@@ -16,6 +16,7 @@ MenuDriveMode::MenuDriveMode(DriveManager* driveManager) {
}
void MenuDriveMode::left() {
this->firstPrint = true;
this->driveManager->changeModus(Modi::Off);
if (parentMenu)
this->parentMenu->printMenu();
+1
View File
@@ -30,6 +30,7 @@ class MenuDriveMode : public MenuControl {
protected:
DriveManager* driveManager;
bool firstPrint = true;
};
#endif // MENU_DRIVE_MODI_H