Revert "rename timers, stop before free"

This reverts commit 89e1620883.
This commit is contained in:
MX
2024-02-21 04:01:47 +03:00
parent e1bc60b7eb
commit 26cb315845
2 changed files with 8 additions and 12 deletions

View File

@@ -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);

View File

@@ -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);
}