Skip to content

Commit

Permalink
fix(api): connect context to real thermocycler during calibration (#4454
Browse files Browse the repository at this point in the history
)

The calibration session currently picks up the simulated context from the beginning of the session. This means that the simulated modules are also usedduring labware calibration. This temporarily connect the thermocycler during calibration so the session is aware of the lid's open/close state. This is a short term patch that will be removed in place of better session management to replace the current RPC over HTTP session communication.
  • Loading branch information
b-cooper authored Nov 15, 2019
1 parent 15fcbd7 commit 1d40fd6
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions api/src/opentrons/protocol_api/contexts.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,24 @@ def temp_connect(self, hardware: hc.API):
"""
old_hw = self._hw_manager.hardware
old_tc = None
tc_context = None
try:
self._hw_manager.set_hw(hardware)
for mod_ctx in self._modules:
if isinstance(mod_ctx, ThermocyclerContext):
tc_context = mod_ctx
hw_tc = next(hw_mod for hw_mod in
hardware.attached_modules.values()
if hw_mod.name() == 'thermocycler')
if hw_tc:
old_tc = mod_ctx._module
mod_ctx._module = hw_tc
yield self
finally:
self._hw_manager.set_hw(old_hw)
if tc_context is not None and old_tc is not None:
tc_context._module = old_tc

@requires_version(2, 0)
def connect(self, hardware: hc.API):
Expand Down

0 comments on commit 1d40fd6

Please sign in to comment.