# HG changeset patch # User drewp@bigasterisk.com # Date 2018-06-09 01:19:23 # Node ID 0da5fcfe4ea5463446ce225b75394fdcad0dd17b # Parent ddd1e3f8856e8d0f89ed68569bd2cceeea692957 collector debug logging Ignore-this: d1357a970ac339186c7e91cd311c6288 diff --git a/bin/collector b/bin/collector --- a/bin/collector +++ b/bin/collector @@ -149,9 +149,10 @@ def launch(graph, doLoadTest=False): try: # todo: drive outputs with config files outputs = [ - # EnttecDmx(L9['output/dmx0/'], '/dev/dmx3', 80), - Udmx(L9['output/dmxA/'], bus=4, numChannels=80), - Udmx(L9['output/dmxB/'], bus=5, numChannels=510), + # EnttecDmx(L9['output/dmxA/'], '/dev/dmx3', 80), + Udmx(L9['output/dmxA/'], bus=5, numChannels=80), + #DummyOutput(L9['output/dmxA/'], 80), + Udmx(L9['output/dmxB/'], bus=7, numChannels=500), ] except Exception: log.error("setting up outputs:") diff --git a/light9/collector/output.py b/light9/collector/output.py --- a/light9/collector/output.py +++ b/light9/collector/output.py @@ -85,11 +85,12 @@ class DmxOutput(Output): self.countError() else: self.lastSentBuffer = sendingBuffer - reactor.callLater(max(0, start + 0.050 - time.time()), + reactor.callLater(max(0, start + 1/20 - time.time()), self._loop) d = threads.deferToThread(self.sendDmx, sendingBuffer) d.addCallback(done) + class EnttecDmx(DmxOutput): stats = scales.collection('/output/enttecDmx', @@ -156,7 +157,7 @@ class Udmx(DmxOutput): def update(self, values): now = time.time() if now > self.lastLog + 1: - log.info('%s %s', self.shortId(), ' '.join(map(str, values))) + log.debug('%s %s', self.shortId(), ' '.join(map(str, values))) self.lastLog = now self.currentBuffer = ''.join(map(chr, values)) @@ -164,10 +165,15 @@ class Udmx(DmxOutput): def sendDmx(self, buf): with Udmx.stats.write.time(): try: + if not buf: + print "skip empty msg" + return True self.dev.SendDMX(buf) return True - except usb.core.USBError: + except usb.core.USBError as e: # not in main thread + msg = 'usb: sending %s bytes to %r; error %r' % (len(buf), self.uri, e) + print msg return False def countError(self):