Skip to content

Commit b8d5344

Browse files
committed
Fixed i2c port (not smart io!).
1 parent 6da040f commit b8d5344

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

src/blocks/mrc_component.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,17 @@ export const FIELD_TYPE = 'TYPE';
3939

4040
// key is a regex pattern that matches a function argument name, value is type of mrc_port block to use.
4141
// TODO: Improve these regex pattern.
42-
// TODO: Should the types here match the PortType values in external_samples/component.py?
42+
// The types here match the PortType values in external_samples/component.py.
4343
const RECOGNIZED_PORT_ARG_NAME_PATTERNS: { [key: string]: string } = {
44-
'can_port': 'SmartCan',
45-
'i2c_port': 'SmartIO',
46-
'io_port': 'SmartIO',
47-
'smartIO_port': 'SmartIO',
48-
'smart_io_port': 'SmartIO',
49-
'motor_port': 'SmartMotor',
50-
'servo_port': 'SmartIO',
51-
'smart_motor_port': 'SmartMotor',
52-
'usb_port': 'USBPort',
44+
'can_port': 'CAN_PORT',
45+
'io_port': 'SMART_IO_PORT',
46+
'smartIO_port': 'SMART_IO_PORT',
47+
'smart_io_port': 'SMART_IO_PORT',
48+
'motor_port': 'SMART_MOTOR_PORT',
49+
'smart_motor_port': 'SMART_MOTOR_PORT',
50+
'servo_port': 'SERVO_PORT',
51+
'i2c_port': 'I2C_PORT',
52+
'usb_port': 'USB_PORT',
5353
};
5454

5555

src/blocks/mrc_mechanism_component_holder.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import * as commonStorage from '../storage/common_storage';
2929
import { OUTPUT_NAME as MECHANISM_OUTPUT } from './mrc_mechanism';
3030
import { BLOCK_NAME as MRC_MECHANISM_NAME } from './mrc_mechanism';
3131
import { BLOCK_NAME as MRC_COMPONENT_NAME } from './mrc_component';
32+
import * as Component from './mrc_component';
3233
import { OUTPUT_NAME as COMPONENT_OUTPUT } from './mrc_component';
3334
import { BLOCK_NAME as MRC_EVENT_NAME } from './mrc_event';
3435
import { OUTPUT_NAME as EVENT_OUTPUT } from './mrc_event';
@@ -137,9 +138,9 @@ const MECHANISM_COMPONENT_HOLDER = {
137138
// Walk through all connected component blocks.
138139
let componentBlock = componentsInput.connection.targetBlock();
139140
while (componentBlock) {
140-
if (componentBlock.type === 'mrc_component') {
141-
const componentName = componentBlock.getFieldValue('NAME');
142-
const componentType = componentBlock.getFieldValue('TYPE');
141+
if (componentBlock.type === MRC_COMPONENT_NAME) {
142+
const componentName = componentBlock.getFieldValue(Component.FIELD_NAME);
143+
const componentType = componentBlock.getFieldValue(Component.FIELD_TYPE);
143144

144145
if (componentName && componentType) {
145146
components.push({

0 commit comments

Comments
 (0)