FastFX  1.1.0
LED Strip Animation and Effects Framework for Arduino
FFXController Class Reference

#include <FFXController.h>

Public Types

enum  FXEventType {
  FX_STARTED, FX_STOPPED, FX_OVERLAY_STARTED, FX_OVERLAY_STOPPED,
  FX_OVERLAY_COMPLETED, FX_OVERLAY_UPDATED, FX_PAUSED, FX_RESUMED,
  FX_BRIGHTNESS_CHANGED, FX_LOCAL_BRIGHTNESS_ENABLED, FX_OPACITY_CHANGED, FX_PARAM_CHANGE,
  FX_LOG
}
 

Public Member Functions

 FFXController (FFXPixelController *initPC)
 
 FFXController ()
 
 ~FFXController ()
 
void initialize (FFXPixelController *initPC)
 
virtual void onFXEvent (const String &segment, FXEventType event, const String &name)
 
virtual void onFXStateChange (FFXSegment *segment)
 
void setFX (FFXBase *newFX)
 
FFXBasegetFX ()
 
FFXSegmentaddSegment (String initTag, uint16_t initStartIdx, uint16_t initEndIdx, FFXBase *initEffect)
 
FFXSegmentaddSegment (String initTag, uint16_t initStartIdx, uint16_t initEndIdx)
 
FFXSegmentfindSegment (String &tag)
 
FFXSegmentgetPrimarySegment ()
 
FFXPixelControllergetStripController ()
 
unsigned long getUpdateMillis ()
 
void setOverlayFX (FFXOverlay *newFX)
 
FFXOverlaygetOverlayFX ()
 
String getFXName ()
 
uint8_t getBrightness ()
 
void setBrightness (uint8_t newBrightness)
 
void show ()
 
void update ()
 

Public Attributes

unsigned long long showCount = 0
 

Protected Attributes

FFXPixelControllerledController = nullptr
 
CRGB * liveLeds = nullptr
 
uint16_t numLeds
 

Detailed Description

FFXController - Primary class used for displaying/running effects/colors/etc. Initialize with a PixelController like: new FXController( new FFXFastLEDPixelController( ledBufferPtr, numberOfLEDs ) );

Effects/Colors are placed into FFXSegments which are managed by the FXController. Every controller has a "Primary" segment, which represents the entire strip/array. This segment is always present and does not need to be created manually.

Additional (secondary) segments are added "on top" of the primary segment by calling AddSegment(...). Each of these
segments can have its own effect running and has independent opacity/transparency and brightness. Each secondary segment is referenced by a unique "Tag" or Name, which is used to address and manipulate the segment.

Displaying and changing effects (Primary Segment)

FFXBase *FX = new RainbowFX( numberOfLEDs, updateInterval );

Displaying and changing effects (Additional Segments)

FFXController->AddSegment( "Left", 0, 25, null )
FFXSegment *seg = FXController->findSegment("Left");
if (seg) {
seg->setFX( new RainbowFX(seg->getLength()));
set->setOpacity(255);
}

** This will show the rotating rainbow effect on pixels 0-25 and the remainder of the strip will continue to show the primary effect.

inside main processing loop:

Each FFXSegment automatically supports cross-fading by using an independent FFXFrameProvider. The Frame Provider does this by allocating extra buffers and using cycles between refreshes to fade from one frame to the next. Turn this on and off using

or

FFXController->findSegment("name")->getFrameProvider()->setFade( boolean )

Overlay FX are effects that can be displayed over the top of existing/running effects (the entire array), such as flashes, pulses, etc. These are also cross-faded and blended with the underlying FX as desired. Both the overlay and the underlying effect are cross-faded and continue to animate while displaying. These are done as follows:

OFX = new PulseOveralyFX( numberOfLEDs, speed );
OFX.getFXColor().setPalette( myPal );

Note that FFXController() automatically deletes the overlay FX, when it is complete so it MUST be created using - new OverlayFX(...); See FFXOverlay.h for more info.

Member Enumeration Documentation

◆ FXEventType

Enumerator
FX_STARTED 
FX_STOPPED 
FX_OVERLAY_STARTED 
FX_OVERLAY_STOPPED 
FX_OVERLAY_COMPLETED 
FX_OVERLAY_UPDATED 
FX_PAUSED 
FX_RESUMED 
FX_BRIGHTNESS_CHANGED 
FX_LOCAL_BRIGHTNESS_ENABLED 
FX_OPACITY_CHANGED 
FX_PARAM_CHANGE 
FX_LOG 

Constructor & Destructor Documentation

◆ FFXController() [1/2]

FFXController::FFXController ( FFXPixelController initPC)

◆ FFXController() [2/2]

FFXController::FFXController ( )

◆ ~FFXController()

FFXController::~FFXController ( )
inline

Member Function Documentation

◆ addSegment() [1/2]

FFXSegment* FFXController::addSegment ( String  initTag,
uint16_t  initStartIdx,
uint16_t  initEndIdx 
)
inline

◆ addSegment() [2/2]

FFXSegment * FFXController::addSegment ( String  initTag,
uint16_t  initStartIdx,
uint16_t  initEndIdx,
FFXBase initEffect 
)

◆ findSegment()

FFXSegment * FFXController::findSegment ( String &  tag)

◆ getBrightness()

uint8_t FFXController::getBrightness ( )
inline

◆ getFX()

FFXBase* FFXController::getFX ( )
inline

◆ getFXName()

String FFXController::getFXName ( )
inline

◆ getOverlayFX()

FFXOverlay* FFXController::getOverlayFX ( )
inline

◆ getPrimarySegment()

FFXSegment* FFXController::getPrimarySegment ( )
inline

◆ getStripController()

FFXPixelController* FFXController::getStripController ( )
inline

◆ getUpdateMillis()

unsigned long FFXController::getUpdateMillis ( )
inline

◆ initialize()

void FFXController::initialize ( FFXPixelController initPC)

◆ onFXEvent()

virtual void FFXController::onFXEvent ( const String &  segment,
FXEventType  event,
const String &  name 
)
inlinevirtual

◆ onFXStateChange()

virtual void FFXController::onFXStateChange ( FFXSegment segment)
inlinevirtual

◆ setBrightness()

void FFXController::setBrightness ( uint8_t  newBrightness)
inline

◆ setFX()

void FFXController::setFX ( FFXBase newFX)

◆ setOverlayFX()

void FFXController::setOverlayFX ( FFXOverlay newFX)

◆ show()

void FFXController::show ( )

◆ update()

void FFXController::update ( )

Member Data Documentation

◆ ledController

FFXPixelController* FFXController::ledController = nullptr
protected

◆ liveLeds

CRGB* FFXController::liveLeds = nullptr
protected

◆ numLeds

uint16_t FFXController::numLeds
protected

◆ showCount

unsigned long long FFXController::showCount = 0