Merge branch 'main' of codeberg.org:cool-tech-zone/tangara-fw

custom
ailurux 8 months ago
commit 40e08f4823
  1. 5
      src/drivers/pcm_buffer.cpp
  2. 4
      src/tangara/audio/track_queue.cpp
  3. 4
      src/tangara/system_fsm/running.cpp

@ -71,11 +71,6 @@ auto PcmBuffer::clear() -> void {
if (data) { if (data) {
vRingbufferReturnItem(ringbuf_, data); vRingbufferReturnItem(ringbuf_, data);
received_ += bytes_cleared / sizeof(int16_t); 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;
} }
} }
} }

@ -235,6 +235,8 @@ auto TrackQueue::next(Reason r) -> void {
{ {
const std::unique_lock<std::shared_mutex> lock(mutex_); const std::unique_lock<std::shared_mutex> lock(mutex_);
auto pos = position_;
if (shuffle_) { if (shuffle_) {
shuffle_->next(); shuffle_->next();
position_ = shuffle_->current(); position_ = shuffle_->current();
@ -243,7 +245,9 @@ auto TrackQueue::next(Reason r) -> void {
position_++; position_++;
} }
} }
goTo(position_); goTo(position_);
changed = pos != position_;
} }
notifyChanged(changed, r); notifyChanged(changed, r);

@ -188,6 +188,10 @@ auto Running::mountStorage() -> void {
// mounted card. // mounted card.
if (sServices->nvs().DbAutoIndex()) { if (sServices->nvs().DbAutoIndex()) {
sServices->bg_worker().Dispatch<void>([&]() { 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(); auto db = sServices->database().lock();
if (!db) { if (!db) {
return; return;

Loading…
Cancel
Save