summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/audio/audio_task.cpp18
-rw-r--r--src/audio/include/audio_task.hpp1
-rw-r--r--src/tasks/tasks.cpp14
-rw-r--r--src/tasks/tasks.hpp2
-rw-r--r--src/ui/lvgl_task.cpp48
5 files changed, 25 insertions, 58 deletions
diff --git a/src/audio/audio_task.cpp b/src/audio/audio_task.cpp
index f0128bf3..2309a5e5 100644
--- a/src/audio/audio_task.cpp
+++ b/src/audio/audio_task.cpp
@@ -126,30 +126,12 @@ void AudioTaskMain(std::unique_ptr<Pipeline> pipeline, IAudioSink* sink) {
}
}
-static std::byte sDrainBuf[8 * 1024];
-
-void AudioDrainMain(IAudioSink* sink) {
- while (1) {
- std::size_t len = xStreamBufferReceive(sink->buffer(), sDrainBuf,
- sizeof(sDrainBuf), portMAX_DELAY);
- if (len > 0) {
- sink->Send({sDrainBuf, len});
- }
- }
-}
-
auto StartPipeline(Pipeline* pipeline, IAudioSink* sink) -> void {
ESP_LOGI(kTag, "starting audio pipeline task");
tasks::StartPersistent<tasks::Type::kAudio>(
[=]() { AudioTaskMain(std::unique_ptr<Pipeline>(pipeline), sink); });
}
-auto StartDrain(IAudioSink* sink) -> void {
- ESP_LOGI(kTag, "starting audio drain task");
- tasks::StartPersistent<tasks::Type::kAudioDrain>(
- [=]() { AudioDrainMain(sink); });
-}
-
} // namespace task
} // namespace audio
diff --git a/src/audio/include/audio_task.hpp b/src/audio/include/audio_task.hpp
index 8269c8d4..bf18fba0 100644
--- a/src/audio/include/audio_task.hpp
+++ b/src/audio/include/audio_task.hpp
@@ -16,7 +16,6 @@ namespace audio {
namespace task {
auto StartPipeline(Pipeline* pipeline, IAudioSink* sink) -> void;
-auto StartDrain(IAudioSink* sink) -> void;
} // namespace task
diff --git a/src/tasks/tasks.cpp b/src/tasks/tasks.cpp
index 0d9d7881..f76c32a1 100644
--- a/src/tasks/tasks.cpp
+++ b/src/tasks/tasks.cpp
@@ -22,10 +22,6 @@ auto Name<Type::kAudio>() -> std::string {
return "AUDIO";
}
template <>
-auto Name<Type::kAudioDrain>() -> std::string {
- return "DRAIN";
-}
-template <>
auto Name<Type::kDatabase>() -> std::string {
return "DB";
}
@@ -41,12 +37,6 @@ auto AllocateStack<Type::kAudio>() -> cpp::span<StackType_t> {
return {static_cast<StackType_t*>(heap_caps_malloc(size, MALLOC_CAP_DEFAULT)),
size};
}
-template <>
-auto AllocateStack<Type::kAudioDrain>() -> cpp::span<StackType_t> {
- std::size_t size = 1024;
- return {static_cast<StackType_t*>(heap_caps_malloc(size, MALLOC_CAP_DEFAULT)),
- size};
-}
// LVGL requires only a relatively small stack. However, it can be allocated in
// PSRAM so we give it a bit of headroom for safety.
template <>
@@ -88,10 +78,6 @@ template <>
auto Priority<Type::kAudio>() -> UBaseType_t {
return 10;
}
-template <>
-auto Priority<Type::kAudioDrain>() -> UBaseType_t {
- return 10;
-}
// After audio issues, UI jank is the most noticeable kind of scheduling-induced
// slowness that the user is likely to notice or care about. Therefore we place
// this task directly below audio in terms of priority.
diff --git a/src/tasks/tasks.hpp b/src/tasks/tasks.hpp
index 9f37131e..993e52bf 100644
--- a/src/tasks/tasks.hpp
+++ b/src/tasks/tasks.hpp
@@ -28,8 +28,6 @@ enum class Type {
kUiFlush,
// The main audio pipeline task.
kAudio,
- // Task for flushing PCM samples to the current output.
- kAudioDrain,
// Task for running database queries.
kDatabase,
};
diff --git a/src/ui/lvgl_task.cpp b/src/ui/lvgl_task.cpp
index 6664f754..7924a3d1 100644
--- a/src/ui/lvgl_task.cpp
+++ b/src/ui/lvgl_task.cpp
@@ -23,8 +23,8 @@
#include "misc/lv_color.h"
#include "misc/lv_style.h"
#include "misc/lv_timer.h"
-#include "touchwheel.hpp"
#include "tasks.hpp"
+#include "touchwheel.hpp"
#include "widgets/lv_label.h"
#include "display.hpp"
@@ -38,37 +38,39 @@ auto tick_hook(TimerHandle_t xTimer) -> void {
lv_tick_inc(1);
}
-void LvglMain(std::weak_ptr<drivers::TouchWheel> weak_touch_wheel, std::weak_ptr<drivers::Display> weak_display) {
- ESP_LOGI(kTag, "init lvgl");
- lv_init();
+void LvglMain(std::weak_ptr<drivers::TouchWheel> weak_touch_wheel,
+ std::weak_ptr<drivers::Display> weak_display) {
+ ESP_LOGI(kTag, "init lvgl");
+ lv_init();
- // LVGL has been initialised, so we can now start reporting ticks to it.
- xTimerCreate("lv_tick", pdMS_TO_TICKS(1), pdTRUE, NULL, &tick_hook);
+ // LVGL has been initialised, so we can now start reporting ticks to it.
+ xTimerCreate("lv_tick", pdMS_TO_TICKS(1), pdTRUE, NULL, &tick_hook);
- lv_style_t style;
- lv_style_init(&style);
- lv_style_set_text_color(&style, LV_COLOR_MAKE(0xFF, 0, 0));
- // TODO: find a nice bitmap font for this display size and density.
- // lv_style_set_text_font(&style, &lv_font_montserrat_24);
+ lv_style_t style;
+ lv_style_init(&style);
+ lv_style_set_text_color(&style, LV_COLOR_MAKE(0xFF, 0, 0));
+ // TODO: find a nice bitmap font for this display size and density.
+ // lv_style_set_text_font(&style, &lv_font_montserrat_24);
- auto label = lv_label_create(NULL);
- lv_label_set_text(label, "COLOURS!!");
- lv_obj_add_style(label, &style, 0);
+ auto label = lv_label_create(NULL);
+ lv_label_set_text(label, "COLOURS!!");
+ lv_obj_add_style(label, &style, 0);
- lv_obj_center(label);
- lv_scr_load(label);
+ lv_obj_center(label);
+ lv_scr_load(label);
- while (1) {
- lv_timer_handler();
- // 30 FPS
- // TODO(jacqueline): make this dynamic
- vTaskDelay(pdMS_TO_TICKS(33));
- }
+ while (1) {
+ lv_timer_handler();
+ // 30 FPS
+ // TODO(jacqueline): make this dynamic
+ vTaskDelay(pdMS_TO_TICKS(33));
+ }
}
auto StartLvgl(std::weak_ptr<drivers::TouchWheel> touch_wheel,
std::weak_ptr<drivers::Display> display) -> void {
- tasks::StartPersistent<tasks::Type::kUi>([=]() { LvglMain(touch_wheel, display); });
+ tasks::StartPersistent<tasks::Type::kUi>(
+ [=]() { LvglMain(touch_wheel, display); });
}
} // namespace ui