@@ -135,6 +135,7 @@ Blockly.Blocks['robActions_motor_on'] = {
135135 break ;
136136 case 'mbot2' :
137137 case 'wedo' :
138+ case 'orb' :
138139 this . action = 'MOTOR' ;
139140 ports = [ ] ;
140141 var container = Blockly . Workspace . getByContainer ( "bricklyDiv" ) ;
@@ -170,7 +171,7 @@ Blockly.Blocks['robActions_motor_on'] = {
170171 this . setPreviousStatement ( true ) ;
171172 this . setNextStatement ( true ) ;
172173 this . setTooltip ( Blockly . Msg . MOTOR_ON_TOOLTIP ) ;
173- if ( this . workspace . device === 'wedo' ) {
174+ if ( this . workspace . device === 'wedo' && this . workspace . device === 'orb' ) {
174175 this . appendValueInput ( 'POWER' ) . appendField ( Blockly . Msg . ACTION_MOTOR ) . appendField ( dropDownPorts , 'MOTORPORT' ) . appendField ( Blockly . Msg . ON ) . appendField ( Blockly . Msg . MOTOR_SPEED ) . setCheck ( 'Number' ) ;
175176 this . dependConfig = {
176177 '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' ) ;
@@ -321,12 +322,22 @@ Blockly.Blocks['robActions_motor_getPower'] = {
321322 * @memberof Block
322323 */
323324 init : function ( ) {
325+
324326 var ports = [ [ Blockly . Msg . MOTOR_PORT + ' A' , 'A' ] , [ Blockly . Msg . MOTOR_PORT + ' B' , 'B' ] , [ Blockly . Msg . MOTOR_PORT + ' C' , 'C' ] ] ;
325327 if ( this . workspace . device === 'ev3' ) {
326328 ports . push ( [ Blockly . Msg . MOTOR_PORT + ' D' , 'D' ] ) ;
329+ var motorPort = new Blockly . FieldDropdown ( ports ) ;
330+ }
331+ else if ( this . workspace . device === 'orb' ) {
332+ var motorPort = new Blockly . FieldDropdown ( ports ) ;
333+ motorPort = getConfigPorts ( 'motor' ) ;
334+ this . dependConfig = {
335+ 'type' : 'motor' ,
336+ 'dropDown' : ports
337+ } ;
327338 }
328339 this . setColour ( Blockly . CAT_ACTION_RGB ) ;
329- var motorPort = new Blockly . FieldDropdown ( ports ) ;
340+ // var motorPort = new Blockly.FieldDropdown(ports);
330341 this . appendDummyInput ( ) . appendField ( Blockly . Msg . GET + ' ' + Blockly . Msg . MOTOR_SPEED ) . appendField ( motorPort , 'MOTORPORT' ) ;
331342 this . setOutput ( true , 'Number' ) ;
332343 this . setTooltip ( Blockly . Msg . MOTOR_GETPOWER_TOOLTIP ) ;
@@ -352,8 +363,17 @@ Blockly.Blocks['robActions_motor_setPower'] = {
352363 var ports = [ [ Blockly . Msg . MOTOR_PORT + ' A' , 'A' ] , [ Blockly . Msg . MOTOR_PORT + ' B' , 'B' ] , [ Blockly . Msg . MOTOR_PORT + ' C' , 'C' ] ] ;
353364 if ( this . workspace . device === 'ev3' ) {
354365 ports . push ( [ Blockly . Msg . MOTOR_PORT + ' D' , 'D' ] ) ;
366+ var motorPort = new Blockly . FieldDropdown ( ports ) ;
355367 }
356- var motorPort = new Blockly . FieldDropdown ( ports ) ;
368+ else if ( this . workspace . device === 'orb' ) {
369+ var motorPort = new Blockly . FieldDropdown ( ports ) ;
370+ motorPort = getConfigPorts ( 'motor' ) ;
371+ this . dependConfig = {
372+ 'type' : 'motor' ,
373+ 'dropDown' : ports
374+ } ;
375+ }
376+ //var motorPort = new Blockly.FieldDropdown(ports);
357377 this . appendValueInput ( 'POWER' ) . appendField ( Blockly . Msg . SET ) . appendField ( motorPort , 'MOTORPORT' ) . appendField ( Blockly . Msg . MOTOR_SPEED ) ;
358378 this . setPreviousStatement ( true ) ;
359379 this . setNextStatement ( true ) ;
@@ -388,7 +408,7 @@ Blockly.Blocks['robActions_motor_stop'] = {
388408 [ Blockly . Msg . MOTOR + ' ' + Blockly . Msg . MOTOR_RIGHT , 'RMOTOR' ] ] ;
389409 }
390410 var motorPort = new Blockly . FieldDropdown ( ports ) ;
391- if ( this . workspace . device === 'wedo' ) {
411+ if ( this . workspace . device === 'wedo' || this . workspace . device === 'orb' ) {
392412 this . action = 'MOTOR' ;
393413 ports = getConfigPorts ( 'motor' ) ;
394414 this . dependConfig = {
@@ -453,7 +473,7 @@ Blockly.Blocks['robActions_motorDiff_on_for'] = {
453473 }
454474 if ( this . workspace . device === 'botnroll' || this . workspace . device === 'mbot' ) {
455475 this . appendValueInput ( 'DISTANCE' ) . setAlign ( Blockly . ALIGN_RIGHT ) . appendField ( Blockly . Msg . SENSOR_TIME + ' ms' ) . setCheck ( 'Number' ) ;
456- } else {
476+ } else {
457477 this . appendValueInput ( 'DISTANCE' ) . setAlign ( Blockly . ALIGN_RIGHT ) . appendField ( Blockly . Msg . MOTOR_DISTANCE ) . setCheck ( 'Number' ) ;
458478 }
459479 this . setPreviousStatement ( true ) ;
@@ -665,10 +685,10 @@ Blockly.Blocks['robActions_display_text'] = {
665685 } else {
666686 this . appendValueInput ( 'OUT' ) . setAlign ( Blockly . ALIGN_RIGHT ) . appendField ( Blockly . Msg . DISPLAY_SHOW + ' ' + Blockly . Msg . DISPLAY_TEXT ) ;
667687 }
668- if ( this . workspace . device !== 'botnroll' && this . workspace . device !== 'wedo' ) {
688+ if ( this . workspace . device !== 'botnroll' && this . workspace . device !== 'wedo' && this . workspace . device !== 'orb' ) {
669689 this . appendValueInput ( 'COL' ) . setCheck ( 'Number' ) . setAlign ( Blockly . ALIGN_RIGHT ) . appendField ( Blockly . Msg . DISPLAY_COL ) ;
670690 }
671- if ( this . workspace . device !== 'wedo' ) {
691+ if ( this . workspace . device !== 'wedo' && this . workspace . device !== 'orb' ) {
672692 this . appendValueInput ( 'ROW' ) . setCheck ( 'Number' ) . setAlign ( Blockly . ALIGN_RIGHT ) . appendField ( Blockly . Msg . DISPLAY_ROW ) ;
673693 }
674694 this . setPreviousStatement ( true ) ;
@@ -807,7 +827,7 @@ Blockly.Blocks['robActions_play_tone'] = {
807827 'dropDown' : dropDownPorts
808828 } ;
809829 this . appendValueInput ( 'FREQUENCE' ) . appendField ( Blockly . Msg . PLAY ) . appendField ( dropDownPorts , 'ACTORPORT' ) . appendField ( Blockly . Msg . PLAY_FREQUENZ ) . setCheck ( 'Number' ) ;
810- } else if ( this . workspace . device === 'wedo' ) {
830+ } else if ( this . workspace . device === 'wedo' || this . workspace . device === 'orb' ) {
811831 this . action = 'BUZZER' ;
812832 var ports = getConfigPorts ( 'buzzer' ) ;
813833 this . dependConfig = {
@@ -1002,7 +1022,7 @@ Blockly.Blocks['robActions_led_on'] = {
10021022 'type' : 'rgbled' ,
10031023 'dropDown' : ports
10041024 } ;
1005- } else if ( this . workspace . device === 'wedo' ) {
1025+ } else if ( this . workspace . device === 'wedo' || this . workspace . device === 'orb' ) {
10061026 var ports = new Blockly . FieldDropdown ( portList ) ;
10071027 this . dependConfig = {
10081028 'type' : 'led' ,
@@ -1064,7 +1084,7 @@ Blockly.Blocks['robActions_led_off'] = {
10641084 'type' : 'rgbled' ,
10651085 'dropDown' : ports
10661086 } ;
1067- } else if ( this . workspace . device === 'wedo' ) {
1087+ } else if ( this . workspace . device === 'wedo' || this . workspace . device === 'orb' ) {
10681088 var ports = new Blockly . FieldDropdown ( portList ) ;
10691089 this . dependConfig = {
10701090 'type' : 'led' ,
0 commit comments