-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wait_for_value_interface_change (#652)
- Loading branch information
1 parent
9ea28ad
commit e4b18e5
Showing
8 changed files
with
237 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# `set_and_wait_for_other_value` | ||
|
||
The `set_and_wait_for_other_value` function (defined in `_signal.py`) is a utility designed to: | ||
|
||
1. **Set a signal**. | ||
2. **Wait for another signal to reach a specified value (`match_value`)**. | ||
|
||
The behavior of the function depends on the value of the `wait_for_set_completion` parameter: | ||
|
||
- **If `wait_for_set_completion = True`:** | ||
The function returns at **1** (see diagram below), which occurs when the "set operation" is complete. | ||
|
||
- **If `wait_for_set_completion = False`:** | ||
The function returns at **2**, which occurs when the `match_signal` reaches the `match_value`. | ||
|
||
In **AreaDetector**, the `wait_for_set_completion` parameter should generally be set to **`False`**, as the preferred behavior is to return when the `match_signal` achieves the `match_value`. | ||
|
||
--- | ||
|
||
## Behavior Diagram: | ||
|
||
![wait_for_set_completion](../images/set_and_wait_for_other_value.svg) | ||
|
||
--- | ||
|
||
## Example Usage | ||
|
||
```python | ||
# Example code snippet for using set_and_wait_for_other_value in an AreaDetector driver | ||
self._arm_status = set_and_wait_for_other_value( | ||
self._drv.arm, | ||
1, | ||
self._drv.state, | ||
"ready", | ||
timeout=DEFAULT_TIMEOUT, | ||
wait_for_set_completion=False, | ||
) | ||
``` | ||
|
||
In this **AreaDetector driver**, the function ensures that the detector's `arm_status` reaches `"ready"` before capturing data. To achieve this: | ||
|
||
- The detector is instructed to transition to the "armed" state by setting the driver's `arm` signal to `1`. | ||
- The function waits until the driver's `state` signal equals `"ready"`. | ||
|
||
This approach ensures that data capture is only initiated once the detector is fully prepared. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.