mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2025-12-12 04:34:43 +04:00
fbt format and naming fix
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -13,4 +13,4 @@ void power_settings_load(PowerSettings* settings);
|
||||
void power_settings_save(const PowerSettings* settings);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -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",
|
||||
@@ -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);
|
||||
@@ -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",
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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};
|
||||
@@ -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);
|
||||
@@ -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);
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -321,4 +321,4 @@ void iso15693_parser_force_1outof256(Iso15693Parser* instance) {
|
||||
|
||||
instance->detect_mode = false;
|
||||
instance->mode = Iso15693ParserMode1OutOf256;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,4 +51,4 @@
|
||||
#include "gangqi.h"
|
||||
#include "marantec24.h"
|
||||
#include "hollarm.h"
|
||||
#include "hay21.h"
|
||||
#include "hay21.h"
|
||||
|
||||
Reference in New Issue
Block a user