Added Set Log Level Commands
This commit is contained in:
@@ -368,12 +368,23 @@ void Player::onMelodyLoopCompleted() {
|
||||
// Check if it's time to pause playback
|
||||
bool Player::timeToPause(unsigned long now) {
|
||||
if (isPlaying && continuous_loop) {
|
||||
uint64_t timeToPause = segmentStartTime + segment_duration;
|
||||
LOG_DEBUG("PTL: %llu // NOW: %lu", timeToPause, now);
|
||||
if (now >= timeToPause && !isPaused) {
|
||||
LOG_DEBUG("(TimerFunction) Segment Duration Reached. Pausing.");
|
||||
pauseTime = now;
|
||||
return true;
|
||||
// Special case: segment_duration = 0 means "one loop only"
|
||||
if (segment_duration == 0) {
|
||||
// Only pause after first loop completes (segmentCmpltTime updated)
|
||||
if (segmentCmpltTime > segmentStartTime && !isPaused) {
|
||||
LOG_DEBUG("(TimerFunction) One-loop segment completed. Pausing.");
|
||||
pauseTime = now;
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
// Normal duration-based pausing
|
||||
uint64_t timeToPause = segmentStartTime + segment_duration;
|
||||
LOG_DEBUG("PTL: %llu // NOW: %lu", timeToPause, now);
|
||||
if (now >= timeToPause && !isPaused) {
|
||||
LOG_DEBUG("(TimerFunction) Segment Duration Reached. Pausing.");
|
||||
pauseTime = now;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@@ -385,6 +396,7 @@ bool Player::timeToResume(unsigned long now) {
|
||||
uint64_t timeToResume = segmentCmpltTime + pause_duration;
|
||||
if (now >= timeToResume) {
|
||||
LOG_DEBUG("(TimerFunction) Pause Duration Reached. Resuming");
|
||||
segmentStartTime = now; // Reset segment start time for next cycle
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user