Skip to content

Commit 1f240e0

Browse files
committed
clean up logic for hard-coded trashBin and wasteChute
1 parent c2ce56d commit 1f240e0

File tree

2 files changed

+20
-34
lines changed

2 files changed

+20
-34
lines changed

protocol-designer/fixtures/protocol/8/thermocyclerOnOt2V7MigratedToV8.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
"733ba018-3550-476c-9fa3-0b5259d1a1d6": "left"
9797
},
9898
"trashBinLocationUpdate": {
99-
"dc2c4599-29b3-4ec8-adff-56677ac0821e:fixedTrash": "cutout12"
99+
"dc2c4599-29b3-4ec8-adff-56677ac0821e:trashBin": "cutout12"
100100
},
101101
"wasteChuteLocationUpdate": {},
102102
"stagingAreaLocationUpdate": {},

protocol-designer/src/load-file/migration/utils/getAdditionalEquipmentLocationUpdate.ts

+19-33
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,6 @@ export const getAdditionalEquipmentLocationUpdate = (
157157
)
158158
: null
159159

160-
if (trashBinCommand == null && robotType === OT2_ROBOT_TYPE) {
161-
console.error(
162-
'expected to find a fixedTrash command for the OT-2 but could not'
163-
)
164-
}
165-
166160
const moveLiquidStepWasteChute =
167161
savedStepForms != null
168162
? Object.values(savedStepForms).find(
@@ -211,7 +205,7 @@ export const getAdditionalEquipmentLocationUpdate = (
211205
}
212206
: {}
213207

214-
const hardcodedTrashBinIdOt2 = `${uuid()}:fixedTrash`
208+
const hardcodedTrashBinIdOt2 = `${uuid()}:trashBin`
215209
const hardcodedTrashBinOt2 = {
216210
[hardcodedTrashBinIdOt2]: getCutoutIdByAddressableArea(
217211
'fixedTrash' as AddressableAreaName,
@@ -220,30 +214,6 @@ export const getAdditionalEquipmentLocationUpdate = (
220214
),
221215
}
222216

223-
const hardcodedTrashAddressableAreaName =
224-
unoccupiedSlotForTrash === WASTE_CHUTE_CUTOUT
225-
? 'wasteChute'
226-
: `movableTrash${unoccupiedSlotForTrash}`
227-
228-
const hardcodedTrashIdFlex = `${uuid()}:${hardcodedTrashAddressableAreaName}`
229-
230-
const hardCodedTrashLocation =
231-
unoccupiedSlotForTrash === ''
232-
? ''
233-
: unoccupiedSlotForTrash === WASTE_CHUTE_CUTOUT
234-
? WASTE_CHUTE_CUTOUT
235-
: getCutoutIdByAddressableArea(
236-
hardcodedTrashAddressableAreaName as AddressableAreaName,
237-
'trashBinAdapter',
238-
FLEX_ROBOT_TYPE
239-
)
240-
241-
const hardcodedTrashFlex = {
242-
[hardcodedTrashIdFlex]: hasWasteChuteCommands
243-
? WASTE_CHUTE_CUTOUT
244-
: hardCodedTrashLocation,
245-
}
246-
247217
let trashBinLocationUpdate: LocationUpdate = hasWasteChuteCommands
248218
? {}
249219
: hardcodedTrashBinOt2
@@ -252,11 +222,27 @@ export const getAdditionalEquipmentLocationUpdate = (
252222
trashBinLocationUpdate = {
253223
[trashBinId]: trashCutoutId as string,
254224
}
225+
// in case the user has no pipetting steps, auto-generate a trashBin or wasteChute entity for Flex
255226
} else if (isFlex && !hasWasteChuteCommands) {
227+
const hardCodedTrashIdFlex = `${uuid()}:movableTrash${unoccupiedSlotForTrash}`
228+
const hardCodedWasteChuteId = `${uuid()}:wasteChute`
229+
256230
trashBinLocationUpdate =
257-
unoccupiedSlotForTrash === WASTE_CHUTE_CUTOUT ? {} : hardcodedTrashFlex
231+
unoccupiedSlotForTrash === WASTE_CHUTE_CUTOUT
232+
? {}
233+
: {
234+
[hardCodedTrashIdFlex]: getCutoutIdByAddressableArea(
235+
`movableTrash${unoccupiedSlotForTrash}` as AddressableAreaName,
236+
'trashBinAdapter',
237+
FLEX_ROBOT_TYPE
238+
),
239+
}
258240
wasteChuteLocationUpdate =
259-
unoccupiedSlotForTrash === WASTE_CHUTE_CUTOUT ? hardcodedTrashFlex : {}
241+
unoccupiedSlotForTrash === WASTE_CHUTE_CUTOUT
242+
? {
243+
[hardCodedWasteChuteId]: WASTE_CHUTE_CUTOUT,
244+
}
245+
: {}
260246
}
261247

262248
const stagingAreaLocationUpdate: LocationUpdate = stagingAreaSlotNames.reduce(

0 commit comments

Comments
 (0)