-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make stage synchronous if arming not started #92
Changes from all commits
e363fc5
e05571d
4a61775
53bd9c9
7da8905
3686bb6
ea77f42
e8e75ce
09d4013
9e4397b
c6f0e61
3dbdef5
ce4f676
52bfa8c
126cf27
bc45b1e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,9 @@ def set(self, value, *, timeout=None, settle_time=None, **kwargs): | |
|
||
detector_params: Optional[DetectorParams] = None | ||
|
||
arming_status = Status() | ||
arming_status.set_finished() | ||
|
||
@classmethod | ||
def with_params( | ||
cls, | ||
|
@@ -79,7 +82,20 @@ def async_stage(self): | |
status_ok, error_message = self.odin.check_odin_initialised() | ||
if not status_ok: | ||
raise Exception(f"Odin not initialised: {error_message}") | ||
return self.do_arming_chain() | ||
|
||
self.arming_status = self.do_arming_chain() | ||
return self.arming_status | ||
|
||
def is_armed(self): | ||
return self.odin.fan.ready.get() == 1 and self.cam.acquire.get() == 1 | ||
|
||
def stage(self): | ||
if not self.arming_status.done: | ||
# Arming has started so wait for it to finish | ||
self.arming_status.wait(60) | ||
elif not self.is_armed(): | ||
# Arming hasn't started, do it asynchronously | ||
self.async_stage().wait(timeout=self.GENERAL_STATUS_TIMEOUT) | ||
|
||
def unstage(self) -> bool: | ||
assert self.detector_params is not None | ||
|
@@ -98,7 +114,6 @@ def unstage(self) -> bool: | |
|
||
LOGGER.info("Disarming detector") | ||
self.disarm_detector() | ||
|
||
status_ok = self.odin.check_odin_state() | ||
self.disable_roi_mode() | ||
return status_ok | ||
|
@@ -289,7 +304,7 @@ def do_arming_chain(self) -> Status: | |
self.set_odin_pvs, | ||
self.set_mx_settings_pvs, | ||
self.set_num_triggers_and_captures, | ||
lambda: await_value(self.STALE_PARAMS_TIMEOUT, 0, 60), | ||
lambda: await_value(self.stale_params, 0, 60), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This typo looks like it should have broken the arming, not sure how it was working before if this was in there There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yh, it's probably just not covered well in the tests |
||
self._wait_for_odin_status, | ||
lambda: self.cam.acquire.set(1, timeout=self.GENERAL_STATUS_TIMEOUT), | ||
self._wait_fan_ready, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should: You should create a placeholder class variable for this that's initialised to a complete status, this helps autocomplete etc.