Changeset - 1382cb43a3ca
[Not reviewed]
default
0 1 0
Drew Perttula - 9 years ago 2016-05-14 23:56:02
drewp@bigasterisk.com
dmxserver -d udmx to talk to the first udmx usb adapter found
Ignore-this: 9495a02620509bbd03271b47f9ab3282
1 file changed with 9 insertions and 5 deletions:
0 comments (0 inline, 0 general)
light9/io/__init__.py
Show inline comments
 
@@ -61,27 +61,31 @@ class UsbDMX(BaseIO):
 
        self.port = port
 
        self.out = None
 
        self.dimmers = dimmers
 

	
 
    def _dmx(self):
 
        if self.out is None:
 
            sys.path.append("dmx_usb_module")
 
            from dmx import Dmx
 
            self.out = Dmx(self.port)
 
            if self.port == 'udmx':
 
                from udmx import Udmx
 
                self.out = Udmx()
 
                self.out.write = self.out.SendDMX
 
            else:
 
                sys.path.append("dmx_usb_module")
 
                from dmx import Dmx
 
                self.out = Dmx(self.port)
 
        return self.out
 
        
 

	
 
    def sendlevels(self, levels):
 
        if self.dummy:
 
            return
 
        # I was outputting on 76 and it was turning on the light at
 
        # dmx75. So I added the 0 byte.
 
        packet = '\x00' + ''.join([chr(int(lev * 255 / 100)) 
 
                                  for lev in levels]) + "\x55"
 
        self._dmx().write(packet)
 

	
 
        
 
class SerialPots(BaseIO):
 
    """
 
    this is a dummy object (that returns zeros forever) until you call startup()
 
    which makes it bind to the port, etc
 
    
 
    """
0 comments (0 inline, 0 general)