Skip to content

Commit

Permalink
add stacker module type to protocol engine
Browse files Browse the repository at this point in the history
  • Loading branch information
ahiuchingau committed Jan 6, 2025
1 parent bb6fb0f commit 4fa9e57
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions api/src/opentrons/protocol_engine/state/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -1314,6 +1314,10 @@ def ensure_and_convert_module_fixture_location(
# only allowed in column 3
assert deck_slot.value[-1] == "3"
return f"absorbanceReaderV1{deck_slot.value}"
elif model == ModuleModel.FLEX_STACKER_V1:
# only allowed in column 4
assert deck_slot.value[-1] == "4"
return f"flexStackerV1{deck_slot.value}"

raise ValueError(
f"Unknown module {model.name} has no addressable areas to provide."
Expand Down
9 changes: 9 additions & 0 deletions api/src/opentrons/protocol_engine/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,7 @@ class ModuleModel(str, Enum):
HEATER_SHAKER_MODULE_V1 = "heaterShakerModuleV1"
MAGNETIC_BLOCK_V1 = "magneticBlockV1"
ABSORBANCE_READER_V1 = "absorbanceReaderV1"
FLEX_STACKER_V1 = "flexStackerV1"

def as_type(self) -> ModuleType:
"""Get the ModuleType of this model."""
Expand All @@ -491,6 +492,8 @@ def as_type(self) -> ModuleType:
return ModuleType.MAGNETIC_BLOCK
elif ModuleModel.is_absorbance_reader(self):
return ModuleType.ABSORBANCE_READER
elif ModuleModel.is_flex_stacker(self):
return ModuleType.FLEX_STACKER

assert False, f"Invalid ModuleModel {self}"

Expand Down Expand Up @@ -533,6 +536,11 @@ def is_absorbance_reader(
) -> TypeGuard[AbsorbanceReaderModel]:
"""Whether a given model is an Absorbance Plate Reader."""
return model == cls.ABSORBANCE_READER_V1

@classmethod
def is_flex_stacker(cls, model: ModuleModel) -> TypeGuard[FlexStackerModel]:
"""Whether a given model is a Flex Stacker."""
return model == cls.FLEX_STACKER_V1


TemperatureModuleModel = Literal[
Expand All @@ -547,6 +555,7 @@ def is_absorbance_reader(
HeaterShakerModuleModel = Literal[ModuleModel.HEATER_SHAKER_MODULE_V1]
MagneticBlockModel = Literal[ModuleModel.MAGNETIC_BLOCK_V1]
AbsorbanceReaderModel = Literal[ModuleModel.ABSORBANCE_READER_V1]
FlexStackerModel = Literal[ModuleModel.FLEX_STACKER_V1]


class ModuleDimensions(BaseModel):
Expand Down

0 comments on commit 4fa9e57

Please sign in to comment.