fbt format and naming fix

This commit is contained in:
MX
2025-01-15 17:23:38 +03:00
parent 8872b13d54
commit 633f5d7c57
9 changed files with 46 additions and 36 deletions

View File

@@ -18,9 +18,9 @@
#define TAG "Desktop"
// dublicate constants from desktop_setting_scene_start.c
#define USB_INHIBIT_AUTOLOCK_OFF 0
#define USB_INHIBIT_AUTOLOCK_ON 1
#define USB_INHIBIT_AUTOLOCK_RPC 2
#define USB_INHIBIT_AUTOLOCK_OFF 0
#define USB_INHIBIT_AUTOLOCK_ON 1
#define USB_INHIBIT_AUTOLOCK_RPC 2
static void desktop_auto_lock_arm(Desktop*);
static void desktop_auto_lock_inhibit(Desktop*);
@@ -151,13 +151,14 @@ static bool desktop_custom_event_callback(void* context, uint32_t event) {
} else if(event == DesktopGlobalAutoLock) {
if(!desktop->app_running && !desktop->locked) {
// if usb_inhibit_autolock enabled and device charging or device charged but still connected to USB then break desktop locking.
if ((desktop->settings.usb_inhibit_auto_lock == USB_INHIBIT_AUTOLOCK_ON) && ((furi_hal_power_is_charging()) || (furi_hal_power_is_charging_done()))){
return(0);
}
if((desktop->settings.usb_inhibit_auto_lock == USB_INHIBIT_AUTOLOCK_ON) &&
((furi_hal_power_is_charging()) || (furi_hal_power_is_charging_done()))) {
return (0);
}
// if usb_inhibit_autolock set to RPC and we have F0 connected to phone or PC app then break desktop locking.
if (desktop->settings.usb_inhibit_auto_lock == USB_INHIBIT_AUTOLOCK_RPC){
return(0);
}
if(desktop->settings.usb_inhibit_auto_lock == USB_INHIBIT_AUTOLOCK_RPC) {
return (0);
}
desktop_lock(desktop);
}
} else if(event == DesktopGlobalSaveSettings) {

View File

@@ -442,10 +442,9 @@ static void power_auto_poweroff_timer_callback(void* context) {
Power* power = context;
//poweroff if not charging now or if connected to charger and charging done
if (((!furi_hal_power_is_charging())) || (furi_hal_power_is_charging_done())) {
if(((!furi_hal_power_is_charging())) || (furi_hal_power_is_charging_done())) {
power_off(power);
}
else {
} else {
//else we dont poweroff device and restart timer
FURI_LOG_D(TAG, "We dont auto_power_off until battery is charging");
power_start_auto_poweroff_timer(power);
@@ -463,7 +462,7 @@ static void power_auto_poweroff_arm(Power* power) {
}
}
// stop timer and event subscription
// stop timer and event subscription
static void power_auto_poweroff_disarm(Power* power) {
power_stop_auto_poweroff_timer(power);
if(power->input_events_subscription) {
@@ -482,7 +481,7 @@ static void power_loader_callback(const void* message, void* context) {
if(event->type == LoaderEventTypeApplicationBeforeLoad) {
power->app_running = true;
power_auto_poweroff_disarm(power);
// arm timer if some apps was not loaded or was stoped
// arm timer if some apps was not loaded or was stoped
} else if(
event->type == LoaderEventTypeApplicationLoadFailed ||
event->type == LoaderEventTypeApplicationStopped) {
@@ -496,7 +495,7 @@ static void power_settings_apply(Power* power) {
//apply auto_poweroff settings
if(power->settings.auto_poweroff_delay_ms && !power->app_running) {
power_auto_poweroff_arm(power);
} else if (power_is_running_auto_poweroff_timer(power)) {
} else if(power_is_running_auto_poweroff_timer(power)) {
power_auto_poweroff_disarm(power);
}
}
@@ -621,7 +620,7 @@ static Power* power_alloc(void) {
Loader* loader = furi_record_open(RECORD_LOADER);
furi_pubsub_subscribe(loader_get_pubsub(loader), power_loader_callback, power);
power->input_events_pubsub = furi_record_open(RECORD_INPUT_EVENTS);
//define autopoweroff timer and they callback
//define autopoweroff timer and they callback
power->auto_poweroff_timer =
furi_timer_alloc(power_auto_poweroff_timer_callback, FuriTimerTypeOnce, power);
@@ -670,7 +669,7 @@ int32_t power_srv(void* p) {
furi_record_create(RECORD_POWER, power);
// Can't be done in alloc, other things in startup need power service and it would deadlock by waiting for loader
// Can't be done in alloc, other things in startup need power service and it would deadlock by waiting for loader
Loader* loader = furi_record_open(RECORD_LOADER);
power->app_running = loader_is_locked(loader);
furi_record_close(RECORD_LOADER);

View File

@@ -13,7 +13,7 @@
#define POWER_SETTINGS_MAGIC (0x18)
typedef struct {
//inital set - empty
//inital set - empty
} PowerSettingsV0;
void power_settings_load(PowerSettings* settings) {
@@ -33,7 +33,9 @@ void power_settings_load(PowerSettings* settings) {
POWER_SETTINGS_MAGIC,
POWER_SETTINGS_VER);
} else if(version == POWER_SETTINGS_VER_0) { // if config previous version - load it and manual set new settings to inital value
} else if(
version ==
POWER_SETTINGS_VER_0) { // if config previous version - load it and manual set new settings to inital value
PowerSettingsV0* settings_v0 = malloc(sizeof(PowerSettingsV0));
success = saved_struct_load(

View File

@@ -13,4 +13,4 @@ void power_settings_load(PowerSettings* settings);
void power_settings_save(const PowerSettings* settings);
#ifdef __cplusplus
}
#endif
#endif