Skip to content

Commit 665b63e

Browse files
committed
integration orb
1 parent a87f969 commit 665b63e

Some content is hidden

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

77 files changed

+1919
-699
lines changed

blockly_compressed.js

Lines changed: 86 additions & 78 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: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ Blockly.Blocks['robActions_motor_on'] = {
125125
break;
126126
case 'mbot2':
127127
case 'wedo':
128+
case 'orb':
128129
this.action = 'MOTOR';
129130
ports = [];
130131
var container = Blockly.Workspace.getByContainer('bricklyDiv');
@@ -158,7 +159,7 @@ Blockly.Blocks['robActions_motor_on'] = {
158159
this.setPreviousStatement(true);
159160
this.setNextStatement(true);
160161
this.setTooltip(Blockly.Msg.MOTOR_ON_TOOLTIP);
161-
if (this.workspace.device === 'wedo') {
162+
if (this.workspace.device === 'wedo' && this.workspace.device === 'orb') {
162163
this.appendValueInput('POWER')
163164
.appendField(Blockly.Msg.ACTION_MOTOR)
164165
.appendField(dropDownPorts, 'MOTORPORT')
@@ -228,7 +229,7 @@ Blockly.Blocks['robActions_motor_on_for'] = {
228229
.appendField(Blockly.Msg.ON)
229230
.appendField(Blockly.Msg.ROTATIONS_PER_MINUTE)
230231
.setCheck('Number');
231-
} else if (this.workspace.device === 'wedo') {
232+
} else if (this.workspace.device === 'wedo' || this.workspace.device === 'orb') {
232233
this.action = 'MOTOR';
233234
motorPort = getConfigPorts('motor');
234235
this.appendValueInput('POWER')
@@ -359,6 +360,14 @@ Blockly.Blocks['robActions_motor_getPower'] = {
359360
if (this.workspace.device === 'thymio') {
360361
ports = [[Blockly.Msg.MOTOR + ' ' + Blockly.Msg.MOTOR_LEFT, 'LEFT'], [Blockly.Msg.MOTOR + ' ' + Blockly.Msg.MOTOR_RIGHT, 'RIGHT']];
361362
}
363+
else if (this.workspace.device === 'orb'){
364+
var motorPort = new Blockly.FieldDropdown(ports);
365+
motorPort = getConfigPorts('motor');
366+
this.dependConfig = {
367+
'type' : 'motor',
368+
'dropDown' : ports
369+
};
370+
}
362371
this.setColour(Blockly.CAT_ACTION_RGB);
363372
var motorPort = new Blockly.FieldDropdown(ports);
364373
this.appendDummyInput()
@@ -389,6 +398,14 @@ Blockly.Blocks['robActions_motor_setPower'] = {
389398
if (this.workspace.device === 'ev3' || this.workspace.device === 'xNN') {
390399
ports.push([Blockly.Msg.MOTOR_PORT + ' D', 'D']);
391400
}
401+
else if (this.workspace.device === 'orb'){
402+
var motorPort = new Blockly.FieldDropdown(ports);
403+
motorPort = getConfigPorts('motor');
404+
this.dependConfig = {
405+
'type' : 'motor',
406+
'dropDown' : ports
407+
};
408+
}
392409
var motorPort = new Blockly.FieldDropdown(ports);
393410
this.appendValueInput('POWER').appendField(Blockly.Msg.SET).appendField(motorPort, 'MOTORPORT').appendField(Blockly.Msg.MOTOR_SPEED);
394411
this.setPreviousStatement(true);
@@ -426,7 +443,7 @@ Blockly.Blocks['robActions_motor_stop'] = {
426443
ports = [[Blockly.Msg.MOTOR + ' ' + Blockly.Msg.MOTOR_LEFT, 'LEFT'], [Blockly.Msg.MOTOR + ' ' + Blockly.Msg.MOTOR_RIGHT, 'RIGHT']];
427444
}
428445
var motorPort = new Blockly.FieldDropdown(ports);
429-
if (this.workspace.device === 'wedo') {
446+
if (this.workspace.device === 'wedo' || this.workspace.device === 'orb') {
430447
this.action = 'MOTOR';
431448
ports = getConfigPorts('motor');
432449
this.dependConfig = {
@@ -782,10 +799,10 @@ Blockly.Blocks['robActions_display_text'] = {
782799
.setAlign(Blockly.ALIGN_RIGHT)
783800
.appendField(Blockly.Msg.DISPLAY_SHOW + ' ' + Blockly.Msg.DISPLAY_TEXT);
784801
}
785-
if (this.workspace.device !== 'botnroll' && this.workspace.device !== 'wedo') {
802+
if (this.workspace.device !== 'botnroll' && this.workspace.device !== 'wedo' && this.workspace.device !== 'orb') {
786803
this.appendValueInput('COL').setCheck('Number').setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.DISPLAY_COL);
787804
}
788-
if (this.workspace.device !== 'wedo') {
805+
if (this.workspace.device !== 'wedo' && this.workspace.device !== 'orb') {
789806
this.appendValueInput('ROW').setCheck('Number').setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.DISPLAY_ROW);
790807
}
791808
this.setPreviousStatement(true);
@@ -941,7 +958,7 @@ Blockly.Blocks['robActions_play_tone'] = {
941958
.appendField(dropDownPorts, 'ACTORPORT')
942959
.appendField(Blockly.Msg.PLAY_FREQUENZ)
943960
.setCheck('Number');
944-
} else if (this.workspace.device === 'wedo') {
961+
} else if (this.workspace.device === 'wedo' || this.workspace.device === 'orb') {
945962
this.action = 'BUZZER';
946963
var ports = getConfigPorts('buzzer');
947964
this.dependConfig = {
@@ -1155,7 +1172,7 @@ Blockly.Blocks['robActions_led_on'] = {
11551172
this.dependConfig = {
11561173
type: 'rgbled', dropDown: ports
11571174
};
1158-
} else if (this.workspace.device === 'wedo') {
1175+
} else if (this.workspace.device === 'wedo' || this.workspace.device === 'orb') {
11591176
var ports = new Blockly.FieldDropdown(portList);
11601177
this.dependConfig = {
11611178
type: 'led', dropDown: ports
@@ -1228,7 +1245,7 @@ Blockly.Blocks['robActions_led_off'] = {
12281245
this.dependConfig = {
12291246
type: 'rgbled', dropDown: ports
12301247
};
1231-
} else if (this.workspace.device === 'wedo') {
1248+
} else if (this.workspace.device === 'wedo' || this.workspace.device === 'orb') {
12321249
var ports = new Blockly.FieldDropdown(portList);
12331250
this.dependConfig = {
12341251
type: 'led', dropDown: ports

0 commit comments

Comments
 (0)