diff --git a/step-generation/src/__tests__/dispenseUpdateLiquidState.test.ts b/step-generation/src/__tests__/dispenseUpdateLiquidState.test.ts index 928a3eb281e..d24ed0a4c21 100644 --- a/step-generation/src/__tests__/dispenseUpdateLiquidState.test.ts +++ b/step-generation/src/__tests__/dispenseUpdateLiquidState.test.ts @@ -8,7 +8,12 @@ import merge from 'lodash/merge' import omit from 'lodash/omit' import produce from 'immer' import { createEmptyLiquidState, createTipLiquidState } from '../utils' -import { makeContext, DEFAULT_PIPETTE, SOURCE_LABWARE } from '../fixtures' +import { + makeContext, + DEFAULT_PIPETTE, + SOURCE_LABWARE, + getInitialRobotStateStandard, +} from '../fixtures' import { dispenseUpdateLiquidState, @@ -33,6 +38,10 @@ beforeEach(() => { useFullVolume: false, labwareId: SOURCE_LABWARE, wellName: 'A1', + robotStateAndWarnings: { + robotState: getInitialRobotStateStandard(invariantContext), + warnings: [], + }, } }) @@ -396,6 +405,10 @@ describe('...8-channel pipette', () => { useFullVolume: false, volume: 150, wellName: 'A1', + robotStateAndWarnings: { + robotState: getInitialRobotStateStandard(invariantContext), + warnings: [], + }, }, initialLiquidState ) diff --git a/step-generation/src/getNextRobotStateAndWarnings/dispenseUpdateLiquidState.ts b/step-generation/src/getNextRobotStateAndWarnings/dispenseUpdateLiquidState.ts index cf27f155d05..84d26e219c1 100644 --- a/step-generation/src/getNextRobotStateAndWarnings/dispenseUpdateLiquidState.ts +++ b/step-generation/src/getNextRobotStateAndWarnings/dispenseUpdateLiquidState.ts @@ -1,6 +1,6 @@ -import assert from 'assert' import mapValues from 'lodash/mapValues' import reduce from 'lodash/reduce' +import { COLUMN } from '@opentrons/shared-data' import { splitLiquid, mergeLiquid, @@ -12,7 +12,9 @@ import type { InvariantContext, LocationLiquidState, SourceAndDest, + RobotStateAndWarnings, } from '../types' + type LiquidState = RobotState['liquidState'] export interface DispenseUpdateLiquidStateArgs { invariantContext: InvariantContext @@ -20,6 +22,7 @@ export interface DispenseUpdateLiquidStateArgs { pipetteId: string // volume value is required when useFullVolume is false useFullVolume: boolean + robotStateAndWarnings: RobotStateAndWarnings wellName?: string labwareId?: string volume?: number @@ -30,6 +33,7 @@ export function dispenseUpdateLiquidState( args: DispenseUpdateLiquidStateArgs ): void { const { + robotStateAndWarnings, invariantContext, labwareId, pipetteId, @@ -39,6 +43,8 @@ export function dispenseUpdateLiquidState( wellName, } = args const pipetteSpec = invariantContext.pipetteEntities[pipetteId].spec + const nozzles = robotStateAndWarnings.robotState.pipettes[pipetteId].nozzles + const channels = nozzles === COLUMN ? 8 : pipetteSpec.channels const trashId = Object.values( invariantContext.additionalEquipmentEntities ).find(aE => aE.name === 'wasteChute' || aE.name === 'trashBin')?.id @@ -59,17 +65,17 @@ export function dispenseUpdateLiquidState( const labwareDef = labwareId != null ? invariantContext.labwareEntities[labwareId].def : null - assert( + console.assert( !(useFullVolume && typeof volume === 'number'), 'dispenseUpdateLiquidState takes either `volume` or `useFullVolume`, but got both' ) - assert( + console.assert( typeof volume === 'number' || useFullVolume, 'in dispenseUpdateLiquidState, either volume or useFullVolume are required' ) const { wellsForTips, allWellsShared } = labwareDef != null && wellName != null - ? getWellsForTips(pipetteSpec.channels, labwareDef, wellName) + ? getWellsForTips(channels, labwareDef, wellName) : { wellsForTips: null, allWellsShared: true } const liquidLabware = diff --git a/step-generation/src/getNextRobotStateAndWarnings/forAspirate.ts b/step-generation/src/getNextRobotStateAndWarnings/forAspirate.ts index 62cd0348ded..e8572dd77fc 100644 --- a/step-generation/src/getNextRobotStateAndWarnings/forAspirate.ts +++ b/step-generation/src/getNextRobotStateAndWarnings/forAspirate.ts @@ -1,4 +1,3 @@ -import assert from 'assert' import range from 'lodash/range' import isEmpty from 'lodash/isEmpty' import uniq from 'lodash/uniq' @@ -32,7 +31,7 @@ export function forAspirate( params.wellName ) - assert( + console.assert( // @ts-expect-error (sa, 2021-05-03): this assert is unnecessary uniq(wellsForTips).length === allWellsShared ? 1 : wellsForTips.length, `expected all wells to be shared, or no wells to be shared. Got: ${JSON.stringify( diff --git a/step-generation/src/getNextRobotStateAndWarnings/forBlowout.ts b/step-generation/src/getNextRobotStateAndWarnings/forBlowout.ts index 2bcffe0bc23..13a2470854e 100644 --- a/step-generation/src/getNextRobotStateAndWarnings/forBlowout.ts +++ b/step-generation/src/getNextRobotStateAndWarnings/forBlowout.ts @@ -15,5 +15,6 @@ export function forBlowout( wellName, prevLiquidState: robotState.liquidState, invariantContext, + robotStateAndWarnings, }) } diff --git a/step-generation/src/getNextRobotStateAndWarnings/forDispense.ts b/step-generation/src/getNextRobotStateAndWarnings/forDispense.ts index 8b08591ea84..6ffaa3da814 100644 --- a/step-generation/src/getNextRobotStateAndWarnings/forDispense.ts +++ b/step-generation/src/getNextRobotStateAndWarnings/forDispense.ts @@ -16,5 +16,6 @@ export function forDispense( useFullVolume: false, volume, wellName, + robotStateAndWarnings, }) } diff --git a/step-generation/src/getNextRobotStateAndWarnings/forDropTip.ts b/step-generation/src/getNextRobotStateAndWarnings/forDropTip.ts index 7ada991f2e4..d389b50f9ff 100644 --- a/step-generation/src/getNextRobotStateAndWarnings/forDropTip.ts +++ b/step-generation/src/getNextRobotStateAndWarnings/forDropTip.ts @@ -20,6 +20,7 @@ export function forDropTip( labwareId, useFullVolume: true, wellName, + robotStateAndWarnings, }) robotState.tipState.pipettes[pipetteId] = false } diff --git a/step-generation/src/getNextRobotStateAndWarnings/inPlaceCommandUpdates.ts b/step-generation/src/getNextRobotStateAndWarnings/inPlaceCommandUpdates.ts index e14b1b37344..18cb8ead615 100644 --- a/step-generation/src/getNextRobotStateAndWarnings/inPlaceCommandUpdates.ts +++ b/step-generation/src/getNextRobotStateAndWarnings/inPlaceCommandUpdates.ts @@ -27,6 +27,7 @@ export const forDispenseInPlace = ( prevLiquidState: robotState.liquidState, useFullVolume: false, volume, + robotStateAndWarnings, }) } @@ -42,6 +43,7 @@ export const forBlowOutInPlace = ( pipetteId, prevLiquidState: robotState.liquidState, useFullVolume: true, + robotStateAndWarnings, }) } @@ -59,5 +61,6 @@ export const forDropTipInPlace = ( prevLiquidState: robotState.liquidState, pipetteId, useFullVolume: true, + robotStateAndWarnings, }) }