@@ -45,13 +45,10 @@ import { ChooseLocation } from './ChooseLocation'
4545import { JogToPosition } from './JogToPosition'
4646import { Success } from './Success'
4747
48- import type { PipetteData , CommandData } from '@opentrons/api-client'
48+ import type { PipetteData } from '@opentrons/api-client'
4949import type {
50- Coordinates ,
5150 PipetteModelSpecs ,
5251 RobotType ,
53- SavePositionRunTimeCommand ,
54- CreateCommand ,
5552 DeckConfiguration ,
5653 AddressableAreaName ,
5754} from '@opentrons/shared-data'
@@ -227,7 +224,6 @@ export const DropTipWizardComponent = (
227224 createMaintenanceRun,
228225 handleCleanUpAndClose,
229226 chainRunCommands,
230- // attachedInstrument,
231227 isRobotMoving,
232228 createRunCommand,
233229 setErrorMessage,
@@ -261,15 +257,7 @@ export const DropTipWizardComponent = (
261257
262258 const goBack = ( ) : void => {
263259 if ( createdMaintenanceRunId != null ) {
264- retractAllAxesAndSavePosition ( )
265- . then ( ( ) =>
266- setCurrentStepIndex (
267- isFinalStep ? currentStepIndex : currentStepIndex - 1
268- )
269- )
270- . catch ( ( e : Error ) =>
271- setErrorMessage ( `Error issuing jog command: ${ e . message } ` )
272- )
260+ setCurrentStepIndex ( isFinalStep ? currentStepIndex : currentStepIndex - 1 )
273261 }
274262 }
275263
@@ -303,103 +291,48 @@ export const DropTipWizardComponent = (
303291 cancel : cancelExit ,
304292 } = useConditionalConfirm ( handleCleanUpAndClose , true )
305293
306- const retractAllAxesAndSavePosition = ( ) : Promise < Coordinates | null > => {
307- if ( createdMaintenanceRunId == null )
308- return Promise . reject < Coordinates > (
309- new Error ( 'no maintenance run present to send move commands to' )
310- )
311- const commands : CreateCommand [ ] = [
312- {
313- commandType : 'home' as const ,
314- params : { axes : [ 'leftZ' , 'rightZ' , 'x' , 'y' ] } ,
315- } ,
316- {
317- commandType : 'savePosition' as const ,
318- params : {
319- pipetteId : MANAGED_PIPETTE_ID ,
320- failOnNotHomed : false ,
321- } ,
322- } ,
323- ]
324- return chainRunCommands ( createdMaintenanceRunId , commands , false )
325- . then ( responses => {
326- if ( responses . length !== commands . length ) {
327- return Promise . reject (
328- new Error ( 'Not all commands executed successfully' )
329- )
330- }
331- const currentPosition = ( responses [ responses . length - 1 ]
332- . data as SavePositionRunTimeCommand ) . result ?. position
333- if ( currentPosition != null ) {
334- return Promise . resolve ( currentPosition )
335- } else {
336- return Promise . reject (
337- new Error ( 'Current position could not be saved' )
338- )
339- }
340- } )
341- . catch ( e => {
342- setErrorMessage (
343- `Error retracting x and y axes or saving position: ${ e . message } `
344- )
345- return null
346- } )
347- }
348-
349294 const moveToAddressableArea = (
350295 addressableArea : AddressableAreaName
351- ) : Promise < CommandData | null > => {
296+ ) : Promise < null > => {
352297 if ( createdMaintenanceRunId == null ) {
353298 return Promise . reject (
354299 new Error ( 'no maintenance run present to send move commands to' )
355300 )
356301 }
357302
358- return retractAllAxesAndSavePosition ( )
359- . then ( currentPosition => {
360- const addressableAreaFromConfig = getAddressableAreaFromConfig (
361- addressableArea ,
362- deckConfig ,
363- instrumentModelSpecs . channels ,
364- robotType
365- )
366-
367- const zOffset =
368- addressableAreaFromConfig === addressableArea &&
369- addressableAreaFromConfig !== 'fixedTrash'
370- ? ( currentPosition as Coordinates ) . z - 10
371- : 0
303+ const addressableAreaFromConfig = getAddressableAreaFromConfig (
304+ addressableArea ,
305+ deckConfig ,
306+ instrumentModelSpecs . channels ,
307+ robotType
308+ )
372309
373- if ( currentPosition != null && addressableAreaFromConfig != null ) {
374- return chainRunCommands (
375- createdMaintenanceRunId ,
376- [
377- {
378- commandType : 'moveToAddressableArea' ,
379- params : {
380- pipetteId : MANAGED_PIPETTE_ID ,
381- addressableAreaName : addressableAreaFromConfig ,
382- offset : { x : 0 , y : 0 , z : zOffset } ,
383- } ,
384- } ,
385- ] ,
386- true
387- ) . then ( commandData => {
388- const error = commandData [ 0 ] . data . error
389- if ( error != null ) {
390- setErrorMessage ( `error moving to position: ${ error . detail } ` )
391- }
392- return null
393- } )
394- } else {
395- setErrorMessage ( `error moving to position: invalid addressable area.` )
396- return null
310+ if ( addressableAreaFromConfig != null ) {
311+ return chainRunCommands (
312+ createdMaintenanceRunId ,
313+ [
314+ {
315+ commandType : 'moveToAddressableArea' ,
316+ params : {
317+ pipetteId : MANAGED_PIPETTE_ID ,
318+ stayAtHighestPossibleZ : true ,
319+ addressableAreaName : addressableAreaFromConfig ,
320+ offset : { x : 0 , y : 0 , z : 0 } ,
321+ } ,
322+ } ,
323+ ] ,
324+ true
325+ ) . then ( commandData => {
326+ const error = commandData [ 0 ] . data . error
327+ if ( error != null ) {
328+ setErrorMessage ( `error moving to position: ${ error . detail } ` )
397329 }
398- } )
399- . catch ( e => {
400- setErrorMessage ( `error moving to position: ${ e . message } ` )
401330 return null
402331 } )
332+ } else {
333+ setErrorMessage ( `error moving to position: invalid addressable area.` )
334+ return Promise . resolve ( null )
335+ }
403336 }
404337
405338 let modalContent : JSX . Element = < div > UNASSIGNED STEP</ div >
0 commit comments