From f2902755ca6fdbf27d2972fc57af3ba0477f6a00 Mon Sep 17 00:00:00 2001 From: Willy-JL <49810075+Willy-JL@users.noreply.github.com> Date: Sun, 12 Nov 2023 06:35:20 +0000 Subject: [PATCH] Fix thread and timer api --- applications/main/archive/archive.c | 5 ++--- applications/services/desktop/views/desktop_view_locked.c | 3 +-- furi/core/thread_i.h | 3 +++ 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/applications/main/archive/archive.c b/applications/main/archive/archive.c index 2f77eb47c..4121af77b 100644 --- a/applications/main/archive/archive.c +++ b/applications/main/archive/archive.c @@ -108,18 +108,17 @@ void archive_free(ArchiveApp* archive) { } void archive_show_loading_popup(ArchiveApp* context, bool show) { - TaskHandle_t timer_task = xTaskGetHandle(configTIMER_SERVICE_TASK_NAME); ViewStack* view_stack = context->view_stack; Loading* loading = context->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); } } diff --git a/applications/services/desktop/views/desktop_view_locked.c b/applications/services/desktop/views/desktop_view_locked.c index 88cbc7d55..a25ae7946 100644 --- a/applications/services/desktop/views/desktop_view_locked.c +++ b/applications/services/desktop/views/desktop_view_locked.c @@ -169,8 +169,7 @@ void desktop_view_locked_update(DesktopViewLocked* locked_view) { view_state == DesktopViewLockedStateCoverOpening && !desktop_view_locked_cover_move(model, false)) { model->view_state = DesktopViewLockedStateUnlocked; - xTimerChangePeriod( - locked_view->timer, pdMS_TO_TICKS(UNLOCKED_HINT_TIMEOUT_MS), portMAX_DELAY); + furi_timer_start(locked_view->timer, LOCKED_HINT_TIMEOUT_MS); } else if(view_state == DesktopViewLockedStateLockedHintShown) { model->view_state = DesktopViewLockedStateLocked; } else if(view_state == DesktopViewLockedStateUnlockedHintShown) { diff --git a/furi/core/thread_i.h b/furi/core/thread_i.h index c3289f7ad..49428ef16 100644 --- a/furi/core/thread_i.h +++ b/furi/core/thread_i.h @@ -3,6 +3,9 @@ #include "thread.h" #include "string.h" +#include +#include + typedef struct { FuriThreadStdoutWriteCallback write_callback; FuriString* buffer;