From 48fab1b1d5ba11f6e4ca0b30f4a7a3aa6cbd6fcc Mon Sep 17 00:00:00 2001 From: Wolfgang Draxinger Date: Fri, 25 Nov 2011 16:41:03 +0100 Subject: axes enumeration parameter now may also be a integer, instead of a list - will imply a range from 0 up to the given value. --- Phytron.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Phytron.py b/Phytron.py index 72c8a22..a68c786 100644 --- a/Phytron.py +++ b/Phytron.py @@ -229,7 +229,7 @@ class ReceiveData: class IPCOMM: MAX_RETRY_COUNT = 5 - def __init__(self, url, baudrate = 38400, axes=range(0x10), axisnames = None): + def __init__(self, url, baudrate = 38400, axes=0x10, axisnames = None): self.rlock = threading.RLock() self.conn = serial.serial_for_url(url) self.conn.baudrate = baudrate @@ -248,8 +248,10 @@ class IPCOMM: return self.axisByName[nameOrID] return self.axisByID[int(nameOrID)] - def enumerate(self, axes=range(0x10), names=None): + def enumerate(self, axes=0x10, names=None): # Use a only short timeout for enumeration. + if isinstance(axes, int): + axes = range(axes) oldtimeout = self.conn.timeout self.conn.timeout = 0.05 self.axisByID.clear() -- cgit v1.2.3