Replace MIDI clock with internal BPM timer for pixel 6 pulse

Revert:
- Remove midi_clock.h/cpp (was causing cross-core crash)
- Remove real-time MIDI message parsing from midi_transport.cpp

New approach:
- Pixel 6 (and all active LEDs) pulse to internal BPM timer
- Default 120 BPM (500ms beat interval)
- 'bpm <n>' serial command to change tempo (20-300)
- Only calls FastLED.show() when actively pulsing (avoids USB/WS2812 interference)
- 33ms update rate (30fps)
- Inactive LEDs left untouched (no unnecessary show() calls)
This commit is contained in:
ash
2026-07-02 07:27:26 +00:00
parent 5dc10eea87
commit af14c2f759
6 changed files with 31 additions and 97 deletions
+11
View File
@@ -89,6 +89,13 @@ void handle_serial_command(const String& cmd) {
} else if (cmd == "exp") {
Serial.printf("[CMD] EXP ADC=%d MIDI=%d\n",
exp_pedal.get_raw(), exp_pedal.get_value());
} else if (cmd.startsWith("bpm ")) {
uint16_t bpm = cmd.substring(4).toInt();
if (bpm >= 20 && bpm <= 300) {
led_driver.set_bpm(bpm);
} else {
Serial.println("[CMD] BPM must be 20-300");
}
} else if (cmd == "usb") {
Serial.printf("[CMD] USB mounted: %s\n", TinyUSBDevice.mounted() ? "YES" : "NO");
Serial.printf("[CMD] USB ready: %s\n", TinyUSBDevice.ready() ? "YES" : "NO");
@@ -133,6 +140,7 @@ void handle_serial_command(const String& cmd) {
Serial.println(" red/green/blue - solid colour");
Serial.println(" pixel0/pixel1 - single pixel test");
Serial.println(" exp - expression pedal ADC/MIDI value");
Serial.println(" bpm <n> - set LED pulse tempo (20-300, default 120)");
Serial.println(" usb - USB connection status and descriptor info");
Serial.println(" gpiotest - raw GPIO pin diagnostic");
Serial.println(" rawled - bit-bang WS2812 (no library)");
@@ -356,6 +364,9 @@ void setup() {
Serial.println("[INIT] Initializing Expression Pedal...");
exp_pedal.begin();
Serial.println("[INIT] Setting LED pulse tempo...");
led_driver.set_bpm(120);
Serial.println("[INIT] Registering MIDI callbacks...");
controller.begin();