diff --git a/bin/collector b/bin/collector --- a/bin/collector +++ b/bin/collector @@ -61,8 +61,10 @@ def startZmq(port, collector): def launch(graph): # todo: drive outputs with config files - outputs = [EnttecDmx(L9['output/dmx0/'], '/dev/dmx0'), - Udmx(L9['output/udmx/'])] + outputs = [ + EnttecDmx(L9['output/dmx0/'], '/dev/dmx0'), + Udmx(L9['output/udmx/']), + ] c = Collector(graph, outputs) server = WebServer(c) diff --git a/light9/collector/collector.py b/light9/collector/collector.py --- a/light9/collector/collector.py +++ b/light9/collector/collector.py @@ -109,7 +109,9 @@ class Collector(object): for outputAttr, value in attrs.iteritems(): self.setAttr(device, outputAttr, value, pendingOut) + print "%.1fms for client math" % (1000 * (time.time() - now)) self.flush(pendingOut) + print "%.1fms including flush" % (1000 * (time.time() - now)) def setAttr(self, device, outputAttr, value, pendingOut): output, index = self.outputMap[(device, outputAttr)] diff --git a/light9/collector/device.py b/light9/collector/device.py --- a/light9/collector/device.py +++ b/light9/collector/device.py @@ -9,6 +9,7 @@ import colormath.color_conversions log = logging.getLogger('device') + class Device(object): def setAttrs(): pass diff --git a/light9/collector/output.py b/light9/collector/output.py --- a/light9/collector/output.py +++ b/light9/collector/output.py @@ -68,7 +68,7 @@ class EnttecDmx(DmxOutput): self.dev = Dmx(devicePath) self.currentBuffer = '' self.lastLog = 0 - task.LoopingCall(self._loop).start(1 / 50) + task.LoopingCall(self._loop).start(0.050) @stats.update.time() def update(self, values): @@ -105,7 +105,7 @@ class Udmx(DmxOutput): # 2. Retries if there are usb errors. # Copying the LoopingCall logic accomplishes those with a # little wasted time if there are no updates. - task.LoopingCall(self._loop).start(1 / 50) + task.LoopingCall(self._loop).start(0.050) @stats.update.time() def update(self, values): @@ -117,14 +117,13 @@ class Udmx(DmxOutput): self.currentBuffer = ''.join(map(chr, values)) def _loop(self): - if self.lastSentBuffer == self.currentBuffer: - return + #if self.lastSentBuffer == self.currentBuffer: + # return with Udmx.stats.write.time(): # frequently errors with usb.core.USBError try: self.dev.SendDMX(self.currentBuffer) self.lastSentBuffer = self.currentBuffer - return except usb.core.USBError: Udmx.stats.usbErrors += 1