From 80d7df910987db5201402fe987124f29f09344f3 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Tue, 25 Jul 2023 17:42:36 +1000 Subject: fuck off --- src/tasks/tasks.cpp | 17 +++++++++++++++++ src/tasks/tasks.hpp | 8 +++++--- 2 files changed, 22 insertions(+), 3 deletions(-) (limited to 'src/tasks') diff --git a/src/tasks/tasks.cpp b/src/tasks/tasks.cpp index 7365813e..abce0bde 100644 --- a/src/tasks/tasks.cpp +++ b/src/tasks/tasks.cpp @@ -26,6 +26,10 @@ auto Name() -> std::string { return "DISPLAY"; } template <> +auto Name() -> std::string { + return "FSTREAMER"; +} +template <> auto Name() -> std::string { return "AUDIO"; } @@ -65,6 +69,14 @@ auto AllocateStack() -> cpp::span { return {static_cast(heap_caps_malloc(size, MALLOC_CAP_DEFAULT)), size}; } + +template <> +auto AllocateStack() -> cpp::span { + std::size_t size = 4 * 1024; + return {static_cast(heap_caps_malloc(size, MALLOC_CAP_SPIRAM)), + size}; +} + // Leveldb is designed for non-embedded use cases, where stack space isn't so // much of a concern. It therefore uses an eye-wateringly large amount of stack. template <> @@ -110,6 +122,11 @@ template <> auto Priority() -> UBaseType_t { return 9; } + +template <> +auto Priority() -> UBaseType_t { + return 10; +} // Database interactions are all inherently async already, due to their // potential for disk access. The user likely won't notice or care about a // couple of ms extra delay due to scheduling, so give this task the lowest diff --git a/src/tasks/tasks.hpp b/src/tasks/tasks.hpp index 4e5dfd17..742bb3cc 100644 --- a/src/tasks/tasks.hpp +++ b/src/tasks/tasks.hpp @@ -32,6 +32,8 @@ enum class Type { kUi, // Task for flushing graphics buffers to the display. kUiFlush, + // TODO. + kFileStreamer, // The main audio pipeline task. kAudio, // Task for running database queries. @@ -55,9 +57,9 @@ template auto StartPersistent(const std::function& fn) -> void { StaticTask_t* task_buffer = new StaticTask_t; cpp::span stack = AllocateStack(); - xTaskCreateStatic(&PersistentMain, Name().c_str(), stack.size(), - new std::function(fn), Priority(), - stack.data(), task_buffer); + xTaskCreateStaticPinnedToCore(&PersistentMain, Name().c_str(), + stack.size(), new std::function(fn), + Priority(), stack.data(), task_buffer, 0); } class Worker { -- cgit v1.2.3