comparison bcf2000.py @ 470:68e1655eaa2c

fix bcf2000 valueOut when you pass an int 0,1 to a button
author drewp@bigasterisk.com
date Sun, 16 Nov 2008 04:21:02 +0000
parents 8713617cc08e
children ff9c72cfb023
comparison
equal deleted inserted replaced
469:c96768581667 470:68e1655eaa2c
101 if self.lastValue.get(name) == value: 101 if self.lastValue.get(name) == value:
102 return 102 return
103 self.lastValue[name] = value 103 self.lastValue[name] = value
104 which = [k for k,v in self.control.items() if v == name] 104 which = [k for k,v in self.control.items() if v == name]
105 assert len(which) == 1, "unknown control name %r" % name 105 assert len(which) == 1, "unknown control name %r" % name
106 if isinstance(value, bool): 106 if name.startswith('button-'):
107 value = value * 127 107 value = value * 127
108 #print "bcf: write %s %s" % (name, value) 108 #print "bcf: write %s %s" % (name, value)
109 self.dev.write(chr(0xb0) + chr(which[0]) + chr(int(value))) 109 self.dev.write(chr(0xb0) + chr(which[0]) + chr(int(value)))
110 110
111 def close(self): 111 def close(self):