Skip to content

Commit

Permalink
fix(app): properly fall back to load order module matching on map vie…
Browse files Browse the repository at this point in the history
…w OT2 module setup (#15204)

Don't look to deck configuration for matching specced modules to
attached modules within the module
setup step of the OT-2

Closes [RQA-2735](https://opentrons.atlassian.net/browse/RQA-2735)
  • Loading branch information
b-cooper committed May 16, 2024
1 parent 97da85c commit 737865d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ export const SetupModulesMap = ({
const attachedProtocolModuleMatches = getAttachedProtocolModuleMatches(
attachedModules,
protocolModulesInfo,
actualDeckConfig
actualDeckConfig,
robotType
)

const modulesOnDeck = attachedProtocolModuleMatches.map(module => ({
Expand Down
25 changes: 15 additions & 10 deletions app/src/organisms/ProtocolSetupModulesAndDeck/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import {
DeckConfiguration,
FLEX_ROBOT_TYPE,
NON_CONNECTING_MODULE_TYPES,
OT2_ROBOT_TYPE,
RobotType,
checkModuleCompatibility,
getCutoutFixturesForModuleModel,
getCutoutIdsFromModuleSlotName,
Expand All @@ -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 => {
Expand All @@ -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)
Expand Down

0 comments on commit 737865d

Please sign in to comment.