Tall cursor backdrop
This commit is contained in:
parent
66c20de208
commit
de6775a7d7
@ -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<NUM_TRACKS; i++) midi.panic(midiChannels[i]);
|
||||
|
||||
@ -9,6 +9,11 @@
|
||||
#include "PlaybackThread.h"
|
||||
#include "SharedState.h"
|
||||
|
||||
// Watchdog
|
||||
volatile unsigned long lastLoop0Time = 0;
|
||||
volatile unsigned long lastLoop1Time = 0;
|
||||
volatile bool watchdogActive = false;
|
||||
|
||||
// Encoder State
|
||||
static uint8_t prevNextCode = 0;
|
||||
static uint16_t store = 0;
|
||||
@ -75,9 +80,23 @@ void setup() {
|
||||
}
|
||||
|
||||
void loop1() {
|
||||
unsigned long now = millis();
|
||||
lastLoop1Time = now;
|
||||
if (watchdogActive && (now - lastLoop0Time > 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();
|
||||
}
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user