Skip to content

Commit

Permalink
save
Browse files Browse the repository at this point in the history
  • Loading branch information
vegano1 committed Oct 22, 2024
1 parent c7e8264 commit 2a7a4b4
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 5 deletions.
9 changes: 9 additions & 0 deletions api-client/src/runs/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import type {
RunTimeCommand,
RunTimeParameter,
NozzleLayoutConfig,
LabwareLocation,
} from '@opentrons/shared-data'
import type { ResourceLink, ErrorDetails } from '../types'
export * from './commands/types'
Expand Down Expand Up @@ -116,7 +117,9 @@ export interface Runs {
}

export interface RunCurrentStateData {
estopEngaged: boolean
activeNozzleLayouts: Record<string, NozzleLayoutValues> // keyed by pipetteId
placeLabwareState?: PlaceLabwareState
}

export const RUN_ACTION_TYPE_PLAY: 'play' = 'play'
Expand Down Expand Up @@ -201,3 +204,9 @@ export interface NozzleLayoutValues {
activeNozzles: string[]
config: NozzleLayoutConfig
}

export interface PlaceLabwareState {
labwareId: string
location: LabwareLocation
shouldPlaceDown: boolean
}
2 changes: 1 addition & 1 deletion app/src/organisms/EmergencyStop/EstopPressedModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ function TouchscreenModal({
data-testid="Estop_pressed_button"
width="100%"
iconName={
isResuming || isPlacing || isWaitingForLogicalDisengage || isWaitingForPlateReaderLidPlacement
isResuming || isPlacing || isWaitingForLogicalDisengage || isWaitingForPlateReaderLidPlacement
? 'ot-spinner'
: undefined
}
Expand Down
5 changes: 5 additions & 0 deletions app/src/organisms/EmergencyStop/EstopTakeover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ export function EstopTakeover({ robotName }: EstopTakeoverProps): JSX.Element {
isWaitingForLogicalDisengage,
setIsWaitingForLogicalDisengage,
] = useState<boolean>(false)
const [
isWaitingForPlateReaderLidPlacement,
setisWaitingForPlateReaderLidPlacement,

Check failure on line 32 in app/src/organisms/EmergencyStop/EstopTakeover.tsx

View workflow job for this annotation

GitHub Actions / js checks

'setisWaitingForPlateReaderLidPlacement' is assigned a value but never used
] = useState<boolean>(false)
const { data: estopStatus } = useEstopQuery({
refetchInterval: estopEngaged
? ESTOP_CURRENTLY_ENGAGED_REFETCH_INTERVAL_MS
Expand Down Expand Up @@ -65,6 +69,7 @@ export function EstopTakeover({ robotName }: EstopTakeoverProps): JSX.Element {
isDismissedModal={isEmergencyStopModalDismissed}
setIsDismissedModal={setIsEmergencyStopModalDismissed}
isWaitingForLogicalDisengage={isWaitingForLogicalDisengage}
isWaitingForPlateReaderLidPlacement={isWaitingForPlateReaderLidPlacement}
setShouldSeeLogicalDisengage={() => {
setIsWaitingForLogicalDisengage(true)
}}
Expand Down
23 changes: 19 additions & 4 deletions app/src/resources/modules/hooks/usePlacePlateReaderLid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import type {
UseRobotControlCommandsProps,
UseRobotControlCommandsResult,
} from '/app/resources/maintenance_runs'
import { useRunCurrentState } from '@opentrons/react-api-client'
import { useCurrentRunId } from '../../runs'

interface UsePlacePlateReaderLidResult {
isPlacing: UseRobotControlCommandsResult['isExecuting']
Expand All @@ -16,12 +18,15 @@ export type UsePlacePlateReaderLidProps = Pick<
'pipetteInfo' | 'onSettled'
>

// TODO: Need to conditionally run this function based on `runs/currentState` value
export function usePlacePlateReaderLid(
props: UsePlacePlateReaderLidProps
): UsePlacePlateReaderLidResult {
const labwareId: string = 'absorbanceReaderV1LidC3'
const location: LabwareLocation = {slotName: 'C3'}
const runId = useCurrentRunId()
const { data: runCurrentState } = useRunCurrentState(runId)
const estopEngaged = runCurrentState?.data.estopEngaged
const placeLabware = runCurrentState?.data.placeLabwareState?.shouldPlaceDown
const labwareId = runCurrentState?.data.placeLabwareState?.labwareId
const location = runCurrentState?.data.placeLabwareState?.location

const LOAD_PLATE_READER: CreateCommand = {

Check failure on line 31 in app/src/resources/modules/hooks/usePlacePlateReaderLid.ts

View workflow job for this annotation

GitHub Actions / js checks

Type '{ commandType: "loadModule"; params: { model: "absorbanceReaderV1"; location: LabwareLocation | undefined; }; }' is not assignable to type 'CreateCommand'.
commandType: 'loadModule' as const,
Expand All @@ -42,8 +47,18 @@ export function usePlacePlateReaderLid(
continuePastCommandFailure: true,
})

const decideFunction = (): void => {
console.log("DECIDE!")
if (estopEngaged != null && placeLabware) {
console.log("PLACE")
executeCommands()
} else {
console.log("DONT PLACE")
}
}

return {
isPlacing: isExecuting,
placeReaderLid: executeCommands,
placeReaderLid: decideFunction,

Check failure on line 62 in app/src/resources/modules/hooks/usePlacePlateReaderLid.ts

View workflow job for this annotation

GitHub Actions / js checks

Type '() => void' is not assignable to type '() => Promise<MaintenanceRun>'.
}
}

0 comments on commit 2a7a4b4

Please sign in to comment.