diff --git a/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/RunHeaderContent/ActionButton/index.tsx b/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/RunHeaderContent/ActionButton/index.tsx index 4b8c0f68076..babdea8d8a9 100644 --- a/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/RunHeaderContent/ActionButton/index.tsx +++ b/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/RunHeaderContent/ActionButton/index.tsx @@ -75,16 +75,19 @@ export function ActionButton(props: ActionButtonProps): JSX.Element { const isValidRunAgain = isRunAgainStatus(runStatus) const { isClosingCurrentRun } = useCloseCurrentRun() - const { isDisabled, disabledReason } = useActionBtnDisabledUtils({ - isCurrentRun, - isSetupComplete, - isOtherRunCurrent, - isProtocolNotReady, - isRobotOnWrongVersionOfSoftware, - isValidRunAgain, - isClosingCurrentRun, - ...props, - }) + // const { isDisabled, disabledReason } = useActionBtnDisabledUtils({ + // isCurrentRun, + // isSetupComplete, + // isOtherRunCurrent, + // isProtocolNotReady, + // isRobotOnWrongVersionOfSoftware, + // isValidRunAgain, + // isClosingCurrentRun, + // ...props, + // }) + + const isDisabled = false + const disabledReason = '' const robot = useRobot(robotName) const robotSerialNumber = getFallbackRobotSerialNumber(robot) diff --git a/app/src/organisms/ErrorRecoveryFlows/hooks/__tests__/useHomeGripperZAxis.test.ts b/app/src/organisms/ErrorRecoveryFlows/hooks/__tests__/useHomeGripperZAxis.test.ts index 197dfbfd3e7..953e3d612d0 100644 --- a/app/src/organisms/ErrorRecoveryFlows/hooks/__tests__/useHomeGripperZAxis.test.ts +++ b/app/src/organisms/ErrorRecoveryFlows/hooks/__tests__/useHomeGripperZAxis.test.ts @@ -1,12 +1,12 @@ import { renderHook, act } from '@testing-library/react' import { describe, it, expect, vi, beforeEach } from 'vitest' -import { useHomeGripperZAxis } from '../useHomeGripperZAxis' +import { useHomeGripper } from '../useHomeGripperZAxis' import { RECOVERY_MAP } from '/app/organisms/ErrorRecoveryFlows/constants' -describe('useHomeGripperZAxis', () => { +describe('useHomeGripper', () => { const mockRecoveryCommands = { - homeGripperZAxis: vi.fn().mockResolvedValue(undefined), + homeGripper: vi.fn().mockResolvedValue(undefined), } const mockRouteUpdateActions = { @@ -28,7 +28,7 @@ describe('useHomeGripperZAxis', () => { it('should home gripper Z axis when in manual gripper step and door is closed', async () => { renderHook(() => { - useHomeGripperZAxis({ + useHomeGripper({ recoveryCommands: mockRecoveryCommands, routeUpdateActions: mockRouteUpdateActions, recoveryMap: mockRecoveryMap, @@ -43,7 +43,7 @@ describe('useHomeGripperZAxis', () => { expect(mockRouteUpdateActions.handleMotionRouting).toHaveBeenCalledWith( true ) - expect(mockRecoveryCommands.homeGripperZAxis).toHaveBeenCalled() + expect(mockRecoveryCommands.homeGripper).toHaveBeenCalled() expect(mockRouteUpdateActions.handleMotionRouting).toHaveBeenCalledWith( false ) @@ -51,7 +51,7 @@ describe('useHomeGripperZAxis', () => { it('should go back to previous step when door is open', () => { renderHook(() => { - useHomeGripperZAxis({ + useHomeGripper({ recoveryCommands: mockRecoveryCommands, routeUpdateActions: mockRouteUpdateActions, recoveryMap: mockRecoveryMap, @@ -60,12 +60,12 @@ describe('useHomeGripperZAxis', () => { }) expect(mockRouteUpdateActions.goBackPrevStep).toHaveBeenCalled() - expect(mockRecoveryCommands.homeGripperZAxis).not.toHaveBeenCalled() + expect(mockRecoveryCommands.homeGripper).not.toHaveBeenCalled() }) it('should not home again if already homed once', async () => { const { rerender } = renderHook(() => { - useHomeGripperZAxis({ + useHomeGripper({ recoveryCommands: mockRecoveryCommands, routeUpdateActions: mockRouteUpdateActions, recoveryMap: mockRecoveryMap, @@ -77,17 +77,17 @@ describe('useHomeGripperZAxis', () => { await new Promise(resolve => setTimeout(resolve, 0)) }) - expect(mockRecoveryCommands.homeGripperZAxis).toHaveBeenCalledTimes(1) + expect(mockRecoveryCommands.homeGripper).toHaveBeenCalledTimes(1) rerender() - expect(mockRecoveryCommands.homeGripperZAxis).toHaveBeenCalledTimes(1) + expect(mockRecoveryCommands.homeGripper).toHaveBeenCalledTimes(1) }) it('should reset hasHomedOnce when step changes to non-manual gripper step and back', async () => { const { rerender } = renderHook( ({ recoveryMap }) => { - useHomeGripperZAxis({ + useHomeGripper({ recoveryCommands: mockRecoveryCommands, routeUpdateActions: mockRouteUpdateActions, recoveryMap, @@ -103,7 +103,7 @@ describe('useHomeGripperZAxis', () => { await new Promise(resolve => setTimeout(resolve, 0)) }) - expect(mockRecoveryCommands.homeGripperZAxis).toHaveBeenCalledTimes(1) + expect(mockRecoveryCommands.homeGripper).toHaveBeenCalledTimes(1) rerender({ recoveryMap: { step: 'SOME_OTHER_STEP' } as any }) @@ -117,6 +117,6 @@ describe('useHomeGripperZAxis', () => { await new Promise(resolve => setTimeout(resolve, 0)) }) - expect(mockRecoveryCommands.homeGripperZAxis).toHaveBeenCalledTimes(2) + expect(mockRecoveryCommands.homeGripper).toHaveBeenCalledTimes(2) }) }) diff --git a/app/src/organisms/ErrorRecoveryFlows/hooks/__tests__/useRecoveryCommands.test.ts b/app/src/organisms/ErrorRecoveryFlows/hooks/__tests__/useRecoveryCommands.test.ts index 11a15edfbfd..c0e052565a5 100644 --- a/app/src/organisms/ErrorRecoveryFlows/hooks/__tests__/useRecoveryCommands.test.ts +++ b/app/src/organisms/ErrorRecoveryFlows/hooks/__tests__/useRecoveryCommands.test.ts @@ -264,11 +264,11 @@ describe('useRecoveryCommands', () => { ) }) - it('should call homeGripperZAxis and resolve the promise', async () => { + it('should call useHomeGripper and resolve the promise', async () => { const { result } = renderHook(() => useRecoveryCommands(props)) await act(async () => { - await result.current.homeGripperZAxis() + await result.current.homeGripper() }) expect(mockChainRunCommands).toHaveBeenCalledWith( diff --git a/app/src/organisms/ErrorRecoveryFlows/hooks/index.ts b/app/src/organisms/ErrorRecoveryFlows/hooks/index.ts index baa685c0dcc..b63f02d9a17 100644 --- a/app/src/organisms/ErrorRecoveryFlows/hooks/index.ts +++ b/app/src/organisms/ErrorRecoveryFlows/hooks/index.ts @@ -5,7 +5,7 @@ export { useRouteUpdateActions } from './useRouteUpdateActions' export { useERUtils } from './useERUtils' export { useRecoveryTakeover } from './useRecoveryTakeover' export { useRetainedFailedCommandBySource } from './useRetainedFailedCommandBySource' -export { useHomeGripperZAxis } from './useHomeGripperZAxis' +export { useHomeGripper } from './useHomeGripperZAxis' export type { ERUtilsProps } from './useERUtils' export type { UseRouteUpdateActionsResult } from './useRouteUpdateActions' diff --git a/app/src/organisms/ErrorRecoveryFlows/hooks/useHomeGripperZAxis.ts b/app/src/organisms/ErrorRecoveryFlows/hooks/useHomeGripperZAxis.ts index 649fb801d44..36ce031a7fd 100644 --- a/app/src/organisms/ErrorRecoveryFlows/hooks/useHomeGripperZAxis.ts +++ b/app/src/organisms/ErrorRecoveryFlows/hooks/useHomeGripperZAxis.ts @@ -4,7 +4,7 @@ import { RECOVERY_MAP } from '/app/organisms/ErrorRecoveryFlows/constants' import type { ErrorRecoveryWizardProps } from '/app/organisms/ErrorRecoveryFlows/ErrorRecoveryWizard' // Home the gripper z-axis implicitly. Because the z-home is not tied to a CTA, it must be handled here. -export function useHomeGripperZAxis({ +export function useHomeGripper({ recoveryCommands, routeUpdateActions, recoveryMap, @@ -20,7 +20,7 @@ export function useHomeGripperZAxis({ useLayoutEffect(() => { const { handleMotionRouting, goBackPrevStep } = routeUpdateActions - const { homeGripperZAxis } = recoveryCommands + const { homeGripper } = recoveryCommands if (!hasHomedOnce) { if (isManualGripperStep) { @@ -28,7 +28,7 @@ export function useHomeGripperZAxis({ void goBackPrevStep() } else { void handleMotionRouting(true) - .then(() => homeGripperZAxis()) + .then(() => homeGripper()) .then(() => { setHasHomedOnce(true) }) diff --git a/app/src/organisms/ErrorRecoveryFlows/hooks/useRecoveryCommands.ts b/app/src/organisms/ErrorRecoveryFlows/hooks/useRecoveryCommands.ts index f0962b07693..a274249cac1 100644 --- a/app/src/organisms/ErrorRecoveryFlows/hooks/useRecoveryCommands.ts +++ b/app/src/organisms/ErrorRecoveryFlows/hooks/useRecoveryCommands.ts @@ -63,7 +63,7 @@ export interface UseRecoveryCommandsResult { /* A non-terminal recovery command */ releaseGripperJaws: () => Promise /* A non-terminal recovery command */ - homeGripperZAxis: () => Promise + homeGripper: () => Promise /* A non-terminal recovery command */ moveLabwareWithoutPause: () => Promise } @@ -269,8 +269,12 @@ export function useRecoveryCommands({ return chainRunRecoveryCommands([RELEASE_GRIPPER_JAW]) }, [chainRunRecoveryCommands]) - const homeGripperZAxis = useCallback((): Promise => { - return chainRunRecoveryCommands([HOME_GRIPPER_Z_AXIS]) + const homeGripper = useCallback((): Promise => { + const gripperAxis = + failedCommandByRunRecord?.error?.errorCode === '2003' + ? HOME_GRIPPER + : HOME_GRIPPER_Z_AXIS + return chainRunRecoveryCommands([gripperAxis]) }, [chainRunRecoveryCommands]) const moveLabwareWithoutPause = useCallback((): Promise => { @@ -291,7 +295,7 @@ export function useRecoveryCommands({ homePipetteZAxes, pickUpTips, releaseGripperJaws, - homeGripperZAxis, + homeGripper, moveLabwareWithoutPause, skipFailedCommand, ignoreErrorKindThisRun, @@ -316,6 +320,12 @@ export const HOME_GRIPPER_Z_AXIS: CreateCommand = { intent: 'fixit', } +export const HOME_GRIPPER: CreateCommand = { + commandType: 'home', + params: { axes: ['extensionZ', 'extensionJaw'] }, + intent: 'fixit', +} + const buildMoveLabwareWithoutPause = ( failedCommand: FailedCommand | null ): CreateCommand | null => {