Changeset - 0da5fcfe4ea5
[Not reviewed]
default
0 2 0
drewp@bigasterisk.com - 7 years ago 2018-06-09 01:19:23
drewp@bigasterisk.com
collector debug logging
Ignore-this: d1357a970ac339186c7e91cd311c6288
2 files changed with 13 insertions and 6 deletions:
0 comments (0 inline, 0 general)
bin/collector
Show inline comments
 
@@ -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:")
light9/collector/output.py
Show inline comments
 
@@ -85,12 +85,13 @@ 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',
 
                              scales.PmfStat('write'),
 
@@ -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):
0 comments (0 inline, 0 general)