Documentation ¶
Index ¶
- Constants
- Variables
- func DrawPath(w io.WriteCloser, p ln.Path, c color.Color, drawSpeed float64)
- func FramePoints() int
- func NextFrame(w io.WriteCloser, pointsPlayed int, last Point) int
- func NumberOfSegments(p ln.Path, drawSpeed float64) float64
- func Osc(cur, max int, amplitude, frequency, offset float64) float64
- type BroadcastPacket
- type DAC
- func (d *DAC) Begin(lwm uint16, rate uint32) (*DACStatus, error)
- func (d *DAC) ClearEmergencyStop() (*DACStatus, error)
- func (d *DAC) Close()
- func (d *DAC) EmergencyStop() (*DACStatus, error)
- func (d *DAC) Measure(stream PointStream)
- func (d *DAC) Ping() (*DACStatus, error)
- func (d *DAC) Play(stream PointStream)
- func (d *DAC) Prepare() (*DACStatus, error)
- func (d *DAC) Read(l int) ([]byte, error)
- func (d *DAC) ReadResponse(cmd string) (*DACStatus, error)
- func (d DAC) Send(cmd []byte) error
- func (d DAC) ShouldPrepare() bool
- func (d *DAC) Stop() (*DACStatus, error)
- func (d *DAC) Update(lwm uint16, rate uint32) (*DACStatus, error)
- func (d *DAC) Write(b []byte) (*DACStatus, error)
- type DACStatus
- type Point
- type PointStream
- type Points
- type ProtocolError
Constants ¶
const BeginCmd = 0x62
BeginCmd starts playback
const ColorMax = 65535
ColorMax is the maximum color/intensity value
const PointSize uint16 = 18
PointSize is the number of bytes in a point struct
Variables ¶
var BlankColor = color.Black
BlankColor is a zeroed out color used for blanking segments
var BlankCount = flag.Int("blank-count", 20, "How many samples to wait after drawing a blanking line.")
BlankCount is the number of blank samples to insert after moving
var Debug = flag.Bool("debug", false, "Enable debug output.")
Debug mode
var DrawSpeed = flag.Float64("draw-speed", 50.0, "Draw speed (25-100). Lower is more precision but slower.")
DrawSpeed affects how many points will be sampled on your lines. Lower is more precise, but is more likely to flicker. Higher values will give smoother playback, but there may be gaps around corners. Try values 25-100.
var Dump = flag.Bool("dump", false, "Dump point stream to stdout.")
Dump will output the point stream coordinates
var ScanRate = flag.Int("scan-rate", 24000, "Number of points per second to play back.")
ScanRate controls the playback speed of the ether dream
Functions ¶
func DrawPath ¶
DrawPath will use linear interpolation to draw fn+1 points along the path (fn segments) qual will override the LineQuality (see above).
func FramePoints ¶
func FramePoints() int
FramePoints is the number of points in one frame - 24k / 30 = 800
func NextFrame ¶
func NextFrame(w io.WriteCloser, pointsPlayed int, last Point) int
NextFrame advances playback ... add some blank points
func NumberOfSegments ¶
NumberOfSegments to use when interpolating the path
Types ¶
type BroadcastPacket ¶
type BroadcastPacket struct { MAC []uint8 HWRev uint16 SWRev uint16 BufferCapacity uint16 MaxPointRate uint32 Status *DACStatus }
BroadcastPacket is the various capabilities advertised by the DAC
func FindFirstDAC ¶
func FindFirstDAC() (*net.UDPAddr, *BroadcastPacket, error)
FindFirstDAC starts a UDP server to listen for broadcast packets on your network. Return the UDPAddr of the first Ether Dream DAC located
func NewBroadcastPacket ¶
func NewBroadcastPacket(b [36]byte) *BroadcastPacket
NewBroadcastPacket is assembled from 36 bytes of data
func (BroadcastPacket) String ¶
func (bp BroadcastPacket) String() string
type DAC ¶
type DAC struct { Host string Port string FirmwareString string LastStatus *DACStatus Reader io.Reader Writer io.WriteCloser PointsPlayed int // contains filtered or unexported fields }
DAC is the interface to the Ether Dream Digital to Analog Converter that turns network signals into ILDA control singnals for a laser scanner.
func (*DAC) Begin ¶
Begin Playback This causes the DAC to begin producing output. lwm is currently unused. rate is the number of points per second to be read from the buffer. If the playback system was Prepared and there was data in the buffer, then the DAC will reply with ACK; otherwise, it replies with NAK - Invalid.
func (*DAC) ClearEmergencyStop ¶
ClearEmergencyStop command. If the light engine was in E-Stop state due to an emergency stop command (either from a local stop condition or over the network), then this command resets it to be Ready. It is ACKed if the DAC was previously in E-Stop; otherwise it is replied to with a NAK - Invalid. If the condition that caused the emergency stop is still active (E-Stop input still asserted, temperature still out of bounds, etc.), then a NAK - Stop Condition is sent.
func (*DAC) EmergencyStop ¶
EmergencyStop command causes the light engine to enter the E-Stop state, regardless of its previous state. It is always ACKed.
func (*DAC) Measure ¶
func (d *DAC) Measure(stream PointStream)
Measure how long it takes to play 10,000 points
func (*DAC) Play ¶
func (d *DAC) Play(stream PointStream)
Play a stream generator and begin sending output to the laser
func (*DAC) ReadResponse ¶
ReadResponse reads the ACK/NACK response to a command
func (DAC) ShouldPrepare ¶
ShouldPrepare or not? State 1 and 2 are good. Some Flags need prepare to reset an invalid state.
type DACStatus ¶
type DACStatus struct { Protocol uint8 LightEngineState uint8 PlaybackState uint8 Source uint8 LightEngineFlags uint16 PlaybackFlags uint16 SourceFlags uint16 BufferFullness uint16 PointRate uint32 PointCount uint32 }
DACStatus is a struct of status informaion sent by the etherdream DAC
func NewDACStatus ¶
type Point ¶
type Point struct { X int16 Y int16 R uint16 G uint16 B uint16 I uint16 U1 uint16 U2 uint16 Flags uint16 }
Point is a step in the laser stream, X, Y, RGB, Intensity and some other fields.
func BlankPath ¶
func BlankPath(w io.WriteCloser, p ln.Path) *Point
BlankPath will add the necessary pause to effectively blank a path
type PointStream ¶
type PointStream func(w io.WriteCloser)
PointStream is the interface clients should implement to generate points
type ProtocolError ¶
type ProtocolError struct {
Msg string
}
ProtocolError indicates a protocol level error. I've never seen one, but maybe you will.
func (*ProtocolError) Error ¶
func (e *ProtocolError) Error() string