Documentation ¶
Index ¶
- Constants
- Variables
- type AckMessage
- type AggregatedData
- type Animation
- type Bin
- type Calibrate
- type CalibrationMessage
- type Config
- type Controller
- type DataMessage
- type Frame
- type GradientTable
- type GradientTrail
- type InfinityStripe
- type MultiTwinkle
- type Pixel
- type Point
- type RawCalibrationData
- type Streak
- type Streamer
Constants ¶
const ( SaturationMinChill = 0.2 SaturationMaxChill = 0.6 SaturationMinFun = 0.5 SaturationMaxFun = 1.0 SaturationMinWide = 0.0 SaturationMaxWide = 1.0 )
Variables ¶
var SaturationMax = SaturationMaxChill
var SaturationMin = SaturationMinChill
Functions ¶
This section is empty.
Types ¶
type AckMessage ¶
type AckMessage struct { CalibrationMessage AckID uint8 `json:"ackID"` }
AckMessage indicates that a frame has been displayed
type AggregatedData ¶
type AggregatedData struct {
Bins []*Bin `json:"bins"`
}
type Calibrate ¶
type Calibrate struct { C chan bool // contains filtered or unexported fields }
Calibrate finds the locations of LEDs in polar co-ordinates where the radius is the distance projected onto the cone-shaped tree from top to bottom
func NewCalibrate ¶
NewCalibrate creates an instance of a Calibrate struct
func (*Calibrate) CalculateFrame ¶
CalculateFrame gets the onscreen frame
type CalibrationMessage ¶
type CalibrationMessage struct {
Type string `json:"type"`
}
CalibrationMessage base that indicates message type
type Config ¶
type Config struct { Mqtt struct { URL string `yaml:"url"` Username string `yaml:"username"` Password string `yaml:"password"` Topics struct { Stream string `yaml:"stream"` Ack string `yaml:"ack"` CalibrateClient string `yaml:"calibrateClient"` CalibrateServer string `yaml:"calibrateServer"` } } `yaml:"mqtt"` }
Config for the application
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller that manages animations.
func NewController ¶
func NewController(runtimeMs int64, frameRate float64, animationTime time.Duration, calibrate *Calibrate) *Controller
NewController creates an instance of a Controller.
func (*Controller) CalculateFrame ¶
func (c *Controller) CalculateFrame(runtimeMs int64) *Frame
CalculateFrame calculates a frame using the current and next animation
func (*Controller) Run ¶
func (c *Controller) Run()
Run causes the Controller to cycle through animations.
func (*Controller) SprintColour ¶
func (c *Controller) SprintColour(colour colorful.Color) string
func (*Controller) SprintColours ¶
func (c *Controller) SprintColours(colours []colorful.Color) string
type DataMessage ¶
type DataMessage struct { CalibrationMessage Locations [][]float64 `json:"locations"` }
DataMessage conveying the locations of LEDs from the mobile app
type Frame ¶
type Frame struct {
// contains filtered or unexported fields
}
Frame represents a frame of RGB pixels to display on an ledrx device.
func (*Frame) InterpolateFrame ¶
InterpolateFrame merges two frames.
func (*Frame) MarshalBinary ¶
MarshalBinary converts a Frame into binary data.
type GradientTable ¶
GradientTable stores a look-up table of colours interpolated by hue.
func (GradientTable) GetColor ¶
func (g GradientTable) GetColor(t float64, l float64) colorful.Color
GetColor gets a colour at the specified point on the look-up table.
func (GradientTable) GetColorFixedSaturation ¶
func (g GradientTable) GetColorFixedSaturation(t float64, s float64, l float64) colorful.Color
GetColorFixedSaturation gets a colour at the specified point on the look-up table.
type GradientTrail ¶
type GradientTrail struct {
// contains filtered or unexported fields
}
A GradientTrail is an Animation that cycles a gradient along an led strip.
func NewGradientTrail ¶
func NewGradientTrail(gradient GradientTable, trailLength uint32, luminance float64, startTimeMs int64, pixelsPerMs float64) *GradientTrail
NewGradientTrail creates an instance of a GradientTrail object.
func (*GradientTrail) CalculateFrame ¶
func (g *GradientTrail) CalculateFrame(runtimeMs int64) *Frame
CalculateFrame creates a new Frame instance.
type InfinityStripe ¶
type InfinityStripe struct {
// contains filtered or unexported fields
}
A GradientTrail is an Animation that cycles a gradient along an led strip.
func NewInfinityStripe ¶
func NewInfinityStripe(startTimeMs int64, pixelsPerMs float64, stripeGenerator stripe.StripeGenerator) *InfinityStripe
NewInfinityStripe creates an instance of a InfinityStripe object.
func (*InfinityStripe) CalculateFrame ¶
func (s *InfinityStripe) CalculateFrame(runtimeMs int64) *Frame
CalculateFrame creates a new Frame instance.
type MultiTwinkle ¶
type MultiTwinkle struct {
// contains filtered or unexported fields
}
A MultiTwinkle is an Animation that twinkles random particles.
func NewMultiTwinkle ¶
func NewMultiTwinkle(scintillationChance int32, backColours []colorful.Color, lut []float64, runtimeMs int64) *MultiTwinkle
NewMultiTwinkle creates an instance of a Twinkle object.
func (*MultiTwinkle) CalculateFrame ¶
func (t *MultiTwinkle) CalculateFrame(runtimeMs int64) *Frame
CalculateFrame creates a new Frame instance.
type RawCalibrationData ¶
type Streak ¶
type Streak struct {
// contains filtered or unexported fields
}
A Streak is an Animation that creates streaks across the tree that fade in then out.
func (*Streak) CalculateFrame ¶
CalculateFrame creates a new Frame instance.
type Streamer ¶
type Streamer struct {
// contains filtered or unexported fields
}
Streamer that streams RGB data frames to an ledrx device.
func NewStreamer ¶
NewStreamer creates an instance of a Streamer.
func (*Streamer) Run ¶
func (s *Streamer) Run()
Run causes the Streamer to send Frames continuously.