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