Skip to content

Commit ea61032

Browse files
committed
startd to add hardware config parsing
1 parent 6e5cc4e commit ea61032

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

microscope/stages/ludl.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import typing
2828
import time
2929
import serial
30+
import re
3031

3132
import microscope.abc
3233

@@ -124,6 +125,37 @@ def __init__(self, port: str, baudrate: int, timeout: float) -> None:
124125
# '\rEND\r' that signals the end of the description.
125126
self.command(b'RCONFIG')
126127
answer = self.read_multiline()
128+
129+
# parse config responce which tells us what devices are present
130+
# on this controller.
131+
132+
self._devlist={}
133+
134+
for line in answer[4:-1]:
135+
#loop through lines 4 to second last one which are devices
136+
#present on this controller
137+
devinfo=re.split(r"\s{2,}",line.decode('ascii'))
138+
# dev address,label,id,description, type
139+
self._devlist[devinfo[0]]=devinfo[1:]
140+
141+
142+
# ['EMOT', 'X', 'X axis stage', 'MCMSE']
143+
# >>> devinfo[0]
144+
# '1'
145+
# >>> answer[3]
146+
# b''
147+
# >>> answer[4]
148+
# b'1 EMOT X X axis stage MCMSE'
149+
# >>> answer[5]
150+
# b'2 EMOT Y Y axis stage MCMSE'
151+
# >>> answer[6]
152+
# b'3 EMOT B B aux motor MCMSE'
153+
# >>> answer[7]
154+
# b'7 HSMOT T T rotation robot MCMSE **** Should be T rot'
155+
156+
# for dev in self._devlist:
157+
158+
127159
print(answer)
128160
# if answer != b"PROSCAN INFORMATION\r":
129161
# self.read_until_timeout()

0 commit comments

Comments
 (0)