From 0a8194fa104f2780194e22d94f783cc1bfd0412e Mon Sep 17 00:00:00 2001 From: "E.T" Date: Fri, 12 Jan 2024 17:33:41 +0100 Subject: [PATCH] Really go home before starting app from serial (#1762) --- firmware/application/ui_navigation.cpp | 10 +++++++++- firmware/application/ui_navigation.hpp | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/firmware/application/ui_navigation.cpp b/firmware/application/ui_navigation.cpp index 66808b86..1a9c7f9c 100644 --- a/firmware/application/ui_navigation.cpp +++ b/firmware/application/ui_navigation.cpp @@ -146,7 +146,7 @@ std::vector NavigationView::fixedAppListFC = { {"lookingglass", "Looking Glass", RX}}; bool NavigationView::StartAppByName(const char* name) { - pop(); + home(false); if (strcmp(name, "adsbrx") == 0) { push(); return true; @@ -660,6 +660,14 @@ void NavigationView::pop(bool trigger_update) { if (on_pop) on_pop(); } +void NavigationView::home(bool trigger_update) { + while (view_stack.size() > 1) { + pop(false); + } + + if (trigger_update) update_view(); +} + void NavigationView::display_modal( const std::string& title, const std::string& message) { diff --git a/firmware/application/ui_navigation.hpp b/firmware/application/ui_navigation.hpp index 02c2bd46..ae07924c 100644 --- a/firmware/application/ui_navigation.hpp +++ b/firmware/application/ui_navigation.hpp @@ -91,6 +91,7 @@ class NavigationView : public View { View* push_view(std::unique_ptr new_view); void replace(View* v); void pop(bool trigger_update = true); + void home(bool trigger_update); void display_modal(const std::string& title, const std::string& message); void display_modal(