Skip to content

Commit 3ee5ad0

Browse files
Adding the settings is working but values is not describing ranges as those can not be requested. They are in the docs
1 parent d431551 commit 3ee5ad0

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

microscope/controllers/asi.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def __init__(self, port: str, baudrate: int, timeout: float) -> None:
186186
# We do not use the general get_description() here because
187187
# if this is not a ProScan device it would never reach the
188188
# '\rEND\r' that signals the end of the description.
189-
self._axis_info = {}
189+
self.axis_info = {}
190190
self._axis_mapper = {}
191191
i = 1
192192
try:
@@ -197,7 +197,7 @@ def __init__(self, port: str, baudrate: int, timeout: float) -> None:
197197
_logger.info(f"Axis {axis} not present")
198198
continue
199199
_logger.info(f"Axis {axis} present")
200-
self._axis_info[axis] = parse_info(answer)
200+
self.axis_info[axis] = parse_info(answer)
201201
self._axis_mapper[i] = axis
202202
except:
203203
print(
@@ -211,7 +211,7 @@ def is_busy(self):
211211
pass
212212

213213
def get_number_axes(self):
214-
return len(self._axis_info)
214+
return len(self.axis_info)
215215

216216
def command(self, command: bytes) -> None:
217217
"""Send command to device."""
@@ -430,14 +430,16 @@ def __init__(self, conn: _ASIMotionController, **kwargs) -> None:
430430
for i in range(1, self._dev_conn.get_number_axes() + 1)
431431
}
432432

433+
self._add_settings(self._dev_conn.axis_info)
434+
433435
self.homed = False
434436

435437
def _add_settings(self, settings) -> None:
436438
"""INFO command returns a list of settings that is parsed into a dict. This function takes that dict and
437439
adds settings consequently to the stage object.
438440
"""
439-
for axis_name, axis_settings in settings.items:
440-
for setting_name, setting_params in axis_settings.items:
441+
for axis_name, axis_settings in settings.items():
442+
for setting_name, setting_params in axis_settings.items():
441443
if setting_params['value'].isdigit():
442444
value = int(setting_params['value'])
443445
dtype = "int"
@@ -462,7 +464,8 @@ def _add_settings(self, settings) -> None:
462464
get_func=lambda: self._dev_conn.get_command(
463465
bytes(f"{setting_params['command']} {axis_name}", "ascii")),
464466
set_func=set_function,
465-
readonly=read_only,
467+
values=lambda: f"curr value is {value}. Units are {setting_params['units']}",
468+
# readonly=read_only,
466469
)
467470

468471
def _do_shutdown(self) -> None:

0 commit comments

Comments
 (0)