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:
ash
2026-07-02 08:37:36 +00:00
parent 76a584a5ef
commit 748d2ef99f
3 changed files with 36 additions and 1 deletions
+26 -1
View File
@@ -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);
}
}