Release Candidate 0.48.0 Bug Fixes (#991)
* Power: wait a little bit till message displayed on screen when executing power off. FuriCore: do not use bkpt in release builds(causing HardFault when SPI is active). * Cleanup BSS section: add more consty consts to be more constish. * Desktop: properly handle autostarted applications.
This commit is contained in:
		| @@ -408,6 +408,11 @@ static StorageAnimation* | ||||
|     return selected; | ||||
| } | ||||
|  | ||||
| bool animation_manager_is_animation_loaded(AnimationManager* animation_manager) { | ||||
|     furi_assert(animation_manager); | ||||
|     return animation_manager->current_animation; | ||||
| } | ||||
|  | ||||
| void animation_manager_unload_and_stall_animation(AnimationManager* animation_manager) { | ||||
|     furi_assert(animation_manager); | ||||
|     furi_assert(animation_manager->current_animation); | ||||
|   | ||||
| @@ -133,6 +133,12 @@ void animation_manager_set_interact_callback( | ||||
|  */ | ||||
| void animation_manager_interact_process(AnimationManager* animation_manager); | ||||
|  | ||||
| /** Check if animation loaded | ||||
|  * | ||||
|  * @animation_manager   instance | ||||
|  */ | ||||
| bool animation_manager_is_animation_loaded(AnimationManager* animation_manager); | ||||
|  | ||||
| /** | ||||
|  * Unload and Stall animation actions. Draw callback in view | ||||
|  * paints first frame of current animation until | ||||
|   | ||||
| @@ -261,7 +261,7 @@ static void animation_storage_free_frames(BubbleAnimation* animation) { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     free(icon->frames); | ||||
|     free((void*)icon->frames); | ||||
| } | ||||
|  | ||||
| static bool animation_storage_load_frames( | ||||
| @@ -317,7 +317,7 @@ static bool animation_storage_load_frames( | ||||
|             break; | ||||
|         } | ||||
|  | ||||
|         icon->frames[i] = furi_alloc(file_info.size); | ||||
|         FURI_CONST_ASSIGN_PTR(icon->frames[i], furi_alloc(file_info.size)); | ||||
|         if(storage_file_read(file, (void*)icon->frames[i], file_info.size) != file_info.size) { | ||||
|             FURI_LOG_E(TAG, "Read failed: \'%s\'", string_get_cstr(filename)); | ||||
|             break; | ||||
|   | ||||
| @@ -266,7 +266,7 @@ static Icon* bubble_animation_clone_first_frame(const Icon* icon_orig) { | ||||
|      * for compressed header | ||||
|      */ | ||||
|     size_t max_bitmap_size = ROUND_UP_TO(icon_orig->width, 8) * icon_orig->height + 1; | ||||
|     icon_clone->frames[0] = furi_alloc(max_bitmap_size); | ||||
|     FURI_CONST_ASSIGN_PTR(icon_clone->frames[0], furi_alloc(max_bitmap_size)); | ||||
|     memcpy((void*)icon_clone->frames[0], icon_orig->frames[0], max_bitmap_size); | ||||
|     FURI_CONST_ASSIGN(icon_clone->frame_count, 1); | ||||
|  | ||||
| @@ -278,7 +278,7 @@ static void bubble_animation_release_frame(Icon** icon) { | ||||
|     furi_assert(*icon); | ||||
|  | ||||
|     free((void*)(*icon)->frames[0]); | ||||
|     free((*icon)->frames); | ||||
|     free((void*)(*icon)->frames); | ||||
|     free(*icon); | ||||
|     *icon = NULL; | ||||
| } | ||||
|   | ||||
| @@ -3,8 +3,8 @@ | ||||
| #include <gui/view_stack.h> | ||||
| #include <furi.h> | ||||
| #include <furi_hal.h> | ||||
| #include <portmacro.h> | ||||
| #include <stdint.h> | ||||
|  | ||||
| #include <loader/loader.h> | ||||
|  | ||||
| #include "animations/animation_manager.h" | ||||
| #include "desktop/scenes/desktop_scene.h" | ||||
| @@ -121,6 +121,14 @@ Desktop* desktop_alloc() { | ||||
|     view_port_enabled_set(desktop->lock_viewport, false); | ||||
|     gui_add_view_port(desktop->gui, desktop->lock_viewport, GuiLayerStatusBarLeft); | ||||
|  | ||||
|     // Special case: autostart application is already running | ||||
|     Loader* loader = furi_record_open("loader"); | ||||
|     if(loader_is_locked(loader) && | ||||
|        animation_manager_is_animation_loaded(desktop->animation_manager)) { | ||||
|         animation_manager_unload_and_stall_animation(desktop->animation_manager); | ||||
|     } | ||||
|     furi_record_close("loader"); | ||||
|  | ||||
|     return desktop; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -11,6 +11,8 @@ | ||||
| #include "desktop_scene_i.h" | ||||
| #include "desktop_scene.h" | ||||
|  | ||||
| #define TAG "DesktopSceneLock" | ||||
|  | ||||
| void desktop_scene_lock_menu_callback(DesktopEvent event, void* context) { | ||||
|     Desktop* desktop = (Desktop*)context; | ||||
|     view_dispatcher_send_custom_event(desktop->view_dispatcher, event); | ||||
| @@ -58,12 +60,15 @@ bool desktop_scene_lock_menu_on_event(void* context, SceneManagerEvent event) { | ||||
|                     desktop->scene_manager, DesktopSceneLocked, SCENE_LOCKED_FIRST_ENTER); | ||||
|                 scene_manager_next_scene(desktop->scene_manager, DesktopSceneLocked); | ||||
|             } else { | ||||
|                 scene_manager_set_scene_state(desktop->scene_manager, DesktopSceneLockMenu, 1); | ||||
|                 Loader* loader = furi_record_open("loader"); | ||||
|                 LoaderStatus status = | ||||
|                     loader_start(loader, "Desktop", DESKTOP_SETTINGS_RUN_PIN_SETUP_ARG); | ||||
|                 furi_check(status == LoaderStatusOk); | ||||
|                 furi_record_close("loader"); | ||||
|                 if(status == LoaderStatusOk) { | ||||
|                     scene_manager_set_scene_state(desktop->scene_manager, DesktopSceneLockMenu, 1); | ||||
|                 } else { | ||||
|                     FURI_LOG_E(TAG, "Unable to start desktop settings"); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             consumed = true; | ||||
|   | ||||
| @@ -87,12 +87,6 @@ void desktop_scene_main_on_enter(void* context) { | ||||
|     Loader* loader = furi_record_open("loader"); | ||||
|     desktop->app_start_stop_subscription = furi_pubsub_subscribe( | ||||
|         loader_get_pubsub(loader), desktop_scene_main_app_started_callback, desktop); | ||||
|  | ||||
|     // Special case: application is already running (autostart application) | ||||
|     if(loader_is_locked(loader)) { | ||||
|         animation_manager_unload_and_stall_animation(desktop->animation_manager); | ||||
|     } | ||||
|  | ||||
|     furi_record_close("loader"); | ||||
|  | ||||
|     desktop_main_set_callback(main_view, desktop_scene_main_callback, desktop); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user