fix(omny): check switchbox reply against expected relay pattern
CI for csaxs_bec / test (push) Successful in 3m40s

The switchbox echoes the relay pattern ('|0003' on set, '_0003' on query),
so the old '"0000" in reply' check failed on every successful switch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
x01dcandClaude Opus 5.5 committed 2026-11-03 15:47:48 +01:00
1 parent 18f5ce902a
commit 7ad20e50c2
1 file changed
+22 -39
+22 -39
View File
@@ -770,48 +770,31 @@ class RtOMNYController(Controller):
self._omny_interferometer_switch_put_and_receive("?000\r")
time.sleep(1)
# relay bit pattern (hex) per mirror channel. The switchbox echoes the
# pattern on a set ("!002XXXX" -> "|XXXX\r") and reports it on a
# query ("?002" -> "_XXXX\r"), verified on HW 2026-11-03.
_SWITCHBOX_RELAY_PATTERNS = {
1: "0003", # Relais 1 and 2
2: "000C", # Relais 3 and 4
3: "0030", # Relais 5 and 6
4: "00C0", # Relais 7 and 8
5: "0300", # Relais 9 and 10
6: "0C00", # Relais 11 and 12
7: "3000", # Relais 13 and 14
8: "00C0", # Relais 7 and 8 SPECIAL CASE use osafzp y signal to align osa y
9: "C000", # Relais 15 and 16
}
def _omny_interferometer_switch_channel(self, channel):
pattern = self._SWITCHBOX_RELAY_PATTERNS.get(channel)
if pattern is None:
raise RtOMNY_mirror_switchbox_Error(f"Unknown mirror channel {channel}.")
self._omny_interferometer_switch_alloff()
time.sleep(0.1)
if channel == 1: # Relais 1 and 2
rback = self._omny_interferometer_switch_put_and_receive("!0020003\r")
# if "|0003\r" != self._omny_interferometer_switch_put_and_receive("!0020003\r"):
# raise RtOMNY_mirror_switchbox_Error("Channel switching failed.")
elif channel == 2: # Relais 3 and 4
rback = self._omny_interferometer_switch_put_and_receive("!002000C\r")
# if "|000C\r" != self._omny_interferometer_switch_put_and_receive("!002000C\r"):
# raise RtOMNY_mirror_switchbox_Error("Channel switching failed.")
elif channel == 3: # Relais 5 and 6
rback = self._omny_interferometer_switch_put_and_receive("!0020030\r")
# if "|0030\r" != self._omny_interferometer_switch_put_and_receive("!0020030\r"):
# raise RtOMNY_mirror_switchbox_Error("Channel switching failed.")
elif channel == 4: # Relais 7 and 8
rback = self._omny_interferometer_switch_put_and_receive("!00200C0\r")
# if "|00C0\r" != self._omny_interferometer_switch_put_and_receive("!00200C0\r"):
# raise RtOMNY_mirror_switchbox_Error("Channel switching failed.")
elif channel == 5: # Relais 9 and 10
rback = self._omny_interferometer_switch_put_and_receive("!0020300\r")
# if "|0300\r" != self._omny_interferometer_switch_put_and_receive("!0020300\r"):
# raise RtOMNY_mirror_switchbox_Error("Channel switching failed.")
elif channel == 6: # Relais 11 and 12
rback = self._omny_interferometer_switch_put_and_receive("!0020C00\r")
# if "|0C00\r" != self._omny_interferometer_switch_put_and_receive("!0020C00\r"):
# raise RtOMNY_mirror_switchbox_Error("Channel switching failed.")
elif channel == 7: # Relais 13 and 14
rback = self._omny_interferometer_switch_put_and_receive("!0023000\r")
# if "|3000\r" != self._omny_interferometer_switch_put_and_receive("!0023000\r"):
# raise RtOMNY_mirror_switchbox_Error("Channel switching failed.")
elif channel == 8: # Relais 7 and 8 SPECIAL CASE use osafzp y signal to align osa y
rback = self._omny_interferometer_switch_put_and_receive("!00200C0\r")
# if "|00C0\r" != self._omny_interferometer_switch_put_and_receive("!00200C0\r"):
# raise RtOMNY_mirror_switchbox_Error("Channel switching failed.")
elif channel == 9: # Relais 15 and 16
rback = self._omny_interferometer_switch_put_and_receive("!002C000\r")
# if "|C000\r" != self._omny_interferometer_switch_put_and_receive("!002C000\r"):
# raise RtOMNY_mirror_switchbox_Error("Channel switching failed.")
if "0000" not in rback:
rback = self._omny_interferometer_switch_put_and_receive(f"!002{pattern}\r")
if f"|{pattern}" not in rback:
raise RtOMNY_mirror_switchbox_Error(
f"Channel switching failed. Switchbox replied {rback!r}"
f"Channel switching failed. Expected '|{pattern}', switchbox replied {rback!r}"
)
def _omny_interferometer_switch_put_and_receive(self, command_str: str) -> str:
@@ -841,7 +824,7 @@ class RtOMNYController(Controller):
time.sleep(0.1)
alloff = self._omny_interferometer_switch_put_and_receive("?002\r")
# check all off
if "00" not in alloff:
if "_0000" not in alloff:
raise RtOMNY_mirror_switchbox_Error(
f"Not all channels switched off. Switchbox replied {alloff!r}"
)