summaryrefslogtreecommitdiff
path: root/digital/asserv/tools/asserv/mex.py
diff options
context:
space:
mode:
authorNicolas Schodet2012-03-27 23:29:37 +0200
committerNicolas Schodet2012-03-27 23:29:37 +0200
commit9ef4e173c5f6b6f4822d6b03befe3af9cdc9dc51 (patch)
treec1317b9e1f1fbcff50ea5e8d5a77f1b2ed4755e4 /digital/asserv/tools/asserv/mex.py
parent8245bfa00896981de1d6d9c2e175881e300942a8 (diff)
digital/asserv/tools: support asserv without aux
Diffstat (limited to 'digital/asserv/tools/asserv/mex.py')
-rw-r--r--digital/asserv/tools/asserv/mex.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/digital/asserv/tools/asserv/mex.py b/digital/asserv/tools/asserv/mex.py
index 059a29ce..8107f2b4 100644
--- a/digital/asserv/tools/asserv/mex.py
+++ b/digital/asserv/tools/asserv/mex.py
@@ -55,13 +55,14 @@ class Mex:
"""
- def __init__ (self, node, instance):
+ def __init__ (self, node, instance, nb):
Observable.__init__ (self)
self.pwm = None
+ self.nb = nb
node.register (instance + ':pwm', self.__handle)
def __handle (self, msg):
- self.pwm = msg.pop ('hhhh')
+ self.pwm = msg.pop ('h' * self.nb)
self.notify ()
class Aux (Observable):
@@ -88,9 +89,10 @@ class Mex:
aux.angle = float (angle) / 1024
aux.notify ()
- def __init__ (self, node, instance = 'asserv0'):
+ def __init__ (self, node, instance = 'asserv0', aux_nb = 2):
self.position = self.Position (node, instance)
- self.pwm = self.PWM (node, instance)
- self.aux = (self.Aux (), self.Aux ())
- self.__aux_pack = self.Aux.Pack (node, instance, self.aux)
+ self.pwm = self.PWM (node, instance, 2 + aux_nb)
+ if aux_nb:
+ self.aux = (self.Aux (), self.Aux ())
+ self.__aux_pack = self.Aux.Pack (node, instance, self.aux)