dmxusbpro

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

README

Enttec USB DMX Pro

Some Notes from the Enttec DMX USB Pro - API Document @v1.44

For latest version check their website

Examples

Write

Write DMX data using the serial device located at COM5.

go run ./example/write/main.go --name=COM5

Source

Note: If testing with a specific fixture, make sure to adapt the example

Read

Read DMX data using the serial device located at COM6.

go run ./example/read/main.go --name=COM6

Source

IN and OUT

DMX USB Pro has been designed to either receive or send a DMX stream at any one time, not both.

The DMX USB Pro’s input and output ports are physically connected to each other, therefore trying to recieve and send DMX streams would cause data degradation and flickering. Having the DMX IN and DMX OUT options it means that it can be integrated as part of a DMX chain when set to receive DMX data (in the same way you can daisy chain DMX in and out of a lighting fixture).

Source

Message-Format

Size in Bytes Description
1 Start of message delimiter, 0x7E.
1 Label to identify type of message. See Labels
1 Data length LSB. Valid range for data length is 0 to 600.
1 Data length MSB.
[data_length] Payload bytes (byte at index 1 contains channel 1. So byte 0 is unused)
1 End of message delimiter, 0x7E.

For implementation see here

Labels
Label # Title (in API description)
1 Reprogram Firmware Request
2 Program Flash Page (Request/Reply)
3 Get Widget Parameters (Request/Reply)
4 Set Widget Parameters Request
5 Received DMX Packet
6 Output Only Send DMX Packet Request
7 Send RDM Packet Request
8 Receive DMX on Change
9 Received DMX Change Of State Packet
10 Get Widget Serial Number (Request/Reply)
11 Send RDM Discovery Request

For implementation see here

Glossary

Term Explanation
LSB Least Significant Bit
MSB Most Significant Bit

Documentation

Index

Constants

View Source
const ENTTEC_DMX_USB_PRO_LOG_PREFIX = "EDUP"

Prefix for any log and error messages

Variables

This section is empty.

Functions

func Extract

func Extract(serialData []byte) (msgs []messages.EnttecDMXUSBProApplicationMessage, unUsedBytes []byte)

Detect valid Messages in an array of bytes.

Returns:

* found messages

* unUsedBytes (any bytes AFTER the last detected message that have not yet been used)

Types

type EnttecDMXUSBProController

type EnttecDMXUSBProController struct {
	// contains filtered or unexported fields
}

Controller for Enttec DMX USB Pro device to handle communication

func NewEnttecDMXUSBProController

func NewEnttecDMXUSBProController(conf *serial.Config, dmxChannelCount int, isWriter bool) *EnttecDMXUSBProController

Helper function for creating a new DMX USB PRO controller

func (*EnttecDMXUSBProController) ClearStage

func (d *EnttecDMXUSBProController) ClearStage()

Set all values of the staged channels to '0'

func (*EnttecDMXUSBProController) Commit

func (d *EnttecDMXUSBProController) Commit() error

Apply the 'staged' values to go live.

Note: This does not clear the Stage!

func (*EnttecDMXUSBProController) Connect

func (d *EnttecDMXUSBProController) Connect() error
Open the serial connection to Enttec DMX USB PRO Widget

Succeeded if no error is returned

func (*EnttecDMXUSBProController) Disconnect

func (d *EnttecDMXUSBProController) Disconnect() error
Close the serial connection to Enttec DMX USB PRO Widget

Succeeded if no error is returned

func (*EnttecDMXUSBProController) GetName

func (d *EnttecDMXUSBProController) GetName() string
Returns the name used for opening the connection

e.g. "COM4" or "/dev/tty.usbserial"

func (*EnttecDMXUSBProController) GetStage

func (d *EnttecDMXUSBProController) GetStage() []byte

Gets a copy of all staged channel values

func (*EnttecDMXUSBProController) OnDMXChange

func (d *EnttecDMXUSBProController) OnDMXChange(c chan messages.EnttecDMXUSBProApplicationMessage, readIntervalMS int)

Start routine to read from DMX and get the results back via channel

Example useage:

c := make(chan messages.EnttecDMXUSBProApplicationMessage) // create channel
go controller.OnDMXChange(c) // start routine
for msg := range c { ... } // handle incoming data

func (*EnttecDMXUSBProController) Read

func (d *EnttecDMXUSBProController) Read(buf []byte) (int, error)

Expose serial read to be used directly

func (*EnttecDMXUSBProController) SetLogVerbosity added in v0.4.0

func (d *EnttecDMXUSBProController) SetLogVerbosity(verbosity uint8)

Set log verbosity

0 = no logging

1 = message logging

2 = byte logging

func (*EnttecDMXUSBProController) Stage

func (d *EnttecDMXUSBProController) Stage(channel int16, value byte) error

Prepare a channel to be changed to the given value

Note: This does not send out the changes, you must call the 'Commit' method to apply the stage live.

func (*EnttecDMXUSBProController) SwitchReadMode

func (d *EnttecDMXUSBProController) SwitchReadMode(changesOnly byte) error

Change the receive mode of the widget.

Setting it to '0' will allow reading always and reads everything

Setting it to '1' will only read when the data changes and only reads the changeset (label=9)

func (*EnttecDMXUSBProController) Write

func (d *EnttecDMXUSBProController) Write(buf []byte) (int, error)

Expose serial write to be used directly

Directories

Path Synopsis
example
live-tests

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL