Merge branch 'main'
of git.kleiax.de:kleiax/Projektarbeit-Rover
This commit is contained in:
@@ -11,10 +11,7 @@
|
|||||||
|
|
||||||
#include "menuAutopilot.h"
|
#include "menuAutopilot.h"
|
||||||
|
|
||||||
void MenuAutopilot::printMenu() {
|
void MenuAutopilot::printPage() const {
|
||||||
if (this->firstPrint)
|
|
||||||
this->init();
|
|
||||||
|
|
||||||
char buf1[17];
|
char buf1[17];
|
||||||
char buf2[17];
|
char buf2[17];
|
||||||
char unit[3];
|
char unit[3];
|
||||||
@@ -72,7 +69,7 @@ void MenuAutopilot::update() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MenuAutopilot::init() {
|
void MenuAutopilot::init() {
|
||||||
this->firstPrint = false;
|
this->setCountPages(4);
|
||||||
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();
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class MenuAutopilot : public MenuDriveMode {
|
|||||||
* Changes the DriveModi to Autopilot if it is the first time called
|
* Changes the DriveModi to Autopilot if it is the first time called
|
||||||
* and save the Autopilot object.
|
* and save the Autopilot object.
|
||||||
*/
|
*/
|
||||||
void printMenu();
|
void printPage() const override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief can be called to update shown data
|
* @brief can be called to update shown data
|
||||||
@@ -44,7 +44,7 @@ class MenuAutopilot : public MenuDriveMode {
|
|||||||
void update() override;
|
void update() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void init();
|
void init() override;
|
||||||
|
|
||||||
Autopilot* autopilot;
|
Autopilot* autopilot;
|
||||||
RouteInfo routeInfo;
|
RouteInfo routeInfo;
|
||||||
|
|||||||
@@ -10,16 +10,32 @@
|
|||||||
*/
|
*/
|
||||||
#include "menuCaptureRoute.h"
|
#include "menuCaptureRoute.h"
|
||||||
|
|
||||||
void MenuCaptureRoute::printMenu() {
|
void MenuCaptureRoute::printPage() const {
|
||||||
if (this->firstPrint)
|
RouteInfo routeInfo = this->captureRoute->getRouteInfo();
|
||||||
this->init();
|
uint8_t currentPage = this->getCurrentPage();
|
||||||
|
|
||||||
|
String lineOne = "";
|
||||||
|
String lineTwo = "";
|
||||||
|
|
||||||
this->routeInfo = this->captureRoute->getRouteInfo();
|
switch (currentPage)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
lineOne = "Points: ";
|
||||||
|
lineOne.concat(routeInfo.totalPoints);
|
||||||
|
lineTwo = "You can drive.";
|
||||||
|
break;
|
||||||
|
|
||||||
String lineOne = "Points: ";
|
case 1:
|
||||||
String lineTwo = "You can drive.";
|
lineOne = "Average distance";
|
||||||
|
lineTwo = "xxx meters";
|
||||||
lineOne.concat(this->routeInfo.totalPoints);
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
lineOne = "Unkown page";
|
||||||
|
lineTwo = "Number: ";
|
||||||
|
lineTwo.concat(currentPage);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
this->print(lineOne, lineTwo);
|
this->print(lineOne, lineTwo);
|
||||||
}
|
}
|
||||||
@@ -31,7 +47,7 @@ void MenuCaptureRoute::update() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MenuCaptureRoute::init() {
|
void MenuCaptureRoute::init() {
|
||||||
this->firstPrint = false;
|
this->setCountPages(4);
|
||||||
this->driveManager->changeModus(Modi::CaptureRoute);
|
this->driveManager->changeModus(Modi::CaptureRoute);
|
||||||
this->captureRoute = (CaptureRoute*) this->driveManager->getDriveModiPtr();
|
this->captureRoute = (CaptureRoute*) this->driveManager->getDriveModiPtr();
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class MenuCaptureRoute : public MenuDriveMode {
|
|||||||
* Changes the DriveModi to CaptureRoute if it is the first time called
|
* Changes the DriveModi to CaptureRoute if it is the first time called
|
||||||
* and save the CaptureRoute object.
|
* and save the CaptureRoute object.
|
||||||
*/
|
*/
|
||||||
void printMenu();
|
void printPage() const override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief can be called to update shown data
|
* @brief can be called to update shown data
|
||||||
@@ -43,10 +43,9 @@ class MenuCaptureRoute : public MenuDriveMode {
|
|||||||
void update() override;
|
void update() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void init();
|
void init() override;
|
||||||
|
|
||||||
CaptureRoute* captureRoute;
|
CaptureRoute* captureRoute;
|
||||||
RouteInfo routeInfo;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MENU_MANUAL_DRIVE_H
|
#endif // MENU_MANUAL_DRIVE_H
|
||||||
|
|||||||
@@ -10,14 +10,34 @@
|
|||||||
*/
|
*/
|
||||||
#include "menuManualDrive.h"
|
#include "menuManualDrive.h"
|
||||||
|
|
||||||
void MenuManualControl::printMenu() {
|
void MenuManualControl::printPage() const {
|
||||||
if (this->firstPrint)
|
String lineOne = "";
|
||||||
this->init();
|
String lineTwo = "";
|
||||||
|
|
||||||
this->print("Now you can", "drive. :)");
|
uint8_t currentPage = this->getCurrentPage();
|
||||||
|
|
||||||
|
switch (currentPage) {
|
||||||
|
case 0:
|
||||||
|
lineOne = "-Ready to drive-";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 0:
|
||||||
|
lineOne = "Speed:";
|
||||||
|
lineTwo = "Warp 3";
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
lineOne = "Unkown page";
|
||||||
|
lineTwo = "Number: ";
|
||||||
|
lineTwo.concat(currentPage);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->print(lineOne, lineTwo);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuManualControl::init() {
|
void MenuManualControl::init() {
|
||||||
this->firstPrint = false;
|
this->firstPrint = false;
|
||||||
this->driveManager->changeModus(Modi::ManualControl);
|
this->driveManager->changeModus(Modi::ManualControl);
|
||||||
|
this->setCountPages(4);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,10 +35,10 @@ class MenuManualControl : public MenuDriveMode {
|
|||||||
*
|
*
|
||||||
* Changes the DriveModi to Autopilot if it is the first time called.
|
* Changes the DriveModi to Autopilot if it is the first time called.
|
||||||
*/
|
*/
|
||||||
void printMenu();
|
void printPage() const override;
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
void init();
|
void init() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MENU_MANUAL_DRIVE_H
|
#endif // MENU_MANUAL_DRIVE_H
|
||||||
|
|||||||
@@ -19,8 +19,10 @@ void MenuDriveMode::left() {
|
|||||||
this->firstPrint = true;
|
this->firstPrint = true;
|
||||||
this->configureOnLeave();
|
this->configureOnLeave();
|
||||||
this->driveManager->changeModus(Modi::Off);
|
this->driveManager->changeModus(Modi::Off);
|
||||||
if (parentMenu)
|
if (parentMenu) {
|
||||||
this->parentMenu->printMenu();
|
this->parentMenu->printMenu();
|
||||||
|
this->leaved = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuDriveMode::no() {
|
void MenuDriveMode::no() {
|
||||||
|
|||||||
@@ -11,14 +11,14 @@
|
|||||||
#ifndef MENU_DRIVE_MODI_H
|
#ifndef MENU_DRIVE_MODI_H
|
||||||
#define MENU_DRIVE_MODI_H
|
#define MENU_DRIVE_MODI_H
|
||||||
|
|
||||||
#include "menuControl.h"
|
#include "menuInformationSites.h"
|
||||||
#include "driveModi/driveManager.h"
|
#include "driveModi/driveManager.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A base class for Menus about DriveModi
|
* @brief A base class for Menus about DriveModi
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class MenuDriveMode : public MenuControl {
|
class MenuDriveMode : public MenuInformationSites {
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Construct a new Menu Drive Mode object
|
* @brief Construct a new Menu Drive Mode object
|
||||||
@@ -36,9 +36,6 @@ class MenuDriveMode : public MenuControl {
|
|||||||
* @brief Calls left.
|
* @brief Calls left.
|
||||||
*/
|
*/
|
||||||
void no() override;
|
void no() override;
|
||||||
|
|
||||||
|
|
||||||
virtual void printMenu() = 0;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void configureOnLeave() {}
|
void configureOnLeave() {}
|
||||||
|
|||||||
Reference in New Issue
Block a user