mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-16 04:24:45 -07:00
No auto stop emulate after 5 mins --nobuild
This commit is contained in:
@@ -2,9 +2,7 @@
|
|||||||
|
|
||||||
#include <xtreme/xtreme.h>
|
#include <xtreme/xtreme.h>
|
||||||
|
|
||||||
#define LFRFID_EMULATION_TIME_MAX_MS (5 * 60 * 1000)
|
FuriTimer* timer_auto_exit = NULL;
|
||||||
|
|
||||||
FuriTimer* timer_auto_exit;
|
|
||||||
|
|
||||||
void lfrfid_scene_emulate_popup_callback(void* context) {
|
void lfrfid_scene_emulate_popup_callback(void* context) {
|
||||||
LfRfid* app = context;
|
LfRfid* app = context;
|
||||||
@@ -33,15 +31,12 @@ void lfrfid_scene_emulate_on_enter(void* context) {
|
|||||||
lfrfid_worker_emulate_start(app->lfworker, (LFRFIDProtocol)app->protocol_id);
|
lfrfid_worker_emulate_start(app->lfworker, (LFRFIDProtocol)app->protocol_id);
|
||||||
notification_message(app->notifications, &sequence_blink_start_magenta);
|
notification_message(app->notifications, &sequence_blink_start_magenta);
|
||||||
|
|
||||||
|
if(app->fav_timeout) {
|
||||||
timer_auto_exit =
|
timer_auto_exit =
|
||||||
furi_timer_alloc(lfrfid_scene_emulate_popup_callback, FuriTimerTypeOnce, app);
|
furi_timer_alloc(lfrfid_scene_emulate_popup_callback, FuriTimerTypeOnce, app);
|
||||||
|
|
||||||
if(!furi_hal_rtc_is_flag_set(FuriHalRtcFlagDebug) || app->fav_timeout)
|
|
||||||
furi_timer_start(
|
furi_timer_start(
|
||||||
timer_auto_exit,
|
timer_auto_exit, xtreme_settings.favorite_timeout * furi_kernel_get_tick_frequency());
|
||||||
app->fav_timeout ?
|
}
|
||||||
xtreme_settings.favorite_timeout * furi_kernel_get_tick_frequency() :
|
|
||||||
LFRFID_EMULATION_TIME_MAX_MS);
|
|
||||||
|
|
||||||
view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewPopup);
|
view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewPopup);
|
||||||
}
|
}
|
||||||
@@ -68,8 +63,11 @@ bool lfrfid_scene_emulate_on_event(void* context, SceneManagerEvent event) {
|
|||||||
void lfrfid_scene_emulate_on_exit(void* context) {
|
void lfrfid_scene_emulate_on_exit(void* context) {
|
||||||
LfRfid* app = context;
|
LfRfid* app = context;
|
||||||
|
|
||||||
|
if(timer_auto_exit) {
|
||||||
furi_timer_stop(timer_auto_exit);
|
furi_timer_stop(timer_auto_exit);
|
||||||
furi_timer_free(timer_auto_exit);
|
furi_timer_free(timer_auto_exit);
|
||||||
|
timer_auto_exit = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
notification_message(app->notifications, &sequence_blink_stop);
|
notification_message(app->notifications, &sequence_blink_stop);
|
||||||
popup_reset(app->popup);
|
popup_reset(app->popup);
|
||||||
|
|||||||
@@ -4,9 +4,7 @@
|
|||||||
|
|
||||||
#include <xtreme/xtreme.h>
|
#include <xtreme/xtreme.h>
|
||||||
|
|
||||||
#define NFC_EMULATION_TIME_MAX_MS (5 * 60 * 1000)
|
FuriTimer* timer_auto_exit = NULL;
|
||||||
|
|
||||||
FuriTimer* timer_auto_exit;
|
|
||||||
|
|
||||||
void nfc_scene_emulate_timer_callback(void* context) {
|
void nfc_scene_emulate_timer_callback(void* context) {
|
||||||
NfcApp* instance = context;
|
NfcApp* instance = context;
|
||||||
@@ -20,15 +18,12 @@ void nfc_scene_emulate_on_enter(void* context) {
|
|||||||
|
|
||||||
nfc_protocol_support_on_enter(NfcProtocolSupportSceneEmulate, context);
|
nfc_protocol_support_on_enter(NfcProtocolSupportSceneEmulate, context);
|
||||||
|
|
||||||
|
if(instance->fav_timeout) {
|
||||||
timer_auto_exit =
|
timer_auto_exit =
|
||||||
furi_timer_alloc(nfc_scene_emulate_timer_callback, FuriTimerTypeOnce, instance);
|
furi_timer_alloc(nfc_scene_emulate_timer_callback, FuriTimerTypeOnce, instance);
|
||||||
|
|
||||||
if(!furi_hal_rtc_is_flag_set(FuriHalRtcFlagDebug) || instance->fav_timeout)
|
|
||||||
furi_timer_start(
|
furi_timer_start(
|
||||||
timer_auto_exit,
|
timer_auto_exit, xtreme_settings.favorite_timeout * furi_kernel_get_tick_frequency());
|
||||||
instance->fav_timeout ?
|
}
|
||||||
xtreme_settings.favorite_timeout * furi_kernel_get_tick_frequency() :
|
|
||||||
NFC_EMULATION_TIME_MAX_MS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nfc_scene_emulate_on_event(void* context, SceneManagerEvent event) {
|
bool nfc_scene_emulate_on_event(void* context, SceneManagerEvent event) {
|
||||||
@@ -49,7 +44,10 @@ bool nfc_scene_emulate_on_event(void* context, SceneManagerEvent event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void nfc_scene_emulate_on_exit(void* context) {
|
void nfc_scene_emulate_on_exit(void* context) {
|
||||||
|
if(timer_auto_exit) {
|
||||||
furi_timer_stop(timer_auto_exit);
|
furi_timer_stop(timer_auto_exit);
|
||||||
furi_timer_free(timer_auto_exit);
|
furi_timer_free(timer_auto_exit);
|
||||||
|
timer_auto_exit = NULL;
|
||||||
|
}
|
||||||
nfc_protocol_support_on_exit(NfcProtocolSupportSceneEmulate, context);
|
nfc_protocol_support_on_exit(NfcProtocolSupportSceneEmulate, context);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user