]> Pileus Git - ~andy/csm213a-hw/blobdiff - vis/visual.py
Get things running
[~andy/csm213a-hw] / vis / visual.py
index 5580b5b47700c80359c733d69aade5b32d1fa01a..ac42208494029e7b0c2b71d9498aeedfca913cc9 100644 (file)
@@ -33,8 +33,8 @@ class Visual:
 
                self.accs     = get_objects(['accx', 'accy', 'accz'])
                self.mags     = get_objects(['magx', 'magy', 'magz'])
-               self.touch    = get_objects(['touch'])
-               self.light    = get_objects(['light'])
+               self.lgts     = get_objects(['lgt'])
+               self.tchs     = get_objects(['tch'])
                self.a2ds     = get_objects(['a2d0', 'a2d1', 'a2d2', 'a2d3', 'a2d4', 'a2d5'])
 
        # Signal handlers
@@ -68,8 +68,8 @@ class Visual:
                name  = name.replace('_btn', '')
                state = obj.get_active()
                if self.config.enable[name] != state:
+                       self.device.set_enable(name, state)
                        self.config.enable[name] = state
-                       self.device.control()
                        self.config.save()
 
        def on_rate(self, obj):
@@ -77,8 +77,8 @@ class Visual:
                name  = name.replace('_spin', '')
                value = obj.get_value()
                if self.config.rate[name] != value:
+                       self.device.set_rate(name, value)
                        self.config.rate[name] = value
-                       self.device.control()
                        self.config.save()
 
        def on_config(self, obj):
@@ -136,16 +136,16 @@ class Visual:
 
                setxyz(self.accs,  state.acc)
                setxyz(self.mags,  state.mag)
-               setabs(self.touch, state.touch)
-               setabs(self.light, state.light)
+               setabs(self.lgts,  state.lgt)
+               setabs(self.tchs,  state.tch)
                setabs(self.a2ds,  state.a2d)
 
        def debug(self, state):
                print('update: ' + str(state))
                print('\tacc - ' + str(state.acc))
                print('\tmag - ' + str(state.mag))
-               print('\tlgt - ' + str(state.light))
-               print('\ttch - ' + str(state.touch))
+               print('\tlgt - ' + str(state.lgt))
+               print('\ttch - ' + str(state.tch))
                print('\ta2d - ' + str(state.a2d))
 
        def timer(self):