FEATURE: added execute type menu entry

This commit is contained in:
Robin Dietzel 2023-01-10 14:37:30 +01:00
parent 5420b39dd2
commit 4ba4908f01
2 changed files with 66 additions and 0 deletions

View File

@ -0,0 +1,34 @@
//
// Created by robtor on 09.12.22.
//
#ifndef FLOATPUMP_MENU_ENTRY_TYPE_EXECUTE_H
#define FLOATPUMP_MENU_ENTRY_TYPE_EXECUTE_H
#include "Menu_Entry_Type_Delegate.h"
namespace floatpump::menu {
class Menu_Entry_Type_Execute : public Menu_Entry_Type_Delegate {
public:
explicit Menu_Entry_Type_Execute() {};
std::string toString() override;
void u_press() override;
void u_increase(uint16_t steps) override;
void u_decrease(uint16_t steps) override;
bool isEntered() override;
void linkConfig(bool *link);
private:
bool *m_state;
};
} // menu
#endif //FLOATPUMP_MENU_ENTRY_TYPE_EXECUTE_H

View File

@ -0,0 +1,32 @@
//
// Created by robtor on 10.01.23.
//
#include "Menu_Entry_Type_Execute.h"
namespace floatpump::menu {
std::string floatpump::menu::Menu_Entry_Type_Execute::toString() {
return {(*m_state) ? "[--]" : "[XX]"};
}
void floatpump::menu::Menu_Entry_Type_Execute::u_press() {
*m_state = true;
}
void floatpump::menu::Menu_Entry_Type_Execute::u_increase(uint16_t steps) {
}
void floatpump::menu::Menu_Entry_Type_Execute::u_decrease(uint16_t steps) {
}
bool floatpump::menu::Menu_Entry_Type_Execute::isEntered() {
return false;
}
void floatpump::menu::Menu_Entry_Type_Execute::linkConfig(bool *link) {
m_state = link;
}
}