From 7bfb54eee97b0c764bea9f67a06e693bc037e312 Mon Sep 17 00:00:00 2001 From: GullCode Date: Sun, 20 Nov 2022 19:53:03 +0100 Subject: [PATCH] better order of events --- firmware/application/apps/ui_recon.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/firmware/application/apps/ui_recon.cpp b/firmware/application/apps/ui_recon.cpp index 781c6e84..9f185e94 100644 --- a/firmware/application/apps/ui_recon.cpp +++ b/firmware/application/apps/ui_recon.cpp @@ -1002,9 +1002,18 @@ namespace ui { if( recon_thread ) { - recon_thread->set_freq_index( current_index ); timer = 0 ; - + + recon_thread->set_freq_index( current_index ); + + RetuneMessage message { }; + receiver_model.set_tuning_frequency( frequency_list[ current_index ] . frequency_a ); // Retune + message.freq = frequency_list[ current_index ] . frequency_a ; + message.range = current_index ; + EventDispatcher::send_message(message); + + chThdSleepMilliseconds( recon_lock_duration ); // give some time to Thread::Run to pause + if( previous_userpause ) { user_pause(); @@ -1014,16 +1023,8 @@ namespace ui { user_resume(); } - RetuneMessage message { }; - receiver_model.set_tuning_frequency( frequency_list[ current_index ] . frequency_a ); // Retune - message.freq = frequency_list[ current_index ] . frequency_a ; - message.range = current_index ; - EventDispatcher::send_message(message); - - chThdSleepMilliseconds( recon_lock_duration ); // give some time to Thread::Run to pause - - recon_thread->set_recon( previous_is_recon ); recon_thread->set_freq_delete(false); + recon_thread->set_recon( previous_is_recon ); } };