diff --git a/firmware/application/main.cpp b/firmware/application/main.cpp index 2bd1d64c..8b695e7e 100755 --- a/firmware/application/main.cpp +++ b/firmware/application/main.cpp @@ -66,6 +66,20 @@ public: }; } + void run() { + while(true) { + const auto events = wait(); + dispatch(events); + } + } + +private: + touch::Manager touch_manager; + ui::Widget* const top_widget; + ui::Painter& painter; + ui::Context& context; + uint32_t encoder_last = 0; + eventmask_t wait() { return chEvtWaitAny(ALL_EVENTS); } @@ -100,13 +114,6 @@ public: } } -private: - touch::Manager touch_manager; - ui::Widget* const top_widget; - ui::Painter& painter; - ui::Context& context; - uint32_t encoder_last = 0; - void handle_application_queue() { while( !shared_memory.application_queue.is_empty() ) { auto message = shared_memory.application_queue.pop(); @@ -250,10 +257,7 @@ int main(void) { m4_init(portapack::spi_flash::baseband, portapack::spi_flash::m4_text_ram_base); - while(true) { - const auto events = event_dispatcher.wait(); - event_dispatcher.dispatch(events); - } + event_dispatcher.run(); return 0; }