Fix Launchpad mode MIDI receive and color palette

- Fixed note matching bug: removed channel check so notes 36-45 match
  across channels 1-3 (Launchpad static/flashing/pulsing)
- Simplified LED lookup to match by note only (channel stored for mode)
- Replaced sparse palette with proper RGB gradients between key
  breakpoints (Red, Orange, Yellow, Green, Cyan, Blue, Purple, Off)
This commit is contained in:
2026-06-25 06:31:16 +00:00
parent fee8ab5b94
commit 40dfe775ea
2 changed files with 139 additions and 44 deletions
+6 -8
View File
@@ -56,25 +56,23 @@ void AppTask::process_midi_event(const MidiEvent& event) {
// Notes 36-45 (C2-A2) map to pads 0-9
// Velocity 1-127 = color palette index
if (event.type == MidiEvent::NOTE_ON || event.type == MidiEvent::NOTE_OFF) {
// Only handle channels 1-3 (Launchpad channels)
if (midi_channel >= 1 && midi_channel <= 3) {
for (uint8_t i = 0; i < NUM_PADS; i++) {
if (pad_mapping[i].midi_channel == midi_channel &&
pad_mapping[i].midi_note == midi_note) {
if (pad_mapping[i].midi_note == midi_note) {
led_index = pad_mapping[i].led_index;
break;
}
}
if (led_index < NUM_PADS) {
uint8_t color_vel = (event.type == MidiEvent::NOTE_ON) ? midi_velocity : 0;
led_driver->set_led_state(
pad_mapping[led_index].midi_note,
pad_mapping[led_index].midi_channel,
midi_note,
midi_channel,
color_vel
);
Serial.printf("[APP] NOTE -> LED: Ch%d Note%d Vel%d -> LED%d\n",
midi_channel, midi_note, color_vel, led_index);
} else {