|
FastLED 3.9.15
|
WLED Client for controlling LEDs through FastLED interface.
Provides a simplified interface for controlling LEDs with WLED-style operations (brightness, on/off, clear). Uses dependency injection to allow both real FastLED control and mock implementations for testing.
Example usage: // Real usage auto controller = createFastLEDController(leds, NUM_LEDS); WLEDClient client(controller); client.setBrightness(128); client.setOn(true);
// Test usage auto mock = fl::make_shared<MockFastLEDController>(100); WLEDClient client(mock); client.setBrightness(128); REQUIRE(mock->getLastBrightness() == 128);
#include <client.h>
Collaboration diagram for fl::WLEDClient:Public Member Functions | |
| WLEDClient (fl::shared_ptr< IFastLED > controller) | |
| Construct WLEDClient with FastLED controller. | |
| void | clear (bool writeToStrip=false) |
| Clear all LEDs. | |
| void | clearSegment () |
| Clear the segment range (operate on full LED array) | |
| u8 | getBrightness () const |
| Get current brightness level. | |
| fl::span< CRGB > | getLEDs () |
| Get access to LED array. | |
| u16 | getMaxRefreshRate () const |
| Get maximum refresh rate. | |
| size_t | getNumLEDs () const |
| Get number of LEDs. | |
| bool | getOn () const |
| Get on/off state. | |
| void | setBrightness (u8 brightness) |
| Set brightness level. | |
| void | setCorrection (CRGB correction) |
| Set color correction. | |
| void | setMaxRefreshRate (u16 fps) |
| Set maximum refresh rate. | |
| void | setOn (bool on) |
| Set on/off state. | |
| void | setSegment (size_t start, size_t end) |
| Set a segment range for subsequent operations. | |
| void | setTemperature (CRGB temperature) |
| Set color temperature. | |
| void | update () |
| Update physical LED strip. | |
Private Attributes | |
| u8 | mBrightness |
| fl::shared_ptr< IFastLED > | mController |
| bool | mOn |