From 4ba4908f01a9d5e99cce3ab44022c17e7777d3c2 Mon Sep 17 00:00:00 2001 From: Robin Dietzel Date: Tue, 10 Jan 2023 14:37:30 +0100 Subject: [PATCH] FEATURE: added execute type menu entry --- .../floatpump/Inc/Menu_Entry_Type_Execute.h | 34 +++++++++++++++++++ .../floatpump/Src/Menu_Entry_Type_Execute.cpp | 32 +++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 Middlewares/floatpump/Inc/Menu_Entry_Type_Execute.h create mode 100644 Middlewares/floatpump/Src/Menu_Entry_Type_Execute.cpp diff --git a/Middlewares/floatpump/Inc/Menu_Entry_Type_Execute.h b/Middlewares/floatpump/Inc/Menu_Entry_Type_Execute.h new file mode 100644 index 0000000..fd78b6c --- /dev/null +++ b/Middlewares/floatpump/Inc/Menu_Entry_Type_Execute.h @@ -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 diff --git a/Middlewares/floatpump/Src/Menu_Entry_Type_Execute.cpp b/Middlewares/floatpump/Src/Menu_Entry_Type_Execute.cpp new file mode 100644 index 0000000..933f3f3 --- /dev/null +++ b/Middlewares/floatpump/Src/Menu_Entry_Type_Execute.cpp @@ -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; + } + +}