Skip to content

Commit 26c534b

Browse files
committed
integration orb
1 parent 481e1d5 commit 26c534b

78 files changed

Lines changed: 4725 additions & 1388 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: 247 additions & 235 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') {
471+
if (this.workspace.device === 'calliope' || this.workspace.device === 'microbit' || this.workspace.device === 'wedo' || this.workspace.device === 'orb') {
472472
this.dropDownPorts = getConfigPorts('buzzer');
473473
this.dependConfig = {
474474
'type' : 'buzzer',

blocks/robActions.js

Lines changed: 42 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ Blockly.Blocks['robActions_motor_on'] = {
134134
ports = [ [ Blockly.Msg.MOTOR + ' ' + 'M1', '1' ], [ Blockly.Msg.MOTOR + ' ' + 'M2', '2' ] ];
135135
break;
136136
case 'wedo':
137+
case 'orb':
137138
this.action = 'MOTOR';
138139
ports = [];
139140
var container = Blockly.Workspace.getByContainer("bricklyDiv");
@@ -169,7 +170,7 @@ Blockly.Blocks['robActions_motor_on'] = {
169170
this.setPreviousStatement(true);
170171
this.setNextStatement(true);
171172
this.setTooltip(Blockly.Msg.MOTOR_ON_TOOLTIP);
172-
if (this.workspace.device !== 'wedo') {
173+
if (this.workspace.device !== 'wedo' && this.workspace.device !== 'orb') {
173174
this.appendValueInput('POWER').appendField(dropDownPorts, 'MOTORPORT').appendField(Blockly.Msg.ON).appendField(Blockly.Msg.MOTOR_SPEED).setCheck('Number');
174175
} else {
175176
this.appendValueInput('POWER').appendField(Blockly.Msg.ACTION_MOTOR).appendField(dropDownPorts, 'MOTORPORT').appendField(Blockly.Msg.ON).appendField(Blockly.Msg.MOTOR_SPEED).setCheck('Number');
@@ -208,7 +209,7 @@ Blockly.Blocks['robActions_motor_on_for'] = {
208209
} else if (this.workspace.device === 'mbot') {
209210
ports = [ [ Blockly.Msg.MOTOR + ' ' + 'M1', '1' ], [ Blockly.Msg.MOTOR + ' ' + 'M2', '2' ] ];
210211
}
211-
if (this.workspace.device === 'wedo') {
212+
if (this.workspace.device === 'wedo' || this.workspace.device === 'orb') {
212213
this.action = 'MOTOR';
213214
var portList = [];
214215
var container = Blockly.Workspace.getByContainer("bricklyDiv");
@@ -237,8 +238,17 @@ Blockly.Blocks['robActions_motor_on_for'] = {
237238
'dropDown' : ports
238239
};
239240
this.appendValueInput('POWER').appendField(Blockly.Msg.ACTION_MOTOR).appendField(ports, 'MOTORPORT').appendField(Blockly.Msg.ON).appendField(Blockly.Msg.MOTOR_SPEED).setCheck('Number');
240-
this.appendValueInput('VALUE').setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.SENSOR_TIME + ' ' + Blockly.Msg.SENSOR_UNIT_MS).setCheck('Number');
241-
this.setTooltip(Blockly.Msg.MOTOR_ON_FOR_TOOLTIP_MS);
241+
242+
if (this.workspace.device === 'wedo') {
243+
this.appendValueInput('VALUE').setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.SENSOR_TIME + ' ' + Blockly.Msg.SENSOR_UNIT_MS).setCheck('Number');
244+
this.setTooltip(Blockly.Msg.MOTOR_ON_FOR_TOOLTIP_MS);
245+
}
246+
else if (this.workspace.device === 'orb'){
247+
this.appendValueInput('VALUE').setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.FOR).appendField(Blockly.Msg.MOTOR_ROTATION).setCheck('Number');
248+
this.setTooltip(Blockly.Msg.MOTOR_ON_FOR_TOOLTIP);
249+
}
250+
//this.appendValueInput('VALUE').setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.SENSOR_TIME + ' ' + Blockly.Msg.SENSOR_UNIT_MS).setCheck('Number');
251+
//this.setTooltip(Blockly.Msg.MOTOR_ON_FOR_TOOLTIP_MS);
242252
} else {
243253
var motorPort = new Blockly.FieldDropdown(ports);
244254
if (this.workspace.device === 'arduino' || this.workspace.device === 'nano33ble') {
@@ -328,12 +338,22 @@ Blockly.Blocks['robActions_motor_getPower'] = {
328338
* @memberof Block
329339
*/
330340
init : function() {
341+
331342
var ports = [ [ Blockly.Msg.MOTOR_PORT + ' A', 'A' ], [ Blockly.Msg.MOTOR_PORT + ' B', 'B' ], [ Blockly.Msg.MOTOR_PORT + ' C', 'C' ] ];
332343
if (this.workspace.device === 'ev3') {
333344
ports.push([ Blockly.Msg.MOTOR_PORT + ' D', 'D' ]);
345+
var motorPort = new Blockly.FieldDropdown(ports);
346+
}
347+
else if (this.workspace.device === 'orb'){
348+
var motorPort = new Blockly.FieldDropdown(ports);
349+
motorPort = getConfigPorts('motor');
350+
this.dependConfig = {
351+
'type' : 'motor',
352+
'dropDown' : ports
353+
};
334354
}
335355
this.setColour(Blockly.CAT_ACTION_RGB);
336-
var motorPort = new Blockly.FieldDropdown(ports);
356+
//var motorPort = new Blockly.FieldDropdown(ports);
337357
this.appendDummyInput().appendField(Blockly.Msg.GET + ' ' + Blockly.Msg.MOTOR_SPEED).appendField(motorPort, 'MOTORPORT');
338358
this.setOutput(true, 'Number');
339359
this.setTooltip(Blockly.Msg.MOTOR_GETPOWER_TOOLTIP);
@@ -359,8 +379,17 @@ Blockly.Blocks['robActions_motor_setPower'] = {
359379
var ports = [ [ Blockly.Msg.MOTOR_PORT + ' A', 'A' ], [ Blockly.Msg.MOTOR_PORT + ' B', 'B' ], [ Blockly.Msg.MOTOR_PORT + ' C', 'C' ] ];
360380
if (this.workspace.device === 'ev3') {
361381
ports.push([ Blockly.Msg.MOTOR_PORT + ' D', 'D' ]);
382+
var motorPort = new Blockly.FieldDropdown(ports);
362383
}
363-
var motorPort = new Blockly.FieldDropdown(ports);
384+
else if (this.workspace.device === 'orb'){
385+
var motorPort = new Blockly.FieldDropdown(ports);
386+
motorPort = getConfigPorts('motor');
387+
this.dependConfig = {
388+
'type' : 'motor',
389+
'dropDown' : ports
390+
};
391+
}
392+
//var motorPort = new Blockly.FieldDropdown(ports);
364393
this.appendValueInput('POWER').appendField(Blockly.Msg.SET).appendField(motorPort, 'MOTORPORT').appendField(Blockly.Msg.MOTOR_SPEED);
365394
this.setPreviousStatement(true);
366395
this.setNextStatement(true);
@@ -395,7 +424,7 @@ Blockly.Blocks['robActions_motor_stop'] = {
395424
[Blockly.Msg.MOTOR + ' ' + Blockly.Msg.MOTOR_RIGHT, 'RMOTOR']];
396425
}
397426
var motorPort = new Blockly.FieldDropdown(ports);
398-
if (this.workspace.device === 'wedo') {
427+
if (this.workspace.device === 'wedo' || this.workspace.device === 'orb') {
399428
this.action = 'MOTOR';
400429
var portList = [];
401430
var container = Blockly.Workspace.getByContainer("bricklyDiv");
@@ -454,7 +483,7 @@ Blockly.Blocks['robActions_motorDiff_on_for'] = {
454483
this.appendValueInput('POWER').appendField(Blockly.Msg.MOTOR_DRIVE).appendField(dropdown, 'DIRECTION').appendField(Blockly.Msg.MOTOR_SPEED).setCheck('Number');
455484
if (this.workspace.device === 'botnroll' || this.workspace.device === 'mbot') {
456485
this.appendValueInput('DISTANCE').setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.SENSOR_TIME + ' ms').setCheck('Number');
457-
} else {
486+
}else {
458487
this.appendValueInput('DISTANCE').setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.MOTOR_DISTANCE).setCheck('Number');
459488
}
460489
this.setPreviousStatement(true);
@@ -606,10 +635,10 @@ Blockly.Blocks['robActions_display_text'] = {
606635
} else {
607636
this.appendValueInput('OUT').setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.DISPLAY_SHOW + ' ' + Blockly.Msg.DISPLAY_TEXT);
608637
}
609-
if (this.workspace.device !== 'botnroll' && this.workspace.device !== 'wedo') {
638+
if (this.workspace.device !== 'botnroll' && this.workspace.device !== 'wedo' && this.workspace.device !== 'orb') {
610639
this.appendValueInput('COL').setCheck('Number').setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.DISPLAY_COL);
611640
}
612-
if (this.workspace.device !== 'wedo') {
641+
if (this.workspace.device !== 'wedo' && this.workspace.device !== 'orb') {
613642
this.appendValueInput('ROW').setCheck('Number').setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.DISPLAY_ROW);
614643
}
615644
this.setPreviousStatement(true);
@@ -740,7 +769,7 @@ Blockly.Blocks['robActions_play_tone'] = {
740769
'dropDown' : dropDownPorts
741770
};
742771
this.appendValueInput('FREQUENCE').appendField(Blockly.Msg.PLAY).appendField(dropDownPorts, 'ACTORPORT').appendField(Blockly.Msg.PLAY_FREQUENZ).setCheck('Number');
743-
} else if (this.workspace.device === 'wedo') {
772+
} else if (this.workspace.device === 'wedo' || this.workspace.device === 'orb') {
744773
this.action = 'BUZZER';
745774
var portList = [];
746775
var container = Blockly.Workspace.getByContainer("bricklyDiv");
@@ -936,7 +965,7 @@ Blockly.Blocks['robActions_led_on'] = {
936965
'type' : 'rgbled',
937966
'dropDown' : ports
938967
};
939-
} else if (this.workspace.device === 'wedo') {
968+
} else if (this.workspace.device === 'wedo' || this.workspace.device === 'orb') {
940969
var ports = new Blockly.FieldDropdown(portList);
941970
this.dependConfig = {
942971
'type' : 'led',
@@ -998,7 +1027,7 @@ Blockly.Blocks['robActions_led_off'] = {
9981027
'type' : 'rgbled',
9991028
'dropDown' : ports
10001029
};
1001-
} else if (this.workspace.device === 'wedo') {
1030+
} else if (this.workspace.device === 'wedo' || this.workspace.device === 'orb') {
10021031
var ports = new Blockly.FieldDropdown(portList);
10031032
this.dependConfig = {
10041033
'type' : 'led',

0 commit comments

Comments
 (0)