From 194602176cae6c698469035c560db05ade48009e Mon Sep 17 00:00:00 2001 From: x01dc Date: Wed, 15 Jul 2026 11:20:58 +0200 Subject: [PATCH] fix(flomni): warn and confirm instead of crashing when fttrx1 is missing feye_in() called umv(dev.fttrx1, ...) unconditionally, so a config without fttrx1 crashed instead of degrading gracefully. Mirrors the existing feye_out() guard: warn that fttrx1 can't be moved and that skipping it risks a hardware collision on the real beamline, then ask yesno before continuing. Co-Authored-By: Claude Sonnet 5 --- .../plugins/flomni/flomni_optics_mixin.py | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/csaxs_bec/bec_ipython_client/plugins/flomni/flomni_optics_mixin.py b/csaxs_bec/bec_ipython_client/plugins/flomni/flomni_optics_mixin.py index 3956aa5..cfa05ea 100644 --- a/csaxs_bec/bec_ipython_client/plugins/flomni/flomni_optics_mixin.py +++ b/csaxs_bec/bec_ipython_client/plugins/flomni/flomni_optics_mixin.py @@ -34,7 +34,9 @@ class FlomniOpticsMixin: if "fttrx1" not in dev: if not self.OMNYTools.yesno( "Device 'fttrx1' does not exist in the current config, so it " - "can't be moved out of the way. Continue anyway?" + "can't be moved out of the way. Continue anyway? WARNING: " + "this could cause collisions when operating on the real " + "beamline." ): print("Aborting feye_out(): fttrx1 not moved.") return @@ -44,9 +46,19 @@ class FlomniOpticsMixin: def feye_in(self): bec.queue.next_dataset_number += 1 - fttrx_out = self._get_user_param_safe("feyex", "fttrx_out") - umv(dev.fttrx1, fttrx_out) - + if "fttrx1" not in dev: + if not self.OMNYTools.yesno( + "Device 'fttrx1' does not exist in the current config, so it " + "can't be moved into position. Continue anyway? WARNING: " + "this could cause collisions when operating on the real " + "beamline." + ): + print("Aborting feye_in(): fttrx1 not moved.") + return + else: + fttrx_out = self._get_user_param_safe("feyex", "fttrx_out") + umv(dev.fttrx1, fttrx_out) + feyex_in = self._get_user_param_safe("feyex", "in") feyey_in = self._get_user_param_safe("feyey", "in")