aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfgang Draxinger <Wolfgang.Draxinger@draxit.de>2011-11-25 16:41:03 +0100
committerWolfgang Draxinger <Wolfgang.Draxinger@draxit.de>2011-11-25 16:41:03 +0100
commit48fab1b1d5ba11f6e4ca0b30f4a7a3aa6cbd6fcc (patch)
tree0649bab3c7a2f52e96f389ef5f4c8b8d20a8f2ce
parent1506bb1334a9ce8cff94d6cc735052aa99a3688c (diff)
downloadPyPhytron-48fab1b1d5ba11f6e4ca0b30f4a7a3aa6cbd6fcc.tar.gz
PyPhytron-48fab1b1d5ba11f6e4ca0b30f4a7a3aa6cbd6fcc.tar.bz2
axes enumeration parameter now may also be a integer, instead of a list - will imply a range from 0 up to the given value.
-rw-r--r--Phytron.py6
1 files 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()