Be more graceful if DMX isn't available

This commit is contained in:
2025-08-22 22:08:52 +01:00
parent a2408b4dbe
commit ee089b4614
3 changed files with 16 additions and 7 deletions

1
dmx.py
View File

@@ -189,6 +189,7 @@ class FixtureOutput:
def tick(self, dt):
for fixture in self._fixtures:
fixture.tick(dt)
if self._dmx is not None:
self._dmx.submit()

View File

@@ -48,6 +48,8 @@ class MakeSet:
class MakeFixtureTypes:
def __new__(cls, config):
if config is None:
config = []
def parse_range(src):
(a, b) = src.split('-')
@@ -77,6 +79,8 @@ class MakeFixtureTypes:
class MakeFixtures:
def __new__(cls, config, fixture_types):
fixtures = {}
if config is None:
config = []
for fixture in config:
dmxch = config[fixture]['dmx']
type = config[fixture]['type']
@@ -88,6 +92,8 @@ class MakeFixtures:
class MakeGroups:
def __new__(cls, config, fixtures):
groups = {}
if config is None:
config = []
for group in config:
fobjects = []
for fixture in config[group]:
@@ -101,6 +107,8 @@ class MakeGroups:
class MakeScenes:
def __new__(cls, config, fixtures, groups):
scenes = {}
if config is None:
config = []
for scene in config:
objects = {}
for name in config[scene].keys():

6
gig.py
View File

@@ -392,12 +392,12 @@ def main():
audiencecontent = AudienceContent(gigconfig=config, eventrunner=eventrunner)
# try:
try:
wrapper = ClientWrapper()
DMX_DATA_SIZE = DMX_UNIVERSE_SIZE
dmx_object = dmx.DMX(args.universe, wrapper, DMX_DATA_SIZE)
# except Exception:
# pass
except Exception:
dmx_object = None
fixtureoutput = dmx.FixtureOutput(fixtures=[config['fixtures'][x] for x in config['fixtures']], dmx=dmx_object)
pyglet.clock.schedule_interval(fixtureoutput.tick, 1/30.0)