Fix thread and timer api

This commit is contained in:
Willy-JL
2023-11-12 06:35:20 +00:00
parent 461aadeedf
commit f2902755ca
3 changed files with 6 additions and 5 deletions

View File

@@ -108,18 +108,17 @@ void archive_free(ArchiveApp* archive) {
} }
void archive_show_loading_popup(ArchiveApp* context, bool show) { void archive_show_loading_popup(ArchiveApp* context, bool show) {
TaskHandle_t timer_task = xTaskGetHandle(configTIMER_SERVICE_TASK_NAME);
ViewStack* view_stack = context->view_stack; ViewStack* view_stack = context->view_stack;
Loading* loading = context->loading; Loading* loading = context->loading;
if(show) { if(show) {
// Raise timer priority so that animations can play // 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)); view_stack_add_view(view_stack, loading_get_view(loading));
} else { } else {
view_stack_remove_view(view_stack, loading_get_view(loading)); view_stack_remove_view(view_stack, loading_get_view(loading));
// Restore default timer priority // Restore default timer priority
vTaskPrioritySet(timer_task, configTIMER_TASK_PRIORITY); furi_timer_set_thread_priority(FuriTimerThreadPriorityNormal);
} }
} }

View File

@@ -169,8 +169,7 @@ void desktop_view_locked_update(DesktopViewLocked* locked_view) {
view_state == DesktopViewLockedStateCoverOpening && view_state == DesktopViewLockedStateCoverOpening &&
!desktop_view_locked_cover_move(model, false)) { !desktop_view_locked_cover_move(model, false)) {
model->view_state = DesktopViewLockedStateUnlocked; model->view_state = DesktopViewLockedStateUnlocked;
xTimerChangePeriod( furi_timer_start(locked_view->timer, LOCKED_HINT_TIMEOUT_MS);
locked_view->timer, pdMS_TO_TICKS(UNLOCKED_HINT_TIMEOUT_MS), portMAX_DELAY);
} else if(view_state == DesktopViewLockedStateLockedHintShown) { } else if(view_state == DesktopViewLockedStateLockedHintShown) {
model->view_state = DesktopViewLockedStateLocked; model->view_state = DesktopViewLockedStateLocked;
} else if(view_state == DesktopViewLockedStateUnlockedHintShown) { } else if(view_state == DesktopViewLockedStateUnlockedHintShown) {

View File

@@ -3,6 +3,9 @@
#include "thread.h" #include "thread.h"
#include "string.h" #include "string.h"
#include <FreeRTOS.h>
#include <task.h>
typedef struct { typedef struct {
FuriThreadStdoutWriteCallback write_callback; FuriThreadStdoutWriteCallback write_callback;
FuriString* buffer; FuriString* buffer;