Skip to content

Commit

Permalink
add input events sub check [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
xMasterX committed Dec 23, 2024
1 parent 9c5341e commit 3832687
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions applications/services/desktop/desktop.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,10 @@ static void desktop_stop_auto_lock_timer(Desktop* desktop) {

static void desktop_auto_lock_arm(Desktop* desktop) {
if(desktop->settings.auto_lock_delay_ms) {
desktop->input_events_subscription = furi_pubsub_subscribe(
desktop->input_events_pubsub, desktop_input_event_callback, desktop);
if(!desktop->input_events_subscription) {
desktop->input_events_subscription = furi_pubsub_subscribe(
desktop->input_events_pubsub, desktop_input_event_callback, desktop);
}
desktop_start_auto_lock_timer(desktop);
}
}
Expand Down Expand Up @@ -246,8 +248,10 @@ static void desktop_stop_auto_poweroff_timer(Desktop* desktop) {

static void desktop_auto_poweroff_arm(Desktop* desktop) {
if(desktop->settings.auto_poweroff_delay_ms) {
desktop->input_events_subscription = furi_pubsub_subscribe(
desktop->input_events_pubsub, desktop_input_event_callback, desktop);
if(desktop->input_events_subscription) {
desktop->input_events_subscription = furi_pubsub_subscribe(
desktop->input_events_pubsub, desktop_input_event_callback, desktop);
}
desktop_start_auto_poweroff_timer(desktop);
}
}
Expand Down

0 comments on commit 3832687

Please sign in to comment.