From 3e857d7ac663e91e25167a5994869630384f3917 Mon Sep 17 00:00:00 2001 From: Alise Au <20424172+ahiuchingau@users.noreply.github.com> Date: Mon, 26 Feb 2024 17:25:06 -0500 Subject: [PATCH] fix(api): reconfigure instrument cache after a firmware update (#14502) 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. --- api/src/opentrons/hardware_control/ot3api.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/api/src/opentrons/hardware_control/ot3api.py b/api/src/opentrons/hardware_control/ot3api.py index 4a586a43c4e..36509e7fb8d 100644 --- a/api/src/opentrons/hardware_control/ot3api.py +++ b/api/src/opentrons/hardware_control/ot3api.py @@ -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)) @@ -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 @@ -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 @@ -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,