changeset 1822:0da5fcfe4ea5

collector debug logging Ignore-this: d1357a970ac339186c7e91cd311c6288
author drewp@bigasterisk.com
date Sat, 09 Jun 2018 01:19:23 +0000
parents ddd1e3f8856e
children 3f606666105b
files bin/collector light9/collector/output.py
diffstat 2 files changed, 13 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/bin/collector	Fri Jun 08 23:14:32 2018 +0000
+++ b/bin/collector	Sat Jun 09 01:19:23 2018 +0000
@@ -149,9 +149,10 @@
     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:")
--- a/light9/collector/output.py	Fri Jun 08 23:14:32 2018 +0000
+++ b/light9/collector/output.py	Sat Jun 09 01:19:23 2018 +0000
@@ -85,11 +85,12 @@
                 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 @@
     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 @@
     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):