summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorailurux <ailuruxx@gmail.com>2024-08-15 12:46:43 +1000
committerailurux <ailuruxx@gmail.com>2024-08-15 12:46:43 +1000
commit40e08f48230953f135a534264c3aeaebe7c084a2 (patch)
treefea9b54751669859e78d5c82b298bfee70a16efd
parent5ab4c2f0d6eda97b73ac789f3d8fd39bd97eeddb (diff)
parent493f8e1200f73a921bf06a51fd1e6689396151ea (diff)
downloadtangara-fw-40e08f48230953f135a534264c3aeaebe7c084a2.tar.gz
Merge branch 'main' of codeberg.org:cool-tech-zone/tangara-fw
-rw-r--r--src/drivers/pcm_buffer.cpp5
-rw-r--r--src/tangara/audio/track_queue.cpp4
-rw-r--r--src/tangara/system_fsm/running.cpp4
3 files changed, 8 insertions, 5 deletions
diff --git a/src/drivers/pcm_buffer.cpp b/src/drivers/pcm_buffer.cpp
index 142a6376..25762c50 100644
--- a/src/drivers/pcm_buffer.cpp
+++ b/src/drivers/pcm_buffer.cpp
@@ -71,11 +71,6 @@ auto PcmBuffer::clear() -> void {
if (data) {
vRingbufferReturnItem(ringbuf_, data);
received_ += bytes_cleared / sizeof(int16_t);
- } else {
- // Defensively guard against looping forever if for some reason the
- // buffer isn't draining.
- ESP_LOGW(kTag, "PcmBuffer not draining");
- break;
}
}
}
diff --git a/src/tangara/audio/track_queue.cpp b/src/tangara/audio/track_queue.cpp
index 51f17a8f..ecf33c74 100644
--- a/src/tangara/audio/track_queue.cpp
+++ b/src/tangara/audio/track_queue.cpp
@@ -235,6 +235,8 @@ auto TrackQueue::next(Reason r) -> void {
{
const std::unique_lock<std::shared_mutex> lock(mutex_);
+ auto pos = position_;
+
if (shuffle_) {
shuffle_->next();
position_ = shuffle_->current();
@@ -243,7 +245,9 @@ auto TrackQueue::next(Reason r) -> void {
position_++;
}
}
+
goTo(position_);
+ changed = pos != position_;
}
notifyChanged(changed, r);
diff --git a/src/tangara/system_fsm/running.cpp b/src/tangara/system_fsm/running.cpp
index f9bca074..07166e2f 100644
--- a/src/tangara/system_fsm/running.cpp
+++ b/src/tangara/system_fsm/running.cpp
@@ -188,6 +188,10 @@ auto Running::mountStorage() -> void {
// mounted card.
if (sServices->nvs().DbAutoIndex()) {
sServices->bg_worker().Dispatch<void>([&]() {
+ // Delay the index update for a bit, since we don't want to cause a lot
+ // of disk contention immediately after mounting (especially when we've
+ // just booted), or else we risk slowing down stuff like UI loading.
+ vTaskDelay(pdMS_TO_TICKS(6000));
auto db = sServices->database().lock();
if (!db) {
return;