Skip to content

Commit

Permalink
fbt format and naming fix
Browse files Browse the repository at this point in the history
  • Loading branch information
xMasterX committed Jan 15, 2025
1 parent 8872b13 commit 633f5d7
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 36 deletions.
19 changes: 10 additions & 9 deletions applications/services/desktop/desktop.c
Original file line number Diff line number Diff line change
Expand Up @@ -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*);
Expand Down Expand Up @@ -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) {
Expand Down
15 changes: 7 additions & 8 deletions applications/services/power/power_service/power.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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) {
Expand All @@ -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) {
Expand All @@ -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);
}
}
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);
Expand Down
6 changes: 4 additions & 2 deletions applications/services/power/power_service/power_settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#define POWER_SETTINGS_MAGIC (0x18)

typedef struct {
//inital set - empty
//inital set - empty
} PowerSettingsV0;

void power_settings_load(PowerSettings* settings) {
Expand All @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion applications/services/power/power_service/power_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ void power_settings_load(PowerSettings* settings);
void power_settings_save(const PowerSettings* settings);
#ifdef __cplusplus
}
#endif
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ const char* const auto_lock_delay_text[AUTO_LOCK_DELAY_COUNT] = {
const uint32_t auto_lock_delay_value[AUTO_LOCK_DELAY_COUNT] =
{0, 10000, 15000, 30000, 60000, 90000, 120000, 300000, 600000};

#define USB_INHIBIT_AUTO_LOCK_DELAY_COUNT 3
#define USB_INHIBIT_AUTOLOCK_OFF 0
#define USB_INHIBIT_AUTOLOCK_ON 1
#define USB_INHIBIT_AUTOLOCK_RPC 2
#define USB_INHIBIT_AUTO_LOCK_DELAY_COUNT 3
#define USB_INHIBIT_AUTOLOCK_OFF 0
#define USB_INHIBIT_AUTOLOCK_ON 1
#define USB_INHIBIT_AUTOLOCK_RPC 2

const char* const usb_inhibit_auto_lock_delay_text[USB_INHIBIT_AUTO_LOCK_DELAY_COUNT] = {
"OFF",
Expand Down Expand Up @@ -104,7 +104,6 @@ static void desktop_settings_scene_start_clock_enable_changed(VariableItem* item
app->settings.display_clock = index;
}


static void desktop_settings_scene_start_auto_lock_delay_changed(VariableItem* item) {
DesktopSettingsApp* app = variable_item_get_context(item);
uint8_t index = variable_item_get_current_value_index(item);
Expand Down Expand Up @@ -151,10 +150,12 @@ void desktop_settings_scene_start_on_enter(void* context) {
app);

value_index = value_index_uint32(
app->settings.usb_inhibit_auto_lock, usb_inhibit_auto_lock_delay_value, USB_INHIBIT_AUTO_LOCK_DELAY_COUNT);
app->settings.usb_inhibit_auto_lock,
usb_inhibit_auto_lock_delay_value,
USB_INHIBIT_AUTO_LOCK_DELAY_COUNT);
variable_item_set_current_value_index(item, value_index);
variable_item_set_current_value_text(item, usb_inhibit_auto_lock_delay_text[value_index]);

item = variable_item_list_add(
variable_item_list,
"Battery View",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ PowerSettingsApp* power_settings_app_alloc(uint32_t first_scene) {
app->view_dispatcher, PowerSettingsAppViewSubmenu, submenu_get_view(app->submenu));
app->variable_item_list = variable_item_list_alloc();
view_dispatcher_add_view(
app->view_dispatcher, PowerSettingsAppViewVariableItemList, variable_item_list_get_view(app->variable_item_list));
app->view_dispatcher,
PowerSettingsAppViewVariableItemList,
variable_item_list_get_view(app->variable_item_list));
app->dialog = dialog_ex_alloc();
view_dispatcher_add_view(
app->view_dispatcher, PowerSettingsAppViewDialog, dialog_ex_get_view(app->dialog));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ enum PowerSettingsSubmenuIndex {

#define AUTO_POWEROFF_DELAY_COUNT 8
const char* const auto_poweroff_delay_text[AUTO_POWEROFF_DELAY_COUNT] =
{"OFF","5min", "10min", "15min", "30min", "45min", "60min", "90min"};
{"OFF", "5min", "10min", "15min", "30min", "45min", "60min", "90min"};

const uint32_t auto_poweroff_delay_value[AUTO_POWEROFF_DELAY_COUNT] =
{0, 300000, 600000, 900000, 1800000, 2700000, 3600000, 5400000};
Expand All @@ -24,7 +24,9 @@ static void power_settings_scene_start_auto_poweroff_delay_changed(VariableItem*
app->settings.auto_poweroff_delay_ms = auto_poweroff_delay_value[index];
}

static void power_settings_scene_start_submenu_callback(void* context, uint32_t index) { //show selected menu screen
static void power_settings_scene_start_submenu_callback(
void* context,
uint32_t index) { //show selected menu screen
furi_assert(context);
PowerSettingsApp* app = context;
view_dispatcher_send_custom_event(app->view_dispatcher, index);
Expand All @@ -42,7 +44,7 @@ void power_settings_scene_start_on_enter(void* context) {
uint8_t value_index;
item = variable_item_list_add(
variable_item_list,
"Auto PowerOff Time",
"Auto PowerOff",
AUTO_POWEROFF_DELAY_COUNT,
power_settings_scene_start_auto_poweroff_delay_changed, //function for change visible item list value and app settings
app);
Expand All @@ -53,11 +55,14 @@ void power_settings_scene_start_on_enter(void* context) {
AUTO_POWEROFF_DELAY_COUNT);
variable_item_set_current_value_index(item, value_index);
variable_item_set_current_value_text(item, auto_poweroff_delay_text[value_index]);

variable_item_list_set_selected_item(
variable_item_list, scene_manager_get_scene_state(app->scene_manager, PowerSettingsAppSceneStart));
variable_item_list,
scene_manager_get_scene_state(app->scene_manager, PowerSettingsAppSceneStart));
variable_item_list_set_enter_callback( //callback to show next mennu screen
variable_item_list, power_settings_scene_start_submenu_callback, app);
variable_item_list,
power_settings_scene_start_submenu_callback,
app);

view_dispatcher_switch_to_view(app->view_dispatcher, PowerSettingsAppViewVariableItemList);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/signal_reader/parsers/iso15693/iso15693_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,4 +321,4 @@ void iso15693_parser_force_1outof256(Iso15693Parser* instance) {

instance->detect_mode = false;
instance->mode = Iso15693ParserMode1OutOf256;
}
}
2 changes: 1 addition & 1 deletion lib/subghz/protocols/protocol_items.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@
#include "gangqi.h"
#include "marantec24.h"
#include "hollarm.h"
#include "hay21.h"
#include "hay21.h"

0 comments on commit 633f5d7

Please sign in to comment.