RSeries astromech firmware
|
#include <dome/HoloLights.h>
Controls the movement and display functions of a single Holoprojector.
Controls the movement and display functions of a single Holoprojector, by default Holoprojectors are 7 LED Neopixel boards inside a HP to produce a life-like emulation of a hologram projection. Servo control is managed by a ServoDispatcher instance.
Example usage:
Public Types | |
enum | HoloID { kFrontHolo = 1, kRearHolo = 2, kTopHolo = 3, kRadarEye = 4, kOtherHolo = 5 } |
enum | HoloPosition { kDown, kCenter, kUp, kLeft, kUpperLeft, kLowerLeft, kRight, kUpperRight, kLowerRight, kNumPositions } |
enum | HoloColors { kOff = 0x000000, kRed = 0xFF0000, kOrange = 0xFF8000, kYellow = 0xFFFF00, kGreen = 0x00FF00, kCyan = 0x00FFFF, kBlue = 0x0000FF, kMagenta = 0xFF00FF, kPurple = 0x800080, kWhite = 0xFFFFFF } |
Public Member Functions | |
HoloLights (const int id=0) | |
Constructor. More... | |
void | begin () |
void | show () |
void | setBrightness (uint8_t b) |
uint8_t | getBrightness () |
uint16_t | numPixels () |
void | setPixelColor (uint16_t n, uint32_t c) |
virtual void | handleCommand (const char *cmd) override |
Command Prefix: HP. More... | |
virtual void | jawaCommand (char cmd, int arg, int value) override |
Subclasses should override this method to handle commands specifying a value. More... | |
virtual void | animate () override |
Runs through one frame of animation for this holoprojector instance. More... | |
virtual void | selectSequence (int sequence, int durationSec) |
Specify the sequence to animate. More... | |
void | assignServos (ServoDispatch *dispatcher, byte hServo, byte vServo) |
Assign ServoDispatcher and servos for horizontal and vertical movement. More... | |
int | getID () |
virtual void | setup () override |
Configures the NeoPixel ring and centers the holoprojector if servos have been assigned. More... | |
void | brighter () |
Increase the brightness of the holoprojector. More... | |
void | dimmer () |
Decrease the brightness of the holoprojector. More... | |
void | off () |
Turn of all LEDs. More... | |
void | setColor (int c) |
Set projector to a solid color. More... | |
void | resetLEDTwitch () |
void | resetHPTwitch () |
void | setHoloPosition (float hpos, float vpos, int speed=0) |
void | moveHP (byte pos, int speed=0) |
Move holoprojector to the specified position. More... | |
void | twitchHP (byte randtwitch) |
void | wagHP (byte type) |
void | setLEDTwitchInterval (unsigned minSeconds, unsigned maxSeconds) |
void | setLEDTwitchRunInterval (unsigned minSeconds, unsigned maxSeconds) |
void | setHPTwitchInterval (unsigned minSeconds, unsigned maxSeconds) |
void | dirty () |
Public Member Functions inherited from HoloLEDPCB< DATA_PIN, GRB, 7 > | |
HoloLEDPCB () | |
enum HoloLights::HoloColors |
enum HoloLights::HoloID |
enum HoloLights::HoloPosition |
|
inline |
Constructor.
|
inlineoverridevirtual |
Runs through one frame of animation for this holoprojector instance.
Implements AnimatedEvent.
Reimplemented in HoloOLED< DATA_PIN, RGB_ORDER, NUM_LEDS >, and HoloDisplay< DATA_PIN, RGB_ORDER, NUM_LEDS >.
|
inline |
Assign ServoDispatcher and servos for horizontal and vertical movement.
|
inline |
|
inline |
Increase the brightness of the holoprojector.
|
inline |
Decrease the brightness of the holoprojector.
|
inline |
|
inline |
|
inline |
|
inlineoverridevirtual |
Command Prefix: HP.
DT##C or DT##CS or DT##R or DT##P
D - the HP designator F - Front HP R - Rear HP T - Top HP D - Radar Eye O - Other HP A - All 3 HPs X - Front & Rear HPs Y - Front & Top HPs Z - Rear & Top HPs S - Sequences (See Below)
T - the Sequence Type is either 0-Led Fuctions and 1-Servo Functions
## - the Sequence Value including leading zero if necessary, ie sequence 3 is 03 C - (Optional), the Color integer value from list below: Basic Color Integer Values 1 = Red 2 = Yellow 3 = Green 4 = Cyan (Aqua) 5 = Blue 6 = Magenta 7 = Orange 8 = Purple 9 = White 0 = Random S - (Optional), Speed setting integer for the Dim Pulse LED function below (0-9) R - (Optional), Random State for clearing LED displays Random State Integer Values 1 = Use Default Sequences 2 = Use Random Sequences P - (Optional), the Position integer value from list below: Preset Position Integer Values 0 = Down 1 = Center 2 = Up 3 = Left 4 = Upper Left 5 = Lower Left 6 = Right 7 = Upper Right 8 = Lower Right D001 - Leia Sequence, Random shades of blue to mimic Leia Hologram D002C - Color Projector Sequence, Like Leia above but using color command value D003CS - Dim Pulse Sequence, Color slowly pulses on and off D004C - Cycle Sequence, using color command value D005C - Toggles Color, Simply sets LEDs tp solid color value D006 - Rainbow Sequence D007C - Short Circuit, Led flashes on and off with interval slowing over time D096 - Clears LED, Disables Auto LED Sequence & "Off Color" D0971 - Clears LED, Enables Auto LED Sequence,Enables Default Sequences, Disables "Off Color" D0972 - Clears LED, Enables Auto LED Sequence,Enables Random Sequences, Disables "Off Color" D098 - Clears LED, Disables Auto LED Sequence, enables "Off Color" D0991 - Clears LED, Enables Auto LED Sequence,Enables Default Sequences, Enables "Off Color" D0992 - Clears LED, Enables Auto LED Sequence,Enables Random Sequences, Enables "Off Color" D101P - Sends HP to a Preset Position D102 - Enables RC Control on HP (Left/Right) D103 - Enables RC Control on HP (Up/Down) D104 - Sends HP to a Random Position D105 - Wags HP Left/Right 5 times D106 - Wags HP Up/Down 5 times D198 - Disables Auto HP Twitch D199 - Enables Auto HP Twitch S1 - Leia Mode (Front HP in Down Position, Leia LED Sequence, all other HPs disabled)* S2 - Play R2 Cartoon [OLED] S3 - Play Deathstar Plans movie [OLED] S4 - Clear all LEDs, Disable Auto HP Twitch, Disable Auto LED Sequence, Disables Off Color S5 - Clear all LEDs, Enable Auto HP Twitch, Enable Auto LED Sequence (w/ default seqs.), Disables Off S9 - Clear all LEDs, Enable Auto HP Twitch, Enable Auto LED Sequence (w/ random seqs.), Disables Off Color S7 - Clear all LEDs, Disable Auto HP Twitch, Disable Auto LED Sequence, Enables Off Color S8 - Clear all LEDs, Enable Auto HP Twitch, Enable Auto LED Sequence (w/ default seqs.), Enables Off Color S9 - Clear all LEDs, Enable Auto HP Twitch, Enable Auto LED Sequence (w/ random seqs.), Enables Off Color
Runtime values can be added to any command string by appending a pipe (|) followed by a numeric value indicating the desired time in seconds you wish the sequence to run.
e.g. A007|25 would run the Rainbow Sequence on all 3 HPs for 25 seconds then clear each one, returning to the system's last known auto twitch mode.
Implements CommandEvent.
Reimplemented in HoloOLED< DATA_PIN, RGB_ORDER, NUM_LEDS >, and HoloDisplay< DATA_PIN, RGB_ORDER, NUM_LEDS >.
|
inlineoverridevirtual |
Subclasses should override this method to handle commands specifying a value.
Reimplemented from JawaEvent.
|
inline |
Move holoprojector to the specified position.
|
inline |
|
inline |
Turn of all LEDs.
|
inline |
|
inline |
|
inlinevirtual |
Specify the sequence to animate.
Reimplemented in HoloDisplay< DATA_PIN, RGB_ORDER, NUM_LEDS >.
|
inline |
|
inline |
Set projector to a solid color.
1 = Red 2 = Yellow 3 = Green 4 = Cyan (Aqua) 5 = Blue 6 = Magenta 7 = Orange 8 = Purple 9 = White 0 = Random
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineoverridevirtual |
Configures the NeoPixel ring and centers the holoprojector if servos have been assigned.
Implements SetupEvent.
Reimplemented in HoloOLED< DATA_PIN, RGB_ORDER, NUM_LEDS >, and HoloDisplay< DATA_PIN, RGB_ORDER, NUM_LEDS >.
|
inline |
|
inline |
|
inline |