|
3 | 3 | from dataclasses import dataclass
|
4 | 4 | from typing import Dict, List, Mapping, Optional, Tuple
|
5 | 5 |
|
| 6 | +from opentrons_shared_data.pipette import pipette_definition |
6 | 7 | from opentrons.config.defaults_ot2 import Z_RETRACT_DISTANCE
|
7 | 8 | from opentrons.hardware_control.dev_types import PipetteDict
|
8 | 9 | from opentrons.types import MountType, Mount as HwMount
|
@@ -71,7 +72,9 @@ class StaticPipetteConfig:
|
71 | 72 | min_volume: float
|
72 | 73 | max_volume: float
|
73 | 74 | channels: int
|
74 |
| - return_tip_scale: float |
| 75 | + tip_configuration_lookup_table: Dict[ |
| 76 | + float, pipette_definition.SupportedTipsDefinition |
| 77 | + ] |
75 | 78 | nominal_tip_overlap: Dict[str, float]
|
76 | 79 | home_position: float
|
77 | 80 | nozzle_offset_z: float
|
@@ -124,7 +127,7 @@ def handle_action(self, action: Action) -> None:
|
124 | 127 | min_volume=config.min_volume,
|
125 | 128 | max_volume=config.max_volume,
|
126 | 129 | channels=config.channels,
|
127 |
| - return_tip_scale=config.return_tip_scale, |
| 130 | + tip_configuration_lookup_table=config.tip_configuration_lookup_table, |
128 | 131 | nominal_tip_overlap=config.nominal_tip_overlap,
|
129 | 132 | home_position=config.home_position,
|
130 | 133 | nozzle_offset_z=config.nozzle_offset_z,
|
@@ -171,11 +174,32 @@ def _handle_command(self, command: Command) -> None:
|
171 | 174 | self._state.attached_tip_by_id[pipette_id] = attached_tip
|
172 | 175 | self._state.aspirated_volume_by_id[pipette_id] = 0
|
173 | 176 |
|
| 177 | + static_config = self._state.static_config_by_id.get(pipette_id) |
| 178 | + if static_config: |
| 179 | + tip_configuration = static_config.tip_configuration_lookup_table[ |
| 180 | + attached_tip.volume |
| 181 | + ] |
| 182 | + self._state.flow_rates_by_id[pipette_id] = FlowRates( |
| 183 | + default_blow_out=tip_configuration.default_blowout_flowrate.values_by_api_level, |
| 184 | + default_aspirate=tip_configuration.default_aspirate_flowrate.values_by_api_level, |
| 185 | + default_dispense=tip_configuration.default_dispense_flowrate.values_by_api_level, |
| 186 | + ) |
| 187 | + |
174 | 188 | elif isinstance(command.result, (DropTipResult, DropTipInPlaceResult)):
|
175 | 189 | pipette_id = command.params.pipetteId
|
176 | 190 | self._state.aspirated_volume_by_id[pipette_id] = None
|
177 | 191 | self._state.attached_tip_by_id[pipette_id] = None
|
178 | 192 |
|
| 193 | + static_config = self._state.static_config_by_id.get(pipette_id) |
| 194 | + if static_config: |
| 195 | + tip_configuration = static_config.tip_configuration_lookup_table[ |
| 196 | + static_config.max_volume |
| 197 | + ] |
| 198 | + self._state.flow_rates_by_id[pipette_id] = FlowRates( |
| 199 | + default_blow_out=tip_configuration.default_blowout_flowrate.values_by_api_level, |
| 200 | + default_aspirate=tip_configuration.default_aspirate_flowrate.values_by_api_level, |
| 201 | + default_dispense=tip_configuration.default_dispense_flowrate.values_by_api_level, |
| 202 | + ) |
179 | 203 | elif isinstance(command.result, BlowOutResult):
|
180 | 204 | pipette_id = command.params.pipetteId
|
181 | 205 | self._state.aspirated_volume_by_id[pipette_id] = None
|
@@ -504,7 +528,20 @@ def get_instrument_max_height_ot2(self, pipette_id: str) -> float:
|
504 | 528 |
|
505 | 529 | def get_return_tip_scale(self, pipette_id: str) -> float:
|
506 | 530 | """Return the given pipette's return tip height scale."""
|
507 |
| - return self.get_config(pipette_id).return_tip_scale |
| 531 | + max_volume = self.get_maximum_volume(pipette_id) |
| 532 | + working_volume = max_volume |
| 533 | + if self.get_attached_tip(pipette_id): |
| 534 | + working_volume = self.get_working_volume(pipette_id) |
| 535 | + |
| 536 | + if working_volume in self.get_config(pipette_id).tip_configuration_lookup_table: |
| 537 | + tip_lookup = self.get_config(pipette_id).tip_configuration_lookup_table[ |
| 538 | + working_volume |
| 539 | + ] |
| 540 | + else: |
| 541 | + tip_lookup = self.get_config(pipette_id).tip_configuration_lookup_table[ |
| 542 | + working_volume |
| 543 | + ] |
| 544 | + return tip_lookup.default_return_tip_height |
508 | 545 |
|
509 | 546 | def get_flow_rates(self, pipette_id: str) -> FlowRates:
|
510 | 547 | """Get the default flow rates for the pipette."""
|
|
0 commit comments