fix(Player): stop short pauses being skipped between segments (F-076, v2.4.2)

timeToResume() measured the pause from segmentCmpltTime, which still held
the previous loop's end while the engine finished the loop that was playing
when the pause was flagged. A pause_duration shorter than one melody loop
therefore resumed before the bells ever went quiet. Only start counting
once that loop has ended (segmentCmpltTime >= pauseTime).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-28 10:41:11 +02:00
co-authored by Claude Opus 5.5
parent 290445e3ad
commit ced38fda0b
3 changed files with 26 additions and 2 deletions
+19
View File
@@ -88,6 +88,7 @@ Check `git log -- src/Version.hpp` for the real bump history before tagging a ne
| F-073 | Confirmed delivery for `status/playback` + `control/reports` (QoS 1, PUBACK tracked, reset + republish/resend); AsyncMqttClient vendored + patched; all dependencies pinned | v2.4.0 | Stable |
| F-074 | Fix: `mode: "infinite"` no longer flips status playing/paused every ~0.5 s | v2.4.0 | Stable |
| F-075 | Play/stop command replies no longer wait for telemetry SD writes (deferred to TelemetryTask) | v2.4.1 | Stable |
| F-076 | Fix: a `pause_duration` shorter than one melody loop no longer gets skipped | v2.4.2 | Stable |
---
@@ -1566,3 +1567,21 @@ held while telemetry is paused for OTA and done right after `resume()`. Before t
one write of the latest values.
Subsystem: `src/Telemetry/Telemetry.hpp`, `src/Telemetry/Telemetry.cpp`
### F-076 — Fix short pauses being skipped
**Symptom.** Found while reviewing the pause logic for F-077 (2026-10-28): in a segmented play (`interval`, or
v1 `continuous_loop`), a `pause_duration` shorter than one melody loop could be skipped. Status went `paused`
then back to `playing`, but the bells never stopped between segments.
**Cause.** `timeToPause()` flags the pause when the segment time runs out, which is usually in the middle of a
loop. The engine finishes that loop before it actually waits. `timeToResume()` measured the pause from
`segmentCmpltTime`, but until that loop ends `segmentCmpltTime` still holds the end of the *previous* loop. If
`previous loop end + pause_duration` was already in the past, the next 500 ms tick resumed before the loop
had finished, so there was no silence.
**Fix.** `timeToResume()` only runs once `segmentCmpltTime >= pauseTime`, that is, once the loop that was
playing when the pause was flagged has ended. The silence now always lasts `pause_duration` (rounded up to the
500 ms timer tick), measured from the end of that loop. Pauses longer than one loop already worked this way.
Subsystem: `src/Player/Player.cpp`