Fix NUM_LEDS=10, NUM_BUTTONS=16 for 2 daisy-chained MUX boards. Fix pixel7 stuck blue (was only sending 8 LED data to 10-LED chain)
This commit is contained in:
+9
-9
@@ -35,7 +35,7 @@ void handle_serial_command(const String& cmd) {
|
||||
} else if (cmd == "probe" || cmd == "p") {
|
||||
mux.probe();
|
||||
} else if (cmd == "ledon") {
|
||||
for (int i = 0; i < 8; i++) {
|
||||
for (int i = 0; i < PixelStompMux::NUM_LEDS; i++) {
|
||||
mux.set_led_color(i, 255, 255, 255);
|
||||
}
|
||||
mux.show();
|
||||
@@ -48,7 +48,7 @@ void handle_serial_command(const String& cmd) {
|
||||
uint8_t r = (colors[c] >> 16) & 0xFF;
|
||||
uint8_t g = (colors[c] >> 8) & 0xFF;
|
||||
uint8_t b = colors[c] & 0xFF;
|
||||
for (int i = 0; i < 8; i++) {
|
||||
for (int i = 0; i < PixelStompMux::NUM_LEDS; i++) {
|
||||
mux.set_led_color(i, r, g, b);
|
||||
}
|
||||
mux.show();
|
||||
@@ -57,20 +57,20 @@ void handle_serial_command(const String& cmd) {
|
||||
mux.clear_all();
|
||||
Serial.println("[CMD] LED test complete");
|
||||
} else if (cmd == "read") {
|
||||
uint8_t raw = mux.read_buttons();
|
||||
Serial.printf("[CMD] Raw: 0x%02X (", raw);
|
||||
for (int i = 7; i >= 0; i--) {
|
||||
uint16_t raw = mux.read_buttons();
|
||||
Serial.printf("[CMD] Raw: 0x%04X (", raw);
|
||||
for (int i = 15; i >= 0; i--) {
|
||||
Serial.print((raw >> i) & 1);
|
||||
}
|
||||
Serial.println(")");
|
||||
} else if (cmd == "red") {
|
||||
for (int i = 0; i < 8; i++) mux.set_led_color(i, 255, 0, 0);
|
||||
for (int i = 0; i < PixelStompMux::NUM_LEDS; i++) mux.set_led_color(i, 255, 0, 0);
|
||||
mux.show();
|
||||
} else if (cmd == "green") {
|
||||
for (int i = 0; i < 8; i++) mux.set_led_color(i, 0, 255, 0);
|
||||
for (int i = 0; i < PixelStompMux::NUM_LEDS; i++) mux.set_led_color(i, 0, 255, 0);
|
||||
mux.show();
|
||||
} else if (cmd == "blue") {
|
||||
for (int i = 0; i < 8; i++) mux.set_led_color(i, 0, 0, 255);
|
||||
for (int i = 0; i < PixelStompMux::NUM_LEDS; i++) mux.set_led_color(i, 0, 0, 255);
|
||||
mux.show();
|
||||
} else if (cmd == "pixel0") {
|
||||
mux.set_led_brightness(255);
|
||||
@@ -133,7 +133,7 @@ void handle_serial_command(const String& cmd) {
|
||||
uint8_t g = (colors[c] >> 8) & 0xFF;
|
||||
uint8_t b = colors[c] & 0xFF;
|
||||
Serial.printf(" Colour %d: #%06X\n", c, colors[c]);
|
||||
for (int i = 0; i < 8; i++) mux.set_led_color(i, r, g, b);
|
||||
for (int i = 0; i < PixelStompMux::NUM_LEDS; i++) mux.set_led_color(i, r, g, b);
|
||||
mux.show();
|
||||
delay(500);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user