Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
164 changes: 86 additions & 78 deletions blockly_compressed.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion blocks/mbedActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ Blockly.Blocks['mbedActions_play_note'] = {
var duration = new Blockly.FieldDropdown([ [ Blockly.Msg.PLAY_WHOLE, '2000' ], [ Blockly.Msg.PLAY_HALF, '1000' ], [ Blockly.Msg.PLAY_QUARTER, '500' ],
[ Blockly.Msg.PLAY_EIGHTH, '250' ], [ Blockly.Msg.PLAY_SIXTEENTH, '125' ] ]);

if (this.workspace.device === 'calliope' || this.workspace.device === 'microbit' || this.workspace.device === 'wedo' || this.workspace.device === 'mbot2') {
if (this.workspace.device === 'calliope' || this.workspace.device === 'microbit' || this.workspace.device === 'wedo' || this.workspace.device === 'mbot2' || this.workspace.device === 'orb') {
this.dropDownPorts = getConfigPorts('buzzer');
this.dependConfig = {
'type' : 'buzzer',
Expand Down
33 changes: 25 additions & 8 deletions blocks/robActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ Blockly.Blocks['robActions_motor_on'] = {
break;
case 'mbot2':
case 'wedo':
case 'orb':
this.action = 'MOTOR';
ports = [];
var container = Blockly.Workspace.getByContainer('bricklyDiv');
Expand Down Expand Up @@ -158,7 +159,7 @@ Blockly.Blocks['robActions_motor_on'] = {
this.setPreviousStatement(true);
this.setNextStatement(true);
this.setTooltip(Blockly.Msg.MOTOR_ON_TOOLTIP);
if (this.workspace.device === 'wedo') {
if (this.workspace.device === 'wedo' && this.workspace.device === 'orb') {
this.appendValueInput('POWER')
.appendField(Blockly.Msg.ACTION_MOTOR)
.appendField(dropDownPorts, 'MOTORPORT')
Expand Down Expand Up @@ -228,7 +229,7 @@ Blockly.Blocks['robActions_motor_on_for'] = {
.appendField(Blockly.Msg.ON)
.appendField(Blockly.Msg.ROTATIONS_PER_MINUTE)
.setCheck('Number');
} else if (this.workspace.device === 'wedo') {
} else if (this.workspace.device === 'wedo' || this.workspace.device === 'orb') {
this.action = 'MOTOR';
motorPort = getConfigPorts('motor');
this.appendValueInput('POWER')
Expand Down Expand Up @@ -359,6 +360,14 @@ Blockly.Blocks['robActions_motor_getPower'] = {
if (this.workspace.device === 'thymio') {
ports = [[Blockly.Msg.MOTOR + ' ' + Blockly.Msg.MOTOR_LEFT, 'LEFT'], [Blockly.Msg.MOTOR + ' ' + Blockly.Msg.MOTOR_RIGHT, 'RIGHT']];
}
else if (this.workspace.device === 'orb'){
var motorPort = new Blockly.FieldDropdown(ports);
motorPort = getConfigPorts('motor');
this.dependConfig = {
'type' : 'motor',
'dropDown' : ports
};
}
this.setColour(Blockly.CAT_ACTION_RGB);
var motorPort = new Blockly.FieldDropdown(ports);
this.appendDummyInput()
Expand Down Expand Up @@ -389,6 +398,14 @@ Blockly.Blocks['robActions_motor_setPower'] = {
if (this.workspace.device === 'ev3' || this.workspace.device === 'xNN') {
ports.push([Blockly.Msg.MOTOR_PORT + ' D', 'D']);
}
else if (this.workspace.device === 'orb'){
var motorPort = new Blockly.FieldDropdown(ports);
motorPort = getConfigPorts('motor');
this.dependConfig = {
'type' : 'motor',
'dropDown' : ports
};
}
var motorPort = new Blockly.FieldDropdown(ports);
this.appendValueInput('POWER').appendField(Blockly.Msg.SET).appendField(motorPort, 'MOTORPORT').appendField(Blockly.Msg.MOTOR_SPEED);
this.setPreviousStatement(true);
Expand Down Expand Up @@ -426,7 +443,7 @@ Blockly.Blocks['robActions_motor_stop'] = {
ports = [[Blockly.Msg.MOTOR + ' ' + Blockly.Msg.MOTOR_LEFT, 'LEFT'], [Blockly.Msg.MOTOR + ' ' + Blockly.Msg.MOTOR_RIGHT, 'RIGHT']];
}
var motorPort = new Blockly.FieldDropdown(ports);
if (this.workspace.device === 'wedo') {
if (this.workspace.device === 'wedo' || this.workspace.device === 'orb') {
this.action = 'MOTOR';
ports = getConfigPorts('motor');
this.dependConfig = {
Expand Down Expand Up @@ -782,10 +799,10 @@ Blockly.Blocks['robActions_display_text'] = {
.setAlign(Blockly.ALIGN_RIGHT)
.appendField(Blockly.Msg.DISPLAY_SHOW + ' ' + Blockly.Msg.DISPLAY_TEXT);
}
if (this.workspace.device !== 'botnroll' && this.workspace.device !== 'wedo') {
if (this.workspace.device !== 'botnroll' && this.workspace.device !== 'wedo' && this.workspace.device !== 'orb') {
this.appendValueInput('COL').setCheck('Number').setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.DISPLAY_COL);
}
if (this.workspace.device !== 'wedo') {
if (this.workspace.device !== 'wedo' && this.workspace.device !== 'orb') {
this.appendValueInput('ROW').setCheck('Number').setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.DISPLAY_ROW);
}
this.setPreviousStatement(true);
Expand Down Expand Up @@ -941,7 +958,7 @@ Blockly.Blocks['robActions_play_tone'] = {
.appendField(dropDownPorts, 'ACTORPORT')
.appendField(Blockly.Msg.PLAY_FREQUENZ)
.setCheck('Number');
} else if (this.workspace.device === 'wedo') {
} else if (this.workspace.device === 'wedo' || this.workspace.device === 'orb') {
this.action = 'BUZZER';
var ports = getConfigPorts('buzzer');
this.dependConfig = {
Expand Down Expand Up @@ -1155,7 +1172,7 @@ Blockly.Blocks['robActions_led_on'] = {
this.dependConfig = {
type: 'rgbled', dropDown: ports
};
} else if (this.workspace.device === 'wedo') {
} else if (this.workspace.device === 'wedo' || this.workspace.device === 'orb') {
var ports = new Blockly.FieldDropdown(portList);
this.dependConfig = {
type: 'led', dropDown: ports
Expand Down Expand Up @@ -1228,7 +1245,7 @@ Blockly.Blocks['robActions_led_off'] = {
this.dependConfig = {
type: 'rgbled', dropDown: ports
};
} else if (this.workspace.device === 'wedo') {
} else if (this.workspace.device === 'wedo' || this.workspace.device === 'orb') {
var ports = new Blockly.FieldDropdown(portList);
this.dependConfig = {
type: 'led', dropDown: ports
Expand Down
Loading