Formatting & New updated IR

This commit is contained in:
VerstreuteSeele
2023-01-14 08:44:32 +01:00
parent 7385a28ddd
commit 905bb23fdf
216 changed files with 6455 additions and 5877 deletions

View File

@@ -365,7 +365,7 @@ static bool animation_manager_is_valid_idle_animation(
static StorageAnimation*
animation_manager_select_idle_animation(AnimationManager* animation_manager) {
UNUSED(animation_manager);
StorageAnimationList_t animation_list;
StorageAnimationList_init(animation_list);
animation_storage_fill_animation_list(&animation_list);
@@ -556,17 +556,17 @@ static void animation_manager_switch_to_one_shot_view(AnimationManager* animatio
View* next_view = one_shot_view_get_view(animation_manager->one_shot_view);
view_stack_remove_view(animation_manager->view_stack, prev_view);
view_stack_add_view(animation_manager->view_stack, next_view);
if (settings->sfw_mode) {
if (stats.level <= 20) {
one_shot_view_start_animation(animation_manager->one_shot_view, &A_Levelup1_128x64_sfw);
}
else if (stats.level >= 21) {
one_shot_view_start_animation(animation_manager->one_shot_view, &A_Levelup2_128x64_sfw);
}
else {
if(settings->sfw_mode) {
if(stats.level <= 20) {
one_shot_view_start_animation(
animation_manager->one_shot_view, &A_Levelup1_128x64_sfw);
} else if(stats.level >= 21) {
one_shot_view_start_animation(
animation_manager->one_shot_view, &A_Levelup2_128x64_sfw);
} else {
furi_assert(0);
}
}else {
} else {
one_shot_view_start_animation(animation_manager->one_shot_view, &A_Levelup1_128x64);
}
free(settings);

View File

@@ -27,20 +27,18 @@ static void animation_storage_free_frames(BubbleAnimation* animation);
static void animation_storage_free_animation(BubbleAnimation** storage_animation);
static BubbleAnimation* animation_storage_load_animation(const char* name);
void animation_handler_beta()
{
void animation_handler_beta() {
DesktopSettings* settings = malloc(sizeof(DesktopSettings));
DESKTOP_SETTINGS_LOAD(settings);
if (settings->sfw_mode) {
snprintf(ANIMATION_MANIFEST_FILE, sizeof(ANIMATION_DIR), "%s", ANIMATION_DIR);
if(settings->sfw_mode) {
snprintf(ANIMATION_MANIFEST_FILE, sizeof(ANIMATION_DIR), "%s", ANIMATION_DIR);
FURI_LOG_I(TAG, "SFW Manifest selected");
strcat(ANIMATION_MANIFEST_FILE,"/sfw/manifest.txt");
}
else {
snprintf(ANIMATION_MANIFEST_FILE, sizeof(ANIMATION_DIR), "%s", ANIMATION_DIR);
strcat(ANIMATION_MANIFEST_FILE, "/sfw/manifest.txt");
} else {
snprintf(ANIMATION_MANIFEST_FILE, sizeof(ANIMATION_DIR), "%s", ANIMATION_DIR);
FURI_LOG_I(TAG, "NSFW Manifest selected");
strcat(ANIMATION_MANIFEST_FILE,"/nsfw/manifest.txt");
strcat(ANIMATION_MANIFEST_FILE, "/nsfw/manifest.txt");
}
free(settings);
}

View File

@@ -26,10 +26,9 @@ static void desktop_loader_callback(const void* message, void* context) {
Desktop* desktop = context;
const LoaderEvent* event = message;
if (event->type == LoaderEventTypeApplicationStarted) {
if(event->type == LoaderEventTypeApplicationStarted) {
view_dispatcher_send_custom_event(desktop->view_dispatcher, DesktopGlobalBeforeAppStarted);
}
else if (event->type == LoaderEventTypeApplicationStopped) {
} else if(event->type == LoaderEventTypeApplicationStopped) {
view_dispatcher_send_custom_event(desktop->view_dispatcher, DesktopGlobalAfterAppFinished);
}
}
@@ -43,7 +42,7 @@ static bool desktop_custom_event_callback(void* context, uint32_t event) {
furi_assert(context);
Desktop* desktop = (Desktop*)context;
switch (event) {
switch(event) {
case DesktopGlobalBeforeAppStarted:
animation_manager_unload_and_stall_animation(desktop->animation_manager);
desktop_auto_lock_inhibit(desktop);
@@ -56,12 +55,11 @@ static bool desktop_custom_event_callback(void* context, uint32_t event) {
desktop_auto_lock_arm(desktop);
return true;
case DesktopGlobalAutoLock:
if (!loader_is_locked(desktop->loader)) {
if (desktop->settings.pin_code.length > 0) {
if(!loader_is_locked(desktop->loader)) {
if(desktop->settings.pin_code.length > 0) {
desktop_pin_lock(&desktop->settings);
desktop_lock(desktop);
}
else {
} else {
desktop_lock(desktop);
}
}
@@ -88,7 +86,7 @@ static void desktop_input_event_callback(const void* value, void* context) {
furi_assert(context);
const InputEvent* event = value;
Desktop* desktop = context;
if (event->type == InputTypePress) {
if(event->type == InputTypePress) {
desktop_start_auto_lock_timer(desktop);
}
}
@@ -109,7 +107,7 @@ static void desktop_stop_auto_lock_timer(Desktop* desktop) {
}
static void desktop_auto_lock_arm(Desktop* desktop) {
if (desktop->settings.auto_lock_delay_ms) {
if(desktop->settings.auto_lock_delay_ms) {
desktop->input_events_subscription = furi_pubsub_subscribe(
desktop->input_events_pubsub, desktop_input_event_callback, desktop);
desktop_start_auto_lock_timer(desktop);
@@ -118,7 +116,7 @@ static void desktop_auto_lock_arm(Desktop* desktop) {
static void desktop_auto_lock_inhibit(Desktop* desktop) {
desktop_stop_auto_lock_timer(desktop);
if (desktop->input_events_subscription) {
if(desktop->input_events_subscription) {
furi_pubsub_unsubscribe(desktop->input_events_pubsub, desktop->input_events_subscription);
desktop->input_events_subscription = NULL;
}
@@ -233,8 +231,8 @@ Desktop* desktop_alloc() {
// Special case: autostart application is already running
desktop->loader = furi_record_open(RECORD_LOADER);
if (loader_is_locked(desktop->loader) &&
animation_manager_is_animation_loaded(desktop->animation_manager)) {
if(loader_is_locked(desktop->loader) &&
animation_manager_is_animation_loaded(desktop->animation_manager)) {
animation_manager_unload_and_stall_animation(desktop->animation_manager);
}
@@ -257,7 +255,7 @@ void desktop_free(Desktop* desktop) {
furi_pubsub_unsubscribe(
loader_get_pubsub(desktop->loader), desktop->app_start_stop_subscription);
if (desktop->input_events_subscription) {
if(desktop->input_events_subscription) {
furi_pubsub_unsubscribe(desktop->input_events_pubsub, desktop->input_events_subscription);
desktop->input_events_subscription = NULL;
}
@@ -313,16 +311,13 @@ static bool desktop_check_file_flag(const char* flag_path) {
int32_t desktop_srv(void* p) {
UNUSED(p);
if (furi_hal_rtc_get_boot_mode() != FuriHalRtcBootModeNormal)
{
if(furi_hal_rtc_get_boot_mode() != FuriHalRtcBootModeNormal) {
FURI_LOG_W("Desktop", "Desktop load skipped. Device is in special startup mode.");
}
else
{
} else {
Desktop* desktop = desktop_alloc();
bool loaded = DESKTOP_SETTINGS_LOAD(&desktop->settings);
if (!loaded) {
if(!loaded) {
memset(&desktop->settings, 0, sizeof(desktop->settings));
DESKTOP_SETTINGS_SAVE(&desktop->settings);
}
@@ -333,24 +328,23 @@ int32_t desktop_srv(void* p) {
desktop_pin_lock_init(&desktop->settings);
if (!desktop_pin_lock_is_locked()) {
if (!loader_is_locked(desktop->loader)) {
if(!desktop_pin_lock_is_locked()) {
if(!loader_is_locked(desktop->loader)) {
desktop_auto_lock_arm(desktop);
}
}
else {
} else {
desktop_lock(desktop);
}
if (desktop_check_file_flag(SLIDESHOW_FS_PATH)) {
if(desktop_check_file_flag(SLIDESHOW_FS_PATH)) {
scene_manager_next_scene(desktop->scene_manager, DesktopSceneSlideshow);
}
if (!furi_hal_version_do_i_belong_here()) {
if(!furi_hal_version_do_i_belong_here()) {
scene_manager_next_scene(desktop->scene_manager, DesktopSceneHwMismatch);
}
if (furi_hal_rtc_get_fault_data()) {
if(furi_hal_rtc_get_fault_data()) {
scene_manager_next_scene(desktop->scene_manager, DesktopSceneFault);
}

View File

@@ -18,7 +18,7 @@ void desktop_scene_fault_on_enter(void* context) {
Popup* popup = desktop->hw_mismatch_popup;
popup_set_context(popup, desktop);
if (settings->sfw_mode) {
if(settings->sfw_mode) {
popup_set_header(
popup,
"Flipper crashed\n but has been rebooted",
@@ -26,8 +26,7 @@ void desktop_scene_fault_on_enter(void* context) {
14 + STATUS_BAR_Y_SHIFT,
AlignCenter,
AlignCenter);
}
else {
} else {
popup_set_header(
popup,
"Slut passed out\n but is now back",
@@ -37,7 +36,6 @@ void desktop_scene_fault_on_enter(void* context) {
AlignCenter);
}
char* message = (char*)furi_hal_rtc_get_fault_data();
popup_set_text(popup, message, 60, 37 + STATUS_BAR_Y_SHIFT, AlignCenter, AlignCenter);
popup_set_callback(popup, desktop_scene_fault_callback);

View File

@@ -38,10 +38,7 @@ void desktop_lock_menu_set_pin_state(DesktopLockMenuView* lock_menu, bool pin_is
void desktop_lock_menu_set_sfw_mode_state(DesktopLockMenuView* lock_menu, bool sfw_mode) {
with_view_model(
lock_menu->view,
DesktopLockMenuViewModel * model,
{ model->sfw_mode = sfw_mode; },
true);
lock_menu->view, DesktopLockMenuViewModel * model, { model->sfw_mode = sfw_mode; }, true);
}
void desktop_lock_menu_set_idx(DesktopLockMenuView* lock_menu, uint8_t idx) {