From 429f441fbd87d816dfd7f2575d85fcf95a109440 Mon Sep 17 00:00:00 2001 From: appel_c Date: Fri, 19 Jun 2026 14:08:49 +0200 Subject: [PATCH] move Compare status acquiring after erase-start call --- .../devices/epics/delay_generator_csaxs/ddg_1.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/csaxs_bec/devices/epics/delay_generator_csaxs/ddg_1.py b/csaxs_bec/devices/epics/delay_generator_csaxs/ddg_1.py index 3290cbc..5a25f68 100644 --- a/csaxs_bec/devices/epics/delay_generator_csaxs/ddg_1.py +++ b/csaxs_bec/devices/epics/delay_generator_csaxs/ddg_1.py @@ -390,9 +390,9 @@ class DDG1(PSIDeviceBase, DelayGeneratorCSAXS): # counters are forwarded to BEC. Once the flag is set, we create a TransitionStatus DONE->ACQUIRING # and start the acquisition through erase_start.put(1). Finally, we wait for the card to go to ACQUIRING state. mcs._omit_mca_callbacks.clear() # pylint: disable=protected-access + mcs.erase_start.put(1) status_acquiring = CompareStatus(mcs.acquiring, ACQUIRING.ACQUIRING) self.cancel_on_stop(status_acquiring) - mcs.erase_start.put(1) return status_acquiring @@ -599,7 +599,17 @@ class DDG1(PSIDeviceBase, DelayGeneratorCSAXS): # an acquisition regularly with a WaitTimeoutError, the timeout can be increased but it should # be investigated why the EPICS interface is slow to respond. try: - status_mcs.wait(timeout=3) + current_time = time.time() + while time.time() - current_time < 3 and mcs.acquiring.get() != ACQUIRING.ACQUIRING: + time.sleep(0.1) + logger.warning( + f"MCS card is not in acquiring state, current state: {mcs.acquiring.get()}" + ) + if mcs.acquiring.get() != ACQUIRING.ACQUIRING: + logger.warning( + f"MCS card is not in acquiring state, current state: {mcs.acquiring.get()}" + ) + status_mcs.wait(timeout=3) except Exception as exc: logger.warning(f"MCS did not go to Acquiring within 3s. Retrying erase_start {exc}") mcs.erase_start.put(1)