Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

This is just a simple wrapper - you probably want to be looking at LedEngine. More...

#include <LedMC.h>

Inheritance diagram for LedMC:

Detailed Description

This is just a simple wrapper - you probably want to be looking at LedEngine.

This is handy if all you want to do is control the LED's, but since other MotionCommands will probably also want to make use of the LEDs, they can just use the engine component to do all the work.

Definition at line 19 of file LedMC.h.

Public Member Functions

 LedMC ()
 constructor More...
 
virtual ~LedMC ()
 destructor More...
 
virtual void doStart ()
 Override this if you want to run some startup code after being added to the MotionManager. More...
 
void setDirty ()
 
virtual int updateOutputs ()
 updates the cmds from LedEngine::updateLEDs() More...
 
virtual int isDirty ()
 not used by MotionManager at the moment, but could be used to reduce recomputation, and you may find it useful More...
 
virtual int isAlive ()
 used to prune "dead" motions from the MotionManager More...
 
void setWeights (LEDBitMask_t leds, float weight)
 Sets the JointCmd::weight of the LEDs specified by leds to weight. More...
 
- Public Member Functions inherited from MotionCommand
 MotionCommand ()
 Constructor: Defaults to kStdPriority and autoprune==true. More...
 
virtual ~MotionCommand ()
 Destructor. More...
 
virtual void start ()
 called after this is added to MotionManager; don't override this, use doStart instead More...
 
virtual void stop ()
 called after this is removed from MotionManager; don't override this, use doStop instead More...
 
virtual bool isActive () const
 returns true if the MotionCommand is currently running (although it may be overridden by a higher priority MotionCommand) More...
 
virtual bool getAutoPrune ()
 
virtual void setAutoPrune (bool ap)
 
virtual bool shouldPrune ()
 whether this motion should be removed from its motion group automatically ( MotionCommand::autoprune && !isAlive()) More...
 
void setTranslator (EventTranslator *q)
 only called from MMCombo during process setup, allows MotionCommands to send events More...
 
- Public Member Functions inherited from MotionManagerMsg
 MotionManagerMsg ()
 constructor More...
 
virtual ~MotionManagerMsg ()
 virtual destructor More...
 
MC_ID getID () const
 Accessor for the id number, set by MotionManager::addMotion() More...
 
- Public Member Functions inherited from LedEngine
 LedEngine ()
 constructor - don't forget to call if you inherit More...
 
virtual ~LedEngine ()
 destructor More...
 
int updateLEDs (const MotionCommand *caller, LEDBitMask_t mask=AllLEDMask)
 call this from a MotionCommand's updateOutputs() - makes calls to MotionManager to update LED values More...
 
int updateLEDs (OutputCmd cmds[NumLEDs])
 call this from a MotionCommand's updateOutputs() - performs the calculations to update LEDs' values More...
 
int updateLEDFrames (OutputCmd cmds[NumLEDs][NumFrames])
 call this from a MotionCommand's updateOutputs() - performs the calculations to update LEDs' values More...
 
void recalcFlashEnd ()
 recalculates nextFlashEnd so we can tell when a flash has completed More...
 
int isDirty ()
 returns true if there are changes since the last updateLEDs() More...
 
void invert (LEDBitMask_t leds)
 sets the leds specified by leds to the inverse of their current value More...
 
void cset (LEDBitMask_t leds, float value)
 sets the leds specified by leds to value, clears all the rest More...
 
void set (LEDBitMask_t leds, float value)
 sets the leds specified by leds to value More...
 
void cflash (LEDBitMask_t leds, float value, unsigned int ms)
 sets the leds specified by leds to value for ms milliseconds, then sets back. Clears ~leds More...
 
void flash (LEDBitMask_t leds, float value, unsigned int ms)
 sets the leds specified by leds to value for ms milliseconds, then sets back. More...
 
void flash (LEDBitMask_t leds, unsigned int ms)
 sets the leds specified by leds to either a much higher or much lower value for ms milliseconds, then sets back. More...
 
void ccycle (LEDBitMask_t leds, unsigned int period, float amp, float offset=0, int phase=0)
 causes the leds specified by leds to cycle between low and high, clears others. See cycle() for parameter documentation. More...
 
void cycle (LEDBitMask_t leds, unsigned int period, float amp, float offset=0, int phase=0)
 causes the leds specified by leds to cycle between low and high; values calculated for cycle will be clipped to [0,1] for more sensible blending of square wave approximations (high amplitude sine wave) More...
 
void clear ()
 sets all leds to 0. More...
 
void extendFlash (unsigned int ms)
 adds ms to all flash times (may resurrect previously completed flashes) More...
 
float getSetting (LEDOffset_t led_id)
 returns the current setting of the LED specified by led_id (the value you passed in set()) More...
 
float getValue (LEDOffset_t led_id, unsigned int planahead=0)
 returns the current value of the LED specified by led_id (the value being expressed - may change if cycling for instance) More...
 
void displayNumber (int x, numStyle_t style)
 Allows convenient display of numerical information to the LEDs on the face. More...
 
void displayPercent (float x, percentStyle_t left_style, percentStyle_t right_style)
 Allows convenient display of percentage information to the LEDs on the face. More...
 

Protected Attributes

OutputCmd cmds [NumLEDs][NumFrames]
 needed to store weight values of LEDs (useful to mark LEDs as unused) More...
 
bool notified
 set to true when we've posted a status event for completion of a flash/cflash More...
 
- Protected Attributes inherited from MotionCommand
EventTranslatorqueue
 send events using this, instead of posting to the erouter More...
 
int autoprune
 default true, autoprune setting, if this is true and isAlive() returns false, MotionManager will attempt to remove the MC automatically More...
 
bool started
 true if the MotionCommand is currently running (although it may be overridden by a higher priority MotionCommand) More...
 
- Protected Attributes inherited from LedEngine
LEDInfo infos [NumLEDs]
 the information regarding each of the LEDs More...
 
bool dirty
 true if changes since last updateLEDs: either at least one LED is cycling or a flash has begun/ended More...
 
unsigned int numCycling
 the number of LEDs currently cycling (if non-zero, always dirty) More...
 
unsigned int nextFlashEnd
 the soonest time a flash will end (and we'll become dirty) More...
 

Additional Inherited Members

- Public Types inherited from MotionManagerMsg
typedef unsigned short MC_ID
 the type to use when referring to MotionCommand ID's More...
 
- Public Types inherited from LedEngine
enum  numStyle_t { onedigit, twodigit }
 Use these to specify a style for displaying numbers using displayNumber() More...
 
enum  percentStyle_t { major, minor, none }
 Use these to specify a style for displaying a percentage value [0-1] using displayPercent() More...
 
- Static Public Attributes inherited from MotionManagerMsg
static const MC_ID invalid_MC_ID =static_cast<MC_ID>(-1)
 for errors and undefined stuff More...
 
- Static Public Attributes inherited from LedEngine
static const LEDBitMask_t defaultCountNumMasks [11]
 
- Protected Member Functions inherited from MotionCommand
void postEvent (const EventBase &event)
 calls EventTranslator::trapEvent() directly (avoids needing erouter, which is a non-shared global, causes problems with context, grr, silly OS) More...
 
virtual void doStop ()
 Override this if you want to clean up after removal from MotionManager. More...
 
- Protected Member Functions inherited from LedEngine
float calcValue (unsigned int i, unsigned int t)
 Calculates the current value of led i for current time t. More...
 
void setOneOfTwo (unsigned int x, unsigned int low, unsigned int mid, unsigned int high)
 used by displayNumber() to determine settings of LEDs when using numStyle_t::twodigit More...
 
void setColumn (float x, unsigned int low, unsigned int mid, unsigned int high, unsigned int top)
 used by displayPercent() to determine settings of LEDs More...
 
- Static Protected Member Functions inherited from MotionCommand
static double interpolate (double a, double b, double x)
 this utility function will probably be of use to a lot of MotionCommand's More...
 
static float interpolate (float a, float b, float x)
 this utility function will probably be of use to a lot of MotionCommand's More...
 
static void interpolate (const OutputCmd &a, const OutputCmd &b, float x, OutputCmd &r)
 this utility function will probably be of use to a lot of MotionCommand's, see interpolate(double a,double b,double r) More...
 
- Static Protected Member Functions inherited from LedEngine
static float calcInvert (float value)
 Performs the 'invert' calculation based on current value (returns 1-value) More...
 
static float calcFlash (float value)
 Performs the 'flash' calculation based on current value (uses calcInvert() if value upper or lower third, 0 or 1 otherwise) More...
 
static float calcCycle (unsigned int period, float amp, float offset, unsigned int t)
 Performs the 'cycle' calculation based on desired period, amplituted, amplitude offset, and time since start. See cycle() More...
 

Constructor & Destructor Documentation

LedMC::LedMC ( )

constructor

Definition at line 22 of file LedMC.h.

virtual LedMC::~LedMC ( )
virtual

destructor

Definition at line 29 of file LedMC.h.

Member Function Documentation

virtual void LedMC::doStart ( )
virtual

Override this if you want to run some startup code after being added to the MotionManager.

Reimplemented from MotionCommand.

Definition at line 31 of file LedMC.h.

virtual int LedMC::isAlive ( )
virtual

used to prune "dead" motions from the MotionManager

note that a motion could be "paused" or inactive and therefore not dirty, but still alive, biding its time to "strike" ;)

Returns
zero if the motion is still processing, non-zero otherwise

Implements MotionCommand.

Definition at line 57 of file LedMC.h.

virtual int LedMC::isDirty ( )
virtual

not used by MotionManager at the moment, but could be used to reduce recomputation, and you may find it useful

Returns
zero if none of the commands have changed since last getJointCmd(), else non-zero

Implements MotionCommand.

Definition at line 55 of file LedMC.h.

void LedMC::setDirty ( )

Definition at line 36 of file LedMC.h.

void LedMC::setWeights ( LEDBitMask_t  leds,
float  weight 
)

Sets the JointCmd::weight of the LEDs specified by leds to weight.

Definition at line 61 of file LedMC.h.

Referenced by Controller::doStart(), LedActivate::LedActivate(), LedMC(), and LedActivate::stop().

virtual int LedMC::updateOutputs ( )
virtual

updates the cmds from LedEngine::updateLEDs()

Implements MotionCommand.

Definition at line 39 of file LedMC.h.

Member Data Documentation

OutputCmd LedMC::cmds[NumLEDs][NumFrames]
protected

needed to store weight values of LEDs (useful to mark LEDs as unused)

Definition at line 70 of file LedMC.h.

Referenced by setWeights(), and updateOutputs().

bool LedMC::notified
protected

set to true when we've posted a status event for completion of a flash/cflash

Definition at line 71 of file LedMC.h.

Referenced by updateOutputs().


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

Tekkotsu v5.1CVS
Generated Thu Jul 21 2016 22:26:11 by Doxygen 1.8.6