2
2
DeckConfiguration ,
3
3
FLEX_ROBOT_TYPE ,
4
4
NON_CONNECTING_MODULE_TYPES ,
5
+ OT2_ROBOT_TYPE ,
6
+ RobotType ,
5
7
checkModuleCompatibility ,
6
8
getCutoutFixturesForModuleModel ,
7
9
getCutoutIdsFromModuleSlotName ,
@@ -16,14 +18,15 @@ export type AttachedProtocolModuleMatch = ProtocolModuleInfo & {
16
18
attachedModuleMatch : AttachedModule | null
17
19
}
18
20
19
- // NOTE: this is a FLEX only function
20
- // some logic copied from useModuleRenderInfoForProtocolById
21
+ // NOTE: some logic copied from useModuleRenderInfoForProtocolById
21
22
export function getAttachedProtocolModuleMatches (
22
23
attachedModules : AttachedModule [ ] ,
23
24
protocolModulesInfo : ProtocolModuleInfo [ ] ,
24
- deckConfig : DeckConfiguration
25
+ deckConfig : DeckConfiguration ,
26
+ robotType : RobotType = FLEX_ROBOT_TYPE
25
27
) : AttachedProtocolModuleMatch [ ] {
26
- const deckDef = getDeckDefFromRobotType ( FLEX_ROBOT_TYPE ) // this is only used for Flex ODD
28
+ const deckDef = getDeckDefFromRobotType ( robotType )
29
+ const robotSupportsModuleConfig = robotType !== OT2_ROBOT_TYPE
27
30
const matchedAttachedModules : AttachedModule [ ] = [ ]
28
31
const attachedProtocolModuleMatches = protocolModulesInfo . map (
29
32
protocolModule => {
@@ -49,12 +52,14 @@ export function getAttachedProtocolModuleMatches(
49
52
matchedAttachedModule . serialNumber ===
50
53
attachedModule . serialNumber
51
54
) &&
52
- // check deck config has module with expected serial number in expected location
53
- deckConfig . some (
54
- ( { cutoutId, opentronsModuleSerialNumber } ) =>
55
- attachedModule . serialNumber === opentronsModuleSerialNumber &&
56
- moduleCutoutIds . includes ( cutoutId )
57
- )
55
+ // then if robotType supports configurable modules check the deck config has a
56
+ // a module with the expected serial number in the expected location
57
+ ( ! robotSupportsModuleConfig ||
58
+ deckConfig . some (
59
+ ( { cutoutId, opentronsModuleSerialNumber } ) =>
60
+ attachedModule . serialNumber === opentronsModuleSerialNumber &&
61
+ moduleCutoutIds . includes ( cutoutId )
62
+ ) )
58
63
) ?? null
59
64
if ( compatibleAttachedModule !== null ) {
60
65
matchedAttachedModules . push ( compatibleAttachedModule )
0 commit comments