mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-14 16:18:35 -07:00
Prevent autolock based on RPC too --nobuild
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
### Breaking Changes:
|
### Breaking Changes:
|
||||||
- UL: Desktop: Option to prevent Auto Lock when connected to USB (by @Dmitry422)
|
- UL: Desktop: Option to prevent Auto Lock when connected to USB/RPC (by @Dmitry422)
|
||||||
- Desktop settings will be reset, need to reconfigure
|
- Desktop settings will be reset, need to reconfigure
|
||||||
- Keybinds will remain configured
|
- Keybinds will remain configured
|
||||||
|
|
||||||
|
|||||||
@@ -138,8 +138,13 @@ static bool desktop_custom_event_callback(void* context, uint32_t event) {
|
|||||||
} else if(event == DesktopGlobalAutoLock) {
|
} else if(event == DesktopGlobalAutoLock) {
|
||||||
if(!desktop->app_running && !desktop->locked) {
|
if(!desktop->app_running && !desktop->locked) {
|
||||||
// Disable AutoLock if usb_inhibit_autolock option enabled and device have active USB session.
|
// Disable AutoLock if usb_inhibit_autolock option enabled and device have active USB session.
|
||||||
if((desktop->settings.usb_inhibit_auto_lock) && (furi_hal_usb_is_locked())) {
|
if(desktop->settings.usb_inhibit_auto_lock) {
|
||||||
return true;
|
Rpc* rpc = furi_record_open(RECORD_RPC);
|
||||||
|
bool inhibit_auto_lock = furi_hal_usb_is_locked() || rpc_get_sessions_count(rpc);
|
||||||
|
furi_record_close(RECORD_RPC);
|
||||||
|
if(inhibit_auto_lock) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
desktop_lock(desktop, desktop->settings.auto_lock_with_pin);
|
desktop_lock(desktop, desktop->settings.auto_lock_with_pin);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ void desktop_settings_scene_start_on_enter(void* context) {
|
|||||||
// USB connection Inhibit autolock OFF|ON|with opened RPC session
|
// USB connection Inhibit autolock OFF|ON|with opened RPC session
|
||||||
item = variable_item_list_add(
|
item = variable_item_list_add(
|
||||||
variable_item_list,
|
variable_item_list,
|
||||||
"Auto Lock disarm by active USB session",
|
"Prevent Auto Lock with USB/RPC session",
|
||||||
USB_INHIBIT_AUTO_LOCK_DELAY_COUNT,
|
USB_INHIBIT_AUTO_LOCK_DELAY_COUNT,
|
||||||
desktop_settings_scene_start_usb_inhibit_auto_lock_delay_changed,
|
desktop_settings_scene_start_usb_inhibit_auto_lock_delay_changed,
|
||||||
app);
|
app);
|
||||||
|
|||||||
Reference in New Issue
Block a user