Fix timer priority api in apps

This commit is contained in:
Willy-JL
2023-11-12 07:42:28 +00:00
parent 0a1a853f9a
commit 782e9eba79
8 changed files with 17 additions and 26 deletions

View File

@@ -121,11 +121,11 @@ void brainfuck_show_loading_popup(void* context, bool show) {
if(show) {
// Raise timer priority so that animations can play
vTaskPrioritySet(timer_task, configMAX_PRIORITIES - 1);
furi_timer_set_thread_priority(FuriTimerThreadPriorityElevated);
view_dispatcher_switch_to_view(brainfuck->view_dispatcher, brainfuckViewLoading);
} else {
// Restore default timer priority
vTaskPrioritySet(timer_task, configTIMER_TASK_PRIORITY);
furi_timer_set_thread_priority(FuriTimerThreadPriorityNormal);
}
}

View File

@@ -2,17 +2,16 @@
#include "../helpers/evil_portal_storage.h"
void evil_portal_show_loading_popup(Evil_PortalApp* app, bool show) {
TaskHandle_t timer_task = xTaskGetHandle(configTIMER_SERVICE_TASK_NAME);
ViewStack* view_stack = app->view_stack;
Loading* loading = app->loading;
if(show) {
// Raise timer priority so that animations can play
vTaskPrioritySet(timer_task, configMAX_PRIORITIES - 1);
furi_timer_set_thread_priority(FuriTimerThreadPriorityElevated);
view_stack_add_view(view_stack, loading_get_view(loading));
} else {
view_stack_remove_view(view_stack, loading_get_view(loading));
// Restore default timer priority
vTaskPrioritySet(timer_task, configTIMER_TASK_PRIORITY);
furi_timer_set_thread_priority(FuriTimerThreadPriorityNormal);
}
}

View File

@@ -235,14 +235,13 @@ void mag_text_input_callback(void* context) {
void mag_show_loading_popup(void* context, bool show) {
Mag* mag = context;
TaskHandle_t timer_task = xTaskGetHandle(configTIMER_SERVICE_TASK_NAME);
if(show) {
// Raise timer priority so that animations can play
vTaskPrioritySet(timer_task, configMAX_PRIORITIES - 1);
furi_timer_set_thread_priority(FuriTimerThreadPriorityElevated);
view_dispatcher_switch_to_view(mag->view_dispatcher, MagViewLoading);
} else {
// Restore default timer priority
vTaskPrioritySet(timer_task, configTIMER_TASK_PRIORITY);
furi_timer_set_thread_priority(FuriTimerThreadPriorityNormal);
}
}

View File

@@ -22,15 +22,13 @@ static void mass_storage_app_tick_event_callback(void* context) {
}
void mass_storage_app_show_loading_popup(MassStorageApp* app, bool show) {
TaskHandle_t timer_task = xTaskGetHandle(configTIMER_SERVICE_TASK_NAME);
if(show) {
// Raise timer priority so that animations can play
vTaskPrioritySet(timer_task, configMAX_PRIORITIES - 1);
furi_timer_set_thread_priority(FuriTimerThreadPriorityElevated);
view_dispatcher_switch_to_view(app->view_dispatcher, MassStorageAppViewLoading);
} else {
// Restore default timer priority
vTaskPrioritySet(timer_task, configTIMER_TASK_PRIORITY);
furi_timer_set_thread_priority(FuriTimerThreadPriorityNormal);
}
}

View File

@@ -21,15 +21,14 @@ void mifare_nested_tick_event_callback(void* context) {
void mifare_nested_show_loading_popup(void* context, bool show) {
MifareNested* mifare_nested = context;
TaskHandle_t timer_task = xTaskGetHandle(configTIMER_SERVICE_TASK_NAME);
if(show) {
// Raise timer priority so that animations can play
vTaskPrioritySet(timer_task, configMAX_PRIORITIES - 1);
furi_timer_set_thread_priority(FuriTimerThreadPriorityElevated);
view_dispatcher_switch_to_view(mifare_nested->view_dispatcher, MifareNestedViewLoading);
} else {
// Restore default timer priority
vTaskPrioritySet(timer_task, configTIMER_TASK_PRIORITY);
furi_timer_set_thread_priority(FuriTimerThreadPriorityNormal);
}
}

View File

@@ -20,15 +20,14 @@ void nfc_magic_tick_event_callback(void* context) {
void nfc_magic_show_loading_popup(void* context, bool show) {
NfcMagic* nfc_magic = context;
TaskHandle_t timer_task = xTaskGetHandle(configTIMER_SERVICE_TASK_NAME);
if(show) {
// Raise timer priority so that animations can play
vTaskPrioritySet(timer_task, configMAX_PRIORITIES - 1);
furi_timer_set_thread_priority(FuriTimerThreadPriorityElevated);
view_dispatcher_switch_to_view(nfc_magic->view_dispatcher, NfcMagicViewLoading);
} else {
// Restore default timer priority
vTaskPrioritySet(timer_task, configTIMER_TASK_PRIORITY);
furi_timer_set_thread_priority(FuriTimerThreadPriorityNormal);
}
}

View File

@@ -197,15 +197,14 @@ void picopass_blink_stop(Picopass* picopass) {
void picopass_show_loading_popup(void* context, bool show) {
Picopass* picopass = context;
TaskHandle_t timer_task = xTaskGetHandle(configTIMER_SERVICE_TASK_NAME);
if(show) {
// Raise timer priority so that animations can play
vTaskPrioritySet(timer_task, configMAX_PRIORITIES - 1);
furi_timer_set_thread_priority(FuriTimerThreadPriorityElevated);
view_dispatcher_switch_to_view(picopass->view_dispatcher, PicopassViewLoading);
} else {
// Restore default timer priority
vTaskPrioritySet(timer_task, configTIMER_TASK_PRIORITY);
furi_timer_set_thread_priority(FuriTimerThreadPriorityNormal);
}
}

View File

@@ -366,9 +366,7 @@ int32_t tetris_game_app() {
}
// Not doing this eventually causes issues with TimerSvc due to not sleeping/yielding enough in this task
TaskHandle_t timer_task = xTaskGetHandle(configTIMER_SERVICE_TASK_NAME);
vTaskPrioritySet(timer_task, configMAX_PRIORITIES - 1);
furi_timer_set_thread_priority(FuriTimerThreadPriorityElevated);
ViewPort* view_port = view_port_alloc();
view_port_set_orientation(view_port, ViewPortOrientationVertical);
@@ -472,9 +470,9 @@ int32_t tetris_game_app() {
view_port_free(view_port);
furi_message_queue_free(event_queue);
furi_mutex_free(tetris_state->mutex);
vTaskPrioritySet(timer_task, configTIMER_TASK_PRIORITY);
furi_timer_set_thread_priority(FuriTimerThreadPriorityNormal);
free(newPiece);
free(tetris_state);
return 0;
}
}