From c52f5fa26c6068f74b9fc95aeb04cc9d429e8a3a Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Sat, 2 Jul 2016 16:38:01 -0700 Subject: [PATCH] Expose static EventDispatcher to stop main loop. Used to fix reboot into HackRF firmware. --- firmware/application/event_m0.cpp | 2 ++ firmware/application/event_m0.hpp | 4 ++-- firmware/application/ui_navigation.cpp | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/firmware/application/event_m0.cpp b/firmware/application/event_m0.cpp index 3acdb4f6..6f291dd3 100644 --- a/firmware/application/event_m0.cpp +++ b/firmware/application/event_m0.cpp @@ -90,6 +90,7 @@ private: static MessageHandlerMap message_map; Thread* EventDispatcher::thread_event_loop = nullptr; +bool EventDispatcher::is_running = false; EventDispatcher::EventDispatcher( ui::Widget* const top_widget, @@ -101,6 +102,7 @@ EventDispatcher::EventDispatcher( init_message_queues(); thread_event_loop = chThdSelf(); + is_running = true; touch_manager.on_event = [this](const ui::TouchEvent event) { this->on_touch_event(event); }; diff --git a/firmware/application/event_m0.hpp b/firmware/application/event_m0.hpp index d08ce78a..f89f0b75 100644 --- a/firmware/application/event_m0.hpp +++ b/firmware/application/event_m0.hpp @@ -50,7 +50,7 @@ public: ); void run(); - void request_stop(); + static void request_stop(); void set_display_sleep(const bool sleep); @@ -99,7 +99,7 @@ private: ui::Painter painter; ui::Context& context; uint32_t encoder_last = 0; - bool is_running = true; + static bool is_running; bool sd_card_present = false; bool display_sleep = false; bool halt = false; diff --git a/firmware/application/ui_navigation.cpp b/firmware/application/ui_navigation.cpp index 20110b68..4238af12 100644 --- a/firmware/application/ui_navigation.cpp +++ b/firmware/application/ui_navigation.cpp @@ -251,8 +251,8 @@ Context& SystemView::context() const { /* HackRFFirmwareView ****************************************************/ HackRFFirmwareView::HackRFFirmwareView(NavigationView& nav) { - button_yes.on_select = [&nav](Button&){ - m4_request_shutdown(); + button_yes.on_select = [](Button&){ + EventDispatcher::request_stop(); }; button_no.on_select = [&nav](Button&){