diff --git a/applications/main/subghz/scenes/subghz_scene_read_raw.c b/applications/main/subghz/scenes/subghz_scene_read_raw.c index 690166723..43b53677a 100644 --- a/applications/main/subghz/scenes/subghz_scene_read_raw.c +++ b/applications/main/subghz/scenes/subghz_scene_read_raw.c @@ -130,15 +130,6 @@ void subghz_scene_read_raw_on_enter(void* context) { if(subghz->fav_timeout) { scene_manager_handle_custom_event( subghz->scene_manager, SubGhzCustomEventViewReadRAWSendStart); - // with_view_model( - // subghz->subghz_read_raw->view, - // SubGhzReadRAWModel * model, - // { - // scene_manager_handle_custom_event( - // subghz->scene_manager, SubGhzCustomEventViewReadRAWSendStart); - // model->status = SubGhzReadRAWStatusTXRepeat; - // }, - // true); } } diff --git a/applications/main/subghz/scenes/subghz_scene_receiver.c b/applications/main/subghz/scenes/subghz_scene_receiver.c index 23b520503..713a67f19 100644 --- a/applications/main/subghz/scenes/subghz_scene_receiver.c +++ b/applications/main/subghz/scenes/subghz_scene_receiver.c @@ -112,7 +112,6 @@ void subghz_scene_receiver_callback(SubGhzCustomEvent event, void* context) { void repeater_stop_callback(void* context) { SubGhz* subghz = context; - furi_timer_stop(subghz->fav_timer); scene_manager_handle_custom_event(subghz->scene_manager, SubGhzCustomEventViewRepeaterStop); } @@ -265,7 +264,8 @@ void subghz_scene_receiver_on_enter(void* context) { SubGhzSpeakerStateShutdown); //Set up a timer for the repeater (recycled favorites timeout TX timer!). - subghz->fav_timer = furi_timer_alloc(repeater_stop_callback, FuriTimerTypePeriodic, subghz); + if(!subghz->timer) + subghz->timer = furi_timer_alloc(repeater_stop_callback, FuriTimerTypeOnce, subghz); //Remember if the repeater was loaded, and do cleanups we need. subghz->repeater = subghz->last_settings->repeater_state; @@ -386,7 +386,7 @@ bool subghz_scene_receiver_on_event(void* context, SceneManagerEvent event) { ((subghz->repeater & SubGhzRepeaterStateOnShort) != 0) ? 1 * tmpTe : repeatnormal * tmpTe; - furi_timer_start(subghz->fav_timer, repeat_time); + furi_timer_start(subghz->timer, repeat_time); } subghz_rx_key_state_set(subghz, SubGhzRxKeyStateTX); break; diff --git a/applications/main/subghz/scenes/subghz_scene_transmitter.c b/applications/main/subghz/scenes/subghz_scene_transmitter.c index 6347f684d..dc1c83303 100644 --- a/applications/main/subghz/scenes/subghz_scene_transmitter.c +++ b/applications/main/subghz/scenes/subghz_scene_transmitter.c @@ -70,19 +70,12 @@ void subghz_scene_transmitter_on_enter(void* context) { // Auto send and exit with favorites if(subghz->fav_timeout) { - // subghz_custom_btn_set(0); + furi_check(!subghz->timer, "SubGhz fav timer exists"); + subghz->timer = furi_timer_alloc(fav_timer_callback, FuriTimerTypeOnce, subghz); scene_manager_handle_custom_event( subghz->scene_manager, SubGhzCustomEventViewTransmitterSendStart); - // with_view_model( - // subghz->subghz_transmitter->view, - // SubGhzViewTransmitterModel * model, - // { model->show_button = false; }, - // true); - subghz->fav_timer = furi_timer_alloc(fav_timer_callback, FuriTimerTypeOnce, subghz); furi_timer_start( - subghz->fav_timer, - xtreme_settings.favorite_timeout * furi_kernel_get_tick_frequency()); - // subghz->state_notifications = SubGhzNotificationStateTx; + subghz->timer, xtreme_settings.favorite_timeout * furi_kernel_get_tick_frequency()); } } diff --git a/applications/main/subghz/subghz.c b/applications/main/subghz/subghz.c index a972d05b5..0f67ddcd6 100644 --- a/applications/main/subghz/subghz.c +++ b/applications/main/subghz/subghz.c @@ -429,9 +429,9 @@ int32_t subghz_app(char* p) { view_dispatcher_run(subghz->view_dispatcher); - if(subghz->fav_timer) { - furi_timer_stop(subghz->fav_timer); - furi_timer_free(subghz->fav_timer); + if(subghz->timer) { + furi_timer_stop(subghz->timer); + furi_timer_free(subghz->timer); } furi_hal_power_suppress_charge_exit(); diff --git a/applications/main/subghz/subghz_i.h b/applications/main/subghz/subghz_i.h index a2cd42f28..5587b3788 100644 --- a/applications/main/subghz/subghz_i.h +++ b/applications/main/subghz/subghz_i.h @@ -103,7 +103,7 @@ struct SubGhz { SubGhzLoadTypeFile load_type_file; bool fav_timeout; - FuriTimer* fav_timer; + FuriTimer* timer; void* rpc_ctx; };