refactor(boards): 规范化micropython板卡代码
This commit is contained in:
@@ -512,17 +512,17 @@ export const actuator_use_uart_init = {
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_SETUP + Blockly.Msg.LISTS_SET_INDEX_INPUT_TO)
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
['SYN6288' + Blockly.Msg.MIXLY_AipSpeech_synthesis,'SYN6288'],
|
||||
['NS9300' + Blockly.Msg.MIXLY_MUSIC_PLAYER,'NS9300']
|
||||
]),'key2');
|
||||
['SYN6288' + Blockly.Msg.MIXLY_AipSpeech_synthesis, 'SYN6288'],
|
||||
['NS9300' + Blockly.Msg.MIXLY_MUSIC_PLAYER, 'NS9300']
|
||||
]), 'key2');
|
||||
this.setInputsInline(true);
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
}
|
||||
};
|
||||
|
||||
export const player_whether_stop ={
|
||||
init:function(){
|
||||
export const player_whether_stop = {
|
||||
init: function () {
|
||||
this.setColour(ACTUATOR_EXTERN_HUE);
|
||||
this.appendValueInput('SUB')
|
||||
.appendField(Blockly.Msg.MIXLY_GET + Blockly.Msg.MIXLY_MUSIC_PLAYER)
|
||||
@@ -540,7 +540,7 @@ export const player_whether_stop ={
|
||||
};
|
||||
|
||||
export const player_set_play = {
|
||||
init:function(){
|
||||
init: function () {
|
||||
this.setColour(ACTUATOR_EXTERN_HUE);
|
||||
this.appendValueInput('SUB')
|
||||
.appendField(Blockly.Msg.MIXLY_MUSIC_PLAYER)
|
||||
@@ -561,13 +561,13 @@ export const player_set_play = {
|
||||
};
|
||||
|
||||
export const player_set_volume = {
|
||||
init:function(){
|
||||
init: function () {
|
||||
this.setColour(ACTUATOR_EXTERN_HUE);
|
||||
this.appendValueInput('SUB')
|
||||
.appendField(Blockly.Msg.MIXLY_MUSIC_PLAYER)
|
||||
.setCheck("var");
|
||||
this.appendValueInput('volume')
|
||||
.appendField(Blockly.Msg.MIXLY_MP3_VOL +Blockly.Msg.MIXLY_STAT);
|
||||
.appendField(Blockly.Msg.MIXLY_MP3_VOL + Blockly.Msg.MIXLY_STAT);
|
||||
this.setInputsInline(true);
|
||||
this.setPreviousStatement(true);
|
||||
this.setNextStatement(true);
|
||||
@@ -576,13 +576,13 @@ export const player_set_volume = {
|
||||
}
|
||||
|
||||
export const player_set_mode = {
|
||||
init:function(){
|
||||
init: function () {
|
||||
this.setColour(ACTUATOR_EXTERN_HUE);
|
||||
this.appendValueInput('SUB')
|
||||
.appendField(Blockly.Msg.MIXLY_MUSIC_PLAYER)
|
||||
.setCheck("var");
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_MODE+Blockly.Msg.MIXLY_STAT)
|
||||
.appendField(Blockly.Msg.MIXLY_MODE + Blockly.Msg.MIXLY_STAT)
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_MP3_LOOP_ALL, "0"],
|
||||
[Blockly.Msg.MIXLY_MP3_LOOP_ONE, "1"],
|
||||
@@ -598,14 +598,14 @@ export const player_set_mode = {
|
||||
};
|
||||
|
||||
export const player_play_music = {
|
||||
init:function(){
|
||||
init: function () {
|
||||
this.setColour(ACTUATOR_EXTERN_HUE);
|
||||
this.appendValueInput('SUB')
|
||||
.appendField(Blockly.Msg.MIXLY_MUSIC_PLAYER)
|
||||
.setCheck("var");
|
||||
this.appendDummyInput("")
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_MICROBIT_JS_START_MELODY,"play"],
|
||||
[Blockly.Msg.MIXLY_MICROBIT_JS_START_MELODY, "play"],
|
||||
[Blockly.Msg.MIXLY_PLAYER_INSERT_MUSIC, "insert"]
|
||||
]), "key");
|
||||
this.appendValueInput('song');
|
||||
@@ -616,7 +616,7 @@ export const player_play_music = {
|
||||
}
|
||||
}
|
||||
|
||||
export const player_insert_music ={
|
||||
export const player_insert_music = {
|
||||
|
||||
}
|
||||
|
||||
@@ -1127,7 +1127,7 @@ export const parrot_move_speed = {
|
||||
this.appendValueInput("speed")
|
||||
.setCheck(Number)
|
||||
.setAlign(Blockly.inputs.Align.RIGHT)
|
||||
.appendField(Blockly.Msg.MIXLY_DISPLAY_MATRIX_ROTATE +Blockly.Msg.MIXLY_SPEED);
|
||||
.appendField(Blockly.Msg.MIXLY_DISPLAY_MATRIX_ROTATE + Blockly.Msg.MIXLY_SPEED);
|
||||
this.setInputsInline(true);
|
||||
this.setPreviousStatement(true);
|
||||
this.setNextStatement(true);
|
||||
|
||||
@@ -1522,7 +1522,7 @@ export const analog_ble_keyboard_mouse_init = {
|
||||
init: function () {
|
||||
this.setColour(ACTUATOR_ONBOARD_HUE);
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.LISTS_SET_INDEX_SET + Blockly.Msg.MIXLY_BLUETOOTH + Blockly.Msg.MIXLY_KEYBOARD_AND_MOUSE);
|
||||
.appendField(Blockly.Msg.LISTS_SET_INDEX_SET + Blockly.Msg.MIXLY_BLUETOOTH + Blockly.Msg.MIXLY_KEYBOARD_AND_MOUSE);
|
||||
this.appendValueInput('kname')
|
||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_JS_SYSTEM_DEVICE_NAME);
|
||||
this.setPreviousStatement(true);
|
||||
@@ -1754,7 +1754,7 @@ export const educore_ble_sensor_init = {
|
||||
init: function () {
|
||||
this.setColour(ACTUATOR_ONBOARD_HUE);
|
||||
this.appendValueInput("name")
|
||||
.appendField(Blockly.Msg.LISTS_SET_INDEX_SET + Blockly.Msg.MIXLY_BLUETOOTH+ Blockly.Msg.MIXLY_MICROBIT_JS_SYSTEM_DEVICE_NAME + Blockly.Msg.MIXLY_MICROBIT_PY_STORAGE_AS);
|
||||
.appendField(Blockly.Msg.LISTS_SET_INDEX_SET + Blockly.Msg.MIXLY_BLUETOOTH + Blockly.Msg.MIXLY_MICROBIT_JS_SYSTEM_DEVICE_NAME + Blockly.Msg.MIXLY_MICROBIT_PY_STORAGE_AS);
|
||||
this.setOutput(true);
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
@@ -1802,7 +1802,7 @@ export const get_keyboard_light = {
|
||||
[Blockly.Msg.MIXLY_NumLock, "0"],
|
||||
[Blockly.Msg.MIXLY_CapsLock, "1"],
|
||||
[Blockly.Msg.MIXLY_ScorllLock, "2"]
|
||||
]),'key');
|
||||
]), 'key');
|
||||
this.setOutput(true);
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
|
||||
@@ -388,7 +388,7 @@ export const educore_car_pin_near = {
|
||||
this.setColour(MEGO_HUE);
|
||||
this.appendValueInput('car');
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_PY_STORAGE_GET+Blockly.Msg.MIXGO_PROXIMITY_SENSOR);
|
||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_PY_STORAGE_GET + Blockly.Msg.MIXGO_PROXIMITY_SENSOR);
|
||||
this.setOutput(true, Number);
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,11 @@ export const controls_delay = {
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_DELAY)
|
||||
this.appendDummyInput("")
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_SECOND, "s"], [Blockly.Msg.MIXLY_mSecond, "ms"], [Blockly.Msg.MIXLY_uSecond, "us"]]), 'Time');
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_SECOND, "s"],
|
||||
[Blockly.Msg.MIXLY_mSecond, "ms"],
|
||||
[Blockly.Msg.MIXLY_uSecond, "us"]
|
||||
]), 'Time');
|
||||
this.appendValueInput("DELAY_TIME", Number)
|
||||
.setCheck(Number);
|
||||
this.setFieldValue('ms', 'Time')
|
||||
@@ -113,14 +117,13 @@ export const controls_whileUntil = {
|
||||
};
|
||||
return TOOLTIPS[op];
|
||||
});
|
||||
}
|
||||
},
|
||||
OPERATORS: [
|
||||
[Blockly.Msg.LANG_CONTROLS_WHILEUNTIL_OPERATOR_WHILE, 'WHILE'],
|
||||
[Blockly.Msg.LANG_CONTROLS_WHILEUNTIL_OPERATOR_UNTIL, 'UNTIL']
|
||||
]
|
||||
};
|
||||
|
||||
controls_whileUntil.OPERATORS = [
|
||||
[Blockly.Msg.LANG_CONTROLS_WHILEUNTIL_OPERATOR_WHILE, 'WHILE'],
|
||||
[Blockly.Msg.LANG_CONTROLS_WHILEUNTIL_OPERATOR_UNTIL, 'UNTIL']
|
||||
];
|
||||
|
||||
export const controls_flow_statements = {
|
||||
init: function () {
|
||||
this.setColour(LOOPS_HUE);
|
||||
@@ -163,14 +166,13 @@ export const controls_flow_statements = {
|
||||
} else {
|
||||
this.setWarningText(Blockly.Msg.LANG_CONTROLS_FLOW_STATEMENTS_WARNING);
|
||||
}
|
||||
}
|
||||
},
|
||||
OPERATORS: [
|
||||
[Blockly.Msg.LANG_CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK, 'BREAK'],
|
||||
[Blockly.Msg.LANG_CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE, 'CONTINUE']
|
||||
]
|
||||
};
|
||||
|
||||
controls_flow_statements.OPERATORS = [
|
||||
[Blockly.Msg.LANG_CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK, 'BREAK'],
|
||||
[Blockly.Msg.LANG_CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE, 'CONTINUE']
|
||||
];
|
||||
|
||||
export const controls_millis = {
|
||||
init: function () {
|
||||
this.setColour(LOOPS_HUE);
|
||||
@@ -618,4 +620,4 @@ export const controls_uname = {
|
||||
this.setOutput(true);
|
||||
this.setTooltip(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN + Blockly.Msg.MIXLY_MICROBIT_PY_CONTORL_UNAME);
|
||||
}
|
||||
};
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,10 +5,6 @@ const DISPLAY_EXTERN_HUE = '5BA5A5';
|
||||
//var IMG = [["HEART", "HEART"],["HEART_SMALL", "HEART_SMALL"],["HAPPY", "HAPPY"],["SAD", "SAD"],["SMILE", "SMILE"],["SILLY", "SILLY"],["FABULOUS", "FABULOUS"],["SURPRISED", "SURPRISED"],["ASLEEP", "ASLEEP"],["ANGRY", "ANGRY"],["CONFUSED", "CONFUSED"],["NO", "NO"],["YES", "YES"],["LEFT_ARROW", "LEFT_ARROW"],["RIGHT_ARROW", "RIGHT_ARROW"],["DRESS", "DRESS"],["TRANSFORMERS", "TRANSFORMERS"],["SCISSORS", "SCISSORS"],["EXIT", "EXIT"],["TREE", "TREE"],["PACMAN", "PACMAN"],["TARGET", "TARGET"],["TSHIRT", "TSHIRT"],["ROLLERSKATE", "ROLLERSKATE"],["DUCK", "DUCK"],["HOUSE", "HOUSE"],["TORTOISE", "TORTOISE"],["BUTTERFLY", "BUTTERFLY"],["STICKFIGURE", "STICKFIGURE"],["GHOST", "GHOST"],["PITCHFORK", "PITCHFORK"],["MUSIC_QUAVERS", "MUSIC_QUAVERS"],["MUSIC_QUAVER", "MUSIC_QUAVER"],["MUSIC_CROTCHET", "MUSIC_CROTCHET"],["COW", "COW"],["RABBIT", "RABBIT"],["SQUARE_SMALL", "SQUARE_SMALL"],["SQUARE", "SQUARE"],["DIAMOND_SMALL", "DIAMOND_SMALL"],["DIAMOND", "DIAMOND"],["CHESSBOARD", "CHESSBOARD"],["TRIANGLE_LEFT", "TRIANGLE_LEFT"],["TRIANGLE", "TRIANGLE"],["SNAKE", "SNAKE"],["UMBRELLA", "UMBRELLA"],["SKULL", "SKULL"],["GIRAFFE", "GIRAFFE"],["SWORD", "SWORD"]];
|
||||
// var IMG = [["HEART", "HEART"], ["HEART_SMALL", "HEART_SMALL"], ["HAPPY", "HAPPY"], ["SAD", "SAD"], ["SMILE", "SMILE"], ["SILLY", "SILLY"], ["FABULOUS", "FABULOUS"], ["SURPRISED", "SURPRISED"], ["ASLEEP", "ASLEEP"], ["ANGRY", "ANGRY"], ["CONFUSED", "CONFUSED"], ["NO", "NO"], ["YES", "YES"]];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export const display_matrix_use_i2c_init = {
|
||||
init: function () {
|
||||
this.setColour(DISPLAY_EXTERN_HUE);
|
||||
@@ -27,8 +23,6 @@ export const display_matrix_use_i2c_init = {
|
||||
this.setInputsInline(true);
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
@@ -139,12 +133,6 @@ export const display_matrix_extern_show_frame_string_delay = {
|
||||
|
||||
export const display_matrix_extern_shift = {
|
||||
init: function () {
|
||||
var OPERATORS = [
|
||||
[Blockly.Msg.MIXLY_UP, 'shift_up'],
|
||||
[Blockly.Msg.MIXLY_DOWN, 'shift_down'],
|
||||
[Blockly.Msg.MIXLY_LEFT, 'shift_left'],
|
||||
[Blockly.Msg.MIXLY_RIGHT, 'shift_right'],
|
||||
];
|
||||
//this.setHelpUrl(Blockly.Msg.MATH_TRIG_HELPURL);
|
||||
this.appendValueInput('SUB')
|
||||
.setCheck("var");
|
||||
@@ -157,7 +145,7 @@ export const display_matrix_extern_shift = {
|
||||
.appendField(Blockly.Msg.DISPLAY_IMAGE_LET)
|
||||
this.appendDummyInput('')
|
||||
.appendField(Blockly.Msg.DISPLAY_IMAGE_LET2)
|
||||
.appendField(new Blockly.FieldDropdown(OPERATORS), 'OP');
|
||||
.appendField(new Blockly.FieldDropdown(this.OPERATORS), 'OP');
|
||||
this.appendValueInput('val')
|
||||
.appendField(Blockly.Msg.DISPLAY_IMAGE_SHIFT)
|
||||
.setCheck(Number);
|
||||
@@ -177,7 +165,13 @@ export const display_matrix_extern_shift = {
|
||||
};
|
||||
return mode0 + mode1 + TOOLTIPS[mode] + mode2;
|
||||
});
|
||||
}
|
||||
},
|
||||
OPERATORS: [
|
||||
[Blockly.Msg.MIXLY_UP, 'shift_up'],
|
||||
[Blockly.Msg.MIXLY_DOWN, 'shift_down'],
|
||||
[Blockly.Msg.MIXLY_LEFT, 'shift_left'],
|
||||
[Blockly.Msg.MIXLY_RIGHT, 'shift_right'],
|
||||
]
|
||||
};
|
||||
|
||||
export const display_matrix_extern_get_pixel = {
|
||||
@@ -265,29 +259,35 @@ export const display_matrix_extern_clear = {
|
||||
|
||||
export const display_matrix_extern_image_builtins = {
|
||||
init: function () {
|
||||
var OPERATORS =
|
||||
[["HEART", "HEART"], ["HEART_SMALL", "HEART_SMALL"], ["HAPPY", "HAPPY"], ["SAD", "SAD"], ["SMILE", "SMILE"], ["SILLY", "SILLY"], ["FABULOUS", "FABULOUS"], ["SURPRISED", "SURPRISED"], ["ASLEEP", "ASLEEP"], ["ANGRY", "ANGRY"], ["CONFUSED", "CONFUSED"], ["NO", "NO"], ["YES", "YES"]
|
||||
// ,["LEFT_ARROW", "LEFT_ARROW"],["RIGHT_ARROW", "RIGHT_ARROW"],["DRESS", "DRESS"],["TRANSFORMERS", "TRANSFORMERS"],["SCISSORS", "SCISSORS"],["EXIT", "EXIT"],["TREE", "TREE"],["PACMAN", "PACMAN"],["TARGET", "TARGET"],["TSHIRT", "TSHIRT"],["ROLLERSKATE", "ROLLERSKATE"],["DUCK", "DUCK"],["HOUSE", "HOUSE"],["TORTOISE", "TORTOISE"],["BUTTERFLY", "BUTTERFLY"],["STICKFIGURE", "STICKFIGURE"],["GHOST", "GHOST"],["PITCHFORK", "PITCHFORK"],["MUSIC_QUAVERS", "MUSIC_QUAVERS"],["MUSIC_QUAVER", "MUSIC_QUAVER"],["MUSIC_CROTCHET", "MUSIC_CROTCHET"],["COW", "COW"],["RABBIT", "RABBIT"],["SQUARE_SMALL", "SQUARE_SMALL"],["SQUARE", "SQUARE"],["DIAMOND_SMALL", "DIAMOND_SMALL"],["DIAMOND", "DIAMOND"],["CHESSBOARD", "CHESSBOARD"],["TRIANGLE_LEFT", "TRIANGLE_LEFT"],["TRIANGLE", "TRIANGLE"],["SNAKE", "SNAKE"],["UMBRELLA", "UMBRELLA"],["SKULL", "SKULL"],["GIRAFFE", "GIRAFFE"],["SWORD", "SWORD"]
|
||||
];
|
||||
this.appendValueInput('SUB')
|
||||
.setCheck("var");
|
||||
this.setColour(DISPLAY_EXTERN_HUE);
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_Built_in_image1)
|
||||
.appendField(new Blockly.FieldDropdown(OPERATORS), 'image');
|
||||
.appendField(new Blockly.FieldDropdown(this.OPERATORS), 'image');
|
||||
this.setOutput(true, "esp32_image");
|
||||
this.setInputsInline(true);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_MICROBIT_Clear_display);
|
||||
}
|
||||
},
|
||||
OPERATORS: [
|
||||
["HEART", "HEART"],
|
||||
["HEART_SMALL", "HEART_SMALL"],
|
||||
["HAPPY", "HAPPY"],
|
||||
["SAD", "SAD"],
|
||||
["SMILE", "SMILE"],
|
||||
["SILLY", "SILLY"],
|
||||
["FABULOUS", "FABULOUS"],
|
||||
["SURPRISED", "SURPRISED"],
|
||||
["ASLEEP", "ASLEEP"],
|
||||
["ANGRY", "ANGRY"],
|
||||
["CONFUSED", "CONFUSED"],
|
||||
["NO", "NO"],
|
||||
["YES", "YES"]
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
export const matrix_extern_image_arithmetic = {
|
||||
init: function () {
|
||||
var OPERATORS = [
|
||||
[Blockly.Msg.MICROBIT_DISPLAY_UNION, 'add'],
|
||||
[Blockly.Msg.MICROBIT_DISPLAY_MINUS, 'sub']
|
||||
];
|
||||
this.appendValueInput('SUB')
|
||||
.setCheck("var");
|
||||
this.setColour(DISPLAY_EXTERN_HUE);
|
||||
@@ -297,7 +297,7 @@ export const matrix_extern_image_arithmetic = {
|
||||
.appendField(Blockly.Msg.MICROBIT_DISPLAY_MERGE_SHAPE);
|
||||
this.appendValueInput('B')
|
||||
// .setCheck(["esp32_image", "List", String])
|
||||
.appendField(new Blockly.FieldDropdown(OPERATORS), 'OP');
|
||||
.appendField(new Blockly.FieldDropdown(this.OPERATORS), 'OP');
|
||||
this.setInputsInline(true);
|
||||
var thisBlock = this;
|
||||
this.setTooltip(function () {
|
||||
@@ -308,7 +308,11 @@ export const matrix_extern_image_arithmetic = {
|
||||
};
|
||||
return TOOLTIPS[mode];
|
||||
});
|
||||
}
|
||||
},
|
||||
OPERATORS: [
|
||||
[Blockly.Msg.MICROBIT_DISPLAY_UNION, 'add'],
|
||||
[Blockly.Msg.MICROBIT_DISPLAY_MINUS, 'sub']
|
||||
]
|
||||
};
|
||||
|
||||
export const matrix_extern_image_invert = {
|
||||
@@ -385,10 +389,6 @@ export const display_draw_4strings = {
|
||||
|
||||
export const display_image_size = {
|
||||
init: function () {
|
||||
var OPERATORS = [
|
||||
[Blockly.Msg.MIXLY_HEIGHT, 'height'],
|
||||
[Blockly.Msg.MIXLY_WIDTH, 'width']
|
||||
];
|
||||
this.setColour(DISPLAY_EXTERN_HUE);
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_PY_STORAGE_GET + Blockly.Msg.MIXLY_MICROBIT_IMAGE);
|
||||
@@ -396,7 +396,7 @@ export const display_image_size = {
|
||||
.setCheck("esp32_image")
|
||||
// .appendField(Blockly.Msg.blockpy_USE_LIST);
|
||||
this.appendDummyInput("")
|
||||
.appendField(new Blockly.FieldDropdown(OPERATORS), 'OP');
|
||||
.appendField(new Blockly.FieldDropdown(this.OPERATORS), 'OP');
|
||||
this.setInputsInline(true);
|
||||
this.setOutput(true);
|
||||
var thisBlock = this;
|
||||
@@ -410,15 +410,15 @@ export const display_image_size = {
|
||||
};
|
||||
return mode0 + mode1 + TOOLTIPS[mode];
|
||||
});
|
||||
}
|
||||
},
|
||||
OPERATORS: [
|
||||
[Blockly.Msg.MIXLY_HEIGHT, 'height'],
|
||||
[Blockly.Msg.MIXLY_WIDTH, 'width']
|
||||
]
|
||||
};
|
||||
|
||||
export const display_rect = {
|
||||
init: function () {
|
||||
var brightness_or_not = [
|
||||
[Blockly.Msg.MIXLY_4DIGITDISPLAY_ON, '1'],
|
||||
[Blockly.Msg.MIXLY_4DIGITDISPLAY_OFF, '0']
|
||||
];
|
||||
this.setColour(DISPLAY_EXTERN_HUE);
|
||||
// this.appendDummyInput()
|
||||
// .appendField(Blockly.Msg.OLED)
|
||||
@@ -428,37 +428,37 @@ export const display_rect = {
|
||||
.setCheck("var");
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_RECT)
|
||||
.appendField(new Blockly.FieldDropdown(brightness_or_not), 'OP')
|
||||
|
||||
.appendField(new Blockly.FieldDropdown(this.STATUS), 'OP')
|
||||
// this.appendValueInput("PIN", Number)
|
||||
// .setCheck(Number)
|
||||
// .setAlign(Blockly.inputs.Align.RIGHT)
|
||||
// .appendField(Blockly.Msg.MIXLY_PIN);
|
||||
this.jsonInit({
|
||||
"message0": Blockly.Msg.MIXLY_MICROBIT_SHOW_RECT,
|
||||
"args0": [{
|
||||
"check": Number,
|
||||
"type": "input_value",
|
||||
"name": "x"
|
||||
}, {
|
||||
"check": Number,
|
||||
"type": "input_value",
|
||||
"name": "y"
|
||||
}, {
|
||||
"check": Number,
|
||||
"type": "input_value",
|
||||
"name": "width"
|
||||
}, {
|
||||
"check": Number,
|
||||
"type": "input_value",
|
||||
"name": "height"
|
||||
}, {
|
||||
"type": "input_dummy"
|
||||
}, {
|
||||
"checked": false,
|
||||
"type": "field_checkbox",
|
||||
"name": "fill"
|
||||
}
|
||||
"args0": [
|
||||
{
|
||||
"check": Number,
|
||||
"type": "input_value",
|
||||
"name": "x"
|
||||
}, {
|
||||
"check": Number,
|
||||
"type": "input_value",
|
||||
"name": "y"
|
||||
}, {
|
||||
"check": Number,
|
||||
"type": "input_value",
|
||||
"name": "width"
|
||||
}, {
|
||||
"check": Number,
|
||||
"type": "input_value",
|
||||
"name": "height"
|
||||
}, {
|
||||
"type": "input_dummy"
|
||||
}, {
|
||||
"checked": false,
|
||||
"type": "field_checkbox",
|
||||
"name": "fill"
|
||||
}
|
||||
]
|
||||
});
|
||||
this.setInputsInline(true);
|
||||
@@ -466,7 +466,11 @@ export const display_rect = {
|
||||
this.setNextStatement(true, null);
|
||||
this.setTooltip('');
|
||||
this.setTooltip(Blockly.Msg.MIXLY_OLED_RECT);
|
||||
}
|
||||
},
|
||||
STATUS: [
|
||||
[Blockly.Msg.MIXLY_4DIGITDISPLAY_ON, '1'],
|
||||
[Blockly.Msg.MIXLY_4DIGITDISPLAY_OFF, '0']
|
||||
]
|
||||
};
|
||||
|
||||
export const display_line = {
|
||||
@@ -484,22 +488,26 @@ export const display_line = {
|
||||
// .appendField(Blockly.Msg.MIXLY_PIN);
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_DISPLAY_DRAW)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_DISPLAY_RLINE, "hline"], [Blockly.Msg.MIXLY_DISPLAY_VLINE, "vline"]]), "direction");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_DISPLAY_RLINE, "hline"],
|
||||
[Blockly.Msg.MIXLY_DISPLAY_VLINE, "vline"]
|
||||
]), "direction");
|
||||
this.jsonInit({
|
||||
"message0": Blockly.Msg.MIXLY_MICROBIT_SHOW_LINE,
|
||||
"args0": [{
|
||||
"check": Number,
|
||||
"type": "input_value",
|
||||
"name": "x"
|
||||
}, {
|
||||
"check": Number,
|
||||
"type": "input_value",
|
||||
"name": "y"
|
||||
}, {
|
||||
"check": Number,
|
||||
"type": "input_value",
|
||||
"name": "length"
|
||||
}
|
||||
"args0": [
|
||||
{
|
||||
"check": Number,
|
||||
"type": "input_value",
|
||||
"name": "x"
|
||||
}, {
|
||||
"check": Number,
|
||||
"type": "input_value",
|
||||
"name": "y"
|
||||
}, {
|
||||
"check": Number,
|
||||
"type": "input_value",
|
||||
"name": "length"
|
||||
}
|
||||
]
|
||||
});
|
||||
this.setInputsInline(true);
|
||||
@@ -524,23 +532,24 @@ export const display_line_arbitrarily = {
|
||||
// .appendField(Blockly.Msg.MIXLY_PIN);
|
||||
this.jsonInit({
|
||||
"message0": Blockly.Msg.MIXLY_MICROBIT_SHOW_LINE_ARBITRARILY,
|
||||
"args0": [{
|
||||
"check": Number,
|
||||
"type": "input_value",
|
||||
"name": "x1"
|
||||
}, {
|
||||
"check": Number,
|
||||
"type": "input_value",
|
||||
"name": "y1"
|
||||
}, {
|
||||
"check": Number,
|
||||
"type": "input_value",
|
||||
"name": "x2"
|
||||
}, {
|
||||
"check": Number,
|
||||
"type": "input_value",
|
||||
"name": "y2"
|
||||
},
|
||||
"args0": [
|
||||
{
|
||||
"check": Number,
|
||||
"type": "input_value",
|
||||
"name": "x1"
|
||||
}, {
|
||||
"check": Number,
|
||||
"type": "input_value",
|
||||
"name": "y1"
|
||||
}, {
|
||||
"check": Number,
|
||||
"type": "input_value",
|
||||
"name": "x2"
|
||||
}, {
|
||||
"check": Number,
|
||||
"type": "input_value",
|
||||
"name": "y2"
|
||||
},
|
||||
]
|
||||
});
|
||||
this.setInputsInline(true);
|
||||
@@ -601,7 +610,10 @@ export const display_onoff = {
|
||||
init: function () {
|
||||
this.setColour(DISPLAY_EXTERN_HUE);
|
||||
this.appendDummyInput("")
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_ESP32_ON, "ON"], [Blockly.Msg.MIXLY_ESP32_OFF, "OFF"]]), 'ONOFF')
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_ESP32_ON, "ON"],
|
||||
[Blockly.Msg.MIXLY_ESP32_OFF, "OFF"]
|
||||
]), 'ONOFF')
|
||||
this.setOutput(true, Boolean);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_INOUT_HIGHLOW);
|
||||
}
|
||||
@@ -648,53 +660,50 @@ export const display_fill = {
|
||||
|
||||
export const display_animate = {
|
||||
init: function () {
|
||||
var ANIMATE = [
|
||||
["ALL_CLOCKS", 'ALL_CLOCKS'],
|
||||
["ALL_ARROWS", 'ALL_ARROWS']
|
||||
];
|
||||
this.setColour(DISPLAY_EXTERN_HUE);
|
||||
this.setOutput(true, 'Tuple');
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_ESP32_DISPLAY_ANIMATE)
|
||||
.appendField(new Blockly.FieldDropdown(ANIMATE), 'ANIMATION')
|
||||
.appendField(new Blockly.FieldDropdown(this.ANIMATE), 'ANIMATION')
|
||||
//this.setTooltip(Blockly.Msg.LOGIC_BOOLEAN_TOOLTIP);
|
||||
}
|
||||
},
|
||||
ANIMATE: [
|
||||
["ALL_CLOCKS", 'ALL_CLOCKS'],
|
||||
["ALL_ARROWS", 'ALL_ARROWS']
|
||||
]
|
||||
};
|
||||
|
||||
export const display_circle = {
|
||||
init: function () {
|
||||
var brightness_or_not = [
|
||||
[Blockly.Msg.MIXLY_4DIGITDISPLAY_ON, '1'],
|
||||
[Blockly.Msg.MIXLY_4DIGITDISPLAY_OFF, '0']
|
||||
];
|
||||
this.setColour(DISPLAY_EXTERN_HUE);
|
||||
this.appendValueInput('VAR')
|
||||
.appendField(Blockly.Msg.OLED)
|
||||
.setCheck("var");
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_MIXPY_TURTLE_DRAW_CIRCLE)
|
||||
.appendField(new Blockly.FieldDropdown(brightness_or_not), 'OP')
|
||||
.appendField(new Blockly.FieldDropdown(this.STATUS), 'OP')
|
||||
this.jsonInit({
|
||||
"message0": Blockly.Msg.MIXLY_HANBIT_SHOW_CIRCLE,
|
||||
"args0": [{
|
||||
"check": Number,
|
||||
"type": "input_value",
|
||||
"name": "x"
|
||||
}, {
|
||||
"check": Number,
|
||||
"type": "input_value",
|
||||
"name": "y"
|
||||
}, {
|
||||
"check": Number,
|
||||
"type": "input_value",
|
||||
"name": "r"
|
||||
}, {
|
||||
"type": "input_dummy"
|
||||
}, {
|
||||
"checked": false,
|
||||
"type": "field_checkbox",
|
||||
"name": "fill"
|
||||
}
|
||||
"args0": [
|
||||
{
|
||||
"check": Number,
|
||||
"type": "input_value",
|
||||
"name": "x"
|
||||
}, {
|
||||
"check": Number,
|
||||
"type": "input_value",
|
||||
"name": "y"
|
||||
}, {
|
||||
"check": Number,
|
||||
"type": "input_value",
|
||||
"name": "r"
|
||||
}, {
|
||||
"type": "input_dummy"
|
||||
}, {
|
||||
"checked": false,
|
||||
"type": "field_checkbox",
|
||||
"name": "fill"
|
||||
}
|
||||
]
|
||||
});
|
||||
this.setInputsInline(true);
|
||||
@@ -702,7 +711,11 @@ export const display_circle = {
|
||||
this.setNextStatement(true, null);
|
||||
this.setTooltip('');
|
||||
this.setTooltip(Blockly.Msg.MIXLY_MIXPY_TURTLE_DRAW_CIRCLE);
|
||||
}
|
||||
},
|
||||
STATUS: [
|
||||
[Blockly.Msg.MIXLY_4DIGITDISPLAY_ON, '1'],
|
||||
[Blockly.Msg.MIXLY_4DIGITDISPLAY_OFF, '0']
|
||||
]
|
||||
};
|
||||
|
||||
export const display_triangle = {
|
||||
@@ -720,37 +733,38 @@ export const display_triangle = {
|
||||
.appendField(new Blockly.FieldDropdown(brightness_or_not), 'OP')
|
||||
this.jsonInit({
|
||||
"message0": Blockly.Msg.MIXLY_HANBIT_SHOW_triangle,
|
||||
"args0": [{
|
||||
"check": Number,
|
||||
"type": "input_value",
|
||||
"name": "x0"
|
||||
}, {
|
||||
"check": Number,
|
||||
"type": "input_value",
|
||||
"name": "y0"
|
||||
}, {
|
||||
"check": Number,
|
||||
"type": "input_value",
|
||||
"name": "x1"
|
||||
}, {
|
||||
"check": Number,
|
||||
"type": "input_value",
|
||||
"name": "y1"
|
||||
}, {
|
||||
"check": Number,
|
||||
"type": "input_value",
|
||||
"name": "x2"
|
||||
}, {
|
||||
"check": Number,
|
||||
"type": "input_value",
|
||||
"name": "y2"
|
||||
}, {
|
||||
"type": "input_dummy"
|
||||
}, {
|
||||
"checked": false,
|
||||
"type": "field_checkbox",
|
||||
"name": "fill"
|
||||
}
|
||||
"args0": [
|
||||
{
|
||||
"check": Number,
|
||||
"type": "input_value",
|
||||
"name": "x0"
|
||||
}, {
|
||||
"check": Number,
|
||||
"type": "input_value",
|
||||
"name": "y0"
|
||||
}, {
|
||||
"check": Number,
|
||||
"type": "input_value",
|
||||
"name": "x1"
|
||||
}, {
|
||||
"check": Number,
|
||||
"type": "input_value",
|
||||
"name": "y1"
|
||||
}, {
|
||||
"check": Number,
|
||||
"type": "input_value",
|
||||
"name": "x2"
|
||||
}, {
|
||||
"check": Number,
|
||||
"type": "input_value",
|
||||
"name": "y2"
|
||||
}, {
|
||||
"type": "input_dummy"
|
||||
}, {
|
||||
"checked": false,
|
||||
"type": "field_checkbox",
|
||||
"name": "fill"
|
||||
}
|
||||
]
|
||||
});
|
||||
this.setInputsInline(true);
|
||||
@@ -861,7 +875,11 @@ export const display_tm1650_power = {
|
||||
.appendField(new Blockly.FieldDropdown([["TM1650", "tm1650"]]), "TYPE");
|
||||
this.appendValueInput("VAR")
|
||||
this.appendDummyInput()
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_ON, "on"], [Blockly.Msg.MIXLY_OFF, "off"], [Blockly.Msg.MIXLY_LCD_STAT_CLEAR, "clear"]]), "STAT");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_ON, "on"],
|
||||
[Blockly.Msg.MIXLY_OFF, "off"],
|
||||
[Blockly.Msg.MIXLY_LCD_STAT_CLEAR, "clear"]
|
||||
]), "STAT");
|
||||
this.setInputsInline(true);
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
@@ -1016,7 +1034,6 @@ export const display_color_seclet = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export const tft_show_image_or_string_delay = {
|
||||
init: function () {
|
||||
this.setColour(DISPLAY_EXTERN_HUE);
|
||||
@@ -1104,8 +1121,6 @@ export const tft_show_frame_string_delay = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
export const tft_fill = {
|
||||
init: function () {
|
||||
this.setColour(DISPLAY_EXTERN_HUE);
|
||||
@@ -1148,23 +1163,24 @@ export const tft_line_arbitrarily = {
|
||||
// .appendField(Blockly.Msg.MIXLY_PIN);
|
||||
this.jsonInit({
|
||||
"message0": Blockly.Msg.MIXLY_MICROBIT_SHOW_LINE_ARBITRARILY,
|
||||
"args0": [{
|
||||
"check": Number,
|
||||
"type": "input_value",
|
||||
"name": "x1"
|
||||
}, {
|
||||
"check": Number,
|
||||
"type": "input_value",
|
||||
"name": "y1"
|
||||
}, {
|
||||
"check": Number,
|
||||
"type": "input_value",
|
||||
"name": "x2"
|
||||
}, {
|
||||
"check": Number,
|
||||
"type": "input_value",
|
||||
"name": "y2"
|
||||
},
|
||||
"args0": [
|
||||
{
|
||||
"check": Number,
|
||||
"type": "input_value",
|
||||
"name": "x1"
|
||||
}, {
|
||||
"check": Number,
|
||||
"type": "input_value",
|
||||
"name": "y1"
|
||||
}, {
|
||||
"check": Number,
|
||||
"type": "input_value",
|
||||
"name": "x2"
|
||||
}, {
|
||||
"check": Number,
|
||||
"type": "input_value",
|
||||
"name": "y2"
|
||||
},
|
||||
]
|
||||
});
|
||||
this.appendValueInput('VAR')
|
||||
@@ -1511,12 +1527,6 @@ export const extern_oled_show_frame_string_delay = {
|
||||
|
||||
export const extern_oled_shift = {
|
||||
init: function () {
|
||||
var OPERATORS = [
|
||||
[Blockly.Msg.MIXLY_UP, 'shift_up'],
|
||||
[Blockly.Msg.MIXLY_DOWN, 'shift_down'],
|
||||
[Blockly.Msg.MIXLY_LEFT, 'shift_left'],
|
||||
[Blockly.Msg.MIXLY_RIGHT, 'shift_right'],
|
||||
];
|
||||
//this.setHelpUrl(Blockly.Msg.MATH_TRIG_HELPURL);
|
||||
this.setColour(DISPLAY_EXTERN_HUE);
|
||||
this.appendValueInput('SUB')
|
||||
@@ -1530,7 +1540,7 @@ export const extern_oled_shift = {
|
||||
.appendField(Blockly.Msg.DISPLAY_IMAGE_LET)
|
||||
this.appendDummyInput('')
|
||||
.appendField(Blockly.Msg.DISPLAY_IMAGE_LET2)
|
||||
.appendField(new Blockly.FieldDropdown(OPERATORS), 'OP');
|
||||
.appendField(new Blockly.FieldDropdown(this.OPERATORS), 'OP');
|
||||
this.appendValueInput('val')
|
||||
.appendField(Blockly.Msg.DISPLAY_IMAGE_SHIFT)
|
||||
.setCheck(Number);
|
||||
@@ -1550,7 +1560,13 @@ export const extern_oled_shift = {
|
||||
};
|
||||
return mode0 + mode1 + TOOLTIPS[mode] + mode2;
|
||||
});
|
||||
}
|
||||
},
|
||||
OPERATORS: [
|
||||
[Blockly.Msg.MIXLY_UP, 'shift_up'],
|
||||
[Blockly.Msg.MIXLY_DOWN, 'shift_down'],
|
||||
[Blockly.Msg.MIXLY_LEFT, 'shift_left'],
|
||||
[Blockly.Msg.MIXLY_RIGHT, 'shift_right'],
|
||||
]
|
||||
};
|
||||
|
||||
export const extern_oled_get_pixel = {
|
||||
@@ -1595,8 +1611,6 @@ export const extern_oled_bright_point = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
export const extern_oled_clear = {
|
||||
init: function () {
|
||||
this.setColour(DISPLAY_EXTERN_HUE);
|
||||
@@ -1619,7 +1633,6 @@ export const extern_oled_shape_rect = {
|
||||
"args0": [
|
||||
{
|
||||
"name": "SUB",
|
||||
|
||||
"type": "input_value"
|
||||
},
|
||||
{
|
||||
@@ -1661,7 +1674,6 @@ export const extern_oled_shape_rect = {
|
||||
"type": "input_value",
|
||||
//"check": "Number"
|
||||
}
|
||||
|
||||
],
|
||||
"inputsInline": true,
|
||||
"helpUrl": Blockly.Msg.mpython_HELPURL,
|
||||
@@ -1680,7 +1692,6 @@ export const extern_oled_hvline = {
|
||||
"args0": [
|
||||
{
|
||||
"name": "SUB",
|
||||
|
||||
"type": "input_value"
|
||||
},
|
||||
{
|
||||
@@ -1717,7 +1728,6 @@ export const extern_oled_hvline = {
|
||||
"type": "input_value",
|
||||
//"check": "Number"
|
||||
}
|
||||
|
||||
],
|
||||
"inputsInline": true,
|
||||
"helpUrl": Blockly.Msg.mpython_HELPURL,
|
||||
@@ -1736,7 +1746,6 @@ export const extern_oled_line = {
|
||||
"args0": [
|
||||
{
|
||||
"name": "SUB",
|
||||
|
||||
"type": "input_value"
|
||||
},
|
||||
{
|
||||
|
||||
@@ -82,7 +82,6 @@ export const display_scroll_string_delay = {
|
||||
this.setNextStatement(true, null);
|
||||
this.setInputsInline(true);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_ESP32_SCROLL_IMAGE_OR_STRING_DELAY);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
@@ -163,13 +162,27 @@ export const display_image_builtins = {
|
||||
init: function () {
|
||||
this.jsonInit({
|
||||
"colour": DISPLAY_ONBOARD_HUE,
|
||||
"args0": [{
|
||||
"name": "image",
|
||||
"options": [["HEART", "HEART"], ["HEART_SMALL", "HEART_SMALL"], ["HAPPY", "HAPPY"], ["SAD", "SAD"], ["SMILE", "SMILE"], ["SILLY", "SILLY"], ["FABULOUS", "FABULOUS"], ["SURPRISED", "SURPRISED"], ["ASLEEP", "ASLEEP"], ["ANGRY", "ANGRY"], ["CONFUSED", "CONFUSED"], ["NO", "NO"], ["YES", "YES"]
|
||||
// ,["LEFT_ARROW", "LEFT_ARROW"],["RIGHT_ARROW", "RIGHT_ARROW"],["DRESS", "DRESS"],["TRANSFORMERS", "TRANSFORMERS"],["SCISSORS", "SCISSORS"],["EXIT", "EXIT"],["TREE", "TREE"],["PACMAN", "PACMAN"],["TARGET", "TARGET"],["TSHIRT", "TSHIRT"],["ROLLERSKATE", "ROLLERSKATE"],["DUCK", "DUCK"],["HOUSE", "HOUSE"],["TORTOISE", "TORTOISE"],["BUTTERFLY", "BUTTERFLY"],["STICKFIGURE", "STICKFIGURE"],["GHOST", "GHOST"],["PITCHFORK", "PITCHFORK"],["MUSIC_QUAVERS", "MUSIC_QUAVERS"],["MUSIC_QUAVER", "MUSIC_QUAVER"],["MUSIC_CROTCHET", "MUSIC_CROTCHET"],["COW", "COW"],["RABBIT", "RABBIT"],["SQUARE_SMALL", "SQUARE_SMALL"],["SQUARE", "SQUARE"],["DIAMOND_SMALL", "DIAMOND_SMALL"],["DIAMOND", "DIAMOND"],["CHESSBOARD", "CHESSBOARD"],["TRIANGLE_LEFT", "TRIANGLE_LEFT"],["TRIANGLE", "TRIANGLE"],["SNAKE", "SNAKE"],["UMBRELLA", "UMBRELLA"],["SKULL", "SKULL"],["GIRAFFE", "GIRAFFE"],["SWORD", "SWORD"]
|
||||
],
|
||||
"type": "field_dropdown"
|
||||
}],
|
||||
"args0": [
|
||||
{
|
||||
"name": "image",
|
||||
"options": [
|
||||
["HEART", "HEART"],
|
||||
["HEART_SMALL", "HEART_SMALL"],
|
||||
["HAPPY", "HAPPY"],
|
||||
["SAD", "SAD"],
|
||||
["SMILE", "SMILE"],
|
||||
["SILLY", "SILLY"],
|
||||
["FABULOUS", "FABULOUS"],
|
||||
["SURPRISED", "SURPRISED"],
|
||||
["ASLEEP", "ASLEEP"],
|
||||
["ANGRY", "ANGRY"],
|
||||
["CONFUSED", "CONFUSED"],
|
||||
["NO", "NO"],
|
||||
["YES", "YES"]
|
||||
],
|
||||
"type": "field_dropdown"
|
||||
}
|
||||
],
|
||||
"output": ["esp32_image", "List"],
|
||||
"helpUrl": "https://microbit-micropython.readthedocs.io/en/latest/image.html#attributes",
|
||||
"tooltip": Blockly.Msg.MIXLY_MICROBIT_Built_in_image1,
|
||||
@@ -190,10 +203,6 @@ export const display_image_builtins_all = {
|
||||
|
||||
export const image_arithmetic = {
|
||||
init: function () {
|
||||
var OPERATORS = [
|
||||
[Blockly.Msg.MICROBIT_DISPLAY_UNION, 'add'],
|
||||
[Blockly.Msg.MICROBIT_DISPLAY_MINUS, 'sub']
|
||||
];
|
||||
this.setColour(DISPLAY_ONBOARD_HUE);
|
||||
this.setOutput(true, "esp32_image");
|
||||
this.appendValueInput('A')
|
||||
@@ -201,7 +210,7 @@ export const image_arithmetic = {
|
||||
.appendField(Blockly.Msg.MICROBIT_DISPLAY_MERGE_SHAPE);
|
||||
this.appendValueInput('B')
|
||||
// .setCheck(["esp32_image", "List", String])
|
||||
.appendField(new Blockly.FieldDropdown(OPERATORS), 'OP');
|
||||
.appendField(new Blockly.FieldDropdown(this.OPERATORS), 'OP');
|
||||
this.setInputsInline(true);
|
||||
var thisBlock = this;
|
||||
this.setTooltip(function () {
|
||||
@@ -212,7 +221,11 @@ export const image_arithmetic = {
|
||||
};
|
||||
return TOOLTIPS[mode];
|
||||
});
|
||||
}
|
||||
},
|
||||
OPERATORS: [
|
||||
[Blockly.Msg.MICROBIT_DISPLAY_UNION, 'add'],
|
||||
[Blockly.Msg.MICROBIT_DISPLAY_MINUS, 'sub']
|
||||
]
|
||||
};
|
||||
|
||||
export const image_invert = {
|
||||
@@ -228,12 +241,6 @@ export const image_invert = {
|
||||
|
||||
export const display_shift = {
|
||||
init: function () {
|
||||
var OPERATORS = [
|
||||
[Blockly.Msg.MIXLY_UP, 'shift_up'],
|
||||
[Blockly.Msg.MIXLY_DOWN, 'shift_down'],
|
||||
[Blockly.Msg.MIXLY_LEFT, 'shift_left'],
|
||||
[Blockly.Msg.MIXLY_RIGHT, 'shift_right'],
|
||||
];
|
||||
//this.setHelpUrl(Blockly.Msg.MATH_TRIG_HELPURL);
|
||||
this.setColour(DISPLAY_ONBOARD_HUE);
|
||||
// this.setOutput(true);
|
||||
@@ -244,7 +251,7 @@ export const display_shift = {
|
||||
.appendField(Blockly.Msg.DISPLAY_IMAGE_LET)
|
||||
this.appendDummyInput('')
|
||||
.appendField(Blockly.Msg.DISPLAY_IMAGE_LET2)
|
||||
.appendField(new Blockly.FieldDropdown(OPERATORS), 'OP');
|
||||
.appendField(new Blockly.FieldDropdown(this.OPERATORS), 'OP');
|
||||
this.appendValueInput('val')
|
||||
.appendField(Blockly.Msg.DISPLAY_IMAGE_SHIFT)
|
||||
.setCheck(Number);
|
||||
@@ -264,7 +271,13 @@ export const display_shift = {
|
||||
};
|
||||
return mode0 + mode1 + TOOLTIPS[mode] + mode2;
|
||||
});
|
||||
}
|
||||
},
|
||||
OPERATORS: [
|
||||
[Blockly.Msg.MIXLY_UP, 'shift_up'],
|
||||
[Blockly.Msg.MIXLY_DOWN, 'shift_down'],
|
||||
[Blockly.Msg.MIXLY_LEFT, 'shift_left'],
|
||||
[Blockly.Msg.MIXLY_RIGHT, 'shift_right'],
|
||||
]
|
||||
};
|
||||
|
||||
export const display_get_pixel = {
|
||||
@@ -339,16 +352,8 @@ export const display_clear = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//mixgo_me onboard_matrix below:
|
||||
|
||||
|
||||
|
||||
export const mixgome_display_image_create = {
|
||||
init: function () {
|
||||
this.appendDummyInput('')
|
||||
@@ -406,28 +411,23 @@ export const mixgo_display_image_create_new = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
export const mixgome_display_font = {
|
||||
init: function () {
|
||||
var OPERATORS = [
|
||||
['4x5' + Blockly.Msg.MIXGO_ME_DISPLAY_HORIZONTAL, "'4x5'"],
|
||||
['5x5' + Blockly.Msg.MIXGO_ME_DISPLAY_HORIZONTAL, "'5x5'"],
|
||||
['5x8' + Blockly.Msg.MIXGO_ME_DISPLAY_VERTICAL, "'5x8'"]
|
||||
];
|
||||
this.setColour(DISPLAY_ONBOARD_HUE);
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.OLED_SET_FONT)
|
||||
.appendField(new Blockly.FieldDropdown(OPERATORS), 'OP');
|
||||
.appendField(new Blockly.FieldDropdown(this.OPERATORS), 'OP');
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setInputsInline(true);
|
||||
|
||||
}
|
||||
},
|
||||
OPERATORS: [
|
||||
['4x5' + Blockly.Msg.MIXGO_ME_DISPLAY_HORIZONTAL, "'4x5'"],
|
||||
['5x5' + Blockly.Msg.MIXGO_ME_DISPLAY_HORIZONTAL, "'5x5'"],
|
||||
['5x8' + Blockly.Msg.MIXGO_ME_DISPLAY_VERTICAL, "'5x8'"]
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
|
||||
//mpython
|
||||
|
||||
export const onboard_oled_show_image = {
|
||||
@@ -532,7 +532,6 @@ export const onboard_oled_scroll_string_delay = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export const onboard_oled_show_frame_string_delay = {
|
||||
init: function () {
|
||||
this.setColour(DISPLAY_ONBOARD_HUE);
|
||||
@@ -614,7 +613,6 @@ export const mpython_display_shape_rect = {
|
||||
"type": "input_value",
|
||||
//"check": "Number"
|
||||
}
|
||||
|
||||
],
|
||||
"inputsInline": true,
|
||||
"helpUrl": Blockly.Msg.mpython_HELPURL,
|
||||
@@ -665,7 +663,6 @@ export const mpython_display_hvline = {
|
||||
"type": "input_value",
|
||||
//"check": "Number"
|
||||
}
|
||||
|
||||
],
|
||||
"inputsInline": true,
|
||||
"helpUrl": Blockly.Msg.mpython_HELPURL,
|
||||
@@ -709,7 +706,6 @@ export const mpython_display_line = {
|
||||
"type": "input_value",
|
||||
//"check": "Number"
|
||||
}
|
||||
|
||||
],
|
||||
"inputsInline": true,
|
||||
"helpUrl": Blockly.Msg.mpython_HELPURL,
|
||||
@@ -832,8 +828,6 @@ export const mpython_pbm_image = {
|
||||
|
||||
//mixbot onboard_matrix below:
|
||||
|
||||
|
||||
|
||||
export const mixbot_display_image_create = {
|
||||
init: function () {
|
||||
this.appendDummyInput('')
|
||||
@@ -889,21 +883,20 @@ export const mixbot_display_bright_screen = {
|
||||
|
||||
export const mixbot_display_rotate = {
|
||||
init: function () {
|
||||
var OPERATORS = [
|
||||
[Blockly.Msg.mixpy_PL_PIE_SHADOW_N, '0'],
|
||||
[Blockly.Msg.CLOCKWISE + '90' + Blockly.Msg.blockpy_setheading_degree, '1'],
|
||||
[Blockly.Msg.CLOCKWISE + '180' + Blockly.Msg.blockpy_setheading_degree, '2'],
|
||||
[Blockly.Msg.CLOCKWISE + '270' + Blockly.Msg.blockpy_setheading_degree, '3']
|
||||
];
|
||||
this.setColour(DISPLAY_ONBOARD_HUE);
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_MIXBOT_SCREEN_ROTATE)
|
||||
.appendField(new Blockly.FieldDropdown(OPERATORS), 'OP');
|
||||
.appendField(new Blockly.FieldDropdown(this.OPERATORS), 'OP');
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setInputsInline(true);
|
||||
|
||||
}
|
||||
},
|
||||
OPERATORS: [
|
||||
[Blockly.Msg.mixpy_PL_PIE_SHADOW_N, '0'],
|
||||
[Blockly.Msg.CLOCKWISE + '90' + Blockly.Msg.blockpy_setheading_degree, '1'],
|
||||
[Blockly.Msg.CLOCKWISE + '180' + Blockly.Msg.blockpy_setheading_degree, '2'],
|
||||
[Blockly.Msg.CLOCKWISE + '270' + Blockly.Msg.blockpy_setheading_degree, '3']
|
||||
]
|
||||
};
|
||||
|
||||
export const bitbot_display_image_create = {
|
||||
@@ -1042,7 +1035,6 @@ export const onboard_tft_display_shape_rect = {
|
||||
"type": "input_value",
|
||||
//"check": "Number"
|
||||
}
|
||||
|
||||
],
|
||||
"inputsInline": true,
|
||||
"helpUrl": Blockly.Msg.mpython_HELPURL,
|
||||
@@ -1090,7 +1082,6 @@ export const onboard_tft_display_hvline = {
|
||||
"type": "input_value",
|
||||
//"check": "Number"
|
||||
}
|
||||
|
||||
],
|
||||
"inputsInline": true,
|
||||
"helpUrl": Blockly.Msg.mpython_HELPURL,
|
||||
@@ -1134,7 +1125,6 @@ export const onboard_tft_display_line = {
|
||||
"type": "input_value",
|
||||
//"check": "Number"
|
||||
}
|
||||
|
||||
],
|
||||
"inputsInline": true,
|
||||
"helpUrl": Blockly.Msg.mpython_HELPURL,
|
||||
@@ -1314,7 +1304,6 @@ export const onboard_tft_display_shape_circle = {
|
||||
"type": "input_value",
|
||||
//"check": "Number"
|
||||
}
|
||||
|
||||
],
|
||||
"inputsInline": true,
|
||||
"helpUrl": Blockly.Msg.mpython_HELPURL,
|
||||
|
||||
@@ -188,8 +188,7 @@ export const factory_declare = {
|
||||
this.setPreviousStatement(true);
|
||||
this.setNextStatement(true);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
export const factory_callMethod_noreturn = {
|
||||
init: function () {
|
||||
|
||||
@@ -149,7 +149,6 @@ export const inout_analog_atten = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export const inout_pin_pressed = {
|
||||
init: function () {
|
||||
this.setColour(BASE_HUE);
|
||||
@@ -174,7 +173,11 @@ export const inout_pin_attachInterrupt = {
|
||||
.setCheck(Number);
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_MODE)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_RISING, "machine.Pin.IRQ_RISING"], [Blockly.Msg.MIXLY_FALLING, "machine.Pin.IRQ_FALLING"], [Blockly.Msg.MIXLY_CHANGE, "(machine.Pin.IRQ_RISING | machine.Pin.IRQ_FALLING)"]]), "mode");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_RISING, "machine.Pin.IRQ_RISING"],
|
||||
[Blockly.Msg.MIXLY_FALLING, "machine.Pin.IRQ_FALLING"],
|
||||
[Blockly.Msg.MIXLY_CHANGE, "(machine.Pin.IRQ_RISING | machine.Pin.IRQ_FALLING)"]
|
||||
]), "mode");
|
||||
this.appendValueInput('DO')
|
||||
.appendField(Blockly.Msg.MIXLY_DO)
|
||||
this.setPreviousStatement(true);
|
||||
|
||||
@@ -264,7 +264,6 @@ export const iot_publish_container = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export const iot_publish_item = {
|
||||
/**
|
||||
* Mutator bolck for adding items.
|
||||
@@ -297,7 +296,6 @@ export const iot_create_with_item = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export const iot_mixio_connect = {
|
||||
init: function () {
|
||||
this.setColour(IOT_HUE);
|
||||
@@ -489,7 +487,6 @@ export const IOT_EMQX_INIT_AND_CONNECT_BY_SHARE_CODE = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export const IOT_EMQX_INIT_AND_CONNECT_BY_MIXLY_CODE = {
|
||||
init: function () {
|
||||
this.setColour(IOT_HUE);
|
||||
@@ -507,7 +504,6 @@ export const IOT_EMQX_INIT_AND_CONNECT_BY_MIXLY_CODE = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export const iot_mixly_key = {
|
||||
init: function () {
|
||||
this.VISITOR_ID = Mixly.Config.BOARD.visitorId.str32.substring(0, 8).toUpperCase();
|
||||
@@ -735,5 +731,4 @@ export const ollama_empty_history = {
|
||||
this.setPreviousStatement(true);
|
||||
this.setNextStatement(true);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
@@ -22,7 +22,6 @@ export const network_init = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export const network_open = {
|
||||
init: function () {
|
||||
this.setColour(NETWORK_HUE);
|
||||
@@ -395,10 +394,8 @@ export const requests_get = {
|
||||
.appendField(Blockly.Msg.DISPLAY_IMAGE_LET2)
|
||||
.setCheck(String);
|
||||
this.appendDummyInput("")
|
||||
|
||||
.appendField(Blockly.Msg.blockpy_REQUESTS_GET)
|
||||
.appendField(new Blockly.FieldTextInput('response'), 'VAR')
|
||||
|
||||
this.setPreviousStatement(true);
|
||||
this.setNextStatement(true);
|
||||
this.setTooltip(Blockly.Msg.blockpy_REQUESTS_GET_TOOLTIP);
|
||||
@@ -411,23 +408,15 @@ export const requests_get = {
|
||||
this.setTitleValue(newName, 'VAR');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
export const requests_attribute = {
|
||||
init: function () {
|
||||
this.appendValueInput('VAL')
|
||||
|
||||
var attr =
|
||||
[[Blockly.Msg.blockpy_REQUESTS_GET_ATTR_STATUS_CODE, 'status_code'], [Blockly.Msg.blockpy_REQUESTS_GET_ATTR_TEXT, 'text']
|
||||
, [Blockly.Msg.blockpy_REQUESTS_GET_ATTR_COOKIES, 'cookies'], [Blockly.Msg.blockpy_REQUESTS_GET_ATTR_CONTENT, 'content']];
|
||||
this.setColour(NETWORK_HUE);
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_JS_GET)
|
||||
.appendField(new Blockly.FieldDropdown(attr), 'ATTR')
|
||||
|
||||
|
||||
.appendField(new Blockly.FieldDropdown(this.ATTR), 'ATTR')
|
||||
this.setInputsInline(true);
|
||||
this.setOutput(true, String);
|
||||
var thisBlock = this;
|
||||
@@ -440,29 +429,26 @@ export const requests_attribute = {
|
||||
};
|
||||
return TOOLTIPS[mode];
|
||||
});
|
||||
}
|
||||
},
|
||||
ATTR: [
|
||||
[Blockly.Msg.blockpy_REQUESTS_GET_ATTR_STATUS_CODE, 'status_code'],
|
||||
[Blockly.Msg.blockpy_REQUESTS_GET_ATTR_TEXT, 'text'],
|
||||
[Blockly.Msg.blockpy_REQUESTS_GET_ATTR_COOKIES, 'cookies'],
|
||||
[Blockly.Msg.blockpy_REQUESTS_GET_ATTR_CONTENT, 'content']
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
|
||||
export const requests_method = {
|
||||
init: function () {
|
||||
this.appendValueInput("VAR")
|
||||
.appendField(Blockly.Msg.DISPLAY_IMAGE_LET2)
|
||||
.setCheck(String);
|
||||
var method = [
|
||||
['post', 'post'], ['put', 'put'],
|
||||
['delete', 'delete'], ['head', 'head'],
|
||||
['option', 'option']
|
||||
];
|
||||
this.setColour(NETWORK_HUE);
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.blockpy_CONDUCT)
|
||||
.appendField(new Blockly.FieldDropdown(method), 'DIR')
|
||||
.appendField(new Blockly.FieldDropdown(this.METHOD), 'DIR')
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.blockpy_REQUESTS)
|
||||
|
||||
|
||||
this.setInputsInline(true);
|
||||
this.setPreviousStatement(true);
|
||||
this.setNextStatement(true);
|
||||
@@ -475,7 +461,12 @@ export const requests_method = {
|
||||
};
|
||||
return TOOLTIPS[mode];
|
||||
});
|
||||
}
|
||||
},
|
||||
METHOD: [
|
||||
['post', 'post'], ['put', 'put'],
|
||||
['delete', 'delete'], ['head', 'head'],
|
||||
['option', 'option']
|
||||
]
|
||||
};
|
||||
|
||||
export const ntptime_time = {
|
||||
@@ -523,7 +514,11 @@ export const requests_get2 = {
|
||||
.setCheck(String);
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.blockpy_CONDUCT)
|
||||
.appendField(new Blockly.FieldDropdown([["get", "get"], ["head", "head"], ["delete", "delete"]]), 'TYPE')
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
["get", "get"],
|
||||
["head", "head"],
|
||||
["delete", "delete"]
|
||||
]), 'TYPE')
|
||||
.appendField(Blockly.Msg.blockpy_REQUESTS)
|
||||
.appendField(Blockly.Msg.MIXPY_REQUESTS_GET_RESULT)
|
||||
this.setInputsInline(true);
|
||||
@@ -540,7 +535,11 @@ export const requests_post = {
|
||||
.setCheck(String);
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.blockpy_CONDUCT)
|
||||
.appendField(new Blockly.FieldDropdown([["post", "post"], ["put", "put"], ["patch", "patch"]]), 'TYPE')
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
["post", "post"],
|
||||
["put", "put"],
|
||||
["patch", "patch"]
|
||||
]), 'TYPE')
|
||||
.appendField(Blockly.Msg.blockpy_REQUESTS)
|
||||
this.appendValueInput("data")
|
||||
.appendField(Blockly.Msg.blockpy_REQUESTS + Blockly.Msg.OLED_STRING)
|
||||
@@ -555,21 +554,20 @@ export const requests_post = {
|
||||
export const requests_attribute2 = {
|
||||
init: function () {
|
||||
this.appendValueInput('VAL')
|
||||
|
||||
var attr = [
|
||||
[Blockly.Msg.blockpy_REQUESTS_GET_ATTR_TEXT, 'text'],
|
||||
[Blockly.Msg.blockpy_REQUESTS_GET_ATTR_JSON, 'json()'],
|
||||
[Blockly.Msg.blockpy_REQUESTS_GET_ATTR_STATUS_CODE, 'status_code'],
|
||||
[Blockly.Msg.blockpy_REQUESTS_GET_ATTR_CONTENT, 'content'],
|
||||
[Blockly.Msg.MIXPY_TEXT_ENCODE, 'encoding']
|
||||
];
|
||||
this.setColour(COMMUNICATE_HUE);
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_JS_GET)
|
||||
.appendField(new Blockly.FieldDropdown(attr), 'ATTR')
|
||||
.appendField(new Blockly.FieldDropdown(this.ATTR), 'ATTR')
|
||||
this.setInputsInline(true);
|
||||
this.setOutput(true, String);
|
||||
}
|
||||
},
|
||||
ATTR: [
|
||||
[Blockly.Msg.blockpy_REQUESTS_GET_ATTR_TEXT, 'text'],
|
||||
[Blockly.Msg.blockpy_REQUESTS_GET_ATTR_JSON, 'json()'],
|
||||
[Blockly.Msg.blockpy_REQUESTS_GET_ATTR_STATUS_CODE, 'status_code'],
|
||||
[Blockly.Msg.blockpy_REQUESTS_GET_ATTR_CONTENT, 'content'],
|
||||
[Blockly.Msg.MIXPY_TEXT_ENCODE, 'encoding']
|
||||
]
|
||||
};
|
||||
|
||||
//educore_networke
|
||||
@@ -596,8 +594,6 @@ export const educore_wifi_connect = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
export const educore_mqtt_connect = {
|
||||
init: function () {
|
||||
this.setColour(COMMUNICATE_HUE);
|
||||
@@ -677,7 +673,7 @@ export const educore_mqtt_connect_success = {
|
||||
init: function () {
|
||||
this.setColour(COMMUNICATE_HUE);
|
||||
this.appendDummyInput()
|
||||
.appendField("mqtt"+Blockly.Msg.MIXLY_EMQX_IS_CONNECT)
|
||||
.appendField("mqtt" + Blockly.Msg.MIXLY_EMQX_IS_CONNECT)
|
||||
this.setInputsInline(true);
|
||||
this.setOutput(true);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ const NOVAG1_HUE = 100;
|
||||
|
||||
export const get_potential_num = {
|
||||
init: function () {
|
||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2];
|
||||
if (version == "mixgo_nova") { var name = 'Nova G1' }
|
||||
this.setColour(NOVAG1_HUE);
|
||||
this.appendDummyInput()
|
||||
@@ -14,11 +14,11 @@ export const get_potential_num = {
|
||||
this.setOutput(true, Number);
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const nova_g1_motor = {
|
||||
init: function () {
|
||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2];
|
||||
if (version == "mixgo_nova") { var name = 'Nova G1' }
|
||||
this.setColour(NOVAG1_HUE);
|
||||
this.appendValueInput('PIN')
|
||||
@@ -43,11 +43,11 @@ export const nova_g1_motor = {
|
||||
this.setNextStatement(true, null);
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const nova_g1_usb = {
|
||||
init: function () {
|
||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2];
|
||||
if (version == "mixgo_nova") { var name = 'Nova G1' }
|
||||
this.setColour(NOVAG1_HUE);
|
||||
this.appendValueInput('PIN')
|
||||
@@ -63,11 +63,11 @@ export const nova_g1_usb = {
|
||||
this.setNextStatement(true, null);
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const nova_g1_spk_en = {
|
||||
init: function () {
|
||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2];
|
||||
if (version == "mixgo_nova") { var name = 'Nova G1' }
|
||||
this.setColour(NOVAG1_HUE);
|
||||
this.appendDummyInput()
|
||||
@@ -81,4 +81,4 @@ export const nova_g1_spk_en = {
|
||||
this.setNextStatement(true, null);
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -5,7 +5,7 @@ const PEG1_HUE = 100;
|
||||
|
||||
export const pe_g1_use_i2c_init = {
|
||||
init: function () {
|
||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2];
|
||||
if (version == "mixgo_ce") { var name = 'CE G6' }
|
||||
else if (version == "mixgo_pe") { var name = 'PE G1' }
|
||||
this.setColour(PEG1_HUE);
|
||||
@@ -26,7 +26,7 @@ export const pe_g1_use_i2c_init = {
|
||||
|
||||
export const pe_g1_battery_left = {
|
||||
init: function () {
|
||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2];
|
||||
if (version == "mixgo_ce") { var name = 'CE G6' }
|
||||
else if (version == "mixgo_pe") { var name = 'PE G1' }
|
||||
this.setColour(PEG1_HUE);
|
||||
@@ -42,7 +42,7 @@ export const pe_g1_battery_left = {
|
||||
|
||||
export const pe_g1_dc_motor = {
|
||||
init: function () {
|
||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2];
|
||||
if (version == "mixgo_ce") { var name = 'CE G6' }
|
||||
else if (version == "mixgo_pe") { var name = 'PE G1' }
|
||||
this.setColour(PEG1_HUE);
|
||||
@@ -70,11 +70,11 @@ export const pe_g1_dc_motor = {
|
||||
this.setNextStatement(true, null);
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const pe_g1_dc_motor_speed = {
|
||||
init: function () {
|
||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2];
|
||||
if (version == "mixgo_ce") { var name = 'CE G6' }
|
||||
else if (version == "mixgo_pe") { var name = 'PE G1' }
|
||||
this.setColour(PEG1_HUE);
|
||||
@@ -90,11 +90,11 @@ export const pe_g1_dc_motor_speed = {
|
||||
this.setOutput(true, Number);
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const pe_g1_servo_set_angle = {
|
||||
init: function () {
|
||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2];
|
||||
if (version == "mixgo_ce") { var name = 'CE G6' }
|
||||
else if (version == "mixgo_pe") { var name = 'PE G1' }
|
||||
this.setColour(PEG1_HUE);
|
||||
@@ -118,7 +118,7 @@ export const pe_g1_servo_set_angle = {
|
||||
|
||||
export const pe_g1_servo_set_speed = {
|
||||
init: function () {
|
||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2];
|
||||
if (version == "mixgo_ce") { var name = 'CE G6' }
|
||||
else if (version == "mixgo_pe") { var name = 'PE G1' }
|
||||
this.setColour(PEG1_HUE);
|
||||
@@ -144,7 +144,7 @@ export const pe_g1_servo_set_speed = {
|
||||
|
||||
export const pe_g1_servo_get_angle = {
|
||||
init: function () {
|
||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2];
|
||||
if (version == "mixgo_ce") { var name = 'CE G6' }
|
||||
else if (version == "mixgo_pe") { var name = 'PE G1' }
|
||||
this.setColour(PEG1_HUE);
|
||||
@@ -163,7 +163,7 @@ export const pe_g1_servo_get_angle = {
|
||||
|
||||
export const pe_g1_servo_get_speed = {
|
||||
init: function () {
|
||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2];
|
||||
if (version == "mixgo_ce") { var name = 'CE G6' }
|
||||
else if (version == "mixgo_pe") { var name = 'PE G1' }
|
||||
this.setColour(PEG1_HUE);
|
||||
@@ -173,7 +173,6 @@ export const pe_g1_servo_get_speed = {
|
||||
this.appendValueInput('PIN')
|
||||
.appendField('360°' + Blockly.Msg.MIXLY_SERVO)
|
||||
.appendField(Blockly.Msg.LCD_NUMBERING)
|
||||
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_GET + Blockly.Msg.MIXLY_SPEED);
|
||||
this.setOutput(true, Number);
|
||||
|
||||
@@ -103,7 +103,6 @@ export const i2c_B_pin = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export const spi_A_pin = {
|
||||
init: function () {
|
||||
this.setColour(PINS_HUE);
|
||||
|
||||
@@ -57,7 +57,11 @@ export const sensor_mixgo_button_attachInterrupt = {
|
||||
.setCheck(Number);
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_MODE)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_RISING, "machine.Pin.IRQ_RISING"], [Blockly.Msg.MIXLY_FALLING, "machine.Pin.IRQ_FALLING"], [Blockly.Msg.MIXLY_CHANGE, "(machine.Pin.IRQ_RISING or machine.Pin.IRQ_FALLING)"]]), "mode");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_RISING, "machine.Pin.IRQ_RISING"],
|
||||
[Blockly.Msg.MIXLY_FALLING, "machine.Pin.IRQ_FALLING"],
|
||||
[Blockly.Msg.MIXLY_CHANGE, "(machine.Pin.IRQ_RISING or machine.Pin.IRQ_FALLING)"]
|
||||
]), "mode");
|
||||
this.appendValueInput('DO')
|
||||
.appendField(Blockly.Msg.MIXLY_DO)
|
||||
this.setPreviousStatement(true);
|
||||
@@ -66,7 +70,6 @@ export const sensor_mixgo_button_attachInterrupt = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export const sensor_mixgo_extern_button_is_pressed = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_HUE);
|
||||
@@ -128,7 +131,11 @@ export const sensor_mixgo_extern_button_attachInterrupt = {
|
||||
.setCheck(Number);
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_MODE)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_RISING, "machine.Pin.IRQ_RISING"], [Blockly.Msg.MIXLY_FALLING, "machine.Pin.IRQ_FALLING"], [Blockly.Msg.MIXLY_CHANGE, "(machine.Pin.IRQ_RISING or machine.Pin.IRQ_FALLING)"]]), "mode");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_RISING, "machine.Pin.IRQ_RISING"],
|
||||
[Blockly.Msg.MIXLY_FALLING, "machine.Pin.IRQ_FALLING"],
|
||||
[Blockly.Msg.MIXLY_CHANGE, "(machine.Pin.IRQ_RISING or machine.Pin.IRQ_FALLING)"]
|
||||
]), "mode");
|
||||
this.appendValueInput('DO')
|
||||
.appendField(Blockly.Msg.MIXLY_DO)
|
||||
this.setPreviousStatement(true);
|
||||
@@ -145,7 +152,19 @@ export const sensor_mpu9250_attachGestureInterrupt = {
|
||||
.setCheck("var");
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_JS_CURRENT_GESTURE)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_MICROBIT_shake, "shake"], [Blockly.Msg.MIXLY_UP, "up"], [Blockly.Msg.MIXLY_DOWN, "down"], [Blockly.Msg.MIXLY_LEFT, "left"], [Blockly.Msg.MIXLY_RIGHT, "right"], [Blockly.Msg.MIXLY_MICROBIT_face_up, "face up"], [Blockly.Msg.MIXLY_MICROBIT_face_down, "face down"], [Blockly.Msg.MIXLY_MICROBIT_freefall, "freefall"], ["3g", "3g"], ["6g", "6g"], ["8g", "8g"]]), "gesture");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_MICROBIT_shake, "shake"],
|
||||
[Blockly.Msg.MIXLY_UP, "up"],
|
||||
[Blockly.Msg.MIXLY_DOWN, "down"],
|
||||
[Blockly.Msg.MIXLY_LEFT, "left"],
|
||||
[Blockly.Msg.MIXLY_RIGHT, "right"],
|
||||
[Blockly.Msg.MIXLY_MICROBIT_face_up, "face up"],
|
||||
[Blockly.Msg.MIXLY_MICROBIT_face_down, "face down"],
|
||||
[Blockly.Msg.MIXLY_MICROBIT_freefall, "freefall"],
|
||||
["3g", "3g"],
|
||||
["6g", "6g"],
|
||||
["8g", "8g"]
|
||||
]), "gesture");
|
||||
this.appendStatementInput('DO')
|
||||
.appendField(Blockly.Msg.MIXLY_DO);
|
||||
this.setPreviousStatement(true);
|
||||
@@ -183,7 +202,15 @@ export const sensor_mpu9250_gesture = {
|
||||
.setCheck("var");
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_JS_CURRENT_GESTURE)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_MICROBIT_shake, "shake"], [Blockly.Msg.MIXLY_UP, "up"], [Blockly.Msg.MIXLY_DOWN, "down"], [Blockly.Msg.MIXLY_LEFT, "left"], [Blockly.Msg.MIXLY_RIGHT, "right"], [Blockly.Msg.MIXLY_MICROBIT_face_up, "face up"], [Blockly.Msg.MIXLY_MICROBIT_face_down, "face down"]]), "gesture");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_MICROBIT_shake, "shake"],
|
||||
[Blockly.Msg.MIXLY_UP, "up"],
|
||||
[Blockly.Msg.MIXLY_DOWN, "down"],
|
||||
[Blockly.Msg.MIXLY_LEFT, "left"],
|
||||
[Blockly.Msg.MIXLY_RIGHT, "right"],
|
||||
[Blockly.Msg.MIXLY_MICROBIT_face_up, "face up"],
|
||||
[Blockly.Msg.MIXLY_MICROBIT_face_down, "face down"]
|
||||
]), "gesture");
|
||||
this.setOutput(true);
|
||||
var thisBlock = this;
|
||||
this.setTooltip(function () {
|
||||
@@ -244,7 +271,6 @@ export const sensor_mpu9250_get_acceleration = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export const sensor_adxl345_get_acceleration = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_HUE);
|
||||
@@ -279,7 +305,6 @@ export const sensor_adxl345_get_acceleration = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export const sensor_light_level = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_HUE);
|
||||
@@ -305,6 +330,7 @@ export const sensor_mpu9250_calibrate_compass = {
|
||||
this.setTooltip(Blockly.Msg.MIXLY_MICROBIT_JS_CALIBRATE_COMPASS);
|
||||
}
|
||||
};
|
||||
|
||||
// export const sensor_mpu9250_is_compass_calibrated = {
|
||||
// init: function(){
|
||||
// this.setColour(SENSOR_HUE);
|
||||
@@ -352,7 +378,10 @@ export const sensor_mpu9250_field_strength = {
|
||||
.setCheck("var");
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_JS_GET_COMPASS)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_MICROBIT_JS_FIELD_STRENGTH, 'strength'], [Blockly.Msg.MIXLY_MICROBIT_JS_BY_ANGLE, 'heading']]), 'compass');
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_MICROBIT_JS_FIELD_STRENGTH, 'strength'],
|
||||
[Blockly.Msg.MIXLY_MICROBIT_JS_BY_ANGLE, 'heading']
|
||||
]), 'compass');
|
||||
this.setOutput(true, Number);
|
||||
this.setInputsInline(true);
|
||||
var thisBlock = this;
|
||||
@@ -500,16 +529,17 @@ export const HCSR04 = {
|
||||
|
||||
export const sensor_dht11 = {
|
||||
init: function () {
|
||||
var WHAT = [[Blockly.Msg.MIXLY_GETTEMPERATUE, 'temperature'], [Blockly.Msg.MIXLY_GETHUMIDITY, 'relative_humidity'], [Blockly.Msg.MIXLY_DHT11_T_H, 'tempandhum']];
|
||||
this.setColour(SENSOR_HUE);
|
||||
this.appendValueInput("PIN", Number)
|
||||
.appendField(new Blockly.FieldDropdown([['DHT11', 'dht11']
|
||||
, ['DHT22', 'dht22']//, ['DHT21', '21'], ['DHT33', '33'], ['DHT44', '44']
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
['DHT11', 'dht11'],
|
||||
['DHT22', 'dht22']
|
||||
//, ['DHT21', '21'], ['DHT33', '33'], ['DHT44', '44']
|
||||
]), 'TYPE')
|
||||
.appendField(Blockly.Msg.MIXLY_PIN)
|
||||
.setCheck(Number);
|
||||
this.appendDummyInput("")
|
||||
.appendField(new Blockly.FieldDropdown(WHAT), "WHAT");
|
||||
.appendField(new Blockly.FieldDropdown(this.METHOD), "WHAT");
|
||||
this.setOutput(true, Number);
|
||||
var thisBlock = this;
|
||||
this.setTooltip(function () {
|
||||
@@ -521,7 +551,12 @@ export const sensor_dht11 = {
|
||||
};
|
||||
return TOOLTIPS[op];
|
||||
});
|
||||
}
|
||||
},
|
||||
METHOD: [
|
||||
[Blockly.Msg.MIXLY_GETTEMPERATUE, 'temperature'],
|
||||
[Blockly.Msg.MIXLY_GETHUMIDITY, 'relative_humidity'],
|
||||
[Blockly.Msg.MIXLY_DHT11_T_H, 'tempandhum']
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
@@ -561,7 +596,10 @@ export const number1 = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_HUE);
|
||||
this.appendDummyInput("")
|
||||
.appendField(new Blockly.FieldDropdown([["1", "touch1"], ["2", "touch2"]]), 'op')
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
["1", "touch1"],
|
||||
["2", "touch2"]
|
||||
]), 'op')
|
||||
this.setOutput(true);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_INOUT_HIGHLOW);
|
||||
}
|
||||
@@ -596,13 +634,15 @@ export const sensor_mixgo_extern_pin_near = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export const sensor_mixgo_pin_near = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_HUE);
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_PY_STORAGE_GET)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.TEXT_TRIM_LEFT, "left"], [Blockly.Msg.TEXT_TRIM_RIGHT, "right"]]), "direction")
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.TEXT_TRIM_LEFT, "left"],
|
||||
[Blockly.Msg.TEXT_TRIM_RIGHT, "right"]
|
||||
]), "direction")
|
||||
.appendField(Blockly.Msg.MIXLY_ESP32_NEAR);
|
||||
this.setOutput(true, Number);
|
||||
this.setInputsInline(true);
|
||||
|
||||
@@ -65,7 +65,11 @@ export const sensor_mixgo_extern_button_attachInterrupt = {
|
||||
.setCheck(Number);
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_MODE)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_RISING, "machine.Pin.IRQ_RISING"], [Blockly.Msg.MIXLY_FALLING, "machine.Pin.IRQ_FALLING"], [Blockly.Msg.MIXLY_CHANGE, "(machine.Pin.IRQ_RISING | machine.Pin.IRQ_FALLING)"]]), "mode");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_RISING, "machine.Pin.IRQ_RISING"],
|
||||
[Blockly.Msg.MIXLY_FALLING, "machine.Pin.IRQ_FALLING"],
|
||||
[Blockly.Msg.MIXLY_CHANGE, "(machine.Pin.IRQ_RISING | machine.Pin.IRQ_FALLING)"]
|
||||
]), "mode");
|
||||
this.appendValueInput('DO')
|
||||
.appendField(Blockly.Msg.MIXLY_DO)
|
||||
this.setPreviousStatement(true);
|
||||
@@ -74,7 +78,6 @@ export const sensor_mixgo_extern_button_attachInterrupt = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export const sensor_mpu9250_attachGestureInterrupt = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_EXTERN_HUE);
|
||||
@@ -83,7 +86,17 @@ export const sensor_mpu9250_attachGestureInterrupt = {
|
||||
.setCheck("var");
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_JS_CURRENT_GESTURE)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_MICROBIT_shake, "shake"], [Blockly.Msg.MIXLY_UP, "up"], [Blockly.Msg.MIXLY_DOWN, "down"], [Blockly.Msg.MIXLY_LEFT, "left"], [Blockly.Msg.MIXLY_RIGHT, "right"], [Blockly.Msg.MIXLY_MICROBIT_face_up, "face up"], [Blockly.Msg.MIXLY_MICROBIT_face_down, "face down"], [Blockly.Msg.MIXLY_MICROBIT_freefall, "freefall"], ["3g", "3g"], ["6g", "6g"], ["8g", "8g"]]), "gesture");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_MICROBIT_shake, "shake"],
|
||||
[Blockly.Msg.MIXLY_UP, "up"],
|
||||
[Blockly.Msg.MIXLY_DOWN, "down"],
|
||||
[Blockly.Msg.MIXLY_LEFT, "left"],
|
||||
[Blockly.Msg.MIXLY_RIGHT, "right"],
|
||||
[Blockly.Msg.MIXLY_MICROBIT_face_up, "face up"],
|
||||
[Blockly.Msg.MIXLY_MICROBIT_face_down, "face down"],
|
||||
[Blockly.Msg.MIXLY_MICROBIT_freefall, "freefall"],
|
||||
["3g", "3g"], ["6g", "6g"], ["8g", "8g"]
|
||||
]), "gesture");
|
||||
this.appendStatementInput('DO')
|
||||
.appendField(Blockly.Msg.MIXLY_DO);
|
||||
this.setPreviousStatement(true);
|
||||
@@ -113,7 +126,6 @@ export const sensor_mpu9250_attachGestureInterrupt = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export const sensor_adxl345_get_acceleration = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_EXTERN_HUE);
|
||||
@@ -148,8 +160,6 @@ export const sensor_adxl345_get_acceleration = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
export const sensor_light_level = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_EXTERN_HUE);
|
||||
@@ -161,20 +171,18 @@ export const sensor_light_level = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
export const sensor_dht11 = {
|
||||
init: function () {
|
||||
var WHAT = [[Blockly.Msg.MIXLY_GETTEMPERATUE, 'temperature'], [Blockly.Msg.MIXLY_GETHUMIDITY, 'humidity']];
|
||||
this.setColour(SENSOR_EXTERN_HUE);
|
||||
this.appendValueInput("PIN", Number)
|
||||
.appendField(new Blockly.FieldDropdown([['DHT11', 'DHT11']
|
||||
, ['DHT22', 'DHT22']//, ['DHT21', '21'], ['DHT33', '33'], ['DHT44', '44']
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
['DHT11', 'DHT11'],
|
||||
['DHT22', 'DHT22']//, ['DHT21', '21'], ['DHT33', '33'], ['DHT44', '44']
|
||||
]), 'TYPE')
|
||||
.appendField(Blockly.Msg.MIXLY_PIN)
|
||||
.setCheck(Number);
|
||||
this.appendDummyInput("")
|
||||
.appendField(new Blockly.FieldDropdown(WHAT), "WHAT");
|
||||
.appendField(new Blockly.FieldDropdown(this.METHOD), "WHAT");
|
||||
this.setOutput(true, Number);
|
||||
var thisBlock = this;
|
||||
this.setTooltip(function () {
|
||||
@@ -186,10 +194,13 @@ export const sensor_dht11 = {
|
||||
};
|
||||
return TOOLTIPS[op];
|
||||
});
|
||||
}
|
||||
},
|
||||
METHOD: [
|
||||
[Blockly.Msg.MIXLY_GETTEMPERATUE, 'temperature'],
|
||||
[Blockly.Msg.MIXLY_GETHUMIDITY, 'humidity']
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
export const sensor_mixgo_extern_light = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_EXTERN_HUE);
|
||||
@@ -222,14 +233,15 @@ export const sensor_mixgo_extern_sound = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
export const sensor_mixgo_extern_pin_near = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_EXTERN_HUE);
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_PY_STORAGE_GET)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.TEXT_TRIM_LEFT, "left"], [Blockly.Msg.TEXT_TRIM_RIGHT, "right"]]), "direction")
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.TEXT_TRIM_LEFT, "left"],
|
||||
[Blockly.Msg.TEXT_TRIM_RIGHT, "right"]
|
||||
]), "direction")
|
||||
.appendField(Blockly.Msg.MIXLY_ESP32_NEAR);
|
||||
this.setOutput(true, Number);
|
||||
this.setInputsInline(true);
|
||||
@@ -327,7 +339,6 @@ export const sensor_lm35 = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//pe
|
||||
export const sensor_use_i2c_init = {
|
||||
init: function () {
|
||||
@@ -637,7 +648,7 @@ export const CI130X_BROADCAST = {
|
||||
this.setNextStatement(true);
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const CI130X_SET_SYSTEM_CMD = {
|
||||
init: function () {
|
||||
@@ -910,7 +921,15 @@ export const sensor_mpu9250_gesture = {
|
||||
.setCheck("var");
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_JS_CURRENT_GESTURE)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_MICROBIT_shake, "shake"], [Blockly.Msg.MIXLY_UP, "up"], [Blockly.Msg.MIXLY_DOWN, "down"], [Blockly.Msg.MIXLY_LEFT, "left"], [Blockly.Msg.MIXLY_RIGHT, "right"], [Blockly.Msg.MIXLY_MICROBIT_face_up, "face up"], [Blockly.Msg.MIXLY_MICROBIT_face_down, "face down"]]), "gesture");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_MICROBIT_shake, "shake"],
|
||||
[Blockly.Msg.MIXLY_UP, "up"],
|
||||
[Blockly.Msg.MIXLY_DOWN, "down"],
|
||||
[Blockly.Msg.MIXLY_LEFT, "left"],
|
||||
[Blockly.Msg.MIXLY_RIGHT, "right"],
|
||||
[Blockly.Msg.MIXLY_MICROBIT_face_up, "face up"],
|
||||
[Blockly.Msg.MIXLY_MICROBIT_face_down, "face down"]
|
||||
]), "gesture");
|
||||
this.setOutput(true);
|
||||
var thisBlock = this;
|
||||
this.setTooltip(function () {
|
||||
@@ -1052,7 +1071,6 @@ export const sensor_mpu9250_calibrate_compass = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export const sensor_mpu9250_temperature = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_EXTERN_HUE);
|
||||
@@ -1068,7 +1086,6 @@ export const sensor_mpu9250_temperature = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export const sensor_mpu9250_field_strength = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_EXTERN_HUE);
|
||||
@@ -1077,7 +1094,10 @@ export const sensor_mpu9250_field_strength = {
|
||||
.setCheck("var");
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_JS_GET_COMPASS)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_MICROBIT_JS_FIELD_STRENGTH, 'strength'], [Blockly.Msg.MIXLY_MICROBIT_JS_BY_ANGLE, 'heading']]), 'compass');
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_MICROBIT_JS_FIELD_STRENGTH, 'strength'],
|
||||
[Blockly.Msg.MIXLY_MICROBIT_JS_BY_ANGLE, 'heading']
|
||||
]), 'compass');
|
||||
this.setOutput(true, Number);
|
||||
this.setInputsInline(true);
|
||||
var thisBlock = this;
|
||||
@@ -1298,7 +1318,6 @@ export const weather_uart_mixio = {
|
||||
};
|
||||
|
||||
export const weather_set_label = {
|
||||
|
||||
init: function () {
|
||||
this.setColour(SENSOR_EXTERN_HUE);
|
||||
this.appendValueInput('SUB')
|
||||
@@ -1314,18 +1333,15 @@ export const weather_set_label = {
|
||||
this.setNextStatement(true);
|
||||
this.setTooltip();
|
||||
},
|
||||
|
||||
mutationToDom: function () {
|
||||
var container = document.createElement('mutation');
|
||||
container.setAttribute('items', this.itemCount_);
|
||||
return container;
|
||||
},
|
||||
|
||||
domToMutation: function (xmlElement) {
|
||||
this.itemCount_ = parseInt(xmlElement.getAttribute('items'), 10);
|
||||
this.updateShape_();
|
||||
},
|
||||
|
||||
decompose: function (workspace) {
|
||||
var containerBlock =
|
||||
workspace.newBlock('weather_set_label_container');
|
||||
@@ -1339,7 +1355,6 @@ export const weather_set_label = {
|
||||
}
|
||||
return containerBlock;
|
||||
},
|
||||
|
||||
compose: function (containerBlock) {
|
||||
var itemBlock = containerBlock.getInputTargetBlock('STACK');
|
||||
// Count number of inputs.
|
||||
@@ -1361,7 +1376,6 @@ export const weather_set_label = {
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
saveConnections: function (containerBlock) {
|
||||
var itemBlock = containerBlock.getInputTargetBlock('STACK');
|
||||
var i = 0;
|
||||
@@ -1373,7 +1387,6 @@ export const weather_set_label = {
|
||||
itemBlock.nextConnection.targetBlock();
|
||||
}
|
||||
},
|
||||
|
||||
updateShape_: function () {
|
||||
// Delete everything.
|
||||
if (this.getInput('EMPTY')) {
|
||||
@@ -1399,6 +1412,7 @@ export const weather_set_label = {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const weather_set_label_container = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_EXTERN_HUE);
|
||||
@@ -1562,8 +1576,7 @@ export const PS2_init = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
var PSBUTTON = [
|
||||
const PSBUTTON = [
|
||||
[Blockly.Msg.PS2_TRIANGLE, "PSB_GREEN"],
|
||||
[Blockly.Msg.PS2_CIRCLE, "PSB_RED"],
|
||||
[Blockly.Msg.PS2_CROSS, "PSB_BLUE"],
|
||||
@@ -1650,18 +1663,18 @@ export const PS2_Buttons = {
|
||||
export const PS2_stk = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_EXTERN_HUE);
|
||||
var PSSTK = [
|
||||
[Blockly.Msg.PS2_RX, "0"],
|
||||
[Blockly.Msg.PS2_RY, "1"],
|
||||
[Blockly.Msg.PS2_LX, "2"],
|
||||
[Blockly.Msg.PS2_LY, "3"],
|
||||
];
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.PS2_stick)
|
||||
.appendField(new Blockly.FieldDropdown(PSSTK), "psstk");
|
||||
.appendField(new Blockly.FieldDropdown(this.PSSTK), "psstk");
|
||||
this.setOutput(true, Number);
|
||||
this.setTooltip('');
|
||||
}
|
||||
},
|
||||
PSSTK: [
|
||||
[Blockly.Msg.PS2_RX, "0"],
|
||||
[Blockly.Msg.PS2_RY, "1"],
|
||||
[Blockly.Msg.PS2_LX, "2"],
|
||||
[Blockly.Msg.PS2_LY, "3"],
|
||||
]
|
||||
};
|
||||
|
||||
export const PS2_init_new = {
|
||||
@@ -1722,20 +1735,20 @@ export const PS2_Buttons_new = {
|
||||
export const PS2_stk_new = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_EXTERN_HUE);
|
||||
var PSSTK = [
|
||||
[Blockly.Msg.PS2_RX, "RX"],
|
||||
[Blockly.Msg.PS2_RY, "RY"],
|
||||
[Blockly.Msg.PS2_LX, "LX"],
|
||||
[Blockly.Msg.PS2_LY, "LY"],
|
||||
];
|
||||
this.appendValueInput('SUB')
|
||||
.appendField(Blockly.Msg.PS2);
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_JOYSTICK)
|
||||
.appendField(new Blockly.FieldDropdown(PSSTK), "psstk");
|
||||
.appendField(new Blockly.FieldDropdown(this.PSSTK), "psstk");
|
||||
this.setOutput(true, Number);
|
||||
this.setTooltip('');
|
||||
}
|
||||
},
|
||||
PSSTK: [
|
||||
[Blockly.Msg.PS2_RX, "RX"],
|
||||
[Blockly.Msg.PS2_RY, "RY"],
|
||||
[Blockly.Msg.PS2_LX, "LX"],
|
||||
[Blockly.Msg.PS2_LY, "LY"],
|
||||
]
|
||||
};
|
||||
|
||||
export const sensor_use_uart_init = {
|
||||
@@ -1756,8 +1769,6 @@ export const sensor_use_uart_init = {
|
||||
[Blockly.Msg.MIXLY_PM25_SENSOR, "PM"],
|
||||
[Blockly.Msg.MIXLY_GNSS_SENSOR, "GNSS"]
|
||||
]), "sensor");
|
||||
|
||||
|
||||
this.setInputsInline(true);
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
@@ -1782,7 +1793,7 @@ export const pm25_get_data = {
|
||||
this.setInputsInline(true);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_PM_CONCENTRATION_TOOLTIP);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const gnss_have_data = {
|
||||
init: function () {
|
||||
@@ -1832,7 +1843,10 @@ export const robot_button_extern_get_value = {
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.ME_GO_MOTOR_EXTERN + Blockly.Msg.MIXLY_BUTTON)
|
||||
.appendField(Blockly.Msg.PIN_NUMBERING)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_LEFT, "0"], [Blockly.Msg.MIXLY_RIGHT, "1"]]), "mode");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_LEFT, "0"],
|
||||
[Blockly.Msg.MIXLY_RIGHT, "1"]
|
||||
]), "mode");
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.TURTLE_POS)
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
@@ -1847,7 +1861,7 @@ export const robot_button_extern_get_value = {
|
||||
this.setOutput(true, Number);
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const robot_touch_extern_get_value = {
|
||||
init: function () {
|
||||
@@ -1855,13 +1869,16 @@ export const robot_touch_extern_get_value = {
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.ME_GO_MOTOR_EXTERN + Blockly.Msg.MIXLY_MICROBIT_JS_INOUT_EVENT_TOUCH + Blockly.Msg.MSG.catSensor)
|
||||
.appendField(Blockly.Msg.PIN_NUMBERING)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_LEFT, "0"], [Blockly.Msg.MIXLY_RIGHT, "1"]]), "mode");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_LEFT, "0"],
|
||||
[Blockly.Msg.MIXLY_RIGHT, "1"]
|
||||
]), "mode");
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_MIXBOT_EXTERN_TOUCHED + "?")
|
||||
this.setOutput(true, Boolean);
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const robot_infrared_extern_get_value = {
|
||||
init: function () {
|
||||
@@ -1869,13 +1886,16 @@ export const robot_infrared_extern_get_value = {
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.ME_GO_MOTOR_EXTERN + Blockly.Msg.MIXLY_ESP32_EXTERN_NEAR)
|
||||
.appendField(Blockly.Msg.PIN_NUMBERING)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_LEFT, "0"], [Blockly.Msg.MIXLY_RIGHT, "1"]]), "mode");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_LEFT, "0"],
|
||||
[Blockly.Msg.MIXLY_RIGHT, "1"]
|
||||
]), "mode");
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_GET + Blockly.Msg.MIXLY_DATA)
|
||||
this.setOutput(true, Number);
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const robot_infrared_extern_grey_get_value = {
|
||||
init: function () {
|
||||
@@ -1883,13 +1903,16 @@ export const robot_infrared_extern_grey_get_value = {
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.ME_GO_MOTOR_EXTERN + Blockly.Msg.MIXLY_ESP32_EXTERN_GRAY_NEAR)
|
||||
.appendField(Blockly.Msg.PIN_NUMBERING)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_LEFT, "0"], [Blockly.Msg.MIXLY_RIGHT, "1"]]), "mode");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_LEFT, "0"],
|
||||
[Blockly.Msg.MIXLY_RIGHT, "1"]
|
||||
]), "mode");
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_GET + Blockly.Msg.MIXLY_DATA)
|
||||
this.setOutput(true, Number);
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const robot_potentiometer_extern_get_value = {
|
||||
init: function () {
|
||||
@@ -1897,13 +1920,16 @@ export const robot_potentiometer_extern_get_value = {
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.ME_GO_MOTOR_EXTERN + Blockly.Msg.MIXLY_KNOB_POTENTIOMETER)
|
||||
.appendField(Blockly.Msg.PIN_NUMBERING)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_LEFT, "0"], [Blockly.Msg.MIXLY_RIGHT, "1"]]), "mode");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_LEFT, "0"],
|
||||
[Blockly.Msg.MIXLY_RIGHT, "1"]
|
||||
]), "mode");
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_GET + Blockly.Msg.MIXLY_DATA)
|
||||
this.setOutput(true, Number);
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const robot_color_extern_get_value = {
|
||||
init: function () {
|
||||
@@ -1911,7 +1937,10 @@ export const robot_color_extern_get_value = {
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.ME_GO_MOTOR_EXTERN + Blockly.Msg.HTML_COLOUR + Blockly.Msg.MSG.catSensor)
|
||||
.appendField(Blockly.Msg.PIN_NUMBERING)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_LEFT, "0"], [Blockly.Msg.MIXLY_RIGHT, "1"]]), "mode");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_LEFT, "0"],
|
||||
[Blockly.Msg.MIXLY_RIGHT, "1"]
|
||||
]), "mode");
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_GET)
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
@@ -1924,7 +1953,7 @@ export const robot_color_extern_get_value = {
|
||||
this.setOutput(true, Boolean);
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const mixbot_sensor_extern_get_addr = {
|
||||
init: function () {
|
||||
@@ -1945,7 +1974,7 @@ export const mixbot_sensor_extern_get_addr = {
|
||||
this.setOutput(true);
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const mixbot_sensor_extern_set_addr = {
|
||||
init: function () {
|
||||
@@ -1975,7 +2004,7 @@ export const mixbot_sensor_extern_set_addr = {
|
||||
this.setNextStatement(true, null);
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const robot_sonar_extern_get_value = {
|
||||
init: function () {
|
||||
@@ -1983,13 +2012,16 @@ export const robot_sonar_extern_get_value = {
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.ME_GO_MOTOR_EXTERN + Blockly.Msg.MIXLY_EXTERN_SONAR)
|
||||
.appendField(Blockly.Msg.PIN_NUMBERING)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_LEFT, "0"], [Blockly.Msg.MIXLY_RIGHT, "1"]]), "mode");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_LEFT, "0"],
|
||||
[Blockly.Msg.MIXLY_RIGHT, "1"]
|
||||
]), "mode");
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_GET + Blockly.Msg.MIXLY_DATA + '(cm)')
|
||||
this.setOutput(true, Number);
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const robot_sonar_extern_led = {
|
||||
init: function () {
|
||||
@@ -1997,7 +2029,10 @@ export const robot_sonar_extern_led = {
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.ME_GO_MOTOR_EXTERN + Blockly.Msg.MIXLY_EXTERN_SONAR)
|
||||
.appendField(Blockly.Msg.PIN_NUMBERING)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_LEFT, "0"], [Blockly.Msg.MIXLY_RIGHT, "1"]]), "mode");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_LEFT, "0"],
|
||||
[Blockly.Msg.MIXLY_RIGHT, "1"]
|
||||
]), "mode");
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_EXTERN_INDICATOR_LIGHT)
|
||||
this.appendValueInput('light')
|
||||
@@ -2010,7 +2045,7 @@ export const robot_sonar_extern_led = {
|
||||
this.setNextStatement(true, null);
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const sensor_weather_solo_init = {
|
||||
init: function () {
|
||||
@@ -2249,4 +2284,4 @@ export const weigh_sensor_get_weight = {
|
||||
this.setOutput(true);
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -62,7 +62,11 @@ export const sensor_mixgo_button_attachInterrupt = {
|
||||
.setCheck(Number);
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_MODE)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_RISING, "machine.Pin.IRQ_RISING"], [Blockly.Msg.MIXLY_FALLING, "machine.Pin.IRQ_FALLING"], [Blockly.Msg.MIXLY_CHANGE, "(machine.Pin.IRQ_RISING | machine.Pin.IRQ_FALLING)"]]), "mode");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_RISING, "machine.Pin.IRQ_RISING"],
|
||||
[Blockly.Msg.MIXLY_FALLING, "machine.Pin.IRQ_FALLING"],
|
||||
[Blockly.Msg.MIXLY_CHANGE, "(machine.Pin.IRQ_RISING | machine.Pin.IRQ_FALLING)"]
|
||||
]), "mode");
|
||||
this.appendValueInput('DO')
|
||||
.appendField(Blockly.Msg.MIXLY_DO)
|
||||
this.setPreviousStatement(true);
|
||||
@@ -121,7 +125,11 @@ export const sensor_mixgocar42_button_attachInterrupt = {
|
||||
.appendField(Blockly.Msg.MIXLY_BUTTON)
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_MODE)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_RISING, "machine.Pin.IRQ_RISING"], [Blockly.Msg.MIXLY_FALLING, "machine.Pin.IRQ_FALLING"], [Blockly.Msg.MIXLY_CHANGE, "(machine.Pin.IRQ_RISING | machine.Pin.IRQ_FALLING)"]]), "mode");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_RISING, "machine.Pin.IRQ_RISING"],
|
||||
[Blockly.Msg.MIXLY_FALLING, "machine.Pin.IRQ_FALLING"],
|
||||
[Blockly.Msg.MIXLY_CHANGE, "(machine.Pin.IRQ_RISING | machine.Pin.IRQ_FALLING)"]
|
||||
]), "mode");
|
||||
this.appendValueInput('DO')
|
||||
.appendField(Blockly.Msg.MIXLY_DO)
|
||||
this.setPreviousStatement(true);
|
||||
@@ -183,7 +191,6 @@ export const sensor_mixgo_touch_slide = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export const sensor_distance_hrsc04 = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_ONBOARD_HUE);
|
||||
@@ -258,8 +265,6 @@ export const RTC_set_date = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
export const HCSR04 = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_ONBOARD_HUE);
|
||||
@@ -275,7 +280,6 @@ export const HCSR04 = {
|
||||
this.setOutput(true, Number);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_BLOCKGROUP_CHAOSHENGBO);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
export const sensor_mixgo_light = {
|
||||
@@ -289,12 +293,14 @@ export const sensor_mixgo_light = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export const number1 = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_ONBOARD_HUE);
|
||||
this.appendDummyInput("")
|
||||
.appendField(new Blockly.FieldDropdown([["1", "touch1"], ["2", "touch2"]]), 'op')
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
["1", "touch1"],
|
||||
["2", "touch2"]
|
||||
]), 'op')
|
||||
this.setOutput(true);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_INOUT_HIGHLOW);
|
||||
}
|
||||
@@ -304,7 +310,12 @@ export const number2 = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_ONBOARD_HUE);
|
||||
this.appendDummyInput("")
|
||||
.appendField(new Blockly.FieldDropdown([["0", "0"], ["1", "1"], ["2", "2"], ["3", "3"]]), 'op')
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
["0", "0"],
|
||||
["1", "1"],
|
||||
["2", "2"],
|
||||
["3", "3"]
|
||||
]), 'op')
|
||||
this.setOutput(true);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_INOUT_HIGHLOW);
|
||||
}
|
||||
@@ -314,7 +325,13 @@ export const number3 = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_ONBOARD_HUE);
|
||||
this.appendDummyInput("")
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_UP, "12"], [Blockly.Msg.MIXLY_DOWN, "14"], [Blockly.Msg.MIXLY_LEFT, "13"], [Blockly.Msg.MIXLY_RIGHT, "15"], ["A", "32"], ["B", "33"]]), 'op')
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_UP, "12"],
|
||||
[Blockly.Msg.MIXLY_DOWN, "14"],
|
||||
[Blockly.Msg.MIXLY_LEFT, "13"],
|
||||
[Blockly.Msg.MIXLY_RIGHT, "15"],
|
||||
["A", "32"], ["B", "33"]
|
||||
]), 'op')
|
||||
this.setOutput(true);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_INOUT_HIGHLOW);
|
||||
}
|
||||
@@ -324,7 +341,13 @@ export const number4 = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_ONBOARD_HUE);
|
||||
this.appendDummyInput("")
|
||||
.appendField(new Blockly.FieldDropdown([["0", "0"], ["1", "1"], ["2", "2"], ["3", "3"], ["4", "4"]]), 'op')
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
["0", "0"],
|
||||
["1", "1"],
|
||||
["2", "2"],
|
||||
["3", "3"],
|
||||
["4", "4"]
|
||||
]), 'op')
|
||||
this.setOutput(true);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_INOUT_HIGHLOW);
|
||||
}
|
||||
@@ -334,7 +357,12 @@ export const number5 = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_ONBOARD_HUE);
|
||||
this.appendDummyInput("")
|
||||
.appendField(new Blockly.FieldDropdown([["0", "0"], ["1", "1"], ["2", "2"], ["3", "3"]]), 'op')
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
["0", "0"],
|
||||
["1", "1"],
|
||||
["2", "2"],
|
||||
["3", "3"]
|
||||
]), 'op')
|
||||
this.setOutput(true);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_INOUT_HIGHLOW);
|
||||
}
|
||||
@@ -344,7 +372,10 @@ export const number6 = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_ONBOARD_HUE);
|
||||
this.appendDummyInput("")
|
||||
.appendField(new Blockly.FieldDropdown([["3", "3"], ["4", "4"]]), 'op')
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
["3", "3"],
|
||||
["4", "4"]
|
||||
]), 'op')
|
||||
this.setOutput(true);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_INOUT_HIGHLOW);
|
||||
}
|
||||
@@ -354,7 +385,10 @@ export const number7 = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_ONBOARD_HUE);
|
||||
this.appendDummyInput("")
|
||||
.appendField(new Blockly.FieldDropdown([["0", "0"], ["1", "1"]]), 'op')
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
["0", "0"],
|
||||
["1", "1"]
|
||||
]), 'op')
|
||||
this.setOutput(true);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_INOUT_HIGHLOW);
|
||||
}
|
||||
@@ -378,7 +412,10 @@ export const sensor_mixgo_pin_near_double = {
|
||||
this.setColour(SENSOR_ONBOARD_HUE);
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_PY_STORAGE_GET)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.TEXT_TRIM_LEFT, "left"], [Blockly.Msg.TEXT_TRIM_RIGHT, "right"]]), "direction")
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.TEXT_TRIM_LEFT, "left"],
|
||||
[Blockly.Msg.TEXT_TRIM_RIGHT, "right"]
|
||||
]), "direction")
|
||||
.appendField(Blockly.Msg.MIXLY_ESP32_NEAR);
|
||||
this.setOutput(true, Number);
|
||||
this.setInputsInline(true);
|
||||
@@ -418,13 +455,15 @@ export const sensor_mixgo_pin_near = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export const sensor_mixgo_nova_pin_near = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_ONBOARD_HUE);
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_PY_STORAGE_GET)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.TEXT_TRIM_LEFT, "l"], [Blockly.Msg.TEXT_TRIM_RIGHT, "r"]]), "direction")
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.TEXT_TRIM_LEFT, "l"],
|
||||
[Blockly.Msg.TEXT_TRIM_RIGHT, "r"]
|
||||
]), "direction")
|
||||
.appendField(Blockly.Msg.MIXLY_ESP32_NEAR);
|
||||
this.setOutput(true, Number);
|
||||
this.setInputsInline(true);
|
||||
@@ -447,7 +486,10 @@ export const sensor_mixgo_nova_LTR308 = {
|
||||
this.setColour(SENSOR_ONBOARD_HUE);
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_PY_STORAGE_GET)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.TEXT_TRIM_LEFT, "l"], [Blockly.Msg.TEXT_TRIM_RIGHT, "r"]]), "direction")
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.TEXT_TRIM_LEFT, "l"],
|
||||
[Blockly.Msg.TEXT_TRIM_RIGHT, "r"]
|
||||
]), "direction")
|
||||
.appendField(Blockly.Msg.MIXLY_ESP32_EXTERN_LIGHT + Blockly.Msg.MIXLY_DATA);
|
||||
this.setOutput(true, Number);
|
||||
this.setInputsInline(true);
|
||||
@@ -671,7 +713,6 @@ export const sensor_aht11 = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export const sensor_get_temperature = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_ONBOARD_HUE);
|
||||
@@ -682,10 +723,6 @@ export const sensor_get_temperature = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export const sensor_hp203 = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_ONBOARD_HUE);
|
||||
@@ -815,7 +852,15 @@ export const sensor_onboard_mpu9250_gesture = {
|
||||
.appendField("MPU9250")
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_JS_CURRENT_GESTURE)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_MICROBIT_shake, "shake"], [Blockly.Msg.MIXLY_UP, "up"], [Blockly.Msg.MIXLY_DOWN, "down"], [Blockly.Msg.MIXLY_LEFT, "left"], [Blockly.Msg.MIXLY_RIGHT, "right"], [Blockly.Msg.MIXLY_MICROBIT_face_up, "face up"], [Blockly.Msg.MIXLY_MICROBIT_face_down, "face down"]]), "gesture");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_MICROBIT_shake, "shake"],
|
||||
[Blockly.Msg.MIXLY_UP, "up"],
|
||||
[Blockly.Msg.MIXLY_DOWN, "down"],
|
||||
[Blockly.Msg.MIXLY_LEFT, "left"],
|
||||
[Blockly.Msg.MIXLY_RIGHT, "right"],
|
||||
[Blockly.Msg.MIXLY_MICROBIT_face_up, "face up"],
|
||||
[Blockly.Msg.MIXLY_MICROBIT_face_down, "face down"]
|
||||
]), "gesture");
|
||||
this.setOutput(true);
|
||||
this.setInputsInline(true);
|
||||
var thisBlock = this;
|
||||
@@ -954,7 +999,6 @@ export const sensor_onboard_mpu9250_calibrate_compass = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export const sensor_onboard_mpu9250_temperature = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_ONBOARD_HUE);
|
||||
@@ -969,7 +1013,6 @@ export const sensor_onboard_mpu9250_temperature = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export const sensor_onboard_mpu9250_field_strength = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_ONBOARD_HUE);
|
||||
@@ -977,7 +1020,10 @@ export const sensor_onboard_mpu9250_field_strength = {
|
||||
.appendField("MPU9250")
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_JS_GET_COMPASS)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_MICROBIT_JS_FIELD_STRENGTH, 'strength'], [Blockly.Msg.MIXLY_MICROBIT_JS_BY_ANGLE, 'heading']]), 'compass');
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_MICROBIT_JS_FIELD_STRENGTH, 'strength'],
|
||||
[Blockly.Msg.MIXLY_MICROBIT_JS_BY_ANGLE, 'heading']
|
||||
]), 'compass');
|
||||
this.setOutput(true, Number);
|
||||
this.setInputsInline(true);
|
||||
var thisBlock = this;
|
||||
@@ -1061,10 +1107,8 @@ export const sensor_mixgo_cc_mmc5603_calibrate_compass = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//mixgo_me onboard_sensor blocks:
|
||||
|
||||
|
||||
export const sensor_mixgome_temperature = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_ONBOARD_HUE);
|
||||
@@ -1079,7 +1123,6 @@ export const sensor_mixgome_temperature = {
|
||||
|
||||
//mixgo_ce onboard_sensor blocks:
|
||||
|
||||
|
||||
export const sensor_mixgoce_temperature = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_ONBOARD_HUE);
|
||||
@@ -1092,9 +1135,6 @@ export const sensor_mixgoce_temperature = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
export const sensor_mpython_qmi8658_get_gyro = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_ONBOARD_HUE);
|
||||
@@ -1137,15 +1177,15 @@ export const sensor_mpython_qmi8658_temperature = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
export const sensor_rm_pin_near_double = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_ONBOARD_HUE);
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_PY_STORAGE_GET)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.TEXT_TRIM_LEFT, "1"], [Blockly.Msg.TEXT_TRIM_RIGHT, "2"]]), "direction")
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.TEXT_TRIM_LEFT, "1"],
|
||||
[Blockly.Msg.TEXT_TRIM_RIGHT, "2"]
|
||||
]), "direction")
|
||||
.appendField(Blockly.Msg.MIXLY_ESP32_NEAR);
|
||||
this.setOutput(true, Number);
|
||||
this.setInputsInline(true);
|
||||
@@ -1254,7 +1294,6 @@ export const sensor_mixgocar_pin_near_state_change = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export const sensor_mixgocar_battery_left = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_ONBOARD_HUE);
|
||||
@@ -1267,7 +1306,6 @@ export const sensor_mixgocar_battery_left = {
|
||||
|
||||
//mixbot onboard_sensor below:
|
||||
|
||||
|
||||
export const sensor_mixbot_patrol_calibrate = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_ONBOARD_HUE);
|
||||
@@ -1319,8 +1357,6 @@ export const sensor_mixbot_temperature = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
export const sensor_mixbot_get_gyro = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_ONBOARD_HUE);
|
||||
|
||||
@@ -53,7 +53,12 @@ export const serial_print_hex = {
|
||||
.appendField(new Blockly.FieldDropdown([['uart1', '1']]), 'mode')
|
||||
.appendField(Blockly.Msg.MIXLY_SERIAL_PRINTLN);
|
||||
this.appendValueInput("CONTENT", Number)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MATH_BIN, "bin"], [Blockly.Msg.MATH_OCT, "oct"], [Blockly.Msg.MATH_DEC, "int"], [Blockly.Msg.MATH_HEX, "hex"]]), "STAT")
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MATH_BIN, "bin"],
|
||||
[Blockly.Msg.MATH_OCT, "oct"],
|
||||
[Blockly.Msg.MATH_DEC, "int"],
|
||||
[Blockly.Msg.MATH_HEX, "hex"]
|
||||
]), "STAT")
|
||||
.setCheck(Number);
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
@@ -147,7 +152,20 @@ export const serial_softserial_new = {
|
||||
.setAlign(Blockly.inputs.Align.RIGHT);
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_SERIAL_BEGIN)
|
||||
.appendField(new Blockly.FieldDropdown([['115200', '115200'], ['57600', '57600'], ['37400', '38400'], ['31250', '31250'], ['28800', '28800'], ['19200', '19200'], ['14400', '14400'], ['9600', '9600'], ['4800', '4800'], ['2400', '2400'], ['1200', '1200'], ['300', '300']]), 'baudrate');
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
['115200', '115200'],
|
||||
['57600', '57600'],
|
||||
['37400', '38400'],
|
||||
['31250', '31250'],
|
||||
['28800', '28800'],
|
||||
['19200', '19200'],
|
||||
['14400', '14400'],
|
||||
['9600', '9600'],
|
||||
['4800', '4800'],
|
||||
['2400', '2400'],
|
||||
['1200', '1200'],
|
||||
['300', '300']
|
||||
]), 'baudrate');
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setInputsInline(true);
|
||||
@@ -160,11 +178,27 @@ export const serial_softserial = {
|
||||
this.setColour(SERIAL_HUE);
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_SETUP)
|
||||
.appendField(new Blockly.FieldDropdown([['uart1 (RX=23,TX=19)', '1'], ['uart2 (RX=5,TX=18)', '2']]), 'mode');
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
['uart1 (RX=23,TX=19)', '1'],
|
||||
['uart2 (RX=5,TX=18)', '2']
|
||||
]), 'mode');
|
||||
//this.setFieldValue('1','mode')
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_SERIAL_BEGIN)
|
||||
.appendField(new Blockly.FieldDropdown([['115200', '115200'], ['57600', '57600'], ['37400', '38400'], ['31250', '31250'], ['28800', '28800'], ['19200', '19200'], ['14400', '14400'], ['9600', '9600'], ['4800', '4800'], ['2400', '2400'], ['1200', '1200'], ['300', '300']]), 'baudrate');
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
['115200', '115200'],
|
||||
['57600', '57600'],
|
||||
['37400', '38400'],
|
||||
['31250', '31250'],
|
||||
['28800', '28800'],
|
||||
['19200', '19200'],
|
||||
['14400', '14400'],
|
||||
['9600', '9600'],
|
||||
['4800', '4800'],
|
||||
['2400', '2400'],
|
||||
['1200', '1200'],
|
||||
['300', '300']
|
||||
]), 'baudrate');
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setInputsInline(true);
|
||||
@@ -177,7 +211,20 @@ export const serial_begin = {
|
||||
this.setColour(SERIAL_HUE);
|
||||
this.appendDummyInput()
|
||||
.appendField("Serial " + Blockly.Msg.MIXLY_SERIAL_BEGIN)
|
||||
.appendField(new Blockly.FieldDropdown([['115200', '115200'], ['57600', '57600'], ['37400', '38400'], ['31250', '31250'], ['28800', '28800'], ['19200', '19200'], ['14400', '14400'], ['9600', '9600'], ['4800', '4800'], ['2400', '2400'], ['1200', '1200'], ['300', '300']]), 'baudrate');
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
['115200', '115200'],
|
||||
['57600', '57600'],
|
||||
['37400', '38400'],
|
||||
['31250', '31250'],
|
||||
['28800', '28800'],
|
||||
['19200', '19200'],
|
||||
['14400', '14400'],
|
||||
['9600', '9600'],
|
||||
['4800', '4800'],
|
||||
['2400', '2400'],
|
||||
['1200', '1200'],
|
||||
['300', '300']
|
||||
]), 'baudrate');
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setInputsInline(true);
|
||||
@@ -194,7 +241,7 @@ export const system_input = {
|
||||
this.setOutput(true);
|
||||
this.setTooltip(Blockly.Msg.INOUT_input_TOOLTIP);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const system_print = {
|
||||
init: function () {
|
||||
@@ -233,10 +280,8 @@ export const system_print_end = {
|
||||
};
|
||||
|
||||
export const system_print_many = {
|
||||
|
||||
init: function () {
|
||||
this.setColour(SERIAL_HUE);
|
||||
|
||||
this.itemCount_ = 2;
|
||||
this.updateShape_();
|
||||
this.setPreviousStatement(false);
|
||||
@@ -247,18 +292,15 @@ export const system_print_many = {
|
||||
this.setNextStatement(true);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_MIXPY_INOUT_PRINT_MANY_TOOLTIP);
|
||||
},
|
||||
|
||||
mutationToDom: function () {
|
||||
var container = document.createElement('mutation');
|
||||
container.setAttribute('items', this.itemCount_);
|
||||
return container;
|
||||
},
|
||||
|
||||
domToMutation: function (xmlElement) {
|
||||
this.itemCount_ = parseInt(xmlElement.getAttribute('items'), 10);
|
||||
this.updateShape_();
|
||||
},
|
||||
|
||||
decompose: function (workspace) {
|
||||
var containerBlock =
|
||||
workspace.newBlock('system_print_container');
|
||||
@@ -272,7 +314,6 @@ export const system_print_many = {
|
||||
}
|
||||
return containerBlock;
|
||||
},
|
||||
|
||||
compose: function (containerBlock) {
|
||||
var itemBlock = containerBlock.getInputTargetBlock('STACK');
|
||||
// Count number of inputs.
|
||||
@@ -294,7 +335,6 @@ export const system_print_many = {
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
saveConnections: function (containerBlock) {
|
||||
var itemBlock = containerBlock.getInputTargetBlock('STACK');
|
||||
var i = 0;
|
||||
@@ -306,7 +346,6 @@ export const system_print_many = {
|
||||
itemBlock.nextConnection.targetBlock();
|
||||
}
|
||||
},
|
||||
|
||||
updateShape_: function () {
|
||||
// Delete everything.
|
||||
if (this.getInput('EMPTY')) {
|
||||
@@ -332,6 +371,7 @@ export const system_print_many = {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const system_print_container = {
|
||||
init: function () {
|
||||
this.setColour(SERIAL_HUE);
|
||||
@@ -365,7 +405,10 @@ export const serial_send_to_ai = {
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.LANG_CONTROLS_FOR_INPUT_TO + Blockly.Msg.MIXLY_OTHER + 'MP' + Blockly.Msg.MIXLY_DEVICE)
|
||||
.appendField(Blockly.Msg.LANG_CONTROLS_WHILEUNTIL_TITLE_REPEAT)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_TURTLE_WRITE_MOVE_TRUE, 'True'], [Blockly.Msg.MIXLY_TURTLE_WRITE_MOVE_FALSE, 'False']]), 'STAT')
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_TURTLE_WRITE_MOVE_TRUE, 'True'],
|
||||
[Blockly.Msg.MIXLY_TURTLE_WRITE_MOVE_FALSE, 'False']
|
||||
]), 'STAT')
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,11 @@ export const controls_delay_new = {
|
||||
this.appendValueInput("DELAY_TIME", Number)
|
||||
.setCheck(Number);
|
||||
this.appendDummyInput("")
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_SECOND, "s"], [Blockly.Msg.MIXLY_mSecond, "ms"], [Blockly.Msg.MIXLY_uSecond, "us"]]), 'Time');
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_SECOND, "s"],
|
||||
[Blockly.Msg.MIXLY_mSecond, "ms"],
|
||||
[Blockly.Msg.MIXLY_uSecond, "us"]
|
||||
]), 'Time');
|
||||
this.setFieldValue('s', 'Time')
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
@@ -26,7 +30,11 @@ export const controls_delay = {
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_DELAY)
|
||||
this.appendDummyInput("")
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_SECOND, "s"], [Blockly.Msg.MIXLY_mSecond, "ms"], [Blockly.Msg.MIXLY_uSecond, "us"]]), 'Time');
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_SECOND, "s"],
|
||||
[Blockly.Msg.MIXLY_mSecond, "ms"],
|
||||
[Blockly.Msg.MIXLY_uSecond, "us"]
|
||||
]), 'Time');
|
||||
this.appendValueInput("DELAY_TIME", Number)
|
||||
.setCheck(Number);
|
||||
this.setFieldValue('ms', 'Time')
|
||||
@@ -67,7 +75,10 @@ export const controls_millis = {
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_RUNTIME);
|
||||
this.appendDummyInput("")
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_mSecond, "ms"], [Blockly.Msg.MIXLY_uSecond, "us"]]), 'Time');
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_mSecond, "ms"],
|
||||
[Blockly.Msg.MIXLY_uSecond, "us"]
|
||||
]), 'Time');
|
||||
this.setOutput(true, Number);
|
||||
this.setInputsInline(true);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_ESP32_CONTROLS_MILLIS_TOOLTIP);
|
||||
@@ -92,7 +103,6 @@ export const controls_uname = {
|
||||
this.setColour(SYSTEM_HUE);
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_PY_CONTORL_UNAME);
|
||||
|
||||
this.setInputsInline(true);
|
||||
this.setOutput(true);
|
||||
this.setTooltip(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN + Blockly.Msg.MIXLY_MICROBIT_PY_CONTORL_UNAME);
|
||||
@@ -137,7 +147,10 @@ export const system_timer = {
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_mSecond)
|
||||
.appendField(Blockly.Msg.MIXLY_MODE)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_PYTHON_ONE_SHOT, "ONE_SHOT"], [Blockly.Msg.MIXLY_PYTHON_PERIODIC, "PERIODIC"]]), "mode");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_PYTHON_ONE_SHOT, "ONE_SHOT"],
|
||||
[Blockly.Msg.MIXLY_PYTHON_PERIODIC, "PERIODIC"]
|
||||
]), "mode");
|
||||
this.appendValueInput('callback')
|
||||
.appendField(Blockly.Msg.MIXLY_DO)
|
||||
this.setPreviousStatement(true);
|
||||
|
||||
Reference in New Issue
Block a user