Tall cursor backdrop

This commit is contained in:
Dejvino 2026-02-19 00:10:10 +01:00
parent 66c20de208
commit de6775a7d7
6 changed files with 26 additions and 28 deletions

View File

@ -123,13 +123,6 @@ static void handlePlayback() {
} }
void loopPlayback() { void loopPlayback() {
unsigned long now = millis();
lastLoop1Time = now;
if (watchdogActive && (now - lastLoop0Time > 1000)) {
Serial.println("Core 0 Freeze detected");
rp2040.reboot();
}
if (needsPanic) { if (needsPanic) {
if (playMode == MODE_POLY) { if (playMode == MODE_POLY) {
for (int i=0; i<NUM_TRACKS; i++) midi.panic(midiChannels[i]); for (int i=0; i<NUM_TRACKS; i++) midi.panic(midiChannels[i]);

View File

@ -9,6 +9,11 @@
#include "PlaybackThread.h" #include "PlaybackThread.h"
#include "SharedState.h" #include "SharedState.h"
// Watchdog
volatile unsigned long lastLoop0Time = 0;
volatile unsigned long lastLoop1Time = 0;
volatile bool watchdogActive = false;
// Encoder State // Encoder State
static uint8_t prevNextCode = 0; static uint8_t prevNextCode = 0;
static uint16_t store = 0; static uint16_t store = 0;
@ -75,9 +80,23 @@ void setup() {
} }
void loop1() { void loop1() {
unsigned long now = millis();
lastLoop1Time = now;
if (watchdogActive && (now - lastLoop0Time > 1000)) {
Serial.println("Core 0 Freeze detected");
rp2040.reboot();
}
loopPlayback(); loopPlayback();
} }
void loop() { void loop() {
unsigned long now = millis();
lastLoop0Time = now;
if (watchdogActive && (now - lastLoop1Time > 1000)) {
Serial.println("Core 1 Freeze detected");
rp2040.reboot();
}
loopUI(); loopUI();
} }

View File

@ -58,11 +58,6 @@ volatile int tempo = 120; // BPM
volatile unsigned long lastClockTime = 0; volatile unsigned long lastClockTime = 0;
volatile int clockCount = 0; volatile int clockCount = 0;
// Watchdog
volatile unsigned long lastLoop0Time = 0;
volatile unsigned long lastLoop1Time = 0;
volatile bool watchdogActive = false;
// Encoder State // Encoder State
volatile int encoderDelta = 0; volatile int encoderDelta = 0;

View File

@ -52,11 +52,6 @@ extern volatile int tempo;
extern volatile unsigned long lastClockTime; extern volatile unsigned long lastClockTime;
extern volatile int clockCount; extern volatile int clockCount;
// Watchdog & Loop timing
extern volatile unsigned long lastLoop0Time;
extern volatile unsigned long lastLoop1Time;
extern volatile bool watchdogActive;
// Input state // Input state
extern volatile int encoderDelta; extern volatile int encoderDelta;
extern bool lastButtonState; extern bool lastButtonState;

View File

@ -246,6 +246,7 @@ void UIManager::updateLeds(const Step sequence[][NUM_STEPS], int playbackStep, b
int x = s % 8; int x = s % 8;
int yBase = (s / 8) * 4; int yBase = (s / 8) * 4;
uint32_t color = 0, dimColor = 0; uint32_t color = 0, dimColor = 0;
bool isCursorHere = (isPlaying && s == playbackStep);
if (sequence[0][s].note != -1) { if (sequence[0][s].note != -1) {
color = getNoteColor(sequence[0][s].note, sequence[0][s].tie); color = getNoteColor(sequence[0][s].note, sequence[0][s].tie);
dimColor = getNoteColor(sequence[0][s].note, true); 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 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; } } 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) { if (isPlaying) {
cursorColor = pixels.Color(0, 50, 0); cursorColor = pixels.Color(0, 50, 0);
if (songModeEnabled && s >= 8) { 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 (cursorColor != 0) {
if (isCursorHere) c[3] = cursorColor; if (isCursorHere) {
else { 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; 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); c[3] = pixels.Color(r/5, g/5, b/5);
} }

View File

@ -434,13 +434,6 @@ static void updateLeds() {
} }
void loopUI() { 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 // Handle Song Mode Generation in UI Thread
if (songModeNeedsNext) { if (songModeNeedsNext) {
int nextTheme = random(1, 8); // Themes 1-7 int nextTheme = random(1, 8); // Themes 1-7