From 5d649f0ba17b241662af190761974b0037171b1f Mon Sep 17 00:00:00 2001 From: Brian Cooper Date: Thu, 16 May 2024 14:38:41 -0400 Subject: [PATCH] fix(app): properly fall back to load order module matching on map view OT2 module setup Don't look to deck configuration for matching specced modules to attached modules within the module setup step of the OT2 Closes RQA-2735 --- .../SetupModuleAndDeck/SetupModulesMap.tsx | 3 ++- .../ProtocolSetupModulesAndDeck/utils.ts | 25 +++++++++++-------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/app/src/organisms/Devices/ProtocolRun/SetupModuleAndDeck/SetupModulesMap.tsx b/app/src/organisms/Devices/ProtocolRun/SetupModuleAndDeck/SetupModulesMap.tsx index 976a3ae034d..72687bc8324 100644 --- a/app/src/organisms/Devices/ProtocolRun/SetupModuleAndDeck/SetupModulesMap.tsx +++ b/app/src/organisms/Devices/ProtocolRun/SetupModuleAndDeck/SetupModulesMap.tsx @@ -54,7 +54,8 @@ export const SetupModulesMap = ({ const attachedProtocolModuleMatches = getAttachedProtocolModuleMatches( attachedModules, protocolModulesInfo, - actualDeckConfig + actualDeckConfig, + robotType ) const modulesOnDeck = attachedProtocolModuleMatches.map(module => ({ diff --git a/app/src/organisms/ProtocolSetupModulesAndDeck/utils.ts b/app/src/organisms/ProtocolSetupModulesAndDeck/utils.ts index cc921ef6049..709d357c511 100644 --- a/app/src/organisms/ProtocolSetupModulesAndDeck/utils.ts +++ b/app/src/organisms/ProtocolSetupModulesAndDeck/utils.ts @@ -2,6 +2,8 @@ import { DeckConfiguration, FLEX_ROBOT_TYPE, NON_CONNECTING_MODULE_TYPES, + OT2_ROBOT_TYPE, + RobotType, checkModuleCompatibility, getCutoutFixturesForModuleModel, getCutoutIdsFromModuleSlotName, @@ -16,14 +18,15 @@ export type AttachedProtocolModuleMatch = ProtocolModuleInfo & { attachedModuleMatch: AttachedModule | null } -// NOTE: this is a FLEX only function -// some logic copied from useModuleRenderInfoForProtocolById +// NOTE: some logic copied from useModuleRenderInfoForProtocolById export function getAttachedProtocolModuleMatches( attachedModules: AttachedModule[], protocolModulesInfo: ProtocolModuleInfo[], - deckConfig: DeckConfiguration + deckConfig: DeckConfiguration, + robotType: RobotType = FLEX_ROBOT_TYPE ): AttachedProtocolModuleMatch[] { - const deckDef = getDeckDefFromRobotType(FLEX_ROBOT_TYPE) // this is only used for Flex ODD + const deckDef = getDeckDefFromRobotType(robotType) + const robotSupportsModuleConfig = robotType !== OT2_ROBOT_TYPE const matchedAttachedModules: AttachedModule[] = [] const attachedProtocolModuleMatches = protocolModulesInfo.map( protocolModule => { @@ -49,12 +52,14 @@ export function getAttachedProtocolModuleMatches( matchedAttachedModule.serialNumber === attachedModule.serialNumber ) && - // check deck config has module with expected serial number in expected location - deckConfig.some( - ({ cutoutId, opentronsModuleSerialNumber }) => - attachedModule.serialNumber === opentronsModuleSerialNumber && - moduleCutoutIds.includes(cutoutId) - ) + // then if robotType supports configurable modules check the deck config has a + // a module with the expected serial number in the expected location + (!robotSupportsModuleConfig || + deckConfig.some( + ({ cutoutId, opentronsModuleSerialNumber }) => + attachedModule.serialNumber === opentronsModuleSerialNumber && + moduleCutoutIds.includes(cutoutId) + )) ) ?? null if (compatibleAttachedModule !== null) { matchedAttachedModules.push(compatibleAttachedModule)