mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-13 21:18:35 -07:00
boot loops & null dereference error fixed
namechanger application was updated thanks to ESurge and application now works without issues :D
This commit is contained in:
@@ -26,9 +26,10 @@ 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);
|
||||
}
|
||||
}
|
||||
@@ -48,7 +49,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);
|
||||
@@ -61,11 +62,12 @@ 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);
|
||||
}
|
||||
}
|
||||
@@ -92,7 +94,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);
|
||||
}
|
||||
}
|
||||
@@ -113,7 +115,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);
|
||||
@@ -122,7 +124,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;
|
||||
}
|
||||
@@ -151,7 +153,6 @@ void desktop_set_sfw_mode_state(Desktop* desktop, bool enabled) {
|
||||
desktop_main_set_sfw_mode_state(desktop->main_view, enabled);
|
||||
animation_manager_set_sfw_mode_state(desktop->animation_manager, enabled);
|
||||
desktop->settings.sfw_mode = enabled;
|
||||
DESKTOP_SETTINGS_SAVE(&desktop->settings);
|
||||
}
|
||||
|
||||
Desktop* desktop_alloc() {
|
||||
@@ -247,8 +248,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);
|
||||
}
|
||||
|
||||
@@ -271,7 +272,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;
|
||||
}
|
||||
@@ -326,45 +327,54 @@ static bool desktop_check_file_flag(const char* flag_path) {
|
||||
|
||||
int32_t desktop_srv(void* p) {
|
||||
UNUSED(p);
|
||||
Desktop* desktop = desktop_alloc();
|
||||
|
||||
bool loaded = DESKTOP_SETTINGS_LOAD(&desktop->settings);
|
||||
if(!loaded) {
|
||||
memset(&desktop->settings, 0, sizeof(desktop->settings));
|
||||
DESKTOP_SETTINGS_SAVE(&desktop->settings);
|
||||
if (furi_hal_rtc_get_boot_mode() != FuriHalRtcBootModeNormal)
|
||||
{
|
||||
FURI_LOG_W("Desktop", "Desktop load skipped. Device is in special startup mode.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Desktop* desktop = desktop_alloc();
|
||||
|
||||
view_port_enabled_set(desktop->sfw_mode_icon_viewport, desktop->settings.sfw_mode);
|
||||
desktop_main_set_sfw_mode_state(desktop->main_view, desktop->settings.sfw_mode);
|
||||
animation_manager_set_sfw_mode_state(
|
||||
desktop->animation_manager, desktop->settings.sfw_mode);
|
||||
|
||||
scene_manager_next_scene(desktop->scene_manager, DesktopSceneMain);
|
||||
|
||||
desktop_pin_lock_init(&desktop->settings);
|
||||
|
||||
if(!desktop_pin_lock_is_locked()) {
|
||||
if(!loader_is_locked(desktop->loader)) {
|
||||
desktop_auto_lock_arm(desktop);
|
||||
bool loaded = DESKTOP_SETTINGS_LOAD(&desktop->settings);
|
||||
if (!loaded) {
|
||||
memset(&desktop->settings, 0, sizeof(desktop->settings));
|
||||
DESKTOP_SETTINGS_SAVE(&desktop->settings);
|
||||
}
|
||||
} else {
|
||||
desktop_lock(desktop);
|
||||
}
|
||||
|
||||
if(desktop_check_file_flag(SLIDESHOW_FS_PATH)) {
|
||||
scene_manager_next_scene(desktop->scene_manager, DesktopSceneSlideshow);
|
||||
}
|
||||
view_port_enabled_set(desktop->sfw_mode_icon_viewport, desktop->settings.sfw_mode);
|
||||
desktop_main_set_sfw_mode_state(desktop->main_view, desktop->settings.sfw_mode);
|
||||
animation_manager_set_sfw_mode_state(
|
||||
desktop->animation_manager, desktop->settings.sfw_mode);
|
||||
|
||||
if(!furi_hal_version_do_i_belong_here()) {
|
||||
scene_manager_next_scene(desktop->scene_manager, DesktopSceneHwMismatch);
|
||||
}
|
||||
scene_manager_next_scene(desktop->scene_manager, DesktopSceneMain);
|
||||
|
||||
if(furi_hal_rtc_get_fault_data()) {
|
||||
scene_manager_next_scene(desktop->scene_manager, DesktopSceneFault);
|
||||
}
|
||||
desktop_pin_lock_init(&desktop->settings);
|
||||
|
||||
view_dispatcher_run(desktop->view_dispatcher);
|
||||
desktop_free(desktop);
|
||||
if (!desktop_pin_lock_is_locked()) {
|
||||
if (!loader_is_locked(desktop->loader)) {
|
||||
desktop_auto_lock_arm(desktop);
|
||||
}
|
||||
}
|
||||
else {
|
||||
desktop_lock(desktop);
|
||||
}
|
||||
|
||||
if (desktop_check_file_flag(SLIDESHOW_FS_PATH)) {
|
||||
scene_manager_next_scene(desktop->scene_manager, DesktopSceneSlideshow);
|
||||
}
|
||||
|
||||
if (!furi_hal_version_do_i_belong_here()) {
|
||||
scene_manager_next_scene(desktop->scene_manager, DesktopSceneHwMismatch);
|
||||
}
|
||||
|
||||
if (furi_hal_rtc_get_fault_data()) {
|
||||
scene_manager_next_scene(desktop->scene_manager, DesktopSceneFault);
|
||||
}
|
||||
|
||||
view_dispatcher_run(desktop->view_dispatcher);
|
||||
desktop_free(desktop);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user