diff --git a/Core/Inc/git_rev.h b/Core/Inc/git_rev.h index bc979d1..6303431 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 "b7b396d" +#define GIT_HASH "5f98ee9" #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 1d3aed9..1eb5992 100644 --- a/Core/Src/main.cpp +++ b/Core/Src/main.cpp @@ -173,8 +173,8 @@ int main(void) { Menu mainmenu("Hauptmenu"); - mainmenu.addSubmenu(&tankmenu); - mainmenu.addSubmenu(&refillmenu); + mainmenu.addSubmenu(tankmenu); + mainmenu.addSubmenu(refillmenu); diff --git a/Middlewares/floatpump/Inc/Menu.h b/Middlewares/floatpump/Inc/Menu.h index 82d991d..8be31d7 100644 --- a/Middlewares/floatpump/Inc/Menu.h +++ b/Middlewares/floatpump/Inc/Menu.h @@ -143,9 +143,8 @@ namespace floatpump { } - auto addSubmenu(Menu *submenu) -> void { - submenu->m_parent = this; - m_submenus.push_back(submenu); + auto addSubmenu(Menu &menu) -> void { + m_submenus.emplace_back(std::make_unique(std::move(menu)))->m_parent = this; } auto printLine() -> const std::string { @@ -168,7 +167,7 @@ namespace floatpump { private: std::vector> m_entries; - std::vector m_submenus; + std::vector> m_submenus; Menu *m_parent = nullptr; std::string m_name; }; diff --git a/Middlewares/floatpump/Src/Menu.cpp b/Middlewares/floatpump/Src/Menu.cpp index 0c9b313..a48309f 100644 --- a/Middlewares/floatpump/Src/Menu.cpp +++ b/Middlewares/floatpump/Src/Menu.cpp @@ -98,7 +98,7 @@ namespace floatpump::menu { auto Menu::getSubmenu(int index) -> Menu * { if (index >= 0 && index < m_submenus.size()) { - return m_submenus[index]; + return m_submenus[index].get(); } else { return nullptr; }