Skip to content

Commit aa508be

Browse files
committed
EV3の修正
1 parent d379264 commit aa508be

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/lib/ruby-generator/ev3.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,25 +44,27 @@ export default function (Generator) {
4444
};
4545

4646
Generator.ev3_getMotorPosition = function (block) {
47+
const order = Generator.ORDER_FUNCTION_CALL;
4748
const port = Generator.valueToCode(block, 'PORT', Generator.ORDER_NONE) || null;
48-
return `ev3_motor_position(${port})\n`;
49+
return [`ev3_motor_position(${port})`, order];
4950
};
5051

5152
Generator.ev3_whenDistanceLessThan = function (block) {
5253
block.isStatement = true;
5354
const distance = Generator.valueToCode(block, 'DISTANCE', Generator.ORDER_NONE) || null;
54-
return `${Generator.spriteName()}.when(:ev3_distance_<, ${distance}) do\n`;
55+
return `${Generator.spriteName()}.when(:ev3_distance_gt, ${distance}) do\n`;
5556
};
5657

5758
Generator.ev3_whenBrightnessLessThan = function (block) {
5859
block.isStatement = true;
5960
const distance = Generator.valueToCode(block, 'DISTANCE', Generator.ORDER_NONE) || null;
60-
return `${Generator.spriteName()}.when(:ev3_brightness_<, ${distance}) do\n`;
61+
return `${Generator.spriteName()}.when(:ev3_brightness_gt, ${distance}) do\n`;
6162
};
6263

6364
Generator.ev3_buttonPressed = function (block) {
64-
const port = Generator.valueToCode(block, 'PORT', Generator.ORDER_NONE) || null;
65-
return `ev3_button_pressed(${port})\n`;
65+
const order = Generator.ORDER_FUNCTION_CALL;
66+
const port = Generator.valueToCode(block, 'PORT', order) || null;
67+
return [`ev3_button_pressed?(${port})`, order];
6668
};
6769

6870
Generator.ev3_getDistance = function () {

0 commit comments

Comments
 (0)