Fixed Single-loop mode playing multiple times on fast speeds.
This commit is contained in:
@@ -74,7 +74,7 @@ BellEngine::~BellEngine() {
|
||||
*
|
||||
*/
|
||||
void BellEngine::begin() {
|
||||
LOG_DEBUG("Initializing BellEngine with high-precision timing");
|
||||
LOG_DEBUG("Initializing BellEngine...");
|
||||
|
||||
// Create engine task with HIGHEST priority on dedicated Core 1
|
||||
// This ensures maximum performance and timing precision
|
||||
@@ -88,7 +88,7 @@ void BellEngine::begin() {
|
||||
1 // 💻 Pin to Core 1 (dedicated)
|
||||
);
|
||||
|
||||
LOG_INFO("BellEngine initialized - Ready for MAXIMUM PRECISION! 🎯");
|
||||
LOG_INFO("BellEngine initialized !");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -120,18 +120,18 @@ void BellEngine::start() {
|
||||
return; // ⛔ Early exit if no melody data
|
||||
}
|
||||
|
||||
LOG_INFO("🚀 BellEngine IGNITION - Starting precision playback");
|
||||
LOG_INFO("🚀 BellEngine Ignition - Starting precision playback");
|
||||
_emergencyStop.store(false); // ✅ Clear any emergency stop state
|
||||
_engineRunning.store(true); // ✅ Activate the engine atomically
|
||||
}
|
||||
|
||||
void BellEngine::stop() {
|
||||
LOG_INFO("BellEngine stopping gracefully");
|
||||
LOG_INFO("BellEngine - Stopping Gracefully");
|
||||
_engineRunning.store(false);
|
||||
}
|
||||
|
||||
void BellEngine::emergencyStop() {
|
||||
LOG_INFO("🛑 EMERGENCY STOP ACTIVATED");
|
||||
LOG_INFO("BellEngine 🛑 EMERGENCY STOP ACTIVATED");
|
||||
_emergencyStop.store(true);
|
||||
_engineRunning.store(false);
|
||||
emergencyShutdown();
|
||||
@@ -238,7 +238,11 @@ void BellEngine::playbackLoop() {
|
||||
|
||||
// Mark segment completion and notify Player
|
||||
_player.segmentCmpltTime = millis();
|
||||
_player.onMelodyLoopCompleted(); // 🔥 Notify Player that melody actually finished!
|
||||
_player.onMelodyLoopCompleted(); // 🔥 Notify Player that melody actually finished!
|
||||
if ((_player.continuous_loop && _player.segment_duration == 0) || _player.total_duration == 0) {
|
||||
vTaskDelay(pdMS_TO_TICKS(500)); //Give Player time to pause/stop
|
||||
LOG_VERBOSE("Melody loop completed for SINGLE Mode - waiting for Player to handle pause/stop");
|
||||
}
|
||||
LOG_DEBUG("🎵 Melody loop completed with PRECISION");
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user