Skip to content

Commit

Permalink
fix(protocol-designer): TC renders for OT-2 and fix isSlotEmpty logic (
Browse files Browse the repository at this point in the history
  • Loading branch information
jerader authored Dec 13, 2023
1 parent cf8876f commit 5c952b7
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 23 deletions.
17 changes: 7 additions & 10 deletions protocol-designer/src/components/DeckSetup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import {
TRASH_BIN_ADAPTER_FIXTURE,
WASTE_CHUTE_CUTOUT,
} from '@opentrons/shared-data'
import { SPAN7_8_10_11_SLOT } from '../../constants'
import { selectors as labwareDefSelectors } from '../../labware-defs'

import { selectors as featureFlagSelectors } from '../../feature-flags'
Expand Down Expand Up @@ -190,16 +191,12 @@ export const DeckSetupContents = (props: ContentsProps): JSX.Element => {
<>
{/* all modules */}
{allModules.map(moduleOnDeck => {
// modules can be on the deck, including pseudo-slots (eg special 'spanning' slot for thermocycler position)
// const moduleParentSlots = [...deckSlots, ...values(PSEUDO_DECK_SLOTS)]
// const slot = moduleParentSlots.find(
// slot => slot.id === moduleOnDeck.slot
// )
const slotPosition = getPositionFromSlotId(moduleOnDeck.slot, deckDef)
const slotId =
moduleOnDeck.slot === SPAN7_8_10_11_SLOT ? '7' : moduleOnDeck.slot

const slotPosition = getPositionFromSlotId(slotId, deckDef)
if (slotPosition == null) {
console.warn(
`no slot ${moduleOnDeck.slot} for module ${moduleOnDeck.id}`
)
console.warn(`no slot ${slotId} for module ${moduleOnDeck.id}`)
return null
}
const moduleDef = getModuleDef2(moduleOnDeck.model)
Expand Down Expand Up @@ -257,7 +254,7 @@ export const DeckSetupContents = (props: ContentsProps): JSX.Element => {
def={moduleDef}
orientation={inferModuleOrientationFromXCoordinate(slotPosition[0])}
innerProps={getModuleInnerProps(moduleOnDeck.moduleState)}
targetSlotId={moduleOnDeck.slot}
targetSlotId={slotId}
targetDeckId={deckDef.otId}
>
{labwareLoadedOnModule != null && !shouldHideChildren ? (
Expand Down
42 changes: 31 additions & 11 deletions protocol-designer/src/step-forms/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,21 @@ import type {
import type { FormData } from '../../form-types'
export { createPresavedStepForm } from './createPresavedStepForm'

const slotToCutoutOt2Map: { [key: string]: string } = {
'1': 'cutout1',
'2': 'cutout2',
'3': 'cutout3',
'4': 'cutout4',
'5': 'cutout5',
'6': 'cutout6',
'7': 'cutout7',
'8': 'cutout8',
'9': 'cutout9',
'10': 'cutout10',
'11': 'cutout11',
'12': 'cutout12',
}

export function getIdsInRange<T extends string | number>(
orderedIds: T[],
startId: T,
Expand Down Expand Up @@ -128,17 +143,22 @@ export const getSlotIsEmpty = (
return false
}

const filteredAdditionalEquipmentOnDeck = includeStagingAreas
? values(
initialDeckSetup.additionalEquipmentOnDeck
).filter((additionalEquipment: AdditionalEquipmentOnDeck) =>
additionalEquipment.location?.includes(slot)
)
: values(initialDeckSetup.additionalEquipmentOnDeck).filter(
(additionalEquipment: AdditionalEquipmentOnDeck) =>
additionalEquipment.location?.includes(slot) &&
additionalEquipment.name !== 'stagingArea'
)
const filteredAdditionalEquipmentOnDeck = values(
initialDeckSetup.additionalEquipmentOnDeck
).filter((additionalEquipment: AdditionalEquipmentOnDeck) => {
const cutoutForSlotOt2 = slotToCutoutOt2Map[slot]
const includeStaging = includeStagingAreas
? true
: additionalEquipment.name !== 'stagingArea'
if (cutoutForSlotOt2 != null) {
// for Ot-2
return additionalEquipment.location === cutoutForSlotOt2 && includeStaging
} else {
// for Flex
return additionalEquipment.location?.includes(slot) && includeStaging
}
})

return (
[
...values(initialDeckSetup.modules).filter((moduleOnDeck: ModuleOnDeck) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,7 @@ export const getUnoccupiedLabwareLocationOptions: Selector<
const isTrashSlot =
robotType === FLEX_ROBOT_TYPE
? MOVABLE_TRASH_ADDRESSABLE_AREAS.includes(slotId)
: slotId === 'fixedTrash'

: ['fixedTrash', '12'].includes(slotId)
return (
!slotIdsOccupiedByModules.includes(slotId) &&
!Object.values(labware)
Expand Down
1 change: 1 addition & 0 deletions shared-data/deck/types/schemaV4.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export type OT2AddressableAreaName =
| '9'
| '10'
| '11'
| '12'
| 'fixedTrash'

export type AddressableAreaName =
Expand Down

0 comments on commit 5c952b7

Please sign in to comment.