MAJOR update. More like a Backup before things get Crazy
Added Websocket Support Added Universal Message Handling for both MQTT and WS Added Timekeeper Class, that handles Physical Clock and Scheduling Added Bell Assignment Settings, Note to Bell mapping
This commit is contained in:
@@ -12,7 +12,6 @@ void durationTimer(void *param) {
|
||||
|
||||
// Task Setup
|
||||
|
||||
|
||||
// Task Loop
|
||||
while (true) {
|
||||
|
||||
@@ -26,16 +25,16 @@ void durationTimer(void *param) {
|
||||
player.unpause();
|
||||
}
|
||||
|
||||
vTaskDelay(pdMS_TO_TICKS(1000)); // Check every 100ms
|
||||
vTaskDelay(pdMS_TO_TICKS(500)); // Check every 500ms
|
||||
}
|
||||
}
|
||||
|
||||
// Check if it's time to stop playback
|
||||
bool timeToStop(unsigned long now) {
|
||||
if (player.isPlaying) {
|
||||
uint64_t stopTime = player.startTime + player.duration;
|
||||
if (player.isPlaying && !player.infinite_play) {
|
||||
uint64_t stopTime = player.startTime + player.total_duration;
|
||||
if (now >= stopTime) {
|
||||
LOG_DEBUG("TIMER: Total Duration Reached");
|
||||
LOG_DEBUG("(TimerFunction) Total Run Duration Reached. Soft Stopping.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -44,11 +43,11 @@ bool timeToStop(unsigned long now) {
|
||||
|
||||
// Check if it's time to pause playback
|
||||
bool timeToPause(unsigned long now) {
|
||||
if (player.isPlaying && player.loop_duration > 0) {
|
||||
uint64_t pauseTimeLimit = player.loopStartTime + player.loop_duration;
|
||||
LOG_DEBUG("PTL: %lu // NOW: %d",pauseTimeLimit, now);
|
||||
if (now >= pauseTimeLimit && !player.isPaused) {
|
||||
LOG_DEBUG("TIMER: Segment Duration Reached");
|
||||
if (player.isPlaying && player.continuous_loop) {
|
||||
uint64_t timeToPause = player.segmentStartTime + player.segment_duration;
|
||||
LOG_DEBUG("PTL: %llu // NOW: %lu", timeToPause, now);
|
||||
if (now >= timeToPause && !player.isPaused) {
|
||||
LOG_DEBUG("(TimerFunction) Segment Duration Reached. Pausing.");
|
||||
player.pauseTime = now;
|
||||
return true;
|
||||
}
|
||||
@@ -59,9 +58,9 @@ bool timeToPause(unsigned long now) {
|
||||
// Check if it's time to resume playback
|
||||
bool timeToResume(unsigned long now) {
|
||||
if (player.isPaused) {
|
||||
uint64_t resumeTime = player.pauseTime + player.interval;
|
||||
if (now >= resumeTime) {
|
||||
LOG_DEBUG("TIMER: Pause Duration Reached");
|
||||
uint64_t timeToResume = player.segmentCmpltTime + player.pause_duration;
|
||||
if (now >= timeToResume) {
|
||||
LOG_DEBUG("(TimerFunction) Pause Duration Reached. Resuming");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user