add input events sub check [ci skip]

This commit is contained in:
MX
2024-12-23 19:19:12 +03:00
parent 9c5341edb1
commit 38326877ea

View File

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