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
36 lines
1012 B
C++
36 lines
1012 B
C++
#pragma once
|
|
|
|
extern Player player;
|
|
|
|
void dataLogging (void * param) {
|
|
|
|
// Task Setup
|
|
uint16_t bellMaxLoad[16] = {60};
|
|
|
|
// Task Loop
|
|
for (;;) {
|
|
// Only run if player is playing OR we're still cooling
|
|
if (player.isPlaying || coolingActive) {
|
|
coolingActive = false; // will be re-enabled if any load > 0
|
|
|
|
for (uint8_t i = 0; i < 16; i++) {
|
|
if (bellLoad[i] > 0) {
|
|
bellLoad[i]--;
|
|
coolingActive = true; // still has heat left
|
|
}
|
|
|
|
// Optional: check for overload
|
|
if (bellLoad[i] > bellMaxLoad[i]) {
|
|
Serial.printf("⚠️ Bell %d OVERLOAD! load=%d max=%d\n",
|
|
i, bellLoad[i], bellMaxLoad[i]);
|
|
player.forceStop();
|
|
// You could also block new strikes here if you want
|
|
}
|
|
}
|
|
}
|
|
|
|
vTaskDelay(pdMS_TO_TICKS(1000)); // run every 1s
|
|
}
|
|
|
|
}
|