Skip to content

Commit 56614ed

Browse files
committed
integration orb
1 parent 89367db commit 56614ed

77 files changed

Lines changed: 1958 additions & 733 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

blockly_compressed.js

Lines changed: 117 additions & 106 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

blocks/mbedActions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ Blockly.Blocks['mbedActions_play_note'] = {
468468
var duration = new Blockly.FieldDropdown([ [ Blockly.Msg.PLAY_WHOLE, '2000' ], [ Blockly.Msg.PLAY_HALF, '1000' ], [ Blockly.Msg.PLAY_QUARTER, '500' ],
469469
[ Blockly.Msg.PLAY_EIGHTH, '250' ], [ Blockly.Msg.PLAY_SIXTEENTH, '125' ] ]);
470470

471-
if (this.workspace.device === 'calliope' || this.workspace.device === 'microbit' || this.workspace.device === 'wedo' || this.workspace.device === 'mbot2') {
471+
if (this.workspace.device === 'calliope' || this.workspace.device === 'microbit' || this.workspace.device === 'wedo' || this.workspace.device === 'mbot2' || this.workspace.device === 'orb') {
472472
this.dropDownPorts = getConfigPorts('buzzer');
473473
this.dependConfig = {
474474
'type' : 'buzzer',

blocks/robActions.js

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ Blockly.Blocks['robActions_motor_on'] = {
136136
break;
137137
case 'mbot2':
138138
case 'wedo':
139+
case 'orb':
139140
this.action = 'MOTOR';
140141
ports = [];
141142
var container = Blockly.Workspace.getByContainer('bricklyDiv');
@@ -171,7 +172,7 @@ Blockly.Blocks['robActions_motor_on'] = {
171172
this.setPreviousStatement(true);
172173
this.setNextStatement(true);
173174
this.setTooltip(Blockly.Msg.MOTOR_ON_TOOLTIP);
174-
if (this.workspace.device === 'wedo') {
175+
if (this.workspace.device === 'wedo' && this.workspace.device === 'orb') {
175176
this.appendValueInput('POWER').appendField(Blockly.Msg.ACTION_MOTOR).appendField(dropDownPorts, 'MOTORPORT').appendField(Blockly.Msg.ON).appendField(Blockly.Msg.MOTOR_SPEED).setCheck('Number');
176177
this.dependConfig = {
177178
'type': 'motor',
@@ -223,7 +224,7 @@ Blockly.Blocks['robActions_motor_on_for'] = {
223224
'dropDown': motorPort
224225
};
225226
this.appendValueInput('POWER').appendField(Blockly.Msg.MOTOR_PORT_ARDUINO).appendField(motorPort, 'MOTORPORT').appendField(Blockly.Msg.ON).appendField(Blockly.Msg.ROTATIONS_PER_MINUTE).setCheck('Number');
226-
} else if (this.workspace.device === 'wedo') {
227+
} else if (this.workspace.device === 'wedo' || this.workspace.device === 'orb') {
227228
this.action = 'MOTOR';
228229
motorPort = getConfigPorts('motor');
229230
this.appendValueInput('POWER').appendField(Blockly.Msg.ACTION_MOTOR).appendField(motorPort, 'MOTORPORT').appendField(Blockly.Msg.ON).appendField(Blockly.Msg.MOTOR_SPEED).setCheck('Number');
@@ -325,6 +326,14 @@ Blockly.Blocks['robActions_motor_getPower'] = {
325326
if (this.workspace.device === 'ev3' || this.workspace.device === 'xNN') {
326327
ports.push([Blockly.Msg.MOTOR_PORT + ' D', 'D']);
327328
}
329+
else if (this.workspace.device === 'orb'){
330+
var motorPort = new Blockly.FieldDropdown(ports);
331+
motorPort = getConfigPorts('motor');
332+
this.dependConfig = {
333+
'type' : 'motor',
334+
'dropDown' : ports
335+
};
336+
}
328337
this.setColour(Blockly.CAT_ACTION_RGB);
329338
var motorPort = new Blockly.FieldDropdown(ports);
330339
this.appendDummyInput().appendField(Blockly.Msg.GET + ' ' + Blockly.Msg.MOTOR_SPEED).appendField(motorPort, 'MOTORPORT');
@@ -353,6 +362,14 @@ Blockly.Blocks['robActions_motor_setPower'] = {
353362
if (this.workspace.device === 'ev3' || this.workspace.device === 'xNN') {
354363
ports.push([Blockly.Msg.MOTOR_PORT + ' D', 'D']);
355364
}
365+
else if (this.workspace.device === 'orb'){
366+
var motorPort = new Blockly.FieldDropdown(ports);
367+
motorPort = getConfigPorts('motor');
368+
this.dependConfig = {
369+
'type' : 'motor',
370+
'dropDown' : ports
371+
};
372+
}
356373
var motorPort = new Blockly.FieldDropdown(ports);
357374
this.appendValueInput('POWER').appendField(Blockly.Msg.SET).appendField(motorPort, 'MOTORPORT').appendField(Blockly.Msg.MOTOR_SPEED);
358375
this.setPreviousStatement(true);
@@ -388,7 +405,7 @@ Blockly.Blocks['robActions_motor_stop'] = {
388405
[Blockly.Msg.MOTOR + ' ' + Blockly.Msg.MOTOR_RIGHT, 'RMOTOR']];
389406
}
390407
var motorPort = new Blockly.FieldDropdown(ports);
391-
if (this.workspace.device === 'wedo') {
408+
if (this.workspace.device === 'wedo' || this.workspace.device === 'orb') {
392409
this.action = 'MOTOR';
393410
ports = getConfigPorts('motor');
394411
this.dependConfig = {
@@ -453,7 +470,7 @@ Blockly.Blocks['robActions_motorDiff_on_for'] = {
453470
}
454471
if (this.workspace.device === 'botnroll' || this.workspace.device === 'mbot') {
455472
this.appendValueInput('DISTANCE').setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.SENSOR_TIME + ' ms').setCheck('Number');
456-
} else {
473+
}else {
457474
this.appendValueInput('DISTANCE').setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.MOTOR_DISTANCE).setCheck('Number');
458475
}
459476
this.setPreviousStatement(true);
@@ -665,10 +682,10 @@ Blockly.Blocks['robActions_display_text'] = {
665682
} else {
666683
this.appendValueInput('OUT').setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.DISPLAY_SHOW + ' ' + Blockly.Msg.DISPLAY_TEXT);
667684
}
668-
if (this.workspace.device !== 'botnroll' && this.workspace.device !== 'wedo') {
685+
if (this.workspace.device !== 'botnroll' && this.workspace.device !== 'wedo' && this.workspace.device !== 'orb') {
669686
this.appendValueInput('COL').setCheck('Number').setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.DISPLAY_COL);
670687
}
671-
if (this.workspace.device !== 'wedo') {
688+
if (this.workspace.device !== 'wedo' && this.workspace.device !== 'orb') {
672689
this.appendValueInput('ROW').setCheck('Number').setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.DISPLAY_ROW);
673690
}
674691
this.setPreviousStatement(true);
@@ -807,7 +824,7 @@ Blockly.Blocks['robActions_play_tone'] = {
807824
'dropDown': dropDownPorts
808825
};
809826
this.appendValueInput('FREQUENCE').appendField(Blockly.Msg.PLAY).appendField(dropDownPorts, 'ACTORPORT').appendField(Blockly.Msg.PLAY_FREQUENZ).setCheck('Number');
810-
} else if (this.workspace.device === 'wedo') {
827+
} else if (this.workspace.device === 'wedo' || this.workspace.device === 'orb') {
811828
this.action = 'BUZZER';
812829
var ports = getConfigPorts('buzzer');
813830
this.dependConfig = {
@@ -1002,7 +1019,7 @@ Blockly.Blocks['robActions_led_on'] = {
10021019
'type': 'rgbled',
10031020
'dropDown': ports
10041021
};
1005-
} else if (this.workspace.device === 'wedo') {
1022+
} else if (this.workspace.device === 'wedo' || this.workspace.device === 'orb') {
10061023
var ports = new Blockly.FieldDropdown(portList);
10071024
this.dependConfig = {
10081025
'type': 'led',
@@ -1064,7 +1081,7 @@ Blockly.Blocks['robActions_led_off'] = {
10641081
'type': 'rgbled',
10651082
'dropDown': ports
10661083
};
1067-
} else if (this.workspace.device === 'wedo') {
1084+
} else if (this.workspace.device === 'wedo' || this.workspace.device === 'orb') {
10681085
var ports = new Blockly.FieldDropdown(portList);
10691086
this.dependConfig = {
10701087
'type': 'led',

0 commit comments

Comments
 (0)