Skip to content

Commit

Permalink
Send initialize command to detector before creating other subsystem c…
Browse files Browse the repository at this point in the history
…ontrollers
  • Loading branch information
jsouter committed Oct 17, 2024
1 parent 9275cd1 commit 1ab7a23
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/fastcs_eiger/eiger_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,16 @@ async def initialise(self) -> None:
controller = EigerDetectorController(
self.connection, self._parameter_update_lock
)
# detector subsystem initialises first
# Check current state of detector_state to see
# if initializing is required.
state_val = await self.connection.get(
"detector/api/1.8.0/status/state"
)
if state_val["value"] == "na":
print("Initializing Detector")
# send initialize command to detector
await controller.initialize()
case "monitor":
controller = EigerMonitorController(
self.connection, self._parameter_update_lock
Expand All @@ -210,6 +220,7 @@ async def initialise(self) -> None:
)
self.register_sub_controller(subsystem.capitalize(), controller)
await controller.initialise()

except HTTPRequestError:
print("\nAn HTTP request failed while introspecting detector:\n")
raise
Expand Down Expand Up @@ -366,14 +377,6 @@ class EigerDetectorController(EigerSubsystemController):
trigger_mode = AttrRW(String()) # TODO: Include URI and validate type from API
trigger_exposure = AttrRW(Float(), handler=LogicHandler())

async def initialise(self) -> None:
# Check current state of detector_state to see if initializing is required.
state_val = await self.connection.get("detector/api/1.8.0/status/state")
if state_val["value"] == "na":
print("Initializing Detector")
await self.initialize()
await super().initialise()

@detector_command
async def initialize(self):
await self.connection.put(command_uri("initialize"))
Expand Down

0 comments on commit 1ab7a23

Please sign in to comment.