Pixel 6 pulses on MIDI Clock beat (0xF8) - all on Core 0
- Detect 0xF8 in midi_transport.cpp (runs on Core 0) - Every 24th tick = beat, flash pixel 6 white - Instant-on, quadratic fade over 80ms, restore to dim - All FastLED calls stay on Core 0, no cross-core conflict
This commit is contained in:
+26
-1
@@ -25,10 +25,35 @@ TaskHandle_t midi_task_handle = NULL;
|
||||
|
||||
void midi_task(void* parameter) {
|
||||
Serial.println("[TASK] MIDI task started on core 0");
|
||||
|
||||
uint32_t last_beat = 0;
|
||||
uint32_t flash_start = 0;
|
||||
|
||||
while (true) {
|
||||
midi_transport.update();
|
||||
exp_pedal.update(midi_transport);
|
||||
|
||||
uint32_t beat = midi_tick_count / 24;
|
||||
if (beat != last_beat) {
|
||||
last_beat = beat;
|
||||
flash_start = millis();
|
||||
mux.set_led_color(6, 255, 255, 255);
|
||||
mux.show();
|
||||
}
|
||||
|
||||
if (flash_start > 0) {
|
||||
uint32_t elapsed = millis() - flash_start;
|
||||
if (elapsed >= 80) {
|
||||
mux.set_led_color(6, 20, 20, 20);
|
||||
mux.show();
|
||||
flash_start = 0;
|
||||
} else {
|
||||
float b = 1.0f - (float)elapsed / 80.0f;
|
||||
uint8_t v = (uint8_t)(255 * b * b);
|
||||
mux.set_led_color(6, v, v, v);
|
||||
mux.show();
|
||||
}
|
||||
}
|
||||
|
||||
vTaskDelay(1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user