From 26cb315845eedc0c17af18dd4e3d8a5b944b305e Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Wed, 21 Feb 2024 04:01:47 +0300 Subject: [PATCH] Revert "rename timers, stop before free" This reverts commit 89e1620883df64692685265c922b9961bb9c54cd. --- applications/main/lfrfid/scenes/lfrfid_scene_emulate.c | 10 ++++------ applications/main/nfc/scenes/nfc_scene_emulate.c | 10 ++++------ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/applications/main/lfrfid/scenes/lfrfid_scene_emulate.c b/applications/main/lfrfid/scenes/lfrfid_scene_emulate.c index b729f4de0..59fbb54d6 100644 --- a/applications/main/lfrfid/scenes/lfrfid_scene_emulate.c +++ b/applications/main/lfrfid/scenes/lfrfid_scene_emulate.c @@ -2,7 +2,7 @@ #define LFRFID_EMULATION_TIME_MAX_MS (5 * 60 * 1000) -FuriTimer* timer_auto_exit; +FuriTimer* timer; void lfrfid_scene_emulate_popup_callback(void* context) { LfRfid* app = context; @@ -31,9 +31,8 @@ void lfrfid_scene_emulate_on_enter(void* context) { lfrfid_worker_emulate_start(app->lfworker, (LFRFIDProtocol)app->protocol_id); notification_message(app->notifications, &sequence_blink_start_magenta); - timer_auto_exit = - furi_timer_alloc(lfrfid_scene_emulate_popup_callback, FuriTimerTypeOnce, app); - furi_timer_start(timer_auto_exit, LFRFID_EMULATION_TIME_MAX_MS); + timer = furi_timer_alloc(lfrfid_scene_emulate_popup_callback, FuriTimerTypeOnce, app); + furi_timer_start(timer, LFRFID_EMULATION_TIME_MAX_MS); view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewPopup); } @@ -60,8 +59,7 @@ bool lfrfid_scene_emulate_on_event(void* context, SceneManagerEvent event) { void lfrfid_scene_emulate_on_exit(void* context) { LfRfid* app = context; - furi_timer_stop(timer_auto_exit); - furi_timer_free(timer_auto_exit); + furi_timer_free(timer); notification_message(app->notifications, &sequence_blink_stop); popup_reset(app->popup); diff --git a/applications/main/nfc/scenes/nfc_scene_emulate.c b/applications/main/nfc/scenes/nfc_scene_emulate.c index 0f178f463..60be11a62 100644 --- a/applications/main/nfc/scenes/nfc_scene_emulate.c +++ b/applications/main/nfc/scenes/nfc_scene_emulate.c @@ -4,7 +4,7 @@ #define NFC_EMULATION_TIME_MAX_MS (5 * 60 * 1000) -FuriTimer* timer_auto_exit; +FuriTimer* timer; void nfc_scene_emulate_timer_callback(void* context) { NfcApp* instance = context; @@ -18,9 +18,8 @@ void nfc_scene_emulate_on_enter(void* context) { nfc_protocol_support_on_enter(NfcProtocolSupportSceneEmulate, context); - timer_auto_exit = - furi_timer_alloc(nfc_scene_emulate_timer_callback, FuriTimerTypeOnce, instance); - furi_timer_start(timer_auto_exit, NFC_EMULATION_TIME_MAX_MS); + timer = furi_timer_alloc(nfc_scene_emulate_timer_callback, FuriTimerTypeOnce, instance); + furi_timer_start(timer, NFC_EMULATION_TIME_MAX_MS); } bool nfc_scene_emulate_on_event(void* context, SceneManagerEvent event) { @@ -41,7 +40,6 @@ bool nfc_scene_emulate_on_event(void* context, SceneManagerEvent event) { } void nfc_scene_emulate_on_exit(void* context) { - furi_timer_stop(timer_auto_exit); - furi_timer_free(timer_auto_exit); + furi_timer_free(timer); nfc_protocol_support_on_exit(NfcProtocolSupportSceneEmulate, context); }