Skip to content

Commit

Permalink
feat(protocol-designer): hook up heater shaker command creator (#9896)
Browse files Browse the repository at this point in the history
* feat(protocol-designer): hook up heater shaker command creator
shlokamin authored Apr 7, 2022
1 parent 16a85cd commit 443afa1
Showing 3 changed files with 22 additions and 8 deletions.
7 changes: 7 additions & 0 deletions protocol-designer/src/file-data/selectors/commands.ts
Original file line number Diff line number Diff line change
@@ -148,7 +148,14 @@ export const commandCreatorFromStepArgs = (
StepGeneration.thermocyclerStateStep,
args
)
case 'heaterShaker':
return StepGeneration.curryCommandCreator(
StepGeneration.heaterShaker,
args
)
}
// @ts-expect-error we've exhausted all command creators, but keeping this console warn
// for when we impelement the next command creator
console.warn(`unhandled commandCreatorFnName: ${args.commandCreatorFnName}`)
return null
}
22 changes: 14 additions & 8 deletions step-generation/src/commandCreators/atomic/awaitTemperature.ts
Original file line number Diff line number Diff line change
@@ -14,17 +14,19 @@ export const awaitTemperature: CommandCreator<AwaitTemperatureArgs> = (
prevRobotState
) => {
const { module, temperature } = args
const tempModState = module ? getModuleState(prevRobotState, module) : null
const moduleState = module ? getModuleState(prevRobotState, module) : null

if (module === null || !tempModState) {
if (module === null || !moduleState) {
return {
errors: [errorCreators.missingModuleError()],
}
}

if (tempModState.type !== TEMPERATURE_MODULE_TYPE) {
if (
moduleState.type !== TEMPERATURE_MODULE_TYPE &&
moduleState.type !== HEATERSHAKER_MODULE_TYPE
) {
console.error(
`expected module to be ${TEMPERATURE_MODULE_TYPE} but got ${tempModState.type}`
`expected module to be ${TEMPERATURE_MODULE_TYPE} but got ${moduleState.type}`
)
return {
errors: [errorCreators.missingModuleError()],
@@ -36,10 +38,14 @@ export const awaitTemperature: CommandCreator<AwaitTemperatureArgs> = (
// this means the temp mod will not change its temp, since it is already
// at the target temp, so the new await temp will never be reached
const unreachableTemp =
tempModState.status === TEMPERATURE_AT_TARGET &&
tempModState.targetTemperature !== temperature
'status' in moduleState &&
moduleState.status === TEMPERATURE_AT_TARGET &&
moduleState.targetTemperature !== temperature

if (unreachableTemp || tempModState.status === TEMPERATURE_DEACTIVATED) {
if (
unreachableTemp ||
('status' in moduleState && moduleState.status === TEMPERATURE_DEACTIVATED)
) {
return {
errors: [errorCreators.missingTemperatureStep()],
}
1 change: 1 addition & 0 deletions step-generation/src/index.ts
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@ export {
thermocyclerStateStep,
touchTip,
transfer,
heaterShaker,
} from './commandCreators'

export * from './robotStateSelectors'

0 comments on commit 443afa1

Please sign in to comment.