Add rawled bit-bang command, restore FastLED

This commit is contained in:
2026-06-23 14:39:46 +00:00
parent 6c678ce18a
commit bec8025f0a
4 changed files with 46 additions and 21 deletions
+15 -17
View File
@@ -5,7 +5,6 @@
PixelStompMux::PixelStompMux(uint8_t dat, uint8_t ld, uint8_t clk, uint8_t di)
: pin_dat(dat), pin_ld(ld), pin_clk(clk), pin_di(di),
strip(NUM_LEDS, dat, NEO_GRB + NEO_KHZ800),
last_button_state(0) {
}
@@ -19,9 +18,10 @@ void PixelStompMux::begin() {
delay(100);
strip.begin();
strip.setBrightness(128);
strip.show();
FastLED.addLeds<WS2812, 9, GRB>(leds, NUM_LEDS);
FastLED.setBrightness(128);
fill_solid(leds, NUM_LEDS, CRGB::Black);
FastLED.show();
Serial.printf("[MUX] Init DAT=%d LD=%d CLK=%d DI=%d\n",
pin_dat, pin_ld, pin_clk, pin_di);
@@ -58,23 +58,21 @@ bool PixelStompMux::is_button_pressed(uint8_t index) {
void PixelStompMux::set_led_color(uint8_t index, uint8_t r, uint8_t g, uint8_t b) {
if (index >= NUM_LEDS) return;
strip.setPixelColor(index, r, g, b);
leds[index] = CRGB(r, g, b);
}
void PixelStompMux::set_led_brightness(uint8_t brightness) {
strip.setBrightness(brightness);
FastLED.setBrightness(brightness);
}
void PixelStompMux::clear_all() {
for (int i = 0; i < NUM_LEDS; i++) {
strip.setPixelColor(i, 0, 0, 0);
}
strip.show();
fill_solid(leds, NUM_LEDS, CRGB::Black);
FastLED.show();
Serial.println("[MUX] LEDs cleared");
}
void PixelStompMux::show() {
strip.show();
FastLED.show();
}
void PixelStompMux::dump() {
@@ -92,7 +90,7 @@ void PixelStompMux::dump() {
}
void PixelStompMux::probe() {
Serial.println("[MUX] === Hardware Probe (NeoPixel) ===");
Serial.println("[MUX] === Hardware Probe ===");
for (int round = 0; round < 5; round++) {
Serial.printf("--- Round %d ---\n", round);
@@ -123,12 +121,12 @@ void PixelStompMux::probe() {
}
Serial.println(" LED test: pixel 0 RED (max brightness)...");
strip.setBrightness(255);
strip.setPixelColor(0, 255, 0, 0);
strip.show();
leds[0] = CRGB(255, 0, 0);
FastLED.setBrightness(255);
FastLED.show();
delay(2000);
strip.setPixelColor(0, 0, 0, 0);
strip.show();
leds[0] = CRGB::Black;
FastLED.show();
Serial.println("[MUX] === Probe Complete ===");
}