100 lines
2.7 KiB
C++
100 lines
2.7 KiB
C++
/**
|
|
* @file menuTestMode.h
|
|
* @author Alexander Klein (alex@kleiax.de)
|
|
* @brief Contains a class to use and print information about the TestMode.
|
|
* @version 0.1
|
|
* @date 2022-09-08
|
|
*
|
|
* @copyright Copyright (c) 2022
|
|
*
|
|
*/
|
|
#ifndef MENU_TEST_MODE_H
|
|
#define MENU_TEST_MODE_H
|
|
|
|
#include "SpecialMenus/driveModi/menuDriveMode.h"
|
|
#include "driveModi/Modi/TestMode/testMode.h"
|
|
#include "menu.h"
|
|
#include "menuAction.h"
|
|
#include "menuIntInput.h"
|
|
#include "speedometerTest.h"
|
|
|
|
/**
|
|
* @brief Interact with the TestMode
|
|
*
|
|
*/
|
|
class MenuTestMode : public MenuControl {
|
|
public:
|
|
/**
|
|
* @brief Construct a new Menu Test Mode object
|
|
*
|
|
* @param driveManager
|
|
*/
|
|
MenuTestMode(DriveManager *driveManager);
|
|
~MenuTestMode();
|
|
|
|
/**
|
|
* @brief Prints the last informations
|
|
*
|
|
* On first call this function calls the init function.
|
|
* On every call this functions call the printMenu function from
|
|
* the mainMenu of this class.
|
|
*/
|
|
void printMenu() override;
|
|
|
|
/**
|
|
* @brief Prints maneuver Timer
|
|
*
|
|
* Aside from that the function looks if the maneuver is done and
|
|
* give the user input free.
|
|
*/
|
|
void printManeuverTime();
|
|
|
|
void down() override;
|
|
void up() override;
|
|
void right() override;
|
|
void left() override;
|
|
void yes() override;
|
|
void no() override;
|
|
|
|
/**
|
|
* @brief Calls the printManeuverTime function if a maneuver is in process.
|
|
*
|
|
*/
|
|
void update() override;
|
|
|
|
TestMode* getTestMode() const { return this->testMode; }
|
|
void maneuverStarted() { this->maneuverInAction = true; }
|
|
|
|
private:
|
|
void init();
|
|
bool checkInput();
|
|
|
|
DriveManager* driveManager;
|
|
TestMode* testMode;
|
|
Menu* mainMenu;
|
|
|
|
bool isInit = false;
|
|
bool maneuverInAction = false;
|
|
|
|
uint32_t lastUpdateTime = 0;
|
|
uint16_t updateDelay = 1000;
|
|
};
|
|
|
|
typedef bool (TestMode::*TestModeFunctionSingle)(int16_t);
|
|
typedef bool (TestMode::*TestModeFunctionDouble)(int16_t, int16_t);
|
|
class MenuTestModeWrapper : public MenuIntInputWrapper {
|
|
public:
|
|
MenuTestModeWrapper(MenuTestMode* menu, TestModeFunctionSingle testModeFunction);
|
|
MenuTestModeWrapper(MenuTestMode* menu, TestModeFunctionDouble testModeFunction);
|
|
|
|
void action(int16_t* values, uint8_t length) override;
|
|
|
|
private:
|
|
MenuTestMode* menu;
|
|
TestMode* testMode;
|
|
TestModeFunctionSingle testModeFunctionSingle = nullptr;
|
|
TestModeFunctionDouble testModeFunctionDouble = nullptr;
|
|
};
|
|
|
|
#endif // MENU_TEST_MODE_H
|