Fixed OTA problems, Clock Alerts and MQTT Logs. V151

This commit is contained in:
2026-01-19 19:02:25 +02:00
parent 7e279c6e45
commit 11b98166d1
10 changed files with 200 additions and 44 deletions

View File

@@ -2,6 +2,7 @@
#include "../Communication/CommunicationRouter/CommunicationRouter.hpp"
#include "../BellEngine/BellEngine.hpp"
#include "../Telemetry/Telemetry.hpp"
#include "../TimeKeeper/TimeKeeper.hpp" // 🔥 Include for Timekeeper class definition
#include "../BuiltInMelodies/BuiltInMelodies.hpp"
// Note: Removed global melody_steps dependency for cleaner architecture
@@ -31,11 +32,12 @@ Player::Player(CommunicationRouter* comm, FileManager* fm)
, _fileManager(fm)
, _bellEngine(nullptr)
, _telemetry(nullptr)
, _timekeeper(nullptr)
, _durationTimerHandle(NULL) {
}
// Default constructor (for backward compatibility)
Player::Player()
Player::Player()
: id(0)
, name("melody1")
, uid("x")
@@ -59,6 +61,7 @@ Player::Player()
, _fileManager(nullptr)
, _bellEngine(nullptr)
, _telemetry(nullptr)
, _timekeeper(nullptr)
, _durationTimerHandle(NULL) {
}
@@ -106,12 +109,18 @@ void Player::play() {
LOG_ERROR("Cannot play: No melody loaded");
return;
}
// 🔥 CRITICAL: Interrupt any active clock alerts - user playback has priority!
if (_timekeeper) {
_timekeeper->interruptActiveAlert();
LOG_DEBUG("Player: Interrupted any active clock alerts");
}
if (_bellEngine) {
_bellEngine->setMelodyData(_melodySteps);
_bellEngine->start();
}
isPlaying = true;
hardStop = false;
startTime = segmentStartTime = millis();

View File

@@ -132,6 +132,12 @@ public:
* @param telemetry Pointer to Telemetry instance
*/
void setTelemetry(Telemetry* telemetry) { _telemetry = telemetry; }
/**
* @brief Set Timekeeper reference for alert coordination
* @param timekeeper Pointer to Timekeeper instance
*/
void setTimekeeper(class Timekeeper* timekeeper) { _timekeeper = timekeeper; }
// ═══════════════════════════════════════════════════════════════════════════════
// MELODY METADATA - Public access for compatibility
@@ -249,6 +255,7 @@ private:
FileManager* _fileManager; // 📁 File operations reference
BellEngine* _bellEngine; // 🔥 High-precision timing engine reference
Telemetry* _telemetry; // 📄 Telemetry system reference
class Timekeeper* _timekeeper; // ⏰ Timekeeper reference for alert coordination
std::vector<uint16_t> _melodySteps; // 🎵 Melody data owned by Player
TimerHandle_t _durationTimerHandle = NULL; // ⏱️ FreeRTOS timer (saves 4KB vs task!)