Skip to content

Commit

Permalink
fix(api): reconfigure instrument cache after a firmware update (#14502)
Browse files Browse the repository at this point in the history
The hardware controller sets the proper motor currents for each axis
when the instruments are cached. Whenever a subsystem gets
rebooted/updated, the motor current setting is lost. This means we must
re-configure the instrument cache after we update a firmware, to make
sure the subsystem motor is set up correctly.
  • Loading branch information
ahiuchingau authored Feb 26, 2024
1 parent 9607d67 commit 3e857d7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions api/src/opentrons/hardware_control/ot3api.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ def estop_cb(event: HardwareEvent) -> None:
self._pipette_handler = OT3PipetteHandler({m: None for m in OT3Mount})
self._gripper_handler = GripperHandler(gripper=None)
self._gantry_load = GantryLoad.LOW_THROUGHPUT
self._configured_since_update = True
OT3RobotCalibrationProvider.__init__(self, self._config)
ExecutionManagerProvider.__init__(self, isinstance(backend, OT3Simulator))

Expand Down Expand Up @@ -523,6 +524,8 @@ async def update_firmware(
message="Update failed because of uncaught error",
wrapping=[PythonException(e)],
) from e
finally:
self._configured_since_update = False

# Incidentals (i.e. not motion) API

Expand Down Expand Up @@ -651,8 +654,8 @@ async def cache_instruments(
and set up hardware controller internal state if necessary.
"""
skip_configure = await self._cache_instruments(require)
if not skip_configure:
self._log.info("Instrument model cache updated, reconfiguring")
if not skip_configure or not self._configured_since_update:
self._log.info("Reconfiguring instrument cache")
await self._configure_instruments()

async def _cache_instruments( # noqa: C901
Expand Down Expand Up @@ -725,6 +728,7 @@ async def _configure_instruments(self) -> None:
await self.set_gantry_load(self._gantry_load_from_instruments())
await self.refresh_positions()
await self.reset_tip_detectors(False)
self._configured_since_update = True

async def reset_tip_detectors(
self,
Expand Down

0 comments on commit 3e857d7

Please sign in to comment.