Skip to content

Commit e520e41

Browse files
authored
fix(step-generation): add wait for temperature timeline warning (#16581)
closes RESC-329 AUTH-891
1 parent 4887bd5 commit e520e41

File tree

6 files changed

+46
-9
lines changed

6 files changed

+46
-9
lines changed

protocol-designer/src/assets/localization/en/alert.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,10 @@
219219
"TIPRACK_IN_WASTE_CHUTE_HAS_TIPS": {
220220
"title": "Disposing unused tips",
221221
"body": "This step moves a tip rack that contains unused tips to the waste chute. There is no way to retrieve the tips after disposal."
222+
},
223+
"TEMPERATURE_IS_POTENTIALLY_UNREACHABLE": {
224+
"title": "The pause temperature is potentially unreachable",
225+
"body": "This step tries to set the module temperature but it can possibly not be reached, resulting in your protocol running forever."
222226
}
223227
}
224228
},

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ describe('moveLabware', () => {
372372
)
373373
expect(result.warnings).toEqual([
374374
{
375-
message: 'Disposing of a tiprack with tips',
375+
message: 'Disposing unused tips',
376376
type: 'TIPRACK_IN_WASTE_CHUTE_HAS_TIPS',
377377
},
378378
])

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ describe('waitForTemperature', () => {
4646
invariantContext = stateAndContext.invariantContext
4747
robotState = stateAndContext.robotState
4848
})
49-
it('temperature module id exists and temp status is approaching temp', () => {
49+
it('temperature module id exists and temp status is approaching temp with a warning that the temp might not be hit', () => {
5050
const temperature = 20
5151
const args: WaitForTemperatureArgs = {
5252
module: temperatureModuleId,
@@ -70,6 +70,12 @@ describe('waitForTemperature', () => {
7070
},
7171
},
7272
],
73+
warnings: [
74+
{
75+
type: 'TEMPERATURE_IS_POTENTIALLY_UNREACHABLE',
76+
message: expect.any(String),
77+
},
78+
],
7379
}
7480
const result = waitForTemperature(
7581
args,

step-generation/src/commandCreators/atomic/waitForTemperature.ts

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,19 @@ import {
33
TEMPERATURE_MODULE_TYPE,
44
} from '@opentrons/shared-data'
55
import { uuid } from '../../utils'
6-
import { TEMPERATURE_AT_TARGET, TEMPERATURE_DEACTIVATED } from '../../constants'
7-
import * as errorCreators from '../../errorCreators'
8-
import type { CommandCreator, WaitForTemperatureArgs } from '../../types'
6+
import {
7+
TEMPERATURE_APPROACHING_TARGET,
8+
TEMPERATURE_AT_TARGET,
9+
TEMPERATURE_DEACTIVATED,
10+
} from '../../constants'
911
import { getModuleState } from '../../robotStateSelectors'
12+
import * as errorCreators from '../../errorCreators'
13+
import * as warningCreators from '../../warningCreators'
14+
import type {
15+
CommandCreator,
16+
CommandCreatorWarning,
17+
WaitForTemperatureArgs,
18+
} from '../../types'
1019

1120
/** Set temperature target for specified module. */
1221
export const waitForTemperature: CommandCreator<WaitForTemperatureArgs> = (
@@ -16,6 +25,7 @@ export const waitForTemperature: CommandCreator<WaitForTemperatureArgs> = (
1625
) => {
1726
const { module, temperature } = args
1827
const moduleState = module ? getModuleState(prevRobotState, module) : null
28+
const warnings: CommandCreatorWarning[] = []
1929

2030
if (module === null || !moduleState) {
2131
return {
@@ -42,6 +52,10 @@ export const waitForTemperature: CommandCreator<WaitForTemperatureArgs> = (
4252
'status' in moduleState &&
4353
moduleState.status === TEMPERATURE_AT_TARGET &&
4454
moduleState.targetTemperature !== temperature
55+
const potentiallyUnreachableTemp =
56+
'status' in moduleState &&
57+
moduleState.status === TEMPERATURE_APPROACHING_TARGET &&
58+
moduleState.targetTemperature !== temperature
4559

4660
if (
4761
unreachableTemp ||
@@ -52,6 +66,10 @@ export const waitForTemperature: CommandCreator<WaitForTemperatureArgs> = (
5266
}
5367
}
5468

69+
if (potentiallyUnreachableTemp) {
70+
warnings.push(warningCreators.potentiallyUnreachableTemp())
71+
}
72+
5573
const moduleType = invariantContext.moduleEntities[module]?.type
5674

5775
switch (moduleType) {
@@ -67,6 +85,7 @@ export const waitForTemperature: CommandCreator<WaitForTemperatureArgs> = (
6785
},
6886
},
6987
],
88+
warnings: warnings.length > 0 ? warnings : undefined,
7089
}
7190

7291
case HEATERSHAKER_MODULE_TYPE:
@@ -81,6 +100,7 @@ export const waitForTemperature: CommandCreator<WaitForTemperatureArgs> = (
81100
},
82101
},
83102
],
103+
warnings: warnings.length > 0 ? warnings : undefined,
84104
}
85105

86106
default:

step-generation/src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,7 @@ export type WarningType =
575575
| 'ASPIRATE_FROM_PRISTINE_WELL'
576576
| 'LABWARE_IN_WASTE_CHUTE_HAS_LIQUID'
577577
| 'TIPRACK_IN_WASTE_CHUTE_HAS_TIPS'
578+
| 'TEMPERATURE_IS_POTENTIALLY_UNREACHABLE'
578579

579580
export interface CommandCreatorWarning {
580581
message: string

step-generation/src/warningCreators.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@ import type { CommandCreatorWarning } from './types'
22
export function aspirateMoreThanWellContents(): CommandCreatorWarning {
33
return {
44
type: 'ASPIRATE_MORE_THAN_WELL_CONTENTS',
5-
message: 'Not enough liquid in well(s)',
5+
message: 'Not enough liquid',
66
}
77
}
88
export function aspirateFromPristineWell(): CommandCreatorWarning {
99
return {
1010
type: 'ASPIRATE_FROM_PRISTINE_WELL',
11-
message:
12-
'Aspirating from a pristine well. No liquids were ever added to this well',
11+
message: 'This step tries to aspirate from an empty well.',
1312
}
1413
}
1514
export function labwareInWasteChuteHasLiquid(): CommandCreatorWarning {
@@ -21,6 +20,13 @@ export function labwareInWasteChuteHasLiquid(): CommandCreatorWarning {
2120
export function tiprackInWasteChuteHasTips(): CommandCreatorWarning {
2221
return {
2322
type: 'TIPRACK_IN_WASTE_CHUTE_HAS_TIPS',
24-
message: 'Disposing of a tiprack with tips',
23+
message: 'Disposing unused tips',
24+
}
25+
}
26+
27+
export function potentiallyUnreachableTemp(): CommandCreatorWarning {
28+
return {
29+
type: 'TEMPERATURE_IS_POTENTIALLY_UNREACHABLE',
30+
message: 'The module set temperature is potentially unreachable.',
2531
}
2632
}

0 commit comments

Comments
 (0)