Skip to content

Commit 64226d5

Browse files
Fixing readonly (no command provided) settings setters and getters
1 parent 2f62cd4 commit 64226d5

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

microscope/controllers/asi.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,9 @@ def __init__(self, conn: _ASIController, **kwargs) -> None:
483483

484484
self.homed = False
485485

486-
def _get_setting(self, command, axis, dtype):
486+
def _get_setting(self, command, axis, dtype, value):
487+
if command is None:
488+
return value
487489
answer = self._dev_conn.get_command(
488490
bytes(f"{command} {axis}?", "ascii")
489491
)
@@ -505,7 +507,10 @@ def _get_setting(self, command, axis, dtype):
505507
raise Exception(f"ASI controller error: {answer}")
506508

507509
def _set_setting(self, value, command, axis):
508-
self._dev_conn.set_command(bytes(f"{command} {axis}={value}", "ascii"))
510+
if command is None:
511+
return False
512+
else:
513+
self._dev_conn.set_command(bytes(f"{command} {axis}={value}", "ascii"))
509514

510515
def _add_settings(self, settings) -> None:
511516
"""INFO command returns a list of settings that is parsed into a dict. This function takes that dict and
@@ -533,8 +538,8 @@ def _add_settings(self, settings) -> None:
533538
dtype=dtype,
534539
get_func=lambda command=setting_params[
535540
"command"
536-
], axis=axis, dtype=dtype: self._get_setting(
537-
command, axis, dtype
541+
], axis=axis, dtype=dtype, value=value: self._get_setting(
542+
command, axis, dtype, value
538543
),
539544
set_func=lambda value, command=setting_params[
540545
"command"

0 commit comments

Comments
 (0)