feat: DMX gateway: Art-Net and serial out, fixtures and a pattern engine
Host gateway that takes led-controller-style commands and fans out DMX512 universes to Art-Net devices and serial ports. Fixtures are patched onto outputs and a led-driver-style pattern engine writes channel roles into them. Includes the vendored microdot/utemplate libs, tests and the README. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
072f95e041
commit
d2ffcb1969
30 files changed
+5490
-1
No files matched your search
+33
@@ -0,0 +1,33 @@
|
||||
# DMX512 UART TX. MicroPython (ESP32) and buffer-only on CPython.
|
||||
|
||||
try:
|
||||
from machine import UART, Pin
|
||||
except ImportError:
|
||||
UART = None
|
||||
Pin = None
|
||||
|
||||
|
||||
class DMX:
|
||||
"""One DMX512 universe. UART TX on MicroPython; frame-only on CPython."""
|
||||
|
||||
def __init__(self, uart=1, tx=0, de=None):
|
||||
self.frame = bytearray(513) # start code 0 + 512 slots
|
||||
self.uart = None
|
||||
self._de = None
|
||||
if UART is None:
|
||||
return
|
||||
self.uart = UART(uart, tx=tx)
|
||||
self.uart.init(250000, bits=8, parity=None, stop=2)
|
||||
if de is not None and Pin is not None:
|
||||
self._de = Pin(de, Pin.OUT)
|
||||
self._de.value(0)
|
||||
|
||||
def send(self):
|
||||
if self.uart is None:
|
||||
return
|
||||
if self._de is not None:
|
||||
self._de.value(1)
|
||||
self.uart.sendbreak()
|
||||
self.uart.write(self.frame)
|
||||
if self._de is not None:
|
||||
self._de.value(0)
|
||||
Reference in new issue
Block a user