Skip to content

Commit

Permalink
fix(step-generation): properly emit configureNozzleLayout command (#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
jerader authored May 28, 2024
1 parent 1c96abf commit 9f5a9e1
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 55 deletions.
44 changes: 44 additions & 0 deletions step-generation/src/__tests__/replaceTip.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
dropTipInPlaceHelper,
moveToAddressableAreaHelper,
DEFAULT_PIPETTE,
PIPETTE_96,
} from '../fixtures'
import { replaceTip } from '../commandCreators/atomic/replaceTip'
import { FIXED_TRASH_ID } from '../constants'
Expand Down Expand Up @@ -129,6 +130,49 @@ describe('replaceTip', () => {
pickUpTipHelper('B1'),
])
})
it('96-channel full tip and emits the configure nozzle layout command before picking up tip', () => {
const initialTestRobotState = merge({}, initialRobotState, {
tipState: {
tipracks: {
[tiprack1Id]: {
A1: false,
},
},
pipettes: {
[PIPETTE_96]: true,
},
},
pipettes: {
[PIPETTE_96]: { nozzles: 'ALL' },
},
})
const result = replaceTip(
{
pipette: PIPETTE_96,
dropTipLocation: FIXED_TRASH_ID,
tipRack: tiprackURI1,
nozzles: COLUMN,
},
invariantContext,
initialTestRobotState
)
const res = getSuccessResult(result)
expect(res.commands).toEqual([
...dropTipHelper(PIPETTE_96),
{
commandType: 'configureNozzleLayout',
key: expect.any(String),
params: {
pipetteId: PIPETTE_96,
configurationParams: {
primaryNozzle: 'A12',
style: COLUMN,
},
},
},
pickUpTipHelper('A2', { pipetteId: PIPETTE_96 }),
])
})
it('Single-channel: used all tips in first rack, move to second rack', () => {
const initialTestRobotState = merge({}, initialRobotState, {
tipState: {
Expand Down
20 changes: 19 additions & 1 deletion step-generation/src/commandCreators/atomic/replaceTip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ import {
getWasteChuteAddressableAreaNamePip,
} from '../../utils'
import { dropTip } from './dropTip'
import { configureNozzleLayout } from './configureNozzleLayout'

import type { NozzleConfigurationStyle } from '@opentrons/shared-data'
import type {
CommandCreator,
CommandCreatorError,
CurriedCommandCreator,
} from '../../types'

interface PickUpTipArgs {
pipette: string
tiprack: string
Expand Down Expand Up @@ -91,7 +93,7 @@ export const replaceTip: CommandCreator<ReplaceTipArgs> = (
prevRobotState
) => {
const { pipette, dropTipLocation, nozzles, tipRack } = args

const stateNozzles = prevRobotState.pipettes[pipette].nozzles
if (tipRack == null) {
return {
errors: [errorCreators.noTipSelected()],
Expand All @@ -106,6 +108,7 @@ export const replaceTip: CommandCreator<ReplaceTipArgs> = (
)
const pipetteSpec = invariantContext.pipetteEntities[pipette]?.spec
const channels = pipetteSpec?.channels

const hasMoreTipracksOnDeck =
tipracks?.totalTipracks > tipracks?.filteredTipracks

Expand Down Expand Up @@ -241,11 +244,24 @@ export const replaceTip: CommandCreator<ReplaceTipArgs> = (
const addressableAreaNameWasteChute = getWasteChuteAddressableAreaNamePip(
channels
)

const configureNozzleLayoutCommand: CurriedCommandCreator[] =
// only emit the command if previous nozzle state is different
channels === 96 && args.nozzles != null && args.nozzles !== stateNozzles
? [
curryCommandCreator(configureNozzleLayout, {
nozzles: args.nozzles,
pipetteId: args.pipette,
}),
]
: []

let commandCreators: CurriedCommandCreator[] = [
curryCommandCreator(dropTip, {
pipette,
dropTipLocation,
}),
...configureNozzleLayoutCommand,
curryCommandCreator(_pickUpTip, {
pipette,
tiprack: nextTiprack.tiprackId,
Expand All @@ -260,6 +276,7 @@ export const replaceTip: CommandCreator<ReplaceTipArgs> = (
addressableAreaName: addressableAreaNameWasteChute,
prevRobotState,
}),
...configureNozzleLayoutCommand,
curryCommandCreator(_pickUpTip, {
pipette,
tiprack: nextTiprack.tiprackId,
Expand All @@ -275,6 +292,7 @@ export const replaceTip: CommandCreator<ReplaceTipArgs> = (
prevRobotState,
invariantContext,
}),
...configureNozzleLayoutCommand,
curryCommandCreator(_pickUpTip, {
pipette,
tiprack: nextTiprack.tiprackId,
Expand Down
14 changes: 0 additions & 14 deletions step-generation/src/commandCreators/compound/consolidate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import {
import {
aspirate,
configureForVolume,
configureNozzleLayout,
delay,
dropTip,
moveToWell,
Expand Down Expand Up @@ -486,20 +485,7 @@ export const consolidate: CommandCreator<ConsolidateArgs> = (
const dropTipAfterDispenseAirGap =
airGapAfterDispenseCommands.length > 0 ? dropTipCommand : []

const stateNozzles = prevRobotState.pipettes[args.pipette].nozzles
const configureNozzleLayoutCommand: CurriedCommandCreator[] =
// only emit the command if previous nozzle state is different
is96Channel && args.nozzles != null && args.nozzles !== stateNozzles
? [
curryCommandCreator(configureNozzleLayout, {
nozzles: args.nozzles,
pipetteId: args.pipette,
}),
]
: []

return [
...configureNozzleLayoutCommand,
...tipCommands,
...configureForVolumeCommand,
...mixBeforeCommands,
Expand Down
14 changes: 0 additions & 14 deletions step-generation/src/commandCreators/compound/distribute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {
import {
aspirate,
configureForVolume,
configureNozzleLayout,
delay,
dispense,
dropTip,
Expand Down Expand Up @@ -460,20 +459,7 @@ export const distribute: CommandCreator<DistributeArgs> = (
]
: []

const stateNozzles = prevRobotState.pipettes[args.pipette].nozzles
const configureNozzleLayoutCommand: CurriedCommandCreator[] =
// only emit the command if previous nozzle state is different
is96Channel && args.nozzles != null && args.nozzles !== stateNozzles
? [
curryCommandCreator(configureNozzleLayout, {
nozzles: args.nozzles,
pipetteId: args.pipette,
}),
]
: []

return [
...configureNozzleLayoutCommand,
...tipCommands,
...configureForVolumeCommand,
...mixBeforeAspirateCommands,
Expand Down
13 changes: 0 additions & 13 deletions step-generation/src/commandCreators/compound/mix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import * as errorCreators from '../../errorCreators'
import {
aspirate,
configureForVolume,
configureNozzleLayout,
delay,
dispense,
replaceTip,
Expand Down Expand Up @@ -201,17 +200,6 @@ export const mix: CommandCreator<MixArgs> = (
}
}
}
const stateNozzles = prevRobotState.pipettes[pipette].nozzles
const configureNozzleLayoutCommand: CurriedCommandCreator[] =
// only emit the command if previous nozzle state is different
is96Channel && data.nozzles != null && data.nozzles !== stateNozzles
? [
curryCommandCreator(configureNozzleLayout, {
nozzles: data.nozzles,
pipetteId: pipette,
}),
]
: []

const configureForVolumeCommand: CurriedCommandCreator[] = LOW_VOLUME_PIPETTES.includes(
invariantContext.pipetteEntities[pipette].name
Expand Down Expand Up @@ -281,7 +269,6 @@ export const mix: CommandCreator<MixArgs> = (
dispenseYOffset,
})
return [
...configureNozzleLayoutCommand,
...tipCommands,
...configureForVolumeCommand,
...mixCommands,
Expand Down
13 changes: 0 additions & 13 deletions step-generation/src/commandCreators/compound/transfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import {
import {
aspirate,
configureForVolume,
configureNozzleLayout,
delay,
dispense,
dropTip,
Expand Down Expand Up @@ -274,17 +273,6 @@ export const transfer: CommandCreator<TransferArgs> = (
changeTipNow =
isInitialSubtransfer || destinationWell !== prevDestWell
}
const stateNozzles = prevRobotState.pipettes[args.pipette].nozzles
const configureNozzleLayoutCommand: CurriedCommandCreator[] =
// only emit the command if previous nozzle state is different
is96Channel && args.nozzles != null && args.nozzles !== stateNozzles
? [
curryCommandCreator(configureNozzleLayout, {
nozzles: args.nozzles,
pipetteId: args.pipette,
}),
]
: []

const configureForVolumeCommand: CurriedCommandCreator[] = LOW_VOLUME_PIPETTES.includes(
invariantContext.pipetteEntities[args.pipette].name
Expand Down Expand Up @@ -603,7 +591,6 @@ export const transfer: CommandCreator<TransferArgs> = (
: []

const nextCommands = [
...configureNozzleLayoutCommand,
...tipCommands,
...preWetTipCommands,
...configureForVolumeCommand,
Expand Down

0 comments on commit 9f5a9e1

Please sign in to comment.