diff --git a/PlaybackThread.cpp b/PlaybackThread.cpp index a2ac77d..1bfa778 100644 --- a/PlaybackThread.cpp +++ b/PlaybackThread.cpp @@ -123,13 +123,6 @@ static void handlePlayback() { } void loopPlayback() { - unsigned long now = millis(); - lastLoop1Time = now; - if (watchdogActive && (now - lastLoop0Time > 1000)) { - Serial.println("Core 0 Freeze detected"); - rp2040.reboot(); - } - if (needsPanic) { if (playMode == MODE_POLY) { for (int i=0; i 1000)) { + Serial.println("Core 0 Freeze detected"); + rp2040.reboot(); + } + loopPlayback(); } void loop() { + unsigned long now = millis(); + lastLoop0Time = now; + if (watchdogActive && (now - lastLoop1Time > 1000)) { + Serial.println("Core 1 Freeze detected"); + rp2040.reboot(); + } + loopUI(); } \ No newline at end of file diff --git a/SharedState.cpp b/SharedState.cpp index cd78327..419a0f2 100644 --- a/SharedState.cpp +++ b/SharedState.cpp @@ -58,11 +58,6 @@ volatile int tempo = 120; // BPM volatile unsigned long lastClockTime = 0; volatile int clockCount = 0; -// Watchdog -volatile unsigned long lastLoop0Time = 0; -volatile unsigned long lastLoop1Time = 0; -volatile bool watchdogActive = false; - // Encoder State volatile int encoderDelta = 0; diff --git a/SharedState.h b/SharedState.h index 6c515cd..b7f2087 100644 --- a/SharedState.h +++ b/SharedState.h @@ -52,11 +52,6 @@ extern volatile int tempo; extern volatile unsigned long lastClockTime; extern volatile int clockCount; -// Watchdog & Loop timing -extern volatile unsigned long lastLoop0Time; -extern volatile unsigned long lastLoop1Time; -extern volatile bool watchdogActive; - // Input state extern volatile int encoderDelta; extern bool lastButtonState; diff --git a/UIManager.cpp b/UIManager.cpp index b0d334c..6774e68 100644 --- a/UIManager.cpp +++ b/UIManager.cpp @@ -246,6 +246,7 @@ void UIManager::updateLeds(const Step sequence[][NUM_STEPS], int playbackStep, b int x = s % 8; int yBase = (s / 8) * 4; uint32_t color = 0, dimColor = 0; + bool isCursorHere = (isPlaying && s == playbackStep); if (sequence[0][s].note != -1) { color = getNoteColor(sequence[0][s].note, sequence[0][s].tie); dimColor = getNoteColor(sequence[0][s].note, true); @@ -257,7 +258,7 @@ void UIManager::updateLeds(const Step sequence[][NUM_STEPS], int playbackStep, b else if (octave < 4) { c[2] = color; if (sequence[0][s].accent) c[1] = dimColor; } else { c[1] = color; if (sequence[0][s].accent) { c[0] = dimColor; c[2] = dimColor; } } } - uint32_t cursorColor = 0; + uint32_t cursorColor = pixels.Color(0, 0, 50); if (isPlaying) { cursorColor = pixels.Color(0, 50, 0); if (songModeEnabled && s >= 8) { @@ -266,10 +267,12 @@ void UIManager::updateLeds(const Step sequence[][NUM_STEPS], int playbackStep, b } } - bool isCursorHere = (isPlaying && s == playbackStep); if (cursorColor != 0) { - if (isCursorHere) c[3] = cursorColor; - else { + if (isCursorHere) { + for(int i=0; i<4; i++) { + if (c[i] == 0) c[i] = cursorColor; + } + } else { uint8_t r = (uint8_t)(cursorColor >> 16), g = (uint8_t)(cursorColor >> 8), b = (uint8_t)cursorColor; c[3] = pixels.Color(r/5, g/5, b/5); } diff --git a/UIThread.cpp b/UIThread.cpp index 89a7667..9154be9 100644 --- a/UIThread.cpp +++ b/UIThread.cpp @@ -434,13 +434,6 @@ static void updateLeds() { } void loopUI() { - unsigned long now = millis(); - lastLoop0Time = now; - if (watchdogActive && (now - lastLoop1Time > 1000)) { - Serial.println("Core 1 Freeze detected"); - rp2040.reboot(); - } - // Handle Song Mode Generation in UI Thread if (songModeNeedsNext) { int nextTheme = random(1, 8); // Themes 1-7