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:
@@ -8,7 +8,7 @@ void setRelayDurations(JsonDocument& doc);
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
// Handles the incoming payload. Returns it into a "JsonDocument" format.
|
||||
JsonDocument handleJSON(char * payload) {
|
||||
JsonDocument payload2json(char * payload) {
|
||||
JsonDocument doc;
|
||||
DeserializationError error = deserializeJson(doc, payload);
|
||||
if (error) {
|
||||
@@ -62,7 +62,7 @@ void OnMqttReceived(char * topic, char * payload, AsyncMqttClientMessageProperti
|
||||
}
|
||||
|
||||
else if (String(topic) == topicSetMelody) {
|
||||
setMelodyAttributes(handleJSON(payload));
|
||||
setMelodyAttributes(payload2json(payload));
|
||||
loadMelodyInRAM(melody_steps);
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ void OnMqttReceived(char * topic, char * payload, AsyncMqttClientMessageProperti
|
||||
}
|
||||
|
||||
else if (String(topic) == topicRelayTimers) {
|
||||
setRelayDurations(handleJSON(payload));
|
||||
setRelayDurations(payload2json(payload));
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#line 1 "C:\\Users\\espi_\\Documents\\Arduino\\4. Bell Systems\\1. Main Projects\\Project - Vesper\\PlaybackControls.hpp"
|
||||
#pragma once
|
||||
|
||||
extern melody_attributes melody;
|
||||
@@ -12,6 +11,8 @@ void durationTimer(void *param);
|
||||
void durationTimer(void *param) {
|
||||
|
||||
// Task Setup
|
||||
Serial.print("Main millis: ");
|
||||
Serial.println(millis());
|
||||
|
||||
|
||||
// Task Loop
|
||||
@@ -27,7 +28,7 @@ void durationTimer(void *param) {
|
||||
melody.unpause();
|
||||
}
|
||||
|
||||
vTaskDelay(pdMS_TO_TICKS(1000)); // Check every 100ms
|
||||
vTaskDelay(pdMS_TO_TICKS(100)); // Check every 100ms
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +48,9 @@ bool timeToStop(unsigned long now) {
|
||||
bool timeToPause(unsigned long now) {
|
||||
if (melody.isPlaying && melody.loop_duration > 0) {
|
||||
uint64_t pauseTimeLimit = melody.loopStartTime + melody.loop_duration;
|
||||
Serial.printf("PTL: %lu // NOW: ",pauseTimeLimit);
|
||||
Serial.print("PTL: ");
|
||||
Serial.print(pauseTimeLimit);
|
||||
Serial.print(" // NOW: ");
|
||||
Serial.println(now);
|
||||
if (now >= pauseTimeLimit && !melody.isPaused) {
|
||||
Serial.println("TIMER: Segment Duration Reached");
|
||||
|
||||
Reference in New Issue
Block a user