-
Notifications
You must be signed in to change notification settings - Fork 11
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
Allow setting on hardware backed signals #1078
base: main
Are you sure you want to change the base?
Conversation
src/dodal/common/signal_utils.py
Outdated
|
||
|
||
class HardwareBackedSoftSignalBackend(SoftSignalBackend[SignalDatatypeT]): | ||
def __init__( | ||
self, | ||
get_from_hardware_func: Callable[[], Coroutine[Any, Any, SignalDatatypeT]], | ||
set_to_hardware_func: Callable[[], Coroutine[SignalDatatypeT, Any, Any]] = None, |
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.
I think set_to_hardware_func should take a set value?
set_to_hardware_func: Callable[[], Coroutine[SignalDatatypeT, Any, Any]] = None, | |
set_to_hardware_func: Callable[[SignalDatatypeT], Coroutine[SignalDatatypeT, Any, Any]] | |
| None = None, |
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.
Thanks! I missed it 'cos the linter is still broken due to #1072
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1078 +/- ##
==========================================
- Coverage 97.69% 97.68% -0.02%
==========================================
Files 160 160
Lines 6635 6644 +9
==========================================
+ Hits 6482 6490 +8
- Misses 153 154 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
As I try to use it, I spotted a couple of things.
def create_rw_hardware_backed_soft_signal( | ||
datatype: type[SignalDatatypeT], | ||
get_from_hardware_func: Callable[[], Coroutine[Any, Any, SignalDatatypeT]], | ||
set_to_hardware_func: SetHardwareType, | ||
units: str | None = None, | ||
precision: int | None = None, | ||
): |
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.
never mind, I notice, it will always get overwrite.
def create_rw_hardware_backed_soft_signal( | |
datatype: type[SignalDatatypeT], | |
get_from_hardware_func: Callable[[], Coroutine[Any, Any, SignalDatatypeT]], | |
set_to_hardware_func: SetHardwareType, | |
units: str | None = None, | |
precision: int | None = None, | |
): | |
def create_rw_hardware_backed_soft_signal( | |
datatype: type[SignalDatatypeT], | |
get_from_hardware_func: Callable[[], Coroutine[Any, Any, SignalDatatypeT]], | |
set_to_hardware_func: Callable[[SignalDatatypeT], Coroutine[Any, Any, None]], | |
initial_value: SignalDatatypeT | None = None, | |
units: str | None = None, | |
precision: int | None = None, | |
) -> SignalRW: |
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.
Yh, I think it's an edge case anyway and initial_value
is probably never going to be None
src/dodal/common/signal_utils.py
Outdated
precision=precision, | ||
) | ||
) | ||
|
||
|
||
def create_hardware_backed_soft_signal( |
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.
Could: Make it match soft_r /soft_rw ?
def create_hardware_backed_soft_signal( | |
def create_r_hardware_backed_soft_signal( |
Fixes #1077
Instructions to reviewer on how to test:
Checks for reviewer
dodal connect ${BEAMLINE}