-
Notifications
You must be signed in to change notification settings - Fork 178
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
refactor(api): only restore changed currents #13683
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## edge #13683 +/- ##
=======================================
Coverage 71.10% 71.10%
=======================================
Files 2438 2438
Lines 68526 68526
Branches 8090 8090
=======================================
Hits 48727 48727
Misses 17905 17905
Partials 1894 1894
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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.
Looks good with a nit
async def restore_current(self) -> AsyncIterator[None]: | ||
"""Save the current.""" | ||
old_current_settings = deepcopy(self._current_settings) | ||
async def restore_current( |
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.
kind of a nit i guess but really this isn't restore_current
anymore, can we call it like motor_current
or something
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 really like this change!!! Some of the hardware-testing scripts just need to be updated to use the new function correctly.
@@ -252,7 +252,7 @@ async def _force_gauge( | |||
force_output = [] | |||
TH.start() | |||
try: | |||
async with api._backend.restore_current(): | |||
async with api._backend.motor_current(): |
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.
The set_active_current
call below should be merged into here
@@ -152,7 +152,7 @@ async def _drop_tip(api: OT3API, trash: Point) -> None: | |||
async def _partial_pick_up_z_motion( | |||
api: OT3API, current: float, distance: float, speed: float | |||
) -> None: | |||
async with api._backend.restore_current(): | |||
async with api._backend.motor_current(): |
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.
The set_active_current
call below should be merged into here
@@ -613,7 +613,7 @@ async def move_tip_motor_relative_ot3( | |||
if motor_current is None: | |||
await _move_coro | |||
else: | |||
async with api._backend.restore_current(): | |||
async with api._backend.motor_current(): |
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.
The set_active_current
call below should be merged into here
@@ -581,7 +581,7 @@ async def move_plunger_absolute_ot3( | |||
if motor_current is None: | |||
await _move_coro | |||
else: | |||
async with api._backend.restore_current(): | |||
async with api._backend.motor_current(): |
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.
The set_active_current
call below should be merged into here
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.
nice
Overview
This PR updates the
ot3controller.restore_current
function so it can optionally take in run currents and hold currents. Instead of unconditionally restoring all current settings for every present axis, now this function can intelligently restore only the ones that were changed.