Fix palette array size (128) and remove duplicate clear_all()
This commit is contained in:
+2
-18
@@ -4,7 +4,7 @@
|
||||
|
||||
static PixelStompMux* mux_ptr = nullptr;
|
||||
|
||||
// Launchpad X color palette (velocity 1-127 mapped to colors)
|
||||
// Launchpad X color palette (velocity 0-127 mapped to colors)
|
||||
static const uint32_t launchpad_palette[128] = {
|
||||
0x000000, // 0: off
|
||||
0xFF0000, 0xFF0000, 0xFF0000, 0xFF0000, // 1-4: Red
|
||||
@@ -42,8 +42,6 @@ static const uint32_t launchpad_palette[128] = {
|
||||
};
|
||||
|
||||
static uint32_t velocity_to_color(uint8_t velocity) {
|
||||
if (velocity == 0) return 0x000000;
|
||||
if (velocity >= 128) return launchpad_palette[127];
|
||||
return launchpad_palette[velocity];
|
||||
}
|
||||
|
||||
@@ -155,6 +153,7 @@ void DefaultLedStub::clear_all() {
|
||||
mux_ptr->set_led_color(i, 0, 0, 0);
|
||||
}
|
||||
mux_ptr->show();
|
||||
Serial.println("[LED] All cleared");
|
||||
}
|
||||
|
||||
void DefaultLedStub::set_led_brightness(uint8_t brightness) {
|
||||
@@ -162,18 +161,3 @@ void DefaultLedStub::set_led_brightness(uint8_t brightness) {
|
||||
mux_ptr->set_led_brightness(brightness);
|
||||
mux_ptr->show();
|
||||
}
|
||||
|
||||
void DefaultLedStub::clear_all() {
|
||||
if (!initialized || !mux_ptr) return;
|
||||
|
||||
for (int i = 0; i < NUM_LEDS; i++) {
|
||||
led_states[i].active = false;
|
||||
led_states[i].velocity = 0;
|
||||
led_states[i].note = 0;
|
||||
led_states[i].channel = 0;
|
||||
led_states[i].timestamp = 0;
|
||||
mux_ptr->set_led_color(i, 0, 0, 0);
|
||||
}
|
||||
mux_ptr->show();
|
||||
Serial.println("[LED] All cleared");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user