Now, controlled via MQTT a Playback of a melody can Start, Stop, Pause etc. Settings like speed, total duration, pauses etc can be set.
29 lines
500 B
C++
29 lines
500 B
C++
#line 1 "C:\\Users\\espi_\\Documents\\Arduino\\vesper\\Timers.hpp"
|
|
#pragma once
|
|
|
|
extern volatile uint64_t startTime;
|
|
extern melody_attributes melody;
|
|
extern volatile bool playing;
|
|
|
|
void durationTimer(void *param);
|
|
|
|
|
|
void durationTimer(void *param){
|
|
|
|
// SETUP TASK
|
|
|
|
for (;;){
|
|
|
|
if (playing){
|
|
uint64_t now = millis();
|
|
uint64_t timeToStop = startTime + melody.duration;
|
|
if (now > timeToStop) {
|
|
playing = false;
|
|
Serial.println("Time Limit Reached. Stopping !");
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
}
|