doxygen comments

This commit is contained in:
2023-10-12 19:50:26 +02:00
parent f05ab56833
commit 9b8bf22795
11 changed files with 1346 additions and 1014 deletions
+118 -103
View File
@@ -1,103 +1,118 @@
/**
* @file menuControl.h
* @author Alexander Klein (alex@kleiax.de)
* @brief Contains a abstract class for Menu
* @version 0.1
* @date 2022-01-19
*
* @copyright Copyright (c) 2022
*
*/
#ifndef MENU_CONTROLL_H
#define MENU_CONTROLL_H
#include <Arduino.h>
#include <iostream>
#include "displayWrapper.h"
/**
* @brief Baseclass to build Menus
*
* This class have to be inherited by other classes which want to be
* act as a menu, because the menu structure uses polymorphism.
*
*/
class MenuControl {
public:
virtual ~MenuControl() {};
/** @name UserInputs
* @brief This functions should be called be user actions.
*
* This functions have to be implement in every other menu
* class.
*/
///@{
virtual void down() {};
virtual void up() {};
virtual void right() {};
virtual void left() {};
virtual void yes() {};
virtual void no() {};
///@}
/**
* @brief can be called to update shown data
*/
virtual void update() {
if (this->updateDelay == 0)
return;
if (millis() - this->lastUpdateMillis < this->updateDelay) {
return;
}
this->printMenu();
this->lastUpdateMillis = millis();
}
virtual void prepareReenterMenu() {}
virtual void printMenu() = 0;
/**
* @brief Set the Parent Menu
*
* If the parentMenu is set it will be called automaticaly
* when the user left the child menu.
*
* @param menu
*/
void setParentMenu(MenuControl* menu);
// MenuControl* getParentMenu() { return this->parentMenu; }
/**
* @brief Set the Lcd object
*
* If this is set the menu will be print on the display too.
*
* @param lcd
*/
void setLcd(DisplayWrapper* lcd) { this->lcd = lcd; }
/**
* @brief Set the time between each new print to the display
*
* If the delay is zero, no updates will be made.
* The delay is by default zero.
*
* @param delay time in milliseconds
*/
void setUpdateDelay(uint16_t delay = 0) { this->updateDelay = delay; }
protected:
void print(String lineOne, String lineTwo) const;
DisplayWrapper* getLcd() const { return this->lcd; }
MenuControl* parentMenu = nullptr;
DisplayWrapper* lcd = nullptr;
uint16_t updateDelay = 0;
uint32_t lastUpdateMillis = 0;
};
#endif // MENU_CONTROLL_H
/**
* @file menuControl.h
* @author Alexander Klein (alex@kleiax.de)
* @brief Contains a abstract class for Menu
* @version 0.1
* @date 2022-01-19
*
* @copyright Copyright (c) 2022
*
*/
#ifndef MENU_CONTROLL_H
#define MENU_CONTROLL_H
#include <Arduino.h>
#include <iostream>
#include "displayWrapper.h"
/**
* @brief Baseclass to build Menus
*
* This class have to be inherited by other classes which want to be
* act as a menu, because the menu structure uses polymorphism.
*
*/
class MenuControl
{
public:
virtual ~MenuControl(){};
/** @name UserInputs
* @brief This functions should be called be user actions.
*
* This functions have to be implement in every other menu
* class.
*/
///@{
virtual void down(){};
virtual void up(){};
virtual void right(){};
virtual void left(){};
virtual void yes(){};
virtual void no(){};
///@}
/**
* @brief can be called to update shown data
*
* The data will be only updated if a updateDelay is set
* and delay is reached.
*/
virtual void update();
/**
* @brief Prepare reenter the this menu
*
* This function must be called separately
*/
virtual void prepareReenterMenu() {}
/**
* @brief Function to print the Menu
*
* Have to be overwritten to implement the representation
* of the menu.
* This function have to call the print() function to access
* the display.
*/
virtual void printMenu() = 0;
/**
* @brief Set the Parent Menu
*
* If the parentMenu is set it will be called automaticaly
* when the user left the child menu.
* If the parentMenu has set a LCD it will be copied to the
* actual instance.
*
* @param menu
*/
void setParentMenu(MenuControl *menu);
/**
* @brief Set the Lcd object
*
* If this is set the menu will be print on the display too.
*
* @param lcd
*/
void setLcd(DisplayWrapper *lcd) { this->lcd = lcd; }
/**
* @brief Set the time between each new print to the display
*
* If the delay is zero, no updates will be made.
* The delay is by default zero.
*
* @param delay time in milliseconds
*/
void setUpdateDelay(uint16_t delay = 0) { this->updateDelay = delay; }
protected:
/**
* @brief
*
* @param lineOne
* @param lineTwo
*/
void print(String lineOne, String lineTwo) const;
DisplayWrapper *getLcd() const { return this->lcd; }
MenuControl *parentMenu = nullptr;
DisplayWrapper *lcd = nullptr;
uint16_t updateDelay = 0;
uint32_t lastUpdateMillis = 0;
};
#endif // MENU_CONTROLL_H