Skip to content

Commit 89e1620

Browse files
committed
rename timers, stop before free
1 parent 4fd0ce3 commit 89e1620

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

applications/main/lfrfid/scenes/lfrfid_scene_emulate.c

+6-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#define LFRFID_EMULATION_TIME_MAX_MS (5 * 60 * 1000)
44

5-
FuriTimer* timer;
5+
FuriTimer* timer_auto_exit;
66

77
void lfrfid_scene_emulate_popup_callback(void* context) {
88
LfRfid* app = context;
@@ -31,8 +31,9 @@ void lfrfid_scene_emulate_on_enter(void* context) {
3131
lfrfid_worker_emulate_start(app->lfworker, (LFRFIDProtocol)app->protocol_id);
3232
notification_message(app->notifications, &sequence_blink_start_magenta);
3333

34-
timer = furi_timer_alloc(lfrfid_scene_emulate_popup_callback, FuriTimerTypeOnce, app);
35-
furi_timer_start(timer, LFRFID_EMULATION_TIME_MAX_MS);
34+
timer_auto_exit =
35+
furi_timer_alloc(lfrfid_scene_emulate_popup_callback, FuriTimerTypeOnce, app);
36+
furi_timer_start(timer_auto_exit, LFRFID_EMULATION_TIME_MAX_MS);
3637

3738
view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewPopup);
3839
}
@@ -59,7 +60,8 @@ bool lfrfid_scene_emulate_on_event(void* context, SceneManagerEvent event) {
5960
void lfrfid_scene_emulate_on_exit(void* context) {
6061
LfRfid* app = context;
6162

62-
furi_timer_free(timer);
63+
furi_timer_stop(timer_auto_exit);
64+
furi_timer_free(timer_auto_exit);
6365

6466
notification_message(app->notifications, &sequence_blink_stop);
6567
popup_reset(app->popup);

applications/main/nfc/scenes/nfc_scene_emulate.c

+6-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
#define NFC_EMULATION_TIME_MAX_MS (5 * 60 * 1000)
66

7-
FuriTimer* timer;
7+
FuriTimer* timer_auto_exit;
88

99
void nfc_scene_emulate_timer_callback(void* context) {
1010
NfcApp* instance = context;
@@ -18,8 +18,9 @@ void nfc_scene_emulate_on_enter(void* context) {
1818

1919
nfc_protocol_support_on_enter(NfcProtocolSupportSceneEmulate, context);
2020

21-
timer = furi_timer_alloc(nfc_scene_emulate_timer_callback, FuriTimerTypeOnce, instance);
22-
furi_timer_start(timer, NFC_EMULATION_TIME_MAX_MS);
21+
timer_auto_exit =
22+
furi_timer_alloc(nfc_scene_emulate_timer_callback, FuriTimerTypeOnce, instance);
23+
furi_timer_start(timer_auto_exit, NFC_EMULATION_TIME_MAX_MS);
2324
}
2425

2526
bool nfc_scene_emulate_on_event(void* context, SceneManagerEvent event) {
@@ -40,6 +41,7 @@ bool nfc_scene_emulate_on_event(void* context, SceneManagerEvent event) {
4041
}
4142

4243
void nfc_scene_emulate_on_exit(void* context) {
43-
furi_timer_free(timer);
44+
furi_timer_stop(timer_auto_exit);
45+
furi_timer_free(timer_auto_exit);
4446
nfc_protocol_support_on_exit(NfcProtocolSupportSceneEmulate, context);
4547
}

0 commit comments

Comments
 (0)