| 104 | } |
| 105 | |
| 106 | void FastLEDAdapter::setSegment(size_t start, size_t end) { |
| 107 | CLEDController& controller = FastLED[mControllerIndex]; |
| 108 | size_t numLeds = controller.size(); |
| 109 | |
| 110 | // Validate bounds |
| 111 | if (start >= numLeds) { |
| 112 | start = numLeds > 0 ? numLeds - 1 : 0; |
| 113 | } |
| 114 | if (end > numLeds) { |
| 115 | end = numLeds; |
| 116 | } |
| 117 | if (end <= start) { |
| 118 | end = start + 1; |
| 119 | if (end > numLeds) { |
| 120 | end = numLeds; |
| 121 | start = end > 0 ? end - 1 : 0; |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | mSegmentStart = start; |
| 126 | mSegmentEnd = end; |
| 127 | mHasSegment = true; |
| 128 | } |
| 129 | |
| 130 | void FastLEDAdapter::clearSegment() { |
| 131 | CLEDController& controller = FastLED[mControllerIndex]; |