SBK_BarDrive Library 2.0.4
Modular animation and control library for bar meter LEDs
Loading...
Searching...
No Matches
SBK_BarMeterAnimations< BarMeterT > Class Template Reference

Templated animation controller for SBK_BarMeter<T>. More...

#include <SBK_BarMeterAnimations.h>

Classes

struct  Block

Public Member Functions

 SBK_BarMeterAnimations (BarMeterT &barMeter)
 Construct an animation controller linked to a bar meter.
 ~SBK_BarMeterAnimations ()
 Destructor. Frees block memory if allocated.
void setSegsNum (uint8_t n)
 Set the total number of segments the animation logic should handle. Typically called automatically from SBK_BarDrive.
bool update (uint32_t syncTime=millis())
 Advance the animation logic based on the current millis().
SBK_BarMeterAnimationsanimInit ()
 Mark animation as ready to reinitialize in next update cycle.
SBK_BarMeterAnimationspause ()
 Pause animation progression.
SBK_BarMeterAnimationsresume ()
 Resume animation after pause.
SBK_BarMeterAnimationsstop ()
 Stop animation and reset internal pointers.
SBK_BarMeterAnimationsloop ()
 Set animation to automatically loop when complete.
SBK_BarMeterAnimationsnoLoop ()
 Disable auto-looping. Animation will stop when complete.
SBK_BarMeterAnimationssetDir (bool newDirection)
 Explicitly set the animation rendering direction.
SBK_BarMeterAnimationstoggleDir ()
 Toggle the current animation rendering direction.
SBK_BarMeterAnimationsreverseDir ()
 Reverse the rendering direction compared to the original one.
SBK_BarMeterAnimationsresetDir ()
 Reset direction to the original setting.
SBK_BarMeterAnimationssetLogic (bool newLogic)
 Set rendering logic (true = inverted logic, false = normal logic), example fill logic become empty logic. Logic refer to behavior, example : fill/empty, exploding/colliding, etc.
SBK_BarMeterAnimationstoggleLogic ()
 Toggle rendering logic (inverted vs normal), example fill logic become empty logic. Logic refer to behavior, example : fill/empty, exploding/colliding, etc. Some functions logic have no invertion, this function will have no effect on them.
SBK_BarMeterAnimationsinvertLogic ()
 Reverse logic compared to initial state Logic refer to behavior, example : fill/empty, exploding/colliding, etc. Some functions logic have no invertion, this function will have no effect on them.
SBK_BarMeterAnimationsresetLogic ()
 Reset logic to initial (default) value. Logic refer to behavior, example : fill/empty, exploding/colliding, etc. Some functions logic have no invertion, this function will have no effect on them.
SBK_BarMeterAnimationsstopBlockEmission ()
 Stop emitting new blocks during compatible block animations.
SBK_BarMeterAnimationsresumeBlockEmission ()
 Resume emitting new blocks during compatible block animations.
bool isRunning () const
 Query if animation is currently active.
bool isPaused () const
 Query if animation is paused.
bool isLoopEnabled () const
 Query if animation loop is enabled.
bool animPendingLoop ()
 Detect whether animation has completed and is about to loop.
bool isLogicInverted ()
 Returns true if current logic is different from original logic.
bool isNonInvertingLogicAnim ()
 Returns true if the current animation hasen't a logic invertion aka logic can't be inverted.
bool isDirectionReversed ()
 Returns true if direction is reversed compared to the original.
bool isBlockEmissionEnabled () const
 Query if block emission is enabled.
SBK_BarMeterAnimationssetAll (bool onff)
 Set all pixels to the specified state.
SBK_BarMeterAnimationssetAllOn ()
 Set all pixels ON.
SBK_BarMeterAnimationssetAllOff ()
 Set all pixels OFF.
SBK_BarMeterAnimationsfillUpDur (uint16_t duration, uint8_t maxPercent=100, uint8_t minPercent=0)
 Start animation that fills the bar upwards over a specified duration.
SBK_BarMeterAnimationsfillUpIntv (uint16_t updateIntv, const uint8_t *maxPercentPtr, const uint8_t *minPercentPtr=nullptr)
 Start animation that fills the bar upwards at a fixed interval with live percent tracking.
SBK_BarMeterAnimationsfillUpIntv (uint16_t updateIntv, uint8_t maxPercent=100, uint8_t minPercent=0)
 Start animation that fills the bar upwards at a fixed interval.
SBK_BarMeterAnimationsfillDownDur (uint16_t duration, uint8_t maxPercent=100, uint8_t minPercent=0)
 Start animation that fills the bar downwards over a specified duration.
SBK_BarMeterAnimationsfillDownIntv (uint16_t updateIntv, const uint8_t *maxPercentPtr, const uint8_t *minPercentPtr=nullptr)
 Start animation that fills the bar downwards at a fixed interval with live percent tracking.
SBK_BarMeterAnimationsfillDownIntv (uint16_t updateIntv, uint8_t maxPercent=100, uint8_t minPercent=0)
 Start animation that fills the bar downwards at a fixed interval.
SBK_BarMeterAnimationsemptyDownDur (uint16_t duration, uint8_t maxPercent=100, uint8_t minPercent=0)
 Start animation that empties the bar from top to bottom over a duration.
SBK_BarMeterAnimationsemptyDownIntv (uint16_t updateIntv, const uint8_t *maxPercentPtr, const uint8_t *minPercentPtr=nullptr)
 Start animation that empties the bar from top to bottom at fixed intervals with live range.
SBK_BarMeterAnimationsemptyDownIntv (uint16_t updateIntv, uint8_t maxPercent=100, uint8_t minPercent=0)
 Start animation that empties the bar from top to bottom at fixed intervals.
SBK_BarMeterAnimationsemptyUpDur (uint16_t duration, uint8_t maxPercent=100, uint8_t minPercent=0)
 Start animation that empties the bar from bottom to top over a duration.
SBK_BarMeterAnimationsemptyUpIntv (uint16_t updateIntv, const uint8_t *maxPercentPtr, const uint8_t *minPercentPtr=nullptr)
 Start animation that empties the bar from bottom to top at fixed intervals with live range.
SBK_BarMeterAnimationsemptyUpIntv (uint16_t updateIntv, uint8_t maxPercent=100, uint8_t minPercent=0)
 Start animation that empties the bar from bottom to top at fixed intervals.
SBK_BarMeterAnimationsbounceFillUpDur (uint16_t duration, uint8_t maxPercent=100, uint8_t minPercent=0, uint16_t fillIntv=0)
 Start animation that fills/empties (bounces) bar upward with fixed range.
SBK_BarMeterAnimationsbounceFillUpIntv (uint16_t fillIntv, uint16_t emptyIntv, const uint8_t *maxPercentPtr, const uint8_t *minPercentPtr=nullptr)
 Start animation that fills/empties (bounces) bar upward with live range.
SBK_BarMeterAnimationsbounceFillUpIntv (uint16_t fillIntv=10, uint16_t emptyIntv=10, uint8_t maxPercent=100, uint8_t minPercent=0)
 Start animation that fills/empties (bounces) bar upward with fixed range.
SBK_BarMeterAnimationsbounceFillDownDur (uint16_t duration, uint8_t maxPercent=100, uint8_t minPercent=0, uint16_t fillIntv=0)
 Start animation that fills/empties (bounces) bar downward.
SBK_BarMeterAnimationsbounceFillDownIntv (uint16_t fillIntv, uint16_t emptyIntv, const uint8_t *maxPercentPtr, const uint8_t *minPercentPtr=nullptr)
 Start downward fill/empty (bounce) with live percent range tracking.
SBK_BarMeterAnimationsbounceFillDownIntv (uint16_t fillIntv=10, uint16_t emptyIntv=10, uint8_t maxPercent=100, uint8_t minPercent=0)
 Start downwardfill/empty (bounce) with fixed percent range.
SBK_BarMeterAnimationsbounceFillFromCenterDur (uint16_t duration, uint8_t maxPercent=100, uint8_t minPercent=0, uint16_t fillIntv=0)
 Bounce fill from center outward with fixed range.
SBK_BarMeterAnimationsbounceFillFromCenterIntv (uint16_t fillIntv, uint16_t emptyIntv, const uint8_t *maxPercentPtr, const uint8_t *minPercentPtr=nullptr)
 Bounce fill from center outward with live percent range tracking.
SBK_BarMeterAnimationsbounceFillFromCenterIntv (uint16_t fillIntv=25, uint16_t emptyIntv=25, uint8_t maxPercent=100, uint8_t minPercent=0)
 Bounce fill from center outward with fixed range.
SBK_BarMeterAnimationsbounceFillFromEdgesDur (uint16_t duration, uint8_t maxPercent=100, uint8_t minPercent=0, uint16_t fillIntv=0)
 Bounce fill from both edges inward with fixed range.
SBK_BarMeterAnimationsbounceFillFromEdgesIntv (uint16_t fillIntv, uint16_t emptyIntv, const uint8_t *maxPercentPtr, const uint8_t *minPercentPtr=nullptr)
 Bounce fill from both edges inward with live percent range tracking..
SBK_BarMeterAnimationsbounceFillFromEdgesIntv (uint16_t fillIntv=25, uint16_t emptyIntv=25, uint8_t maxPercent=100, uint8_t minPercent=0)
 Bounce fill from both edges inward with fix range.
SBK_BarMeterAnimationsbeatPulse (uint8_t *bpmPtr)
 Start a beat pulse animation synchronized to a live BPM value.
SBK_BarMeterAnimationsbeatPulse (uint8_t bpm=116)
 Start a beat pulse animation synchronized to a constant BPM.
SBK_BarMeterAnimationsexplodingBlocks (uint16_t intv=50, uint8_t blockLength=2, uint8_t blockSpacing=1, uint8_t numBlocks=0)
 Emit mirrored blocks from center outward.
SBK_BarMeterAnimationscollidingBlocks (uint16_t intv=50, uint8_t blockLength=2, uint8_t blockSpacing=1, uint8_t numBlocks=0)
 Emit mirrored blocks from edge to center.
SBK_BarMeterAnimationsscrollingUpBlocks (uint16_t intv=50, uint8_t blockLength=2, uint8_t blockSpacing=1, uint8_t numBlocks=0)
 Scroll blocks upward.
SBK_BarMeterAnimationsscrollingDownBlocks (uint16_t intv=50, uint8_t blockLength=2, uint8_t blockSpacing=1, uint8_t numBlocks=0)
 Scroll blocks downward.
SBK_BarMeterAnimationsdownStackingBlocks (uint16_t intv=50, uint8_t blockLength=1, uint8_t blockSpacing=0)
 Drop blocks from top and stack from bottom up.
SBK_BarMeterAnimationsupUnstackingBlocks (uint16_t intv=50, uint8_t blockLength=1, uint8_t blockSpacing=0)
 Launch blocks upward and unstack from top.
SBK_BarMeterAnimationsupStackingBlocks (uint16_t intv=50, uint8_t blockLength=1, uint8_t blockSpacing=0)
 Launch blocks from bottom and stack at the top.
SBK_BarMeterAnimationsdownUnstackingBlocks (uint16_t intv=50, uint8_t blockLength=1, uint8_t blockSpacing=0)
 Drop blocks from top and unstack from bottom up.
SBK_BarMeterAnimationsfollowSignalSmooth (const uint16_t *sigPtr, uint16_t updateIntv=100, uint16_t minMap=0, uint16_t maxMap=1023, uint8_t smoothingFactor=30, uint16_t samplingIntv=5)
 Follow analog signal with smoothing for fill animation.
SBK_BarMeterAnimationsfollowSignalWithPointer (const uint16_t *sigPtr, uint16_t updateIntv=100, uint16_t minMap=0, uint16_t maxMap=1023, uint8_t smoothingFactor=30, uint16_t samplingIntv=5)
 Follow signal with smoothing and display a pointer.
SBK_BarMeterAnimationsfollowDualSignalFromCenter (const uint16_t *sig1Ptr, uint16_t updateIntv=100, const uint16_t *sig2Ptr=nullptr, uint16_t minMap=0, uint16_t maxMap=1023, uint8_t smoothingFactor=30, uint16_t samplingIntv=5)
 Smoothly fills the lower half and upper half of the bar meter independently from center, based on two signal levels.
SBK_BarMeterAnimationsfollowDualSignalFromEdges (const uint16_t *sig1Ptr, uint16_t updateIntv=100, const uint16_t *sig2Ptr=nullptr, uint16_t minMap=0, uint16_t maxMap=1023, uint8_t smoothingFactor=30, uint16_t samplingIntv=5)
 Smoothly fills the lower half and upper half of the bar meter independently from center, based on two signal levels.
SBK_BarMeterAnimationsfollowSignalFloatingPeak (const uint16_t *sigPtr, uint8_t peakHoldTime=20, uint16_t updateIntv=100, uint16_t minMap=0, uint16_t maxMap=1023, uint8_t smoothingFactor=30, uint16_t samplingIntv=5)
 Follow an analog signal with smoothing and floating peak indicator.
SBK_BarMeterAnimationsrandomFill (uint16_t interval=30)
 Randomly light up pixels until the bar is full.
SBK_BarMeterAnimationsrandomEmpty (uint16_t interval=30)
 Randomly turn off pixels until the bar is empty.

Protected Types

using AnimUpdateFn = bool (SBK_BarMeterAnimations::*)()

Protected Member Functions

void _mapMinMaxTrackerFromPtr (uint16_t *minPercPtr, uint16_t *maxPercPtr, int8_t minR, uint8_t maxR)
void _mapMinMaxTracker (uint8_t minP, uint8_t maxP, uint8_t minR, uint8_t maxR)
uint8_t _corrPixelToDir (uint8_t pixel)
uint8_t _corrPixelToDirForHalfRange (uint8_t pixel)
bool _setAllOn ()
bool _setAllOff ()
bool _fillOrEmpty ()
bool _bounceFill ()
bool _fillFromOrEmptyToCenter ()
bool _bounceFillHalfRangeMirrorCenter ()
bool _beatPulse ()
void _emitBlock (int8_t pos)
int8_t _calculateSwitchedEmitTickCounter (uint8_t range)
bool _mirrorBlocks ()
bool _scrollingBlocks ()
bool _stackingBlocks ()
bool _followSignalSmooth ()
bool _followSignalWithPointer ()
bool _followDualSignalCenterMirror ()
bool _followSignalFloatingPeak ()
bool _randomPixelUpdater ()

Static Protected Member Functions

static void _normalizePercentRange (uint8_t &minP, uint8_t &maxP)
static void _correctSwapOrEqualMinMax (uint16_t &minVal, uint16_t &maxVal)
static uint8_t _getMappedSignal (uint16_t sig, uint16_t minM, uint16_t maxM, uint8_t minR, uint8_t maxR)
static int8_t _calculateSwtichPostion (int8_t pos, uint8_t bockL, uint8_t range)

Protected Attributes

BarMeterT & _barMeter
uint8_t _segsNum = 0
AnimUpdateFn _currentFunc = nullptr
bool _init = true
bool _isRunning = false
bool _isPaused = false
bool _loop = false
bool _isLoopingNow = false
bool _AnimInitLogicIsInverted = false
bool _animRenderLogicIsInverted = false
bool _prevAnimRenderLogic = false
bool _isNonInvertingLogicAnim = false
bool _mirrorHalfRangeDir = false
bool _animLogicSet = false
bool _skipPending = false
bool _animRenderDirIsReversed = false
bool _AnimInitDirIsReversed = false
bool _animDirSet = false
bool _usePtr = false
bool _emittingBlocksEnabled = true
uint32_t _currentTime = 0
uint32_t _lastUpdate1 = 0
uint32_t _lastUpdate2 = 0
uint32_t _lastUpdate3 = 0
uint16_t _updateIntv1 = 10
uint16_t _updateIntv2 = 10
uint16_t _updateIntv3 = 10
uint8_t _sequenceState = 0
int8_t _ledTracker1 = 0
int8_t _ledTracker2 = 0
int8_t _ledTracker3 = 0
int8_t _minTracker = 0
int8_t _maxTracker = 1
uint8_t _param1 = 0
uint8_t _param2 = 0
uint8_t _param3 = 0
uint8_t _param4 = 0
uint8_t _param5 = 0
uint16_t _smoothedValue1 = 0
uint16_t _smoothedValue2 = 0
uint16_t _minMap = 0
uint16_t _maxMap = 1023
uint8_t _counter1 = 0
uint8_t _counter2 = 0
const uint16_t * _sigPtr1 = nullptr
const uint16_t * _sigPtr2 = nullptr
Block_blocks = nullptr

Detailed Description

template<typename BarMeterT>
class SBK_BarMeterAnimations< BarMeterT >

Templated animation controller for SBK_BarMeter<T>.

This class encapsulates timing logic, block emission, bouncing effects, signal smoothing, and beat-based animations for bar meters. Chainable API makes integration in update loops easy.

Template Parameters
BarMeterTA specific SBK_BarMeter<DriverT> instance

Constructor & Destructor Documentation

◆ SBK_BarMeterAnimations()

template<typename BarMeterT>
SBK_BarMeterAnimations< BarMeterT >::SBK_BarMeterAnimations ( BarMeterT & barMeter)
inlineexplicit

Construct an animation controller linked to a bar meter.

Parameters
barMeterReference to the associated SBK_BarMeter instance.

Member Function Documentation

◆ beatPulse() [1/2]

template<typename BarMeterT>
SBK_BarMeterAnimations & SBK_BarMeterAnimations< BarMeterT >::beatPulse ( uint8_t * bpmPtr)
inline

Start a beat pulse animation synchronized to a live BPM value.

Parameters
bpmPtrPointer to a variable holding the BPM value.
Returns
Reference to this animation instance.

◆ beatPulse() [2/2]

template<typename BarMeterT>
SBK_BarMeterAnimations & SBK_BarMeterAnimations< BarMeterT >::beatPulse ( uint8_t bpm = 116)
inline

Start a beat pulse animation synchronized to a constant BPM.

Parameters
bpmBeats per minute. Default is 116.
Returns
Reference to this animation instance.

◆ bounceFillDownDur()

template<typename BarMeterT>
SBK_BarMeterAnimations & SBK_BarMeterAnimations< BarMeterT >::bounceFillDownDur ( uint16_t duration,
uint8_t maxPercent = 100,
uint8_t minPercent = 0,
uint16_t fillIntv = 0 )
inline

Start animation that fills/empties (bounces) bar downward.

Parameters
durationTotal time in milliseconds for full bounce cycle.
maxPercentMaximum fill percentage fill range. Default is 100.
minPercentMinimum fill percentage fill range. Default is 0.
fillIntvOptional interval override for the fill phase. Default is 0 (auto).
Returns
Reference to this animation instance.

◆ bounceFillDownIntv() [1/2]

template<typename BarMeterT>
SBK_BarMeterAnimations & SBK_BarMeterAnimations< BarMeterT >::bounceFillDownIntv ( uint16_t fillIntv,
uint16_t emptyIntv,
const uint8_t * maxPercentPtr,
const uint8_t * minPercentPtr = nullptr )
inline

Start downward fill/empty (bounce) with live percent range tracking.

Parameters
fillIntvFill interval in ms.
emptyIntvEmpty interval in ms.
maxPercentPtrPointer to max percent fill range.
minPercentPtrPointer to min percent fill range. Default is nullptr.
Returns
Reference to this animation instance.

◆ bounceFillDownIntv() [2/2]

template<typename BarMeterT>
SBK_BarMeterAnimations & SBK_BarMeterAnimations< BarMeterT >::bounceFillDownIntv ( uint16_t fillIntv = 10,
uint16_t emptyIntv = 10,
uint8_t maxPercent = 100,
uint8_t minPercent = 0 )
inline

Start downwardfill/empty (bounce) with fixed percent range.

Parameters
fillIntvFill interval in ms. Default is 10.
emptyIntvEmpty interval in ms. Default is 10.
maxPercentMaximum fill percent. Default is 100.
minPercentMinimum fill percent. Default is 0.
Returns
Reference to this animation instance.

◆ bounceFillFromCenterDur()

template<typename BarMeterT>
SBK_BarMeterAnimations & SBK_BarMeterAnimations< BarMeterT >::bounceFillFromCenterDur ( uint16_t duration,
uint8_t maxPercent = 100,
uint8_t minPercent = 0,
uint16_t fillIntv = 0 )
inline

Bounce fill from center outward with fixed range.

Parameters
durationTotal time in milliseconds for full bounce cycle.
maxPercentMaximum fill percentage fill range. Default is 100.
minPercentMinimum fill percentage fill range. Default is 0.
fillIntvOptional interval override for the fill phase. Default is 0 (auto).
Returns
Reference to this animation instance.

◆ bounceFillFromCenterIntv() [1/2]

template<typename BarMeterT>
SBK_BarMeterAnimations & SBK_BarMeterAnimations< BarMeterT >::bounceFillFromCenterIntv ( uint16_t fillIntv,
uint16_t emptyIntv,
const uint8_t * maxPercentPtr,
const uint8_t * minPercentPtr = nullptr )
inline

Bounce fill from center outward with live percent range tracking.

Parameters
fillIntvFill interval in ms.
emptyIntvEmpty interval in ms.
maxPercentPtrPointer to max percent fill range.
minPercentPtrPointer to min percent fill range. Default is nullptr.
Returns
Reference to this animation instance.

◆ bounceFillFromCenterIntv() [2/2]

template<typename BarMeterT>
SBK_BarMeterAnimations & SBK_BarMeterAnimations< BarMeterT >::bounceFillFromCenterIntv ( uint16_t fillIntv = 25,
uint16_t emptyIntv = 25,
uint8_t maxPercent = 100,
uint8_t minPercent = 0 )
inline

Bounce fill from center outward with fixed range.

Parameters
fillIntvFill interval in ms. Default is 25.
emptyIntvEmpty interval in ms. Default is 25.
maxPercentMaximum range percent to animate. Default is 100.
minPercentMinimum range percent to animate. Default is 0.
Returns
Reference to this animation instance.

◆ bounceFillFromEdgesDur()

template<typename BarMeterT>
SBK_BarMeterAnimations & SBK_BarMeterAnimations< BarMeterT >::bounceFillFromEdgesDur ( uint16_t duration,
uint8_t maxPercent = 100,
uint8_t minPercent = 0,
uint16_t fillIntv = 0 )
inline

Bounce fill from both edges inward with fixed range.

Parameters
durationTotal time in milliseconds for full bounce cycle.
maxPercentMaximum fill percentage fill range. Default is 100.
minPercentMinimum fill percentage fill range. Default is 0.
fillIntvOptional interval override for the fill phase. Default is 0 (auto).
Returns
Reference to this animation instance.

◆ bounceFillFromEdgesIntv() [1/2]

template<typename BarMeterT>
SBK_BarMeterAnimations & SBK_BarMeterAnimations< BarMeterT >::bounceFillFromEdgesIntv ( uint16_t fillIntv,
uint16_t emptyIntv,
const uint8_t * maxPercentPtr,
const uint8_t * minPercentPtr = nullptr )
inline

Bounce fill from both edges inward with live percent range tracking..

Parameters
fillIntvFill interval in ms.
emptyIntvEmpty interval in ms.
maxPercentPtrPointer to max percent fill range.
minPercentPtrPointer to min percent fill range. Default is nullptr.
Returns
Reference to this animation instance.

◆ bounceFillFromEdgesIntv() [2/2]

template<typename BarMeterT>
SBK_BarMeterAnimations & SBK_BarMeterAnimations< BarMeterT >::bounceFillFromEdgesIntv ( uint16_t fillIntv = 25,
uint16_t emptyIntv = 25,
uint8_t maxPercent = 100,
uint8_t minPercent = 0 )
inline

Bounce fill from both edges inward with fix range.

Parameters
fillIntvFill interval in ms. Default is 25.
emptyIntvEmpty interval in ms. Default is 25.
maxPercentMaximum range percent to animate. Default is 100.
minPercentMinimum range percent to animate. Default is 0.
Returns
Reference to this animation instance.

◆ bounceFillUpDur()

template<typename BarMeterT>
SBK_BarMeterAnimations & SBK_BarMeterAnimations< BarMeterT >::bounceFillUpDur ( uint16_t duration,
uint8_t maxPercent = 100,
uint8_t minPercent = 0,
uint16_t fillIntv = 0 )
inline

Start animation that fills/empties (bounces) bar upward with fixed range.

Parameters
durationTotal time in milliseconds for full bounce cycle.
maxPercentMaximum fill percentage (0–100). Default is 100.
minPercentMinimum fill percentage (0–100). Default is 0.
fillIntvOptional fixed interval for the fill phase. Default is 0 (auto).
Returns
Reference to this animation instance.

◆ bounceFillUpIntv() [1/2]

template<typename BarMeterT>
SBK_BarMeterAnimations & SBK_BarMeterAnimations< BarMeterT >::bounceFillUpIntv ( uint16_t fillIntv,
uint16_t emptyIntv,
const uint8_t * maxPercentPtr,
const uint8_t * minPercentPtr = nullptr )
inline

Start animation that fills/empties (bounces) bar upward with live range.

Parameters
fillIntvFill interval in ms.
emptyIntvEmpty interval in ms.
maxPercentPtrPointer to maximum percentage fill range value.
minPercentPtrPointer to minimum percentage fill range value (optional). Default is nullptr.
Returns
Reference to this animation instance.

◆ bounceFillUpIntv() [2/2]

template<typename BarMeterT>
SBK_BarMeterAnimations & SBK_BarMeterAnimations< BarMeterT >::bounceFillUpIntv ( uint16_t fillIntv = 10,
uint16_t emptyIntv = 10,
uint8_t maxPercent = 100,
uint8_t minPercent = 0 )
inline

Start animation that fills/empties (bounces) bar upward with fixed range.

Parameters
fillIntvFill interval in ms. Default is 10.
emptyIntvEmpty interval in ms. Default is 10.
maxPercentMax fill percent fill range. Default is 100.
minPercentMin fill percent fill range. Default is 0.
Returns
Reference to this animation instance.

◆ collidingBlocks()

template<typename BarMeterT>
SBK_BarMeterAnimations & SBK_BarMeterAnimations< BarMeterT >::collidingBlocks ( uint16_t intv = 50,
uint8_t blockLength = 2,
uint8_t blockSpacing = 1,
uint8_t numBlocks = 0 )
inline

Emit mirrored blocks from edge to center.

Parameters
intvStep interval in milliseconds. Default is 50.
blockLengthNumber of pixels per block. Default is 2.
blockSpacingSpace between blocks. Default is 1.
numBlocksNumber of blocks to emit (0 = infinite). Default is 0.
Returns
Reference to this animation instance.

◆ downStackingBlocks()

template<typename BarMeterT>
SBK_BarMeterAnimations & SBK_BarMeterAnimations< BarMeterT >::downStackingBlocks ( uint16_t intv = 50,
uint8_t blockLength = 1,
uint8_t blockSpacing = 0 )
inline

Drop blocks from top and stack from bottom up.

Parameters
intvUpdate interval in milliseconds. Default is 50.
blockLengthNumber of segments per block. Default is 1.
blockSpacingSpace between blocks. Default is 0.
Returns
Reference to this animation instance.

◆ downUnstackingBlocks()

template<typename BarMeterT>
SBK_BarMeterAnimations & SBK_BarMeterAnimations< BarMeterT >::downUnstackingBlocks ( uint16_t intv = 50,
uint8_t blockLength = 1,
uint8_t blockSpacing = 0 )
inline

Drop blocks from top and unstack from bottom up.

Parameters
intvUpdate interval in milliseconds. Default is 50.
blockLengthNumber of segments per block. Default is 1.
blockSpacingSpace between blocks. Default is 0.
Returns
Reference to this animation instance.

◆ emptyDownDur()

template<typename BarMeterT>
SBK_BarMeterAnimations & SBK_BarMeterAnimations< BarMeterT >::emptyDownDur ( uint16_t duration,
uint8_t maxPercent = 100,
uint8_t minPercent = 0 )
inline

Start animation that empties the bar from top to bottom over a duration.

Parameters
durationTotal time in milliseconds.
maxPercentTop of the max fill range (0–100). Default is 100.
minPercentBottom of the min fill range (0–100). Default is 0.
Returns
Reference to this animation instance.

◆ emptyDownIntv() [1/2]

template<typename BarMeterT>
SBK_BarMeterAnimations & SBK_BarMeterAnimations< BarMeterT >::emptyDownIntv ( uint16_t updateIntv,
const uint8_t * maxPercentPtr,
const uint8_t * minPercentPtr = nullptr )
inline

Start animation that empties the bar from top to bottom at fixed intervals with live range.

Parameters
updateIntvTime between updates in milliseconds.
maxPercentPtrPointer to maximum fill range percent value (0–100).
minPercentPtrOptional pointer to minimum fill range percent value (0–100). Default is nullptr.
Returns
Reference to this animation instance.

◆ emptyDownIntv() [2/2]

template<typename BarMeterT>
SBK_BarMeterAnimations & SBK_BarMeterAnimations< BarMeterT >::emptyDownIntv ( uint16_t updateIntv,
uint8_t maxPercent = 100,
uint8_t minPercent = 0 )
inline

Start animation that empties the bar from top to bottom at fixed intervals.

Parameters
updateIntvTime between updates in milliseconds.
maxPercentTop of the max fill range (0–100). Default is 100.
minPercentBottom of the min fill range (0–100). Default is 0.
Returns
Reference to this animation instance.

◆ emptyUpDur()

template<typename BarMeterT>
SBK_BarMeterAnimations & SBK_BarMeterAnimations< BarMeterT >::emptyUpDur ( uint16_t duration,
uint8_t maxPercent = 100,
uint8_t minPercent = 0 )
inline

Start animation that empties the bar from bottom to top over a duration.

Parameters
updateIntvTime between updates in milliseconds.
maxPercentPtrPointer to top max fill range percent value.
minPercentPtrPointer to bottom min fill range percent value (optional). Default is nullptr.
Returns
Reference to this animation instance.

◆ emptyUpIntv() [1/2]

template<typename BarMeterT>
SBK_BarMeterAnimations & SBK_BarMeterAnimations< BarMeterT >::emptyUpIntv ( uint16_t updateIntv,
const uint8_t * maxPercentPtr,
const uint8_t * minPercentPtr = nullptr )
inline

Start animation that empties the bar from bottom to top at fixed intervals with live range.

Parameters
updateIntvTime between updates in milliseconds.
maxPercentPtrPointer to top max fill range percent value.
minPercentPtrPointer to bottom min fill range percent value (optional). Default is nullptr.
Returns
Reference to this animation instance.

◆ emptyUpIntv() [2/2]

template<typename BarMeterT>
SBK_BarMeterAnimations & SBK_BarMeterAnimations< BarMeterT >::emptyUpIntv ( uint16_t updateIntv,
uint8_t maxPercent = 100,
uint8_t minPercent = 0 )
inline

Start animation that empties the bar from bottom to top at fixed intervals.

Parameters
updateIntvTime between updates in milliseconds.
maxPercentTop of the max fill range (0–100). Default is 100.
minPercentBottom of the min fill range (0–100). Default is 0.
Returns
Reference to this animation instance.

◆ explodingBlocks()

template<typename BarMeterT>
SBK_BarMeterAnimations & SBK_BarMeterAnimations< BarMeterT >::explodingBlocks ( uint16_t intv = 50,
uint8_t blockLength = 2,
uint8_t blockSpacing = 1,
uint8_t numBlocks = 0 )
inline

Emit mirrored blocks from center outward.

Parameters
intvStep interval in milliseconds. Default is 50.
blockLengthNumber of pixels per block. Default is 2.
blockSpacingSpace between blocks. Default is 1.
numBlocksNumber of blocks to emit (0 = infinite). Default is 0.
Returns
Reference to this animation instance.

◆ fillDownDur()

template<typename BarMeterT>
SBK_BarMeterAnimations & SBK_BarMeterAnimations< BarMeterT >::fillDownDur ( uint16_t duration,
uint8_t maxPercent = 100,
uint8_t minPercent = 0 )
inline

Start animation that fills the bar downwards over a specified duration.

Parameters
durationTotal time in milliseconds.
maxPercentTop of the max fill range (0–100). Default is 100.
minPercentBottom of the min fill range (0–100). Default is 0.
Returns
Reference to this animation instance.

◆ fillDownIntv() [1/2]

template<typename BarMeterT>
SBK_BarMeterAnimations & SBK_BarMeterAnimations< BarMeterT >::fillDownIntv ( uint16_t updateIntv,
const uint8_t * maxPercentPtr,
const uint8_t * minPercentPtr = nullptr )
inline

Start animation that fills the bar downwards at a fixed interval with live percent tracking.

Parameters
updateIntvTime between updates in milliseconds.
maxPercentPtrPointer to maximum fill range percent value (0–100).
minPercentPtrOptional pointer to minimum fill range percent value (0–100). Default is nullptr.
Returns
Reference to this animation instance.

◆ fillDownIntv() [2/2]

template<typename BarMeterT>
SBK_BarMeterAnimations & SBK_BarMeterAnimations< BarMeterT >::fillDownIntv ( uint16_t updateIntv,
uint8_t maxPercent = 100,
uint8_t minPercent = 0 )
inline

Start animation that fills the bar downwards at a fixed interval.

Parameters
updateIntvTime between updates in milliseconds.
maxPercentTop of the max fill range (0–100). Default is 100.
minPercentBottom of the min fill range (0–100). Default is 0.
Returns
Reference to this animation instance.

◆ fillUpDur()

template<typename BarMeterT>
SBK_BarMeterAnimations & SBK_BarMeterAnimations< BarMeterT >::fillUpDur ( uint16_t duration,
uint8_t maxPercent = 100,
uint8_t minPercent = 0 )
inline

Start animation that fills the bar upwards over a specified duration.

Parameters
durationTotal time in milliseconds.
maxPercentTop of the max fill range (0–100). Default is 100.
minPercentBottom of the min fill range (0–100). Default is 0.
Returns
Reference to this animation instance.

◆ fillUpIntv() [1/2]

template<typename BarMeterT>
SBK_BarMeterAnimations & SBK_BarMeterAnimations< BarMeterT >::fillUpIntv ( uint16_t updateIntv,
const uint8_t * maxPercentPtr,
const uint8_t * minPercentPtr = nullptr )
inline

Start animation that fills the bar upwards at a fixed interval with live percent tracking.

Parameters
updateIntvTime between updates in milliseconds.
maxPercentPtrPointer to maximum fill range percent value (0–100).
minPercentPtrOptional pointer to minimum fill range percent value (0–100). Default is nullptr.
Returns
Reference to this animation instance.

◆ fillUpIntv() [2/2]

template<typename BarMeterT>
SBK_BarMeterAnimations & SBK_BarMeterAnimations< BarMeterT >::fillUpIntv ( uint16_t updateIntv,
uint8_t maxPercent = 100,
uint8_t minPercent = 0 )
inline

Start animation that fills the bar upwards at a fixed interval.

Parameters
updateIntvTime between updates in milliseconds.
maxPercentTop of the max fill range (0–100). Default is 100.
minPercentBottom of the min fill range (0–100). Default is 0.
Returns
Reference to this animation instance.

◆ followDualSignalFromCenter()

template<typename BarMeterT>
SBK_BarMeterAnimations & SBK_BarMeterAnimations< BarMeterT >::followDualSignalFromCenter ( const uint16_t * sig1Ptr,
uint16_t updateIntv = 100,
const uint16_t * sig2Ptr = nullptr,
uint16_t minMap = 0,
uint16_t maxMap = 1023,
uint8_t smoothingFactor = 30,
uint16_t samplingIntv = 5 )
inline

Smoothly fills the lower half and upper half of the bar meter independently from center, based on two signal levels.

Parameters
sigPtr1Pointer to analog signal1 for bottom half (center to bottom)
updateIntvUpdate interval in milliseconds. Default is 100.
sig2PtrPointer to signal2 for top half (center to top). Default nullptr, signal 1 will be mirrored.
minMapMinimum raw value to map. Default 0.
maxMapMaximum raw value to map. Default 1023.
smoothingFactorSmoothing strength 0–100. Default is 30.
samplingIntvsignal sampling rate. Default is 5.
Returns
Reference to this animation instance (chainable).

◆ followDualSignalFromEdges()

template<typename BarMeterT>
SBK_BarMeterAnimations & SBK_BarMeterAnimations< BarMeterT >::followDualSignalFromEdges ( const uint16_t * sig1Ptr,
uint16_t updateIntv = 100,
const uint16_t * sig2Ptr = nullptr,
uint16_t minMap = 0,
uint16_t maxMap = 1023,
uint8_t smoothingFactor = 30,
uint16_t samplingIntv = 5 )
inline

Smoothly fills the lower half and upper half of the bar meter independently from center, based on two signal levels.

Parameters
sigPtr1Pointer to analog signal1 for bottom half (bottom edge to center)
updateIntvUpdate interval in milliseconds. Default is 100.
sig2PtrPointer to signal2 for top half (top edge to center). Default nullptr, signal 1 will be mirrored.
updateIntvUpdate interval in milliseconds.
sig1PtrPointer to signal level for bottom half (center to bottom).
sig2PtrPointer to signal level for top half (center to top). Default nullptr.
minMapMinimum raw value to map. Default 0.
maxMapMaximum raw value to map. Default 1023.
smoothingFactorSmoothing strength 0–100. Default is 30.
samplingIntvsignal sampling rate. Default is 5.
Returns
Reference to this animation instance (chainable).

◆ followSignalFloatingPeak()

template<typename BarMeterT>
SBK_BarMeterAnimations & SBK_BarMeterAnimations< BarMeterT >::followSignalFloatingPeak ( const uint16_t * sigPtr,
uint8_t peakHoldTime = 20,
uint16_t updateIntv = 100,
uint16_t minMap = 0,
uint16_t maxMap = 1023,
uint8_t smoothingFactor = 30,
uint16_t samplingIntv = 5 )
inline

Follow an analog signal with smoothing and floating peak indicator.

This animation fills the bar based on a smoothed analog input value and displays a peak marker that holds momentarily before decaying.

Parameters
sigPtrPointer to the analog signal value (e.g., from analogRead()).
peakHoldTimeDuration (in ms) to hold the peak before it begins to decay.
updateIntvBar update interval in milliseconds. Default is 100 ms.
minMapMinimum expected raw signal value. Default is 0.
maxMapMaximum expected raw signal value. Default is 1023.
smoothingFactorSignal smoothing strength (0–100). Higher = smoother. Default is 30.
samplingIntvSignal sampling interval in milliseconds. Default is 5 ms.
Returns
Reference to this animation instance (chainable).

◆ followSignalSmooth()

template<typename BarMeterT>
SBK_BarMeterAnimations & SBK_BarMeterAnimations< BarMeterT >::followSignalSmooth ( const uint16_t * sigPtr,
uint16_t updateIntv = 100,
uint16_t minMap = 0,
uint16_t maxMap = 1023,
uint8_t smoothingFactor = 30,
uint16_t samplingIntv = 5 )
inline

Follow analog signal with smoothing for fill animation.

Parameters
sigPtrPointer to analog signal.
updateIntvUpdate interval in milliseconds. Default is 100.
minMapMinimum input value. Default is 0.
maxMapMaximum input value. Default is 1023.
smoothingFactorSmoothing strength 0–100. Default is 30.
samplingIntvsignal sampling rate. Default is 5.
Returns
Reference to this animation instance (chainable).

◆ followSignalWithPointer()

template<typename BarMeterT>
SBK_BarMeterAnimations & SBK_BarMeterAnimations< BarMeterT >::followSignalWithPointer ( const uint16_t * sigPtr,
uint16_t updateIntv = 100,
uint16_t minMap = 0,
uint16_t maxMap = 1023,
uint8_t smoothingFactor = 30,
uint16_t samplingIntv = 5 )
inline

Follow signal with smoothing and display a pointer.

Parameters
sigPtrPointer to analog signal.
updateIntvUpdate interval in milliseconds. Default is 100.
minMapMinimum input value. Default is 0.
maxMapMaximum input value. Default is 1023.
smoothingFactorSmoothing strength 0–100. Default is 30.
samplingIntvsignal sampling rate. Default is 5.
Returns
Reference to this animation instance (chainable).

◆ randomEmpty()

template<typename BarMeterT>
SBK_BarMeterAnimations & SBK_BarMeterAnimations< BarMeterT >::randomEmpty ( uint16_t interval = 30)
inline

Randomly turn off pixels until the bar is empty.

Parameters
intervalUpdate interval in milliseconds. Default is 30.
Returns
Reference to this animation instance.

◆ randomFill()

template<typename BarMeterT>
SBK_BarMeterAnimations & SBK_BarMeterAnimations< BarMeterT >::randomFill ( uint16_t interval = 30)
inline

Randomly light up pixels until the bar is full.

Parameters
intervalUpdate interval in milliseconds. Default is 30.
Returns
Reference to this animation instance.

◆ scrollingDownBlocks()

template<typename BarMeterT>
SBK_BarMeterAnimations & SBK_BarMeterAnimations< BarMeterT >::scrollingDownBlocks ( uint16_t intv = 50,
uint8_t blockLength = 2,
uint8_t blockSpacing = 1,
uint8_t numBlocks = 0 )
inline

Scroll blocks downward.

Parameters
intvUpdate interval in ms. Default is 50.
blockLengthBlock length in segments. Default is 2.
blockSpacingSpace between blocks. Default is 1.
numBlocksNumber of blocks to show. 0 = infinite. Default is 0.
Returns
Reference to this animation instance.

◆ scrollingUpBlocks()

template<typename BarMeterT>
SBK_BarMeterAnimations & SBK_BarMeterAnimations< BarMeterT >::scrollingUpBlocks ( uint16_t intv = 50,
uint8_t blockLength = 2,
uint8_t blockSpacing = 1,
uint8_t numBlocks = 0 )
inline

Scroll blocks upward.

Parameters
intvUpdate interval in ms. Default is 50.
blockLengthBlock length in segments. Default is 2.
blockSpacingSpace between blocks. Default is 1.
numBlocksNumber of blocks to show. 0 = infinite. Default is 0.
Returns
Reference to this animation instance.

◆ setAll()

template<typename BarMeterT>
SBK_BarMeterAnimations & SBK_BarMeterAnimations< BarMeterT >::setAll ( bool onff)
inline

Set all pixels to the specified state.

Parameters
onoffPixels desired state true = ON, false = off.

◆ setSegsNum()

template<typename BarMeterT>
void SBK_BarMeterAnimations< BarMeterT >::setSegsNum ( uint8_t n)
inline

Set the total number of segments the animation logic should handle. Typically called automatically from SBK_BarDrive.

Parameters
nNumber of segments in the bar.

◆ update()

template<typename BarMeterT>
bool SBK_BarMeterAnimations< BarMeterT >::update ( uint32_t syncTime = millis())
inline

Advance the animation logic based on the current millis().

Parameters
syncTimeOptional timestamp to synchronize animation.
Returns
true if animation is still running; false otherwise.

◆ upStackingBlocks()

template<typename BarMeterT>
SBK_BarMeterAnimations & SBK_BarMeterAnimations< BarMeterT >::upStackingBlocks ( uint16_t intv = 50,
uint8_t blockLength = 1,
uint8_t blockSpacing = 0 )
inline

Launch blocks from bottom and stack at the top.

Parameters
intvUpdate interval in milliseconds. Default is 50.
blockLengthNumber of segments per block. Default is 1.
blockSpacingSpace between blocks. Default is 0.
Returns
Reference to this animation instance.

◆ upUnstackingBlocks()

template<typename BarMeterT>
SBK_BarMeterAnimations & SBK_BarMeterAnimations< BarMeterT >::upUnstackingBlocks ( uint16_t intv = 50,
uint8_t blockLength = 1,
uint8_t blockSpacing = 0 )
inline

Launch blocks upward and unstack from top.

Parameters
intvUpdate interval in milliseconds. Default is 50.
blockLengthNumber of segments per block. Default is 1.
blockSpacingSpace between blocks. Default is 0.
Returns
Reference to this animation instance.

The documentation for this class was generated from the following file: