Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(app): properly fall back to load order module matching on map view OT2 module setup #15204

Merged
merged 1 commit into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading