From b098109880e41aa59fa77d2b5d23981f1bbca8eb Mon Sep 17 00:00:00 2001 From: gac-x02da Date: Mon, 16 Jun 2025 20:26:09 +0200 Subject: [PATCH] perf(std_daq): only reset backend if status is not idle --- tomcat_bec/devices/pco_edge/pcoedgecamera.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tomcat_bec/devices/pco_edge/pcoedgecamera.py b/tomcat_bec/devices/pco_edge/pcoedgecamera.py index 108fe52..abbb1a7 100644 --- a/tomcat_bec/devices/pco_edge/pcoedgecamera.py +++ b/tomcat_bec/devices/pco_edge/pcoedgecamera.py @@ -367,10 +367,13 @@ class PcoEdge5M(PSIDeviceBase, PcoEdgeBase): """Stop the camera acquisition and set it to idle state""" self.set_idle().wait() status = DeviceStatus(self) - self.backend.add_status_callback( - status, success=[StdDaqStatus.IDLE], error=[StdDaqStatus.REJECTED, StdDaqStatus.ERROR] - ) - self.backend.stop() + if self.backend.status != StdDaqStatus.IDLE: + self.backend.add_status_callback( + status, success=[StdDaqStatus.IDLE], error=[StdDaqStatus.REJECTED, StdDaqStatus.ERROR] + ) + self.backend.stop() + else: + status.set_finished() return status @property @@ -526,6 +529,7 @@ class PcoEdge5M(PSIDeviceBase, PcoEdgeBase): successful=True, hinted_location={"data": "data"}, ) + logger.info(f"Finished writing to {self.target_file}") status = self.acq_done() status.add_callback(_create_dataset)