| 49 | } |
| 50 | |
| 51 | void FastLEDAdapter::clear(bool writeToStrip) { |
| 52 | CLEDController& controller = FastLED[mControllerIndex]; |
| 53 | CRGB* leds = controller.leds(); |
| 54 | if (!leds) { |
| 55 | return; |
| 56 | } |
| 57 | |
| 58 | if (mHasSegment) { |
| 59 | // Clear only the segment |
| 60 | for (size_t i = mSegmentStart; i < mSegmentEnd; i++) { |
| 61 | leds[i] = CRGB::Black; |
| 62 | } |
| 63 | } else { |
| 64 | // Clear all LEDs |
| 65 | size_t numLeds = controller.size(); |
| 66 | for (size_t i = 0; i < numLeds; i++) { |
| 67 | leds[i] = CRGB::Black; |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | if (writeToStrip) { |
| 72 | FastLED.show(); |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | void FastLEDAdapter::setBrightness(u8 brightness) { |
| 77 | FastLED.setBrightness(brightness); |