From ef3c8d9a2c52c13c8c00b46257f80f8b06cfc1f6 Mon Sep 17 00:00:00 2001 From: Stefan Bethke Date: Mon, 23 Dec 2024 10:40:23 -0500 Subject: [PATCH] Add Entec RGBW --- dmx.py | 15 ++++++++++++--- foobaz.py | 6 ++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/dmx.py b/dmx.py index 453d116..e01d8f4 100644 --- a/dmx.py +++ b/dmx.py @@ -21,9 +21,13 @@ class RGB: def rgb(self, color): (r, g, b) = color - self.dmx.set(self.slot + self.offset + 0, ledlog(r)) - self.dmx.set(self.slot + self.offset + 1, ledlog(g)) - self.dmx.set(self.slot + self.offset + 2, ledlog(b)) + try: + self.dmx.set(self.slot + self.offset + 0, ledlog(r)) + self.dmx.set(self.slot + self.offset + 1, ledlog(g)) + self.dmx.set(self.slot + self.offset + 2, ledlog(b)) + except Exception as e: + print(f'slot={self.slot}, offset={self.offset}') + raise(e) class Bar252(RGB): @@ -57,6 +61,11 @@ class ZhennbyPar(RGB): dmx.set(self.slot + 6, 0) +class Entec6RGBW(RGB): + def __init__(self, dmx, slot=1): + super(Entec6RGBW, self).__init__(dmx, slot) + + class DMX: def __init__(self, host, port=0x1936, universe=1, maxchan=512): self._host = host diff --git a/foobaz.py b/foobaz.py index 7e0812b..b1b5d01 100644 --- a/foobaz.py +++ b/foobaz.py @@ -7,7 +7,7 @@ from typing import Tuple from bottle import post, request, route, run, static_file, view from animation import Off -from dmx import DMX, Bar252, StairvilleLedPar56, REDSpot18RGB, ZhennbyPar +from dmx import DMX, Bar252, StairvilleLedPar56, REDSpot18RGB, ZhennbyPar, Entec6RGBW room = '' @@ -56,7 +56,7 @@ def main(args): args = parser.parse_args(args) print(f"Starting DMX via Art-Net to {args.artnet}", file=sys.stderr) - dmx = DMX(args.artnet, maxchan=128, universe=args.universe) + dmx = DMX(args.artnet, maxchan=512, universe=args.universe) if args.room == "shop": dmx._rgbs = [ @@ -83,6 +83,8 @@ def main(args): ZhennbyPar(dmx, 15), ZhennbyPar(dmx, 22), ] + elif args.room == "defrag": + dmx._rgbs = [Entec6RGBW(dmx, 300 + i*4) for i in range(19)] else: print(f"Unknown room {args.room}", file=sys.stderr) sys.exit(64)