diff --git a/Core/Inc/git_rev.h b/Core/Inc/git_rev.h index 41284d1..f897122 100644 --- a/Core/Inc/git_rev.h +++ b/Core/Inc/git_rev.h @@ -7,6 +7,6 @@ // Auto generated header file containing the last git revision -#define GIT_HASH "527ebdc" +#define GIT_HASH "49c43ab" #endif //FLOATPUMP_GIT_REVISION_TEMPLATE_H \ No newline at end of file diff --git a/Core/Src/main.cpp b/Core/Src/main.cpp index 112104b..6065af7 100644 --- a/Core/Src/main.cpp +++ b/Core/Src/main.cpp @@ -5,18 +5,11 @@ #include "LCD_I2C_Driver.h" #include "InitSequence.h" #include "button_input.h" -#include "Menu.h" -#include "Menu_Entry_Type_Checkable.h" -#include "Menu_Entry_Type_Numeric.h" -#include "Menu_Entry_Type_Percent.h" -#include "Menu_Entry_Type_ReadOnly.h" -#include "Menu_Entry_Type_Time.h" #include "Config_Store.h" #include "Menu_Controller.h" #include "PressureChannel.h" #include "RelayChannel.h" #include "GPIChannel.h" -#include "Menu_Entry_Type_Execute.h" #include "NewMenu.h" #define SLAVE_ADDRESS_LCD 0x4e @@ -150,27 +143,9 @@ int main(void) { InitSequence initializer(display); initializer.runInitSequence(); + using namespace floatpump::menu; - //EXP - - using namespace floatpump::newmenu; - - - - //EXP - - - /// - /// - /// LOGICAL CODE BEGIN - /// - /// - /// - - using namespace floatpump; - - - newmenu::Menu tankmenu("Tank"); + Menu tankmenu("Tank"); bool a_caliblow, a_calibhigh = false; tankmenu.addEntry(&a_caliblow, "Kal. Unt. Punkt"); @@ -185,7 +160,7 @@ int main(void) { tankmenu.addEntry(globalConfig.TankPumpInvert.getLink(), "Inv Relais"); - newmenu::Menu refillmenu("Nachspeisung"); + Menu refillmenu("Nachspeisung"); refillmenu.addEntry(globalConfig.RefillEnable.getLink(), "Nachsp. akt."); refillmenu.addEntry(globalConfig.RefillBlockEnable.getLink(), "Notabschalt."); @@ -197,12 +172,11 @@ int main(void) { refillmenu.addEntry(globalConfig.RefillCooldown.getLink(), "Wartezeit"); - newmenu::Menu mainmenu("Hauptmenu"); + Menu mainmenu("Hauptmenu"); mainmenu.addSubmenu(&tankmenu); mainmenu.addSubmenu(&refillmenu); - newmenu::Menu_Controller controller(&mainmenu, display); - static int old_pos = 0; + //Instantiate Input and Output modules io::PressureChannel tankLevel0(&hadc1, MPWR0_GPIO_Port, MPWR0_Pin, 50); @@ -216,16 +190,11 @@ int main(void) { uint32_t last_backlight_retrigger = 0; bool f_store = false, f_restore = false; -// menu::Menu_Entry_Type_Execute t_MStore; -// menu::Menu_Entry_Type_Execute t_MRestore; -// t_MStore.linkConfig(&f_store); -// t_MRestore.linkConfig(&f_restore); -// menu::Menu_Entry MStore(t_MStore, "Speichern"); -// menu::Menu_Entry MRestore(t_MRestore, "Laden"); -// -// -// mainmenu.addEntry(MStore); -// mainmenu.addEntry(MRestore); + mainmenu.addEntry(&f_store, "Speichern"); + mainmenu.addEntry(&f_restore, "Laden"); + + Menu_Controller controller(&mainmenu, display); + static int old_pos = 0; while (1) { @@ -276,11 +245,11 @@ int main(void) { //Check for rotation to enable display backlight if (old_pos < rot_counter) { - controller.pushEvent(newmenu::Menu_Controller::Event::Increase); + controller.pushEvent(menu::Menu_Controller::Event::Increase); old_pos = rot_counter; last_backlight_retrigger = HAL_GetTick(); } else if (old_pos > rot_counter) { - controller.pushEvent(newmenu::Menu_Controller::Event::Decrease); + controller.pushEvent(menu::Menu_Controller::Event::Decrease); old_pos = rot_counter; last_backlight_retrigger = HAL_GetTick(); } @@ -301,16 +270,16 @@ int main(void) { controller.execute(); if (rot_button) { rot_button = false; - controller.pushEvent(newmenu::Menu_Controller::Event::Push); + controller.pushEvent(menu::Menu_Controller::Event::Push); last_menu_retrigger = HAL_GetTick(); } if (old_pos < rot_counter) { - controller.pushEvent(newmenu::Menu_Controller::Event::Increase); + controller.pushEvent(menu::Menu_Controller::Event::Increase); old_pos = rot_counter; last_menu_retrigger = HAL_GetTick(); } else if (old_pos > rot_counter) { - controller.pushEvent(newmenu::Menu_Controller::Event::Decrease); + controller.pushEvent(menu::Menu_Controller::Event::Decrease); old_pos = rot_counter; last_menu_retrigger = HAL_GetTick(); } diff --git a/Middlewares/floatpump/Inc/Menu.h b/Middlewares/floatpump/Inc/Menu.h deleted file mode 100644 index 63f3381..0000000 --- a/Middlewares/floatpump/Inc/Menu.h +++ /dev/null @@ -1,54 +0,0 @@ -// -// Created by robtor on 09.12.22. -// - -#ifndef FLOATPUMP_MENU_H -#define FLOATPUMP_MENU_H - -#include -#include -#include -#include "Menu_Entry.h" -#include "LCD_I2C_Driver.h" - -namespace floatpump::menu { - - class Menu { - - public: - - explicit Menu(std::string name) : m_name(std::move(name)) {} - - //Add specific components - void addEntry(const Menu_Entry &entry); - - void addSubmenu(Menu *submenu); - - //Get this menu as string - [[nodiscard]] std::string printLine() const; - - //Get all submenus and entries as string vector - std::vector getDisplayList(); - - //Get number of all entries - [[nodiscard]] unsigned int getAllEntriesNum() const; - - //Retrieve specific submenu, returns nullptr on error - Menu *getSubmenu(int index); - - //Retrieve specific entry, returns nullptr on error - Menu_Entry *getEntry(int index); - - //Returns parent menu pointer or nullptr - Menu *getParent(); - - private: - std::vector m_entries; //normal menu entries - std::vector m_submenus; //all submenu entries - Menu *m_parent = nullptr; //the parent menu, if it is a submenu - std::string m_name = "Menu"; //the name of this menu (displayed if it is an submenu) - }; - -} - -#endif //FLOATPUMP_MENU_H diff --git a/Middlewares/floatpump/Inc/Menu_Controller.h b/Middlewares/floatpump/Inc/Menu_Controller.h index a11a91f..f34f5c8 100644 --- a/Middlewares/floatpump/Inc/Menu_Controller.h +++ b/Middlewares/floatpump/Inc/Menu_Controller.h @@ -8,7 +8,7 @@ #include "NewMenu.h" #include "LCD_I2C_Driver.h" -namespace floatpump::newmenu { +namespace floatpump::menu { class Menu_Controller { public: diff --git a/Middlewares/floatpump/Inc/Menu_Entry.h b/Middlewares/floatpump/Inc/Menu_Entry.h deleted file mode 100644 index a96f4a0..0000000 --- a/Middlewares/floatpump/Inc/Menu_Entry.h +++ /dev/null @@ -1,38 +0,0 @@ -// -// Created by robtor on 04.01.23. -// - -#ifndef FLOATPUMP_MENU_ENTRY_H -#define FLOATPUMP_MENU_ENTRY_H - -#include - - -namespace floatpump::menu { - - class Menu_Entry { - public: - Menu_Entry(Menu_Entry_Type_Delegate &type, std::string name) : m_type(type), m_name(name) {}; - - - - //Retreive string for putting on display - std::string printLine(); - - void action_press(); - - void action_increase(); - - void action_decrease(); - - //Check if currently entered - bool isEntered(); - - private: - std::string m_name; - menu::Menu_Entry_Type_Delegate &m_type; //Saves type of this menu entry - }; - -} - -#endif //FLOATPUMP_MENU_ENTRY_H diff --git a/Middlewares/floatpump/Inc/Menu_Entry_Type_Checkable.h b/Middlewares/floatpump/Inc/Menu_Entry_Type_Checkable.h deleted file mode 100644 index 2df005b..0000000 --- a/Middlewares/floatpump/Inc/Menu_Entry_Type_Checkable.h +++ /dev/null @@ -1,34 +0,0 @@ -// -// Created by robtor on 09.12.22. -// - -#ifndef FLOATPUMP_MENU_ENTRY_TYPE_CHECKABLE_H -#define FLOATPUMP_MENU_ENTRY_TYPE_CHECKABLE_H - -#include "Menu_Entry_Type_Delegate.h" - -namespace floatpump::menu { - - class Menu_Entry_Type_Checkable : public Menu_Entry_Type_Delegate { - public: - explicit Menu_Entry_Type_Checkable(bool mState); - - 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_CHECKABLE_H diff --git a/Middlewares/floatpump/Inc/Menu_Entry_Type_Delegate.h b/Middlewares/floatpump/Inc/Menu_Entry_Type_Delegate.h deleted file mode 100644 index e1ae09f..0000000 --- a/Middlewares/floatpump/Inc/Menu_Entry_Type_Delegate.h +++ /dev/null @@ -1,26 +0,0 @@ -// -// Created by robtor on 09.12.22. -// - -#ifndef FLOATPUMP_MENU_ENTRY_DELEGATE_H -#define FLOATPUMP_MENU_ENTRY_DELEGATE_H - -#include - -namespace floatpump { - namespace menu { - - - class Menu_Entry_Type_Delegate { - public: - virtual std::string toString() = 0; - virtual void u_press() = 0; - virtual void u_increase(uint16_t steps = 1) = 0; - virtual void u_decrease(uint16_t steps = 1) = 0; - virtual bool isEntered() = 0; - }; - - } // floatpump -} // menu - -#endif //FLOATPUMP_MENU_ENTRY_DELEGATE_H diff --git a/Middlewares/floatpump/Inc/Menu_Entry_Type_Execute.h b/Middlewares/floatpump/Inc/Menu_Entry_Type_Execute.h deleted file mode 100644 index fd78b6c..0000000 --- a/Middlewares/floatpump/Inc/Menu_Entry_Type_Execute.h +++ /dev/null @@ -1,34 +0,0 @@ -// -// 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/Inc/Menu_Entry_Type_Numeric.h b/Middlewares/floatpump/Inc/Menu_Entry_Type_Numeric.h deleted file mode 100644 index e01ca8e..0000000 --- a/Middlewares/floatpump/Inc/Menu_Entry_Type_Numeric.h +++ /dev/null @@ -1,38 +0,0 @@ -// -// Created by robtor on 04.01.23. -// - -#ifndef FLOATPUMP_MENU_ENTRY_TYPE_NUMERIC_H -#define FLOATPUMP_MENU_ENTRY_TYPE_NUMERIC_H - -#include -#include "Menu_Entry_Type_Delegate.h" - -namespace floatpump { - namespace menu { - - class Menu_Entry_Type_Numeric : public Menu_Entry_Type_Delegate { - public: - explicit Menu_Entry_Type_Numeric(uint16_t mValue); - - 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(uint16_t *link); - - private: - uint16_t *m_value = 0; - bool m_entered = false; - }; - - } // floatpump -} // menu - -#endif //FLOATPUMP_MENU_ENTRY_TYPE_NUMERIC_H diff --git a/Middlewares/floatpump/Inc/Menu_Entry_Type_Percent.h b/Middlewares/floatpump/Inc/Menu_Entry_Type_Percent.h deleted file mode 100644 index 929b9a2..0000000 --- a/Middlewares/floatpump/Inc/Menu_Entry_Type_Percent.h +++ /dev/null @@ -1,39 +0,0 @@ -// -// Created by robtor on 05.01.23. -// - -#ifndef FLOATPUMP_MENU_ENTRY_TYPE_PERCENT_H -#define FLOATPUMP_MENU_ENTRY_TYPE_PERCENT_H - -#include "Menu_Entry_Type_Delegate.h" - -namespace floatpump::menu { - - - class Menu_Entry_Type_Percent : public floatpump::menu::Menu_Entry_Type_Delegate { - public: - explicit Menu_Entry_Type_Percent(uint8_t val);; - - 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(uint8_t *link); - - private: - uint8_t *m_value = nullptr; - bool m_entered = false; - }; - -} //floatpump - - - - -#endif //FLOATPUMP_MENU_ENTRY_TYPE_PERCENT_H diff --git a/Middlewares/floatpump/Inc/Menu_Entry_Type_ReadOnly.h b/Middlewares/floatpump/Inc/Menu_Entry_Type_ReadOnly.h deleted file mode 100644 index 82b626d..0000000 --- a/Middlewares/floatpump/Inc/Menu_Entry_Type_ReadOnly.h +++ /dev/null @@ -1,51 +0,0 @@ -// -// Created by robtor on 06.01.23. -// - -#ifndef FLOATPUMP_MENU_ENTRY_TYPE_READONLY_H -#define FLOATPUMP_MENU_ENTRY_TYPE_READONLY_H - -#include "Menu_Entry_Type_Delegate.h" - -namespace floatpump { - namespace menu { - - template - class Menu_Entry_Type_ReadOnly : public Menu_Entry_Type_Delegate { - public: - explicit Menu_Entry_Type_ReadOnly(T store) { - m_store = new T(store); - }; - - std::string toString() override { - return std::to_string(*m_store); - } - - void u_press() override { - - } - - void u_increase(uint16_t steps) override { - - } - - void u_decrease(uint16_t steps) override { - - } - - bool isEntered() override { - return false; - } - - void linkConfig(T *link) { - m_store = link; - } - - private: - T *m_store; - }; - - } // floatpump -} // menu - -#endif //FLOATPUMP_MENU_ENTRY_TYPE_READONLY_H diff --git a/Middlewares/floatpump/Inc/Menu_Entry_Type_Time.h b/Middlewares/floatpump/Inc/Menu_Entry_Type_Time.h deleted file mode 100644 index 221ffc5..0000000 --- a/Middlewares/floatpump/Inc/Menu_Entry_Type_Time.h +++ /dev/null @@ -1,35 +0,0 @@ -// -// Created by robtor on 05.01.23. -// - -#ifndef FLOATPUMP_MENU_ENTRY_TYPE_TIME_H -#define FLOATPUMP_MENU_ENTRY_TYPE_TIME_H - -#include "Menu_Entry_Type_Delegate.h" - -namespace floatpump::menu { - - class Menu_Entry_Type_Time : public Menu_Entry_Type_Delegate{ - public: - Menu_Entry_Type_Time(uint8_t hour, uint8_t minute, uint8_t second);; - - 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(uint8_t *c_hour, uint8_t *c_minute, uint8_t *c_second); - - private: - uint8_t m_entered = 0; - uint8_t *m_hour, *m_minute, *m_second = nullptr; - }; - - } // menu - -#endif //FLOATPUMP_MENU_ENTRY_TYPE_TIME_H diff --git a/Middlewares/floatpump/Inc/NewMenu.h b/Middlewares/floatpump/Inc/NewMenu.h index 097794f..a3a6b84 100644 --- a/Middlewares/floatpump/Inc/NewMenu.h +++ b/Middlewares/floatpump/Inc/NewMenu.h @@ -12,7 +12,7 @@ #include namespace floatpump { - namespace newmenu { + namespace menu { struct IMenuEntry { virtual ~IMenuEntry() = default; @@ -181,7 +181,7 @@ namespace floatpump { explicit Menu(const std::string &m_name) : m_name(m_name) {} template - auto addEntry(As&& ...args) -> void{ + auto addEntry(As &&...args) -> void { m_entries.push_back(std::make_unique(std::forward(args)...)); } @@ -221,7 +221,7 @@ namespace floatpump { return (m_entries.size() + m_submenus.size()) + ((m_parent != nullptr) ? 1 : 0); } - auto getSubmenu(int index) -> Menu* { + auto getSubmenu(int index) -> Menu * { if (index >= 0 && index < m_submenus.size()) { return m_submenus[index]; } else { @@ -237,7 +237,7 @@ namespace floatpump { } } - auto getParent() -> Menu* { + auto getParent() -> Menu * { return m_parent; } diff --git a/Middlewares/floatpump/Src/Menu.cpp b/Middlewares/floatpump/Src/Menu.cpp deleted file mode 100644 index 9073d6a..0000000 --- a/Middlewares/floatpump/Src/Menu.cpp +++ /dev/null @@ -1,69 +0,0 @@ -// -// Created by robtor on 09.12.22. -// - -#include "Menu.h" - -namespace floatpump::menu { - void Menu::addEntry(const Menu_Entry &entry) { - m_entries.push_back(entry); - } - - void Menu::addSubmenu(Menu *submenu) { - //Always set this menu as parent of created submenus within this menu - submenu->m_parent = this; - m_submenus.push_back(submenu); - } - - std::string Menu::printLine() const { - return m_name; - } - - std::vector Menu::getDisplayList() { - std::vector list; - - list.reserve(m_submenus.size() + m_entries.size()); - - //Append all Submenus - for (auto &m_submenu: m_submenus) { - list.push_back(m_submenu->printLine()); - } - - //Append all Entries - for (auto &m_entry: m_entries) { - list.push_back(m_entry.printLine()); - } - - //Append Go-Back-Entry if we are within a submenu - if (m_parent != nullptr) { - list.emplace_back("<- Go Back"); - } - - return list; - } - - unsigned int Menu::getAllEntriesNum() const { - //Add 1 to this if we have a parent menu -> makes Go-Back-Entry selectable - return (m_entries.size() + m_submenus.size()) + ((m_parent != nullptr) ? 1 : 0); - } - - Menu *Menu::getSubmenu(int index) { - if (index >= 0 && index < m_submenus.size()) { - return m_submenus[index]; - } else { - return nullptr; - } - } - - Menu_Entry *Menu::getEntry(int index) { - if (index >= m_submenus.size() && index < m_entries.size() + m_submenus.size()) { - return &m_entries[index - m_submenus.size()]; - } else { - return nullptr; - } - } - - Menu *Menu::getParent() { - return m_parent; - } -} \ No newline at end of file diff --git a/Middlewares/floatpump/Src/Menu_Controller.cpp b/Middlewares/floatpump/Src/Menu_Controller.cpp index 4d8110b..6276060 100644 --- a/Middlewares/floatpump/Src/Menu_Controller.cpp +++ b/Middlewares/floatpump/Src/Menu_Controller.cpp @@ -4,7 +4,7 @@ #include "Menu_Controller.h" -namespace floatpump::newmenu { +namespace floatpump::menu { void Menu_Controller::execute() { displayMenu(m_menu); diff --git a/Middlewares/floatpump/Src/Menu_Entry.cpp b/Middlewares/floatpump/Src/Menu_Entry.cpp deleted file mode 100644 index f1ada37..0000000 --- a/Middlewares/floatpump/Src/Menu_Entry.cpp +++ /dev/null @@ -1,35 +0,0 @@ -// -// Created by robtor on 04.01.23. -// - -#include "Menu_Entry.h" - -namespace floatpump { - namespace menu { - - std::string Menu_Entry::printLine() { - //We have 19 characters width for displaying the entry -> fill with spaces - int spaces = 19 - (m_name.length() + m_type.toString().length()); - std::string spacer; - if(spaces > 0) - spacer.append(spaces, ' '); - return m_name + spacer + m_type.toString(); - } - - void Menu_Entry::action_press() { - m_type.u_press(); - } - - void Menu_Entry::action_increase() { - m_type.u_increase(1); - } - - void Menu_Entry::action_decrease() { - m_type.u_decrease(1); - } - - bool Menu_Entry::isEntered() { - return m_type.isEntered(); - } - } // floatpump -} // menu \ No newline at end of file diff --git a/Middlewares/floatpump/Src/Menu_Entry_Type_Checkable.cpp b/Middlewares/floatpump/Src/Menu_Entry_Type_Checkable.cpp deleted file mode 100644 index 447339b..0000000 --- a/Middlewares/floatpump/Src/Menu_Entry_Type_Checkable.cpp +++ /dev/null @@ -1,39 +0,0 @@ -// -// Created by robtor on 09.12.22. -// - -#include "Menu_Entry_Type_Checkable.h" - -namespace floatpump { - namespace menu { - - - Menu_Entry_Type_Checkable::Menu_Entry_Type_Checkable(bool mState) { - m_state = new bool(mState); - } - - std::string Menu_Entry_Type_Checkable::toString() { - return {(*m_state) ? "ON " : "OFF"}; - } - - void Menu_Entry_Type_Checkable::u_press() { - *m_state = !(*m_state); - } - - void Menu_Entry_Type_Checkable::u_increase(uint16_t steps) { - - } - - void Menu_Entry_Type_Checkable::u_decrease(uint16_t steps) { - - } - - bool Menu_Entry_Type_Checkable::isEntered() { - return false; - } - - void Menu_Entry_Type_Checkable::linkConfig(bool *link) { - m_state = link; - } - } // floatpump -} // menu \ No newline at end of file diff --git a/Middlewares/floatpump/Src/Menu_Entry_Type_Execute.cpp b/Middlewares/floatpump/Src/Menu_Entry_Type_Execute.cpp deleted file mode 100644 index 933f3f3..0000000 --- a/Middlewares/floatpump/Src/Menu_Entry_Type_Execute.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// -// 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; - } - -} diff --git a/Middlewares/floatpump/Src/Menu_Entry_Type_Numeric.cpp b/Middlewares/floatpump/Src/Menu_Entry_Type_Numeric.cpp deleted file mode 100644 index e6385b3..0000000 --- a/Middlewares/floatpump/Src/Menu_Entry_Type_Numeric.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// -// Created by robtor on 04.01.23. -// - -#include "Menu_Entry_Type_Numeric.h" - -namespace floatpump { - namespace menu { - - Menu_Entry_Type_Numeric::Menu_Entry_Type_Numeric(uint16_t mValue) { - m_value = new uint16_t(mValue); - } - - std::string Menu_Entry_Type_Numeric::toString() { - if (m_entered) { - return std::string("> " + std::to_string(*m_value)); - } else { - return std::string(" " + std::to_string(*m_value)); - } - } - - void Menu_Entry_Type_Numeric::u_press() { - m_entered = !m_entered; - } - - void Menu_Entry_Type_Numeric::u_increase(uint16_t steps) { - (*m_value)++; - } - - void Menu_Entry_Type_Numeric::u_decrease(uint16_t steps) { - (*m_value)--; - } - - bool Menu_Entry_Type_Numeric::isEntered() { - return m_entered; - } - - void Menu_Entry_Type_Numeric::linkConfig(uint16_t *link) { - m_value = link; - } - } // floatpump -} // menu \ No newline at end of file diff --git a/Middlewares/floatpump/Src/Menu_Entry_Type_Percent.cpp b/Middlewares/floatpump/Src/Menu_Entry_Type_Percent.cpp deleted file mode 100644 index f0bccf4..0000000 --- a/Middlewares/floatpump/Src/Menu_Entry_Type_Percent.cpp +++ /dev/null @@ -1,40 +0,0 @@ -// -// Created by robtor on 05.01.23. -// - -#include "Menu_Entry_Type_Percent.h" - -std::string floatpump::menu::Menu_Entry_Type_Percent::toString() { - if (m_entered) { - return std::string("> %" + std::to_string(*m_value)); - } else { - return std::string(" %" + std::to_string(*m_value)); - } -} - -void floatpump::menu::Menu_Entry_Type_Percent::u_press() { - m_entered = !m_entered; -} - -void floatpump::menu::Menu_Entry_Type_Percent::u_increase(uint16_t steps) { - if (*m_value < 100) - (*m_value)++; -} - -void floatpump::menu::Menu_Entry_Type_Percent::u_decrease(uint16_t steps) { - if (*m_value > 0) { - (*m_value)--; - } -} - -bool floatpump::menu::Menu_Entry_Type_Percent::isEntered() { - return m_entered; -} - -floatpump::menu::Menu_Entry_Type_Percent::Menu_Entry_Type_Percent(uint8_t val) { - m_value = new uint8_t(val); -} - -void floatpump::menu::Menu_Entry_Type_Percent::linkConfig(uint8_t *link) { - m_value = link; -} diff --git a/Middlewares/floatpump/Src/Menu_Entry_Type_ReadOnly.cpp b/Middlewares/floatpump/Src/Menu_Entry_Type_ReadOnly.cpp deleted file mode 100644 index 572ae40..0000000 --- a/Middlewares/floatpump/Src/Menu_Entry_Type_ReadOnly.cpp +++ /dev/null @@ -1,10 +0,0 @@ -// -// Created by robtor on 06.01.23. -// - -#include "Menu_Entry_Type_ReadOnly.h" - -namespace floatpump { - namespace menu { - } // floatpump -} // menu \ No newline at end of file diff --git a/Middlewares/floatpump/Src/Menu_Entry_Type_Time.cpp b/Middlewares/floatpump/Src/Menu_Entry_Type_Time.cpp deleted file mode 100644 index d1454bc..0000000 --- a/Middlewares/floatpump/Src/Menu_Entry_Type_Time.cpp +++ /dev/null @@ -1,73 +0,0 @@ -// -// Created by robtor on 05.01.23. -// - -#include "Menu_Entry_Type_Time.h" - -namespace floatpump { - namespace menu { - std::string Menu_Entry_Type_Time::toString() { - switch(m_entered) { - case 0: - return std::string(" " + std::to_string(*m_hour) + ":" + std::to_string(*m_minute) + ":" + std::to_string(*m_second)); break; - case 1: - return std::string("#" + std::to_string(*m_hour) + ":" + std::to_string(*m_minute) + ":" + std::to_string(*m_second)); break; - case 2: - return std::string(" " + std::to_string(*m_hour) + "#" + std::to_string(*m_minute) + ":" + std::to_string(*m_second)); break; - case 3: - return std::string(" " + std::to_string(*m_hour) + ":" + std::to_string(*m_minute) + "#" + std::to_string(*m_second)); break; - } - return std::string(); - } - - void Menu_Entry_Type_Time::u_press() { - if(m_entered < 3) { - m_entered++; - } else { - m_entered = 0; - } - } - - void Menu_Entry_Type_Time::u_increase(uint16_t steps) { - switch(m_entered) { - case 1: - (*m_hour < 23) ? (*m_hour)++ : *m_hour = 0; break; - case 2: - (*m_minute < 59) ? (*m_minute)++ : *m_minute = 0; break; - case 3: - (*m_second < 59) ? (*m_second)++ : *m_second = 0; break; - } - } - - void Menu_Entry_Type_Time::u_decrease(uint16_t steps) { - switch(m_entered) { - case 1: - (*m_hour > 0) ? (*m_hour)-- : *m_hour = 23; break; - case 2: - (*m_minute > 0) ? (*m_minute)-- : *m_minute = 59; break; - case 3: - (*m_second > 0) ? (*m_second)-- : *m_second = 59; break; - } - } - - bool Menu_Entry_Type_Time::isEntered() { - if(m_entered > 0) { - return true; - } else { - return false; - } - } - - Menu_Entry_Type_Time::Menu_Entry_Type_Time(uint8_t hour, uint8_t minute, uint8_t second) { - m_hour = new uint8_t (hour); - m_minute = new uint8_t (minute); - m_second = new uint8_t (second); - } - - void Menu_Entry_Type_Time::linkConfig(uint8_t *c_hour, uint8_t *c_minute, uint8_t *c_second) { - m_hour = c_hour; - m_minute = c_minute; - m_second = c_second; - } - } // floatpump -} // menu \ No newline at end of file