w
This commit is contained in:
@@ -21,6 +21,7 @@ from ophyd_devices.interfaces.base_classes.psi_device_base import PSIDeviceBase
|
||||
from typeguard import typechecked
|
||||
|
||||
from superxas_bec.devices.timepix.timepix_fly_client.timepix_fly_backend import TimepixFlyBackend
|
||||
from superxas_bec.devices.timepix.timepix_fly_client.timepix_fly_client import TimePixFlyStatus
|
||||
from superxas_bec.devices.timepix.timepix_fly_client.timepix_fly_interface import (
|
||||
OtherConfigModel,
|
||||
PixelMap,
|
||||
@@ -366,7 +367,8 @@ class Timepix(PSIDeviceBase, TimePixControl):
|
||||
|
||||
def trigger_callback(status: DeviceStatus):
|
||||
"""Trigger callback to start the acquisition."""
|
||||
status.device.cam.acquire.put(1)
|
||||
if status.done:
|
||||
status.device.cam.acquire.put(1)
|
||||
|
||||
# Detector will be ready to start, as either pre_scan or the status_camera from a previous
|
||||
# trigger will ensure that the detector is in ACQUIRESTATUS.DONE state.
|
||||
@@ -381,8 +383,24 @@ class Timepix(PSIDeviceBase, TimePixControl):
|
||||
self.cam.acquire_busy, [ACQUIRESTATUS.ACQUIRING, ACQUIRESTATUS.DONE]
|
||||
)
|
||||
|
||||
# TODO cleanup and test
|
||||
def failed_to_start_collect_cb(status: DeviceStatus):
|
||||
"""Callback to handle failure to start the collect."""
|
||||
if not status.done:
|
||||
logger.error("Failed to start collect on Timepix Fly backend.")
|
||||
status.device.backend.timepix_fly_client.stop_collect()
|
||||
|
||||
status_collect_backend = DeviceStatus(self, timeout=10)
|
||||
status_collect_backend.add_callback(failed_to_start_collect_cb)
|
||||
self.backend.timepix_fly_client.add_status_callback(
|
||||
status=status_collect_backend,
|
||||
success=[TimePixFlyStatus.COLLECT],
|
||||
error=[TimePixFlyStatus.EXCEPT, TimePixFlyStatus.SHUTDOWN],
|
||||
)
|
||||
|
||||
status = AndStatus(status_backend, status_camera)
|
||||
self.cancel_on_stop(status)
|
||||
st = AndStatus(status, status_collect_backend)
|
||||
self.cancel_on_stop(st)
|
||||
# NOTE, the callback to sent the data will always be called from the backend
|
||||
# as it is attached via self.backend.add_callback() in on_connected.
|
||||
return status
|
||||
|
||||
@@ -340,7 +340,7 @@ if __name__ == "__main__": # pragma: no cover
|
||||
)
|
||||
timepix.on_stage(other_config=config, pixel_map=pixel_map)
|
||||
print("TimepixFlyBackend staged with configuration and pixel map.")
|
||||
for ii in range(10):
|
||||
for ii in range(100):
|
||||
print(f"Starting scan {ii + 1}...;")
|
||||
# time.sleep(1)
|
||||
status_1 = timepix.on_trigger()
|
||||
|
||||
Reference in New Issue
Block a user