Skip to content

Commit d11b8cd

Browse files
committed
feat(step-generation): error for full hopper
1 parent f2f0b12 commit d11b8cd

File tree

3 files changed

+62
-0
lines changed

3 files changed

+62
-0
lines changed

step-generation/src/__tests__/flexStackerStore.test.ts

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,4 +218,56 @@ describe('flexStackerStore', () => {
218218
type: 'MISMATCHED_STACKER_LABWARE_TYPE',
219219
})
220220
})
221+
it ('raises an error if the hopper is full', () => {
222+
vi.mocked(flexStackerStateGetter).mockReturnValue({
223+
labwareOnShuttle: {
224+
primaryLabwareId: 'mockLabwareId',
225+
adapterLabwareId: null,
226+
lidLabwareId: null,
227+
},
228+
labwareInHopper: [
229+
{
230+
primaryLabwareId: 'mockLabwareId',
231+
adapterLabwareId: null,
232+
lidLabwareId: null,
233+
},
234+
],
235+
maxPoolCount: 10,
236+
storedLabwareDetails: {
237+
moduleId,
238+
initialCount: 10,
239+
primaryLabware: {
240+
loadName: 'fixture_96_plate',
241+
namespace: 'opentrons',
242+
version: 1,
243+
},
244+
lidLabware: null,
245+
adapterLabware: null,
246+
},
247+
type: FLEX_STACKER_MODULE_TYPE,
248+
} as FlexStackerModuleState)
249+
const fullRobotState = {
250+
...robotState,
251+
modules: {
252+
[moduleId]: {
253+
slot: 'D3',
254+
moduleState: {} as FlexStackerModuleState,
255+
},
256+
},
257+
labware: {
258+
mockLabwareId: {
259+
stack: ['mockLabwareId', 'D3'],
260+
},
261+
},
262+
}
263+
const result = flexStackerStore(
264+
{ moduleId, strategy: 'automatic' },
265+
invariantContext,
266+
fullRobotState
267+
)
268+
expect(getErrorResult(result).errors[0]).toMatchObject({
269+
type: 'HOPPER_FULL',
270+
})
271+
})
272+
221273
})

step-generation/src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,7 @@ export type ErrorType =
752752
| 'HEATER_SHAKER_NORTH_SOUTH__OF_NON_TIPRACK_WITH_MULTI_CHANNEL'
753753
| 'HEATER_SHAKER_NORTH_SOUTH_EAST_WEST_SHAKING'
754754
| 'HOPPER_EMPTY'
755+
| 'HOPPER_FULL'
755756
| 'INSUFFICIENT_TIPS'
756757
| 'INVALID_SLOT'
757758
| 'LABWARE_DISCARDED_IN_TRASH'

step-generation/src/utils/misc.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1382,3 +1382,12 @@ export const labwareMatchesLabwareInHopper = (
13821382
const labwareToBeStored = def.parameters.loadName
13831383
return loadedLabware === labwareToBeStored
13841384
}
1385+
1386+
export const spaceInHopper = (
1387+
stackerState: FlexStackerModuleState | null
1388+
) : boolean => {
1389+
const maximumAllowedLabware = stackerState?.maxPoolCount ?? 0
1390+
const labwareStored = stackerState?.labwareInHopper
1391+
const numberOfLabwareStored = labwareStored?.length ?? 0
1392+
return (numberOfLabwareStored + 1) < maximumAllowedLabware
1393+
}

0 commit comments

Comments
 (0)