refactor(boards): 规范化micropython板卡代码
This commit is contained in:
@@ -19,7 +19,11 @@ export const controls_delay = {
|
|||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.MIXLY_DELAY)
|
.appendField(Blockly.Msg.MIXLY_DELAY)
|
||||||
this.appendDummyInput("")
|
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)
|
this.appendValueInput("DELAY_TIME", Number)
|
||||||
.setCheck(Number);
|
.setCheck(Number);
|
||||||
this.setFieldValue('ms', 'Time')
|
this.setFieldValue('ms', 'Time')
|
||||||
@@ -113,13 +117,12 @@ export const controls_whileUntil = {
|
|||||||
};
|
};
|
||||||
return TOOLTIPS[op];
|
return TOOLTIPS[op];
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
};
|
OPERATORS: [
|
||||||
|
|
||||||
controls_whileUntil.OPERATORS = [
|
|
||||||
[Blockly.Msg.LANG_CONTROLS_WHILEUNTIL_OPERATOR_WHILE, 'WHILE'],
|
[Blockly.Msg.LANG_CONTROLS_WHILEUNTIL_OPERATOR_WHILE, 'WHILE'],
|
||||||
[Blockly.Msg.LANG_CONTROLS_WHILEUNTIL_OPERATOR_UNTIL, 'UNTIL']
|
[Blockly.Msg.LANG_CONTROLS_WHILEUNTIL_OPERATOR_UNTIL, 'UNTIL']
|
||||||
];
|
]
|
||||||
|
};
|
||||||
|
|
||||||
export const controls_flow_statements = {
|
export const controls_flow_statements = {
|
||||||
init: function () {
|
init: function () {
|
||||||
@@ -163,13 +166,12 @@ export const controls_flow_statements = {
|
|||||||
} else {
|
} else {
|
||||||
this.setWarningText(Blockly.Msg.LANG_CONTROLS_FLOW_STATEMENTS_WARNING);
|
this.setWarningText(Blockly.Msg.LANG_CONTROLS_FLOW_STATEMENTS_WARNING);
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
};
|
OPERATORS: [
|
||||||
|
|
||||||
controls_flow_statements.OPERATORS = [
|
|
||||||
[Blockly.Msg.LANG_CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK, 'BREAK'],
|
[Blockly.Msg.LANG_CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK, 'BREAK'],
|
||||||
[Blockly.Msg.LANG_CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE, 'CONTINUE']
|
[Blockly.Msg.LANG_CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE, 'CONTINUE']
|
||||||
];
|
]
|
||||||
|
};
|
||||||
|
|
||||||
export const controls_millis = {
|
export const controls_millis = {
|
||||||
init: function () {
|
init: function () {
|
||||||
|
|||||||
@@ -63,7 +63,10 @@ export const monitor_show_string = {
|
|||||||
this.setColour(DISPLAY_HUE);
|
this.setColour(DISPLAY_HUE);
|
||||||
this.appendValueInput('data')
|
this.appendValueInput('data')
|
||||||
.setCheck(String)
|
.setCheck(String)
|
||||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.OLED_DRAWSTR_ONE_BY_ONE, 'show'], [Blockly.Msg.MIXLY_ESP32_MONITOR_SCROLL, 'scroll']]), "MODE")
|
.appendField(new Blockly.FieldDropdown([
|
||||||
|
[Blockly.Msg.OLED_DRAWSTR_ONE_BY_ONE, 'show'],
|
||||||
|
[Blockly.Msg.MIXLY_ESP32_MONITOR_SCROLL, 'scroll']
|
||||||
|
]), "MODE")
|
||||||
.appendField(Blockly.Msg.OLED_DRAWSTR);
|
.appendField(Blockly.Msg.OLED_DRAWSTR);
|
||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
@@ -86,7 +89,10 @@ export const monitor_show_scroll_string = {
|
|||||||
this.setColour(DISPLAY_HUE);
|
this.setColour(DISPLAY_HUE);
|
||||||
this.appendValueInput('data')
|
this.appendValueInput('data')
|
||||||
.setCheck(String)
|
.setCheck(String)
|
||||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.OLED_DRAWSTR_ONE_BY_ONE, 'show'], [Blockly.Msg.MIXLY_ESP32_MONITOR_SCROLL, 'scroll']]), "MODE")
|
.appendField(new Blockly.FieldDropdown([
|
||||||
|
[Blockly.Msg.OLED_DRAWSTR_ONE_BY_ONE, 'show'],
|
||||||
|
[Blockly.Msg.MIXLY_ESP32_MONITOR_SCROLL, 'scroll']
|
||||||
|
]), "MODE")
|
||||||
.appendField(Blockly.Msg.OLED_DRAWSTR);
|
.appendField(Blockly.Msg.OLED_DRAWSTR);
|
||||||
this.appendValueInput("time")
|
this.appendValueInput("time")
|
||||||
.setCheck(Number)
|
.setCheck(Number)
|
||||||
@@ -108,7 +114,6 @@ export const monitor_show_scroll_string = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export const display_show_static = {
|
export const display_show_static = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(DISPLAY_HUE);
|
this.setColour(DISPLAY_HUE);
|
||||||
@@ -135,8 +140,6 @@ export const microbit_display_show_image = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const esp32_display_show_default_image = {
|
export const esp32_display_show_default_image = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.jsonInit({
|
this.jsonInit({
|
||||||
@@ -147,9 +150,59 @@ export const esp32_display_show_default_image = {
|
|||||||
"helpUrl": "https://microbit-micropython.readthedocs.io/en/latest/display.html#microbit.display.show",
|
"helpUrl": "https://microbit-micropython.readthedocs.io/en/latest/display.html#microbit.display.show",
|
||||||
"tooltip": "Show the referenced image on the display.",
|
"tooltip": "Show the referenced image on the display.",
|
||||||
"message0": Blockly.Msg.OLED_BITMAP,
|
"message0": Blockly.Msg.OLED_BITMAP,
|
||||||
"args0": [{
|
"args0": [
|
||||||
|
{
|
||||||
"name": "image",
|
"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"]],
|
"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"
|
"type": "field_dropdown"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -157,7 +210,6 @@ export const esp32_display_show_default_image = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export const esp32_display_show_animation = {
|
export const esp32_display_show_animation = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.jsonInit({
|
this.jsonInit({
|
||||||
@@ -167,7 +219,8 @@ export const esp32_display_show_animation = {
|
|||||||
"previousStatement": null,
|
"previousStatement": null,
|
||||||
"helpUrl": "https://microbit-micropython.readthedocs.io/en/latest/display.html#microbit.display.show",
|
"helpUrl": "https://microbit-micropython.readthedocs.io/en/latest/display.html#microbit.display.show",
|
||||||
"message0": Blockly.Msg.MIXLY_MICROBIT_Animate_images,
|
"message0": Blockly.Msg.MIXLY_MICROBIT_Animate_images,
|
||||||
"args0": [{
|
"args0": [
|
||||||
|
{
|
||||||
"check": "List",
|
"check": "List",
|
||||||
"type": "input_value",
|
"type": "input_value",
|
||||||
"name": "images"
|
"name": "images"
|
||||||
@@ -223,7 +276,10 @@ export const esp32_display_on = {
|
|||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(DISPLAY_HUE);
|
this.setColour(DISPLAY_HUE);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_MICROBIT_Turn_on_display, 'on'], [Blockly.Msg.MIXLY_MICROBIT_Turn_off_display, 'off']]), 'on_off')
|
.appendField(new Blockly.FieldDropdown([
|
||||||
|
[Blockly.Msg.MIXLY_MICROBIT_Turn_on_display, 'on'],
|
||||||
|
[Blockly.Msg.MIXLY_MICROBIT_Turn_off_display, 'off']
|
||||||
|
]), 'on_off')
|
||||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_monitor);
|
.appendField(Blockly.Msg.MIXLY_MICROBIT_monitor);
|
||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
@@ -273,7 +329,56 @@ export const display_image_builtins = {
|
|||||||
"colour": DISPLAY_HUE,
|
"colour": DISPLAY_HUE,
|
||||||
"args0": [{
|
"args0": [{
|
||||||
"name": "image",
|
"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"]],
|
"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"
|
"type": "field_dropdown"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -285,12 +390,12 @@ export const display_image_builtins = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export const display_image_create = {
|
export const display_image_create = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.jsonInit({
|
this.jsonInit({
|
||||||
"colour": DISPLAY_HUE,
|
"colour": DISPLAY_HUE,
|
||||||
"args0": [{
|
"args0": [
|
||||||
|
{
|
||||||
"type": "input_dummy"
|
"type": "input_dummy"
|
||||||
}, {
|
}, {
|
||||||
"colour": "#000000",
|
"colour": "#000000",
|
||||||
@@ -828,16 +933,8 @@ export const display_image_create = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const image_shift = {
|
export const image_shift = {
|
||||||
init: function () {
|
init: function () {
|
||||||
var OPERATORS = [
|
|
||||||
[Blockly.Msg.MIXLY_UP, 'up'],
|
|
||||||
[Blockly.Msg.MIXLY_DOWN, 'down'],
|
|
||||||
[Blockly.Msg.MIXLY_LEFT, 'left'],
|
|
||||||
[Blockly.Msg.MIXLY_RIGHT, 'right'],
|
|
||||||
];
|
|
||||||
//this.setHelpUrl(Blockly.Msg.MATH_TRIG_HELPURL);
|
//this.setHelpUrl(Blockly.Msg.MATH_TRIG_HELPURL);
|
||||||
this.setColour(DISPLAY_HUE);
|
this.setColour(DISPLAY_HUE);
|
||||||
this.setOutput(true);
|
this.setOutput(true);
|
||||||
@@ -847,7 +944,7 @@ export const image_shift = {
|
|||||||
.setCheck(["esp32_image", "List", String]);
|
.setCheck(["esp32_image", "List", String]);
|
||||||
this.appendDummyInput('')
|
this.appendDummyInput('')
|
||||||
.appendField(Blockly.Msg.DISPLAY_IMAGE_LET2)
|
.appendField(Blockly.Msg.DISPLAY_IMAGE_LET2)
|
||||||
.appendField(new Blockly.FieldDropdown(OPERATORS), 'OP');
|
.appendField(new Blockly.FieldDropdown(this.OPERATORS), 'OP');
|
||||||
this.appendValueInput('val')
|
this.appendValueInput('val')
|
||||||
.appendField(Blockly.Msg.DISPLAY_IMAGE_SHIFT)
|
.appendField(Blockly.Msg.DISPLAY_IMAGE_SHIFT)
|
||||||
.setCheck(Number);
|
.setCheck(Number);
|
||||||
@@ -867,15 +964,17 @@ export const image_shift = {
|
|||||||
};
|
};
|
||||||
return mode0 + mode1 + TOOLTIPS[mode] + mode2;
|
return mode0 + mode1 + TOOLTIPS[mode] + mode2;
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
|
OPERATORS: [
|
||||||
|
[Blockly.Msg.MIXLY_UP, 'up'],
|
||||||
|
[Blockly.Msg.MIXLY_DOWN, 'down'],
|
||||||
|
[Blockly.Msg.MIXLY_LEFT, 'left'],
|
||||||
|
[Blockly.Msg.MIXLY_RIGHT, 'right'],
|
||||||
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
export const image_arithmetic = {
|
export const image_arithmetic = {
|
||||||
init: function () {
|
init: function () {
|
||||||
var OPERATORS = [
|
|
||||||
[Blockly.Msg.MICROBIT_DISPLAY_UNION, '+'],
|
|
||||||
[Blockly.Msg.MICROBIT_DISPLAY_MINUS, '-']
|
|
||||||
];
|
|
||||||
//this.setHelpUrl(Blockly.Msg.MATH_ARITHMETIC_HELPURL);
|
//this.setHelpUrl(Blockly.Msg.MATH_ARITHMETIC_HELPURL);
|
||||||
this.setColour(DISPLAY_HUE);
|
this.setColour(DISPLAY_HUE);
|
||||||
this.setOutput(true, "esp32_image");
|
this.setOutput(true, "esp32_image");
|
||||||
@@ -884,7 +983,7 @@ export const image_arithmetic = {
|
|||||||
.appendField(Blockly.Msg.MICROBIT_DISPLAY_MERGE_SHAPE);
|
.appendField(Blockly.Msg.MICROBIT_DISPLAY_MERGE_SHAPE);
|
||||||
this.appendValueInput('B')
|
this.appendValueInput('B')
|
||||||
// .setCheck(["esp32_image", "List", String])
|
// .setCheck(["esp32_image", "List", String])
|
||||||
.appendField(new Blockly.FieldDropdown(OPERATORS), 'OP');
|
.appendField(new Blockly.FieldDropdown(this.OPERATORS), 'OP');
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
var thisBlock = this;
|
var thisBlock = this;
|
||||||
this.setTooltip(function () {
|
this.setTooltip(function () {
|
||||||
@@ -895,13 +994,20 @@ export const image_arithmetic = {
|
|||||||
};
|
};
|
||||||
return TOOLTIPS[mode];
|
return TOOLTIPS[mode];
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
|
OPERATORS: [
|
||||||
|
[Blockly.Msg.MICROBIT_DISPLAY_UNION, '+'],
|
||||||
|
[Blockly.Msg.MICROBIT_DISPLAY_MINUS, '-']
|
||||||
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
export const esp32_display_show_string = {
|
export const esp32_display_show_string = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.OLED_DRAWSTR_ONE_BY_ONE, 'show'], [Blockly.Msg.MIXLY_MICROBIT_JS_MONITOR_SCROLL_STRING, 'scroll']]), "MODE");
|
.appendField(new Blockly.FieldDropdown([
|
||||||
|
[Blockly.Msg.OLED_DRAWSTR_ONE_BY_ONE, 'show'],
|
||||||
|
[Blockly.Msg.MIXLY_MICROBIT_JS_MONITOR_SCROLL_STRING, 'scroll']
|
||||||
|
]), "MODE");
|
||||||
this.jsonInit({
|
this.jsonInit({
|
||||||
"colour": DISPLAY_HUE,
|
"colour": DISPLAY_HUE,
|
||||||
"inputsInline": true,
|
"inputsInline": true,
|
||||||
@@ -1072,7 +1178,13 @@ export const group_lcd_power = {
|
|||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.MIXLY_DF_LCD)
|
.appendField(Blockly.Msg.MIXLY_DF_LCD)
|
||||||
.appendField('mylcd')
|
.appendField('mylcd')
|
||||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_ON, "on()"], [Blockly.Msg.MIXLY_OFF, "off()"], [Blockly.Msg.MIXLY_LCD_STAT_CLEAR, "clear()"], [Blockly.Msg.MIXLY_LCD_NOBACKLIGHT, "backlight(off)"], [Blockly.Msg.MIXLY_LCD_BACKLIGHT, "backlight(on)"]]), "STAT");
|
.appendField(new Blockly.FieldDropdown([
|
||||||
|
[Blockly.Msg.MIXLY_ON, "on()"],
|
||||||
|
[Blockly.Msg.MIXLY_OFF, "off()"],
|
||||||
|
[Blockly.Msg.MIXLY_LCD_STAT_CLEAR, "clear()"],
|
||||||
|
[Blockly.Msg.MIXLY_LCD_NOBACKLIGHT, "backlight(off)"],
|
||||||
|
[Blockly.Msg.MIXLY_LCD_BACKLIGHT, "backlight(on)"]
|
||||||
|
]), "STAT");
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
@@ -1181,10 +1293,6 @@ export const display_draw_4strings = {
|
|||||||
|
|
||||||
export const display_image_size = {
|
export const display_image_size = {
|
||||||
init: function () {
|
init: function () {
|
||||||
var OPERATORS = [
|
|
||||||
[Blockly.Msg.MIXLY_HEIGHT, 'height'],
|
|
||||||
[Blockly.Msg.MIXLY_WIDTH, 'width']
|
|
||||||
];
|
|
||||||
this.setColour(DISPLAY_HUE);
|
this.setColour(DISPLAY_HUE);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_PY_STORAGE_GET + Blockly.Msg.MIXLY_MICROBIT_IMAGE);
|
.appendField(Blockly.Msg.MIXLY_MICROBIT_PY_STORAGE_GET + Blockly.Msg.MIXLY_MICROBIT_IMAGE);
|
||||||
@@ -1192,7 +1300,7 @@ export const display_image_size = {
|
|||||||
.setCheck("esp32_image")
|
.setCheck("esp32_image")
|
||||||
// .appendField(Blockly.Msg.blockpy_USE_LIST);
|
// .appendField(Blockly.Msg.blockpy_USE_LIST);
|
||||||
this.appendDummyInput("")
|
this.appendDummyInput("")
|
||||||
.appendField(new Blockly.FieldDropdown(OPERATORS), 'OP');
|
.appendField(new Blockly.FieldDropdown(this.OPERATORS), 'OP');
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
this.setOutput(true);
|
this.setOutput(true);
|
||||||
var thisBlock = this;
|
var thisBlock = this;
|
||||||
@@ -1206,15 +1314,15 @@ export const display_image_size = {
|
|||||||
};
|
};
|
||||||
return mode0 + mode1 + TOOLTIPS[mode];
|
return mode0 + mode1 + TOOLTIPS[mode];
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
|
OPERATORS: [
|
||||||
|
[Blockly.Msg.MIXLY_HEIGHT, 'height'],
|
||||||
|
[Blockly.Msg.MIXLY_WIDTH, 'width']
|
||||||
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
export const display_rect = {
|
export const display_rect = {
|
||||||
init: function () {
|
init: function () {
|
||||||
var brightness_or_not = [
|
|
||||||
[Blockly.Msg.MIXLY_4DIGITDISPLAY_ON, '1'],
|
|
||||||
[Blockly.Msg.MIXLY_4DIGITDISPLAY_OFF, '0']
|
|
||||||
];
|
|
||||||
this.setColour(DISPLAY_HUE);
|
this.setColour(DISPLAY_HUE);
|
||||||
// this.appendDummyInput()
|
// this.appendDummyInput()
|
||||||
// .appendField(Blockly.Msg.OLED)
|
// .appendField(Blockly.Msg.OLED)
|
||||||
@@ -1224,8 +1332,7 @@ export const display_rect = {
|
|||||||
.setCheck("var");
|
.setCheck("var");
|
||||||
this.appendDummyInput("")
|
this.appendDummyInput("")
|
||||||
.appendField(Blockly.Msg.MIXLY_RECT)
|
.appendField(Blockly.Msg.MIXLY_RECT)
|
||||||
.appendField(new Blockly.FieldDropdown(brightness_or_not), 'OP')
|
.appendField(new Blockly.FieldDropdown(this.STATUS), 'OP')
|
||||||
|
|
||||||
// this.appendValueInput("PIN", Number)
|
// this.appendValueInput("PIN", Number)
|
||||||
// .setCheck(Number)
|
// .setCheck(Number)
|
||||||
// .setAlign(Blockly.inputs.Align.RIGHT)
|
// .setAlign(Blockly.inputs.Align.RIGHT)
|
||||||
@@ -1262,7 +1369,11 @@ export const display_rect = {
|
|||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
this.setTooltip('');
|
this.setTooltip('');
|
||||||
this.setTooltip(Blockly.Msg.MIXLY_OLED_RECT);
|
this.setTooltip(Blockly.Msg.MIXLY_OLED_RECT);
|
||||||
}
|
},
|
||||||
|
STATUS: [
|
||||||
|
[Blockly.Msg.MIXLY_4DIGITDISPLAY_ON, '1'],
|
||||||
|
[Blockly.Msg.MIXLY_4DIGITDISPLAY_OFF, '0']
|
||||||
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
export const display_line = {
|
export const display_line = {
|
||||||
@@ -1280,10 +1391,14 @@ export const display_line = {
|
|||||||
// .appendField(Blockly.Msg.MIXLY_PIN);
|
// .appendField(Blockly.Msg.MIXLY_PIN);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.MIXLY_DISPLAY_DRAW)
|
.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({
|
this.jsonInit({
|
||||||
"message0": Blockly.Msg.MIXLY_MICROBIT_SHOW_LINE,
|
"message0": Blockly.Msg.MIXLY_MICROBIT_SHOW_LINE,
|
||||||
"args0": [{
|
"args0": [
|
||||||
|
{
|
||||||
"check": Number,
|
"check": Number,
|
||||||
"type": "input_value",
|
"type": "input_value",
|
||||||
"name": "x"
|
"name": "x"
|
||||||
@@ -1320,7 +1435,8 @@ export const display_line_arbitrarily = {
|
|||||||
// .appendField(Blockly.Msg.MIXLY_PIN);
|
// .appendField(Blockly.Msg.MIXLY_PIN);
|
||||||
this.jsonInit({
|
this.jsonInit({
|
||||||
"message0": Blockly.Msg.MIXLY_MICROBIT_SHOW_LINE_ARBITRARILY,
|
"message0": Blockly.Msg.MIXLY_MICROBIT_SHOW_LINE_ARBITRARILY,
|
||||||
"args0": [{
|
"args0": [
|
||||||
|
{
|
||||||
"check": Number,
|
"check": Number,
|
||||||
"type": "input_value",
|
"type": "input_value",
|
||||||
"name": "x1"
|
"name": "x1"
|
||||||
@@ -1479,7 +1595,10 @@ export const display_onoff = {
|
|||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(DISPLAY_HUE);
|
this.setColour(DISPLAY_HUE);
|
||||||
this.appendDummyInput("")
|
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.setOutput(true, Boolean);
|
||||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_INOUT_HIGHLOW);
|
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_INOUT_HIGHLOW);
|
||||||
}
|
}
|
||||||
@@ -1564,7 +1683,11 @@ export const display_tm1650_power = {
|
|||||||
.appendField(new Blockly.FieldDropdown([["TM1650", "tm1650"]]), "TYPE");
|
.appendField(new Blockly.FieldDropdown([["TM1650", "tm1650"]]), "TYPE");
|
||||||
this.appendValueInput("VAR")
|
this.appendValueInput("VAR")
|
||||||
this.appendDummyInput()
|
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.setInputsInline(true);
|
||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
@@ -1609,35 +1732,32 @@ export const display_tm1650_show_dot = {
|
|||||||
|
|
||||||
export const display_animate = {
|
export const display_animate = {
|
||||||
init: function () {
|
init: function () {
|
||||||
var ANIMATE = [
|
|
||||||
["ALL_CLOCKS", 'ALL_CLOCKS'],
|
|
||||||
["ALL_ARROWS", 'ALL_ARROWS']
|
|
||||||
];
|
|
||||||
this.setColour(DISPLAY_HUE);
|
this.setColour(DISPLAY_HUE);
|
||||||
this.setOutput(true, 'Tuple');
|
this.setOutput(true, 'Tuple');
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.MIXLY_ESP32_DISPLAY_ANIMATE)
|
.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);
|
//this.setTooltip(Blockly.Msg.LOGIC_BOOLEAN_TOOLTIP);
|
||||||
}
|
},
|
||||||
|
ANIMATE: [
|
||||||
|
["ALL_CLOCKS", 'ALL_CLOCKS'],
|
||||||
|
["ALL_ARROWS", 'ALL_ARROWS']
|
||||||
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
export const display_circle = {
|
export const display_circle = {
|
||||||
init: function () {
|
init: function () {
|
||||||
var brightness_or_not = [
|
|
||||||
[Blockly.Msg.MIXLY_4DIGITDISPLAY_ON, '1'],
|
|
||||||
[Blockly.Msg.MIXLY_4DIGITDISPLAY_OFF, '0']
|
|
||||||
];
|
|
||||||
this.setColour(DISPLAY_HUE);
|
this.setColour(DISPLAY_HUE);
|
||||||
this.appendValueInput('VAR')
|
this.appendValueInput('VAR')
|
||||||
.appendField(Blockly.Msg.OLED)
|
.appendField(Blockly.Msg.OLED)
|
||||||
.setCheck("var");
|
.setCheck("var");
|
||||||
this.appendDummyInput("")
|
this.appendDummyInput("")
|
||||||
.appendField(Blockly.Msg.MIXLY_MIXPY_TURTLE_DRAW_CIRCLE)
|
.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({
|
this.jsonInit({
|
||||||
"message0": Blockly.Msg.MIXLY_HANBIT_SHOW_CIRCLE,
|
"message0": Blockly.Msg.MIXLY_HANBIT_SHOW_CIRCLE,
|
||||||
"args0": [{
|
"args0": [
|
||||||
|
{
|
||||||
"check": Number,
|
"check": Number,
|
||||||
"type": "input_value",
|
"type": "input_value",
|
||||||
"name": "x"
|
"name": "x"
|
||||||
@@ -1663,25 +1783,26 @@ export const display_circle = {
|
|||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
this.setTooltip('');
|
this.setTooltip('');
|
||||||
this.setTooltip(Blockly.Msg.MIXLY_MIXPY_TURTLE_DRAW_CIRCLE);
|
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 = {
|
export const display_triangle = {
|
||||||
init: function () {
|
init: function () {
|
||||||
var brightness_or_not = [
|
|
||||||
[Blockly.Msg.MIXLY_4DIGITDISPLAY_ON, '1'],
|
|
||||||
[Blockly.Msg.MIXLY_4DIGITDISPLAY_OFF, '0']
|
|
||||||
];
|
|
||||||
this.setColour(DISPLAY_HUE);
|
this.setColour(DISPLAY_HUE);
|
||||||
this.appendValueInput('VAR')
|
this.appendValueInput('VAR')
|
||||||
.appendField(Blockly.Msg.OLED)
|
.appendField(Blockly.Msg.OLED)
|
||||||
.setCheck("var");
|
.setCheck("var");
|
||||||
this.appendDummyInput("")
|
this.appendDummyInput("")
|
||||||
.appendField(Blockly.Msg.MIXLY_DISPLAY_DRAW + Blockly.Msg.MIXLY_HANBIT_DRAW_TRIANGLE)
|
.appendField(Blockly.Msg.MIXLY_DISPLAY_DRAW + Blockly.Msg.MIXLY_HANBIT_DRAW_TRIANGLE)
|
||||||
.appendField(new Blockly.FieldDropdown(brightness_or_not), 'OP')
|
.appendField(new Blockly.FieldDropdown(this.STATUS), 'OP')
|
||||||
this.jsonInit({
|
this.jsonInit({
|
||||||
"message0": Blockly.Msg.MIXLY_HANBIT_SHOW_triangle,
|
"message0": Blockly.Msg.MIXLY_HANBIT_SHOW_triangle,
|
||||||
"args0": [{
|
"args0": [
|
||||||
|
{
|
||||||
"check": Number,
|
"check": Number,
|
||||||
"type": "input_value",
|
"type": "input_value",
|
||||||
"name": "x0"
|
"name": "x0"
|
||||||
@@ -1719,7 +1840,11 @@ export const display_triangle = {
|
|||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
this.setTooltip('');
|
this.setTooltip('');
|
||||||
this.setTooltip(Blockly.Msg.MIXLY_DISPLAY_DRAW + Blockly.Msg.MIXLY_HANBIT_DRAW_TRIANGLE);
|
this.setTooltip(Blockly.Msg.MIXLY_DISPLAY_DRAW + Blockly.Msg.MIXLY_HANBIT_DRAW_TRIANGLE);
|
||||||
}
|
},
|
||||||
|
STATUS: [
|
||||||
|
[Blockly.Msg.MIXLY_4DIGITDISPLAY_ON, '1'],
|
||||||
|
[Blockly.Msg.MIXLY_4DIGITDISPLAY_OFF, '0']
|
||||||
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
export const display_help = {
|
export const display_help = {
|
||||||
@@ -1799,8 +1924,6 @@ export const display_matrix_use_i2c_init = {
|
|||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1830,4 +1953,3 @@ export const display_scroll_string_extern = {
|
|||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -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"],["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"]];
|
// 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 = {
|
export const display_matrix_use_i2c_init = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(DISPLAY_EXTERN_HUE);
|
this.setColour(DISPLAY_EXTERN_HUE);
|
||||||
@@ -27,8 +23,6 @@ export const display_matrix_use_i2c_init = {
|
|||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(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 = {
|
export const display_matrix_extern_shift = {
|
||||||
init: function () {
|
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.setHelpUrl(Blockly.Msg.MATH_TRIG_HELPURL);
|
||||||
this.appendValueInput('SUB')
|
this.appendValueInput('SUB')
|
||||||
.setCheck("var");
|
.setCheck("var");
|
||||||
@@ -157,7 +145,7 @@ export const display_matrix_extern_shift = {
|
|||||||
.appendField(Blockly.Msg.DISPLAY_IMAGE_LET)
|
.appendField(Blockly.Msg.DISPLAY_IMAGE_LET)
|
||||||
this.appendDummyInput('')
|
this.appendDummyInput('')
|
||||||
.appendField(Blockly.Msg.DISPLAY_IMAGE_LET2)
|
.appendField(Blockly.Msg.DISPLAY_IMAGE_LET2)
|
||||||
.appendField(new Blockly.FieldDropdown(OPERATORS), 'OP');
|
.appendField(new Blockly.FieldDropdown(this.OPERATORS), 'OP');
|
||||||
this.appendValueInput('val')
|
this.appendValueInput('val')
|
||||||
.appendField(Blockly.Msg.DISPLAY_IMAGE_SHIFT)
|
.appendField(Blockly.Msg.DISPLAY_IMAGE_SHIFT)
|
||||||
.setCheck(Number);
|
.setCheck(Number);
|
||||||
@@ -177,7 +165,13 @@ export const display_matrix_extern_shift = {
|
|||||||
};
|
};
|
||||||
return mode0 + mode1 + TOOLTIPS[mode] + mode2;
|
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 = {
|
export const display_matrix_extern_get_pixel = {
|
||||||
@@ -265,29 +259,35 @@ export const display_matrix_extern_clear = {
|
|||||||
|
|
||||||
export const display_matrix_extern_image_builtins = {
|
export const display_matrix_extern_image_builtins = {
|
||||||
init: function () {
|
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')
|
this.appendValueInput('SUB')
|
||||||
.setCheck("var");
|
.setCheck("var");
|
||||||
this.setColour(DISPLAY_EXTERN_HUE);
|
this.setColour(DISPLAY_EXTERN_HUE);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_Built_in_image1)
|
.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.setOutput(true, "esp32_image");
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
this.setTooltip(Blockly.Msg.MIXLY_MICROBIT_Clear_display);
|
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 = {
|
export const matrix_extern_image_arithmetic = {
|
||||||
init: function () {
|
init: function () {
|
||||||
var OPERATORS = [
|
|
||||||
[Blockly.Msg.MICROBIT_DISPLAY_UNION, 'add'],
|
|
||||||
[Blockly.Msg.MICROBIT_DISPLAY_MINUS, 'sub']
|
|
||||||
];
|
|
||||||
this.appendValueInput('SUB')
|
this.appendValueInput('SUB')
|
||||||
.setCheck("var");
|
.setCheck("var");
|
||||||
this.setColour(DISPLAY_EXTERN_HUE);
|
this.setColour(DISPLAY_EXTERN_HUE);
|
||||||
@@ -297,7 +297,7 @@ export const matrix_extern_image_arithmetic = {
|
|||||||
.appendField(Blockly.Msg.MICROBIT_DISPLAY_MERGE_SHAPE);
|
.appendField(Blockly.Msg.MICROBIT_DISPLAY_MERGE_SHAPE);
|
||||||
this.appendValueInput('B')
|
this.appendValueInput('B')
|
||||||
// .setCheck(["esp32_image", "List", String])
|
// .setCheck(["esp32_image", "List", String])
|
||||||
.appendField(new Blockly.FieldDropdown(OPERATORS), 'OP');
|
.appendField(new Blockly.FieldDropdown(this.OPERATORS), 'OP');
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
var thisBlock = this;
|
var thisBlock = this;
|
||||||
this.setTooltip(function () {
|
this.setTooltip(function () {
|
||||||
@@ -308,7 +308,11 @@ export const matrix_extern_image_arithmetic = {
|
|||||||
};
|
};
|
||||||
return TOOLTIPS[mode];
|
return TOOLTIPS[mode];
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
|
OPERATORS: [
|
||||||
|
[Blockly.Msg.MICROBIT_DISPLAY_UNION, 'add'],
|
||||||
|
[Blockly.Msg.MICROBIT_DISPLAY_MINUS, 'sub']
|
||||||
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
export const matrix_extern_image_invert = {
|
export const matrix_extern_image_invert = {
|
||||||
@@ -385,10 +389,6 @@ export const display_draw_4strings = {
|
|||||||
|
|
||||||
export const display_image_size = {
|
export const display_image_size = {
|
||||||
init: function () {
|
init: function () {
|
||||||
var OPERATORS = [
|
|
||||||
[Blockly.Msg.MIXLY_HEIGHT, 'height'],
|
|
||||||
[Blockly.Msg.MIXLY_WIDTH, 'width']
|
|
||||||
];
|
|
||||||
this.setColour(DISPLAY_EXTERN_HUE);
|
this.setColour(DISPLAY_EXTERN_HUE);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_PY_STORAGE_GET + Blockly.Msg.MIXLY_MICROBIT_IMAGE);
|
.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")
|
.setCheck("esp32_image")
|
||||||
// .appendField(Blockly.Msg.blockpy_USE_LIST);
|
// .appendField(Blockly.Msg.blockpy_USE_LIST);
|
||||||
this.appendDummyInput("")
|
this.appendDummyInput("")
|
||||||
.appendField(new Blockly.FieldDropdown(OPERATORS), 'OP');
|
.appendField(new Blockly.FieldDropdown(this.OPERATORS), 'OP');
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
this.setOutput(true);
|
this.setOutput(true);
|
||||||
var thisBlock = this;
|
var thisBlock = this;
|
||||||
@@ -410,15 +410,15 @@ export const display_image_size = {
|
|||||||
};
|
};
|
||||||
return mode0 + mode1 + TOOLTIPS[mode];
|
return mode0 + mode1 + TOOLTIPS[mode];
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
|
OPERATORS: [
|
||||||
|
[Blockly.Msg.MIXLY_HEIGHT, 'height'],
|
||||||
|
[Blockly.Msg.MIXLY_WIDTH, 'width']
|
||||||
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
export const display_rect = {
|
export const display_rect = {
|
||||||
init: function () {
|
init: function () {
|
||||||
var brightness_or_not = [
|
|
||||||
[Blockly.Msg.MIXLY_4DIGITDISPLAY_ON, '1'],
|
|
||||||
[Blockly.Msg.MIXLY_4DIGITDISPLAY_OFF, '0']
|
|
||||||
];
|
|
||||||
this.setColour(DISPLAY_EXTERN_HUE);
|
this.setColour(DISPLAY_EXTERN_HUE);
|
||||||
// this.appendDummyInput()
|
// this.appendDummyInput()
|
||||||
// .appendField(Blockly.Msg.OLED)
|
// .appendField(Blockly.Msg.OLED)
|
||||||
@@ -428,15 +428,15 @@ export const display_rect = {
|
|||||||
.setCheck("var");
|
.setCheck("var");
|
||||||
this.appendDummyInput("")
|
this.appendDummyInput("")
|
||||||
.appendField(Blockly.Msg.MIXLY_RECT)
|
.appendField(Blockly.Msg.MIXLY_RECT)
|
||||||
.appendField(new Blockly.FieldDropdown(brightness_or_not), 'OP')
|
.appendField(new Blockly.FieldDropdown(this.STATUS), 'OP')
|
||||||
|
|
||||||
// this.appendValueInput("PIN", Number)
|
// this.appendValueInput("PIN", Number)
|
||||||
// .setCheck(Number)
|
// .setCheck(Number)
|
||||||
// .setAlign(Blockly.inputs.Align.RIGHT)
|
// .setAlign(Blockly.inputs.Align.RIGHT)
|
||||||
// .appendField(Blockly.Msg.MIXLY_PIN);
|
// .appendField(Blockly.Msg.MIXLY_PIN);
|
||||||
this.jsonInit({
|
this.jsonInit({
|
||||||
"message0": Blockly.Msg.MIXLY_MICROBIT_SHOW_RECT,
|
"message0": Blockly.Msg.MIXLY_MICROBIT_SHOW_RECT,
|
||||||
"args0": [{
|
"args0": [
|
||||||
|
{
|
||||||
"check": Number,
|
"check": Number,
|
||||||
"type": "input_value",
|
"type": "input_value",
|
||||||
"name": "x"
|
"name": "x"
|
||||||
@@ -466,7 +466,11 @@ export const display_rect = {
|
|||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
this.setTooltip('');
|
this.setTooltip('');
|
||||||
this.setTooltip(Blockly.Msg.MIXLY_OLED_RECT);
|
this.setTooltip(Blockly.Msg.MIXLY_OLED_RECT);
|
||||||
}
|
},
|
||||||
|
STATUS: [
|
||||||
|
[Blockly.Msg.MIXLY_4DIGITDISPLAY_ON, '1'],
|
||||||
|
[Blockly.Msg.MIXLY_4DIGITDISPLAY_OFF, '0']
|
||||||
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
export const display_line = {
|
export const display_line = {
|
||||||
@@ -484,10 +488,14 @@ export const display_line = {
|
|||||||
// .appendField(Blockly.Msg.MIXLY_PIN);
|
// .appendField(Blockly.Msg.MIXLY_PIN);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.MIXLY_DISPLAY_DRAW)
|
.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({
|
this.jsonInit({
|
||||||
"message0": Blockly.Msg.MIXLY_MICROBIT_SHOW_LINE,
|
"message0": Blockly.Msg.MIXLY_MICROBIT_SHOW_LINE,
|
||||||
"args0": [{
|
"args0": [
|
||||||
|
{
|
||||||
"check": Number,
|
"check": Number,
|
||||||
"type": "input_value",
|
"type": "input_value",
|
||||||
"name": "x"
|
"name": "x"
|
||||||
@@ -524,7 +532,8 @@ export const display_line_arbitrarily = {
|
|||||||
// .appendField(Blockly.Msg.MIXLY_PIN);
|
// .appendField(Blockly.Msg.MIXLY_PIN);
|
||||||
this.jsonInit({
|
this.jsonInit({
|
||||||
"message0": Blockly.Msg.MIXLY_MICROBIT_SHOW_LINE_ARBITRARILY,
|
"message0": Blockly.Msg.MIXLY_MICROBIT_SHOW_LINE_ARBITRARILY,
|
||||||
"args0": [{
|
"args0": [
|
||||||
|
{
|
||||||
"check": Number,
|
"check": Number,
|
||||||
"type": "input_value",
|
"type": "input_value",
|
||||||
"name": "x1"
|
"name": "x1"
|
||||||
@@ -601,7 +610,10 @@ export const display_onoff = {
|
|||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(DISPLAY_EXTERN_HUE);
|
this.setColour(DISPLAY_EXTERN_HUE);
|
||||||
this.appendDummyInput("")
|
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.setOutput(true, Boolean);
|
||||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_INOUT_HIGHLOW);
|
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_INOUT_HIGHLOW);
|
||||||
}
|
}
|
||||||
@@ -648,35 +660,32 @@ export const display_fill = {
|
|||||||
|
|
||||||
export const display_animate = {
|
export const display_animate = {
|
||||||
init: function () {
|
init: function () {
|
||||||
var ANIMATE = [
|
|
||||||
["ALL_CLOCKS", 'ALL_CLOCKS'],
|
|
||||||
["ALL_ARROWS", 'ALL_ARROWS']
|
|
||||||
];
|
|
||||||
this.setColour(DISPLAY_EXTERN_HUE);
|
this.setColour(DISPLAY_EXTERN_HUE);
|
||||||
this.setOutput(true, 'Tuple');
|
this.setOutput(true, 'Tuple');
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.MIXLY_ESP32_DISPLAY_ANIMATE)
|
.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);
|
//this.setTooltip(Blockly.Msg.LOGIC_BOOLEAN_TOOLTIP);
|
||||||
}
|
},
|
||||||
|
ANIMATE: [
|
||||||
|
["ALL_CLOCKS", 'ALL_CLOCKS'],
|
||||||
|
["ALL_ARROWS", 'ALL_ARROWS']
|
||||||
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
export const display_circle = {
|
export const display_circle = {
|
||||||
init: function () {
|
init: function () {
|
||||||
var brightness_or_not = [
|
|
||||||
[Blockly.Msg.MIXLY_4DIGITDISPLAY_ON, '1'],
|
|
||||||
[Blockly.Msg.MIXLY_4DIGITDISPLAY_OFF, '0']
|
|
||||||
];
|
|
||||||
this.setColour(DISPLAY_EXTERN_HUE);
|
this.setColour(DISPLAY_EXTERN_HUE);
|
||||||
this.appendValueInput('VAR')
|
this.appendValueInput('VAR')
|
||||||
.appendField(Blockly.Msg.OLED)
|
.appendField(Blockly.Msg.OLED)
|
||||||
.setCheck("var");
|
.setCheck("var");
|
||||||
this.appendDummyInput("")
|
this.appendDummyInput("")
|
||||||
.appendField(Blockly.Msg.MIXLY_MIXPY_TURTLE_DRAW_CIRCLE)
|
.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({
|
this.jsonInit({
|
||||||
"message0": Blockly.Msg.MIXLY_HANBIT_SHOW_CIRCLE,
|
"message0": Blockly.Msg.MIXLY_HANBIT_SHOW_CIRCLE,
|
||||||
"args0": [{
|
"args0": [
|
||||||
|
{
|
||||||
"check": Number,
|
"check": Number,
|
||||||
"type": "input_value",
|
"type": "input_value",
|
||||||
"name": "x"
|
"name": "x"
|
||||||
@@ -702,7 +711,11 @@ export const display_circle = {
|
|||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
this.setTooltip('');
|
this.setTooltip('');
|
||||||
this.setTooltip(Blockly.Msg.MIXLY_MIXPY_TURTLE_DRAW_CIRCLE);
|
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 = {
|
export const display_triangle = {
|
||||||
@@ -720,7 +733,8 @@ export const display_triangle = {
|
|||||||
.appendField(new Blockly.FieldDropdown(brightness_or_not), 'OP')
|
.appendField(new Blockly.FieldDropdown(brightness_or_not), 'OP')
|
||||||
this.jsonInit({
|
this.jsonInit({
|
||||||
"message0": Blockly.Msg.MIXLY_HANBIT_SHOW_triangle,
|
"message0": Blockly.Msg.MIXLY_HANBIT_SHOW_triangle,
|
||||||
"args0": [{
|
"args0": [
|
||||||
|
{
|
||||||
"check": Number,
|
"check": Number,
|
||||||
"type": "input_value",
|
"type": "input_value",
|
||||||
"name": "x0"
|
"name": "x0"
|
||||||
@@ -861,7 +875,11 @@ export const display_tm1650_power = {
|
|||||||
.appendField(new Blockly.FieldDropdown([["TM1650", "tm1650"]]), "TYPE");
|
.appendField(new Blockly.FieldDropdown([["TM1650", "tm1650"]]), "TYPE");
|
||||||
this.appendValueInput("VAR")
|
this.appendValueInput("VAR")
|
||||||
this.appendDummyInput()
|
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.setInputsInline(true);
|
||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
@@ -1016,7 +1034,6 @@ export const display_color_seclet = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export const tft_show_image_or_string_delay = {
|
export const tft_show_image_or_string_delay = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(DISPLAY_EXTERN_HUE);
|
this.setColour(DISPLAY_EXTERN_HUE);
|
||||||
@@ -1104,8 +1121,6 @@ export const tft_show_frame_string_delay = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const tft_fill = {
|
export const tft_fill = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(DISPLAY_EXTERN_HUE);
|
this.setColour(DISPLAY_EXTERN_HUE);
|
||||||
@@ -1148,7 +1163,8 @@ export const tft_line_arbitrarily = {
|
|||||||
// .appendField(Blockly.Msg.MIXLY_PIN);
|
// .appendField(Blockly.Msg.MIXLY_PIN);
|
||||||
this.jsonInit({
|
this.jsonInit({
|
||||||
"message0": Blockly.Msg.MIXLY_MICROBIT_SHOW_LINE_ARBITRARILY,
|
"message0": Blockly.Msg.MIXLY_MICROBIT_SHOW_LINE_ARBITRARILY,
|
||||||
"args0": [{
|
"args0": [
|
||||||
|
{
|
||||||
"check": Number,
|
"check": Number,
|
||||||
"type": "input_value",
|
"type": "input_value",
|
||||||
"name": "x1"
|
"name": "x1"
|
||||||
@@ -1511,12 +1527,6 @@ export const extern_oled_show_frame_string_delay = {
|
|||||||
|
|
||||||
export const extern_oled_shift = {
|
export const extern_oled_shift = {
|
||||||
init: function () {
|
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.setHelpUrl(Blockly.Msg.MATH_TRIG_HELPURL);
|
||||||
this.setColour(DISPLAY_EXTERN_HUE);
|
this.setColour(DISPLAY_EXTERN_HUE);
|
||||||
this.appendValueInput('SUB')
|
this.appendValueInput('SUB')
|
||||||
@@ -1530,7 +1540,7 @@ export const extern_oled_shift = {
|
|||||||
.appendField(Blockly.Msg.DISPLAY_IMAGE_LET)
|
.appendField(Blockly.Msg.DISPLAY_IMAGE_LET)
|
||||||
this.appendDummyInput('')
|
this.appendDummyInput('')
|
||||||
.appendField(Blockly.Msg.DISPLAY_IMAGE_LET2)
|
.appendField(Blockly.Msg.DISPLAY_IMAGE_LET2)
|
||||||
.appendField(new Blockly.FieldDropdown(OPERATORS), 'OP');
|
.appendField(new Blockly.FieldDropdown(this.OPERATORS), 'OP');
|
||||||
this.appendValueInput('val')
|
this.appendValueInput('val')
|
||||||
.appendField(Blockly.Msg.DISPLAY_IMAGE_SHIFT)
|
.appendField(Blockly.Msg.DISPLAY_IMAGE_SHIFT)
|
||||||
.setCheck(Number);
|
.setCheck(Number);
|
||||||
@@ -1550,7 +1560,13 @@ export const extern_oled_shift = {
|
|||||||
};
|
};
|
||||||
return mode0 + mode1 + TOOLTIPS[mode] + mode2;
|
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 = {
|
export const extern_oled_get_pixel = {
|
||||||
@@ -1595,8 +1611,6 @@ export const extern_oled_bright_point = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const extern_oled_clear = {
|
export const extern_oled_clear = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(DISPLAY_EXTERN_HUE);
|
this.setColour(DISPLAY_EXTERN_HUE);
|
||||||
@@ -1619,7 +1633,6 @@ export const extern_oled_shape_rect = {
|
|||||||
"args0": [
|
"args0": [
|
||||||
{
|
{
|
||||||
"name": "SUB",
|
"name": "SUB",
|
||||||
|
|
||||||
"type": "input_value"
|
"type": "input_value"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -1661,7 +1674,6 @@ export const extern_oled_shape_rect = {
|
|||||||
"type": "input_value",
|
"type": "input_value",
|
||||||
//"check": "Number"
|
//"check": "Number"
|
||||||
}
|
}
|
||||||
|
|
||||||
],
|
],
|
||||||
"inputsInline": true,
|
"inputsInline": true,
|
||||||
"helpUrl": Blockly.Msg.mpython_HELPURL,
|
"helpUrl": Blockly.Msg.mpython_HELPURL,
|
||||||
@@ -1680,7 +1692,6 @@ export const extern_oled_hvline = {
|
|||||||
"args0": [
|
"args0": [
|
||||||
{
|
{
|
||||||
"name": "SUB",
|
"name": "SUB",
|
||||||
|
|
||||||
"type": "input_value"
|
"type": "input_value"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -1717,7 +1728,6 @@ export const extern_oled_hvline = {
|
|||||||
"type": "input_value",
|
"type": "input_value",
|
||||||
//"check": "Number"
|
//"check": "Number"
|
||||||
}
|
}
|
||||||
|
|
||||||
],
|
],
|
||||||
"inputsInline": true,
|
"inputsInline": true,
|
||||||
"helpUrl": Blockly.Msg.mpython_HELPURL,
|
"helpUrl": Blockly.Msg.mpython_HELPURL,
|
||||||
@@ -1736,7 +1746,6 @@ export const extern_oled_line = {
|
|||||||
"args0": [
|
"args0": [
|
||||||
{
|
{
|
||||||
"name": "SUB",
|
"name": "SUB",
|
||||||
|
|
||||||
"type": "input_value"
|
"type": "input_value"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -82,7 +82,6 @@ export const display_scroll_string_delay = {
|
|||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
this.setTooltip(Blockly.Msg.MIXLY_ESP32_SCROLL_IMAGE_OR_STRING_DELAY);
|
this.setTooltip(Blockly.Msg.MIXLY_ESP32_SCROLL_IMAGE_OR_STRING_DELAY);
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -163,13 +162,27 @@ export const display_image_builtins = {
|
|||||||
init: function () {
|
init: function () {
|
||||||
this.jsonInit({
|
this.jsonInit({
|
||||||
"colour": DISPLAY_ONBOARD_HUE,
|
"colour": DISPLAY_ONBOARD_HUE,
|
||||||
"args0": [{
|
"args0": [
|
||||||
|
{
|
||||||
"name": "image",
|
"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"]
|
"options": [
|
||||||
// ,["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"]
|
["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"
|
"type": "field_dropdown"
|
||||||
}],
|
}
|
||||||
|
],
|
||||||
"output": ["esp32_image", "List"],
|
"output": ["esp32_image", "List"],
|
||||||
"helpUrl": "https://microbit-micropython.readthedocs.io/en/latest/image.html#attributes",
|
"helpUrl": "https://microbit-micropython.readthedocs.io/en/latest/image.html#attributes",
|
||||||
"tooltip": Blockly.Msg.MIXLY_MICROBIT_Built_in_image1,
|
"tooltip": Blockly.Msg.MIXLY_MICROBIT_Built_in_image1,
|
||||||
@@ -190,10 +203,6 @@ export const display_image_builtins_all = {
|
|||||||
|
|
||||||
export const image_arithmetic = {
|
export const image_arithmetic = {
|
||||||
init: function () {
|
init: function () {
|
||||||
var OPERATORS = [
|
|
||||||
[Blockly.Msg.MICROBIT_DISPLAY_UNION, 'add'],
|
|
||||||
[Blockly.Msg.MICROBIT_DISPLAY_MINUS, 'sub']
|
|
||||||
];
|
|
||||||
this.setColour(DISPLAY_ONBOARD_HUE);
|
this.setColour(DISPLAY_ONBOARD_HUE);
|
||||||
this.setOutput(true, "esp32_image");
|
this.setOutput(true, "esp32_image");
|
||||||
this.appendValueInput('A')
|
this.appendValueInput('A')
|
||||||
@@ -201,7 +210,7 @@ export const image_arithmetic = {
|
|||||||
.appendField(Blockly.Msg.MICROBIT_DISPLAY_MERGE_SHAPE);
|
.appendField(Blockly.Msg.MICROBIT_DISPLAY_MERGE_SHAPE);
|
||||||
this.appendValueInput('B')
|
this.appendValueInput('B')
|
||||||
// .setCheck(["esp32_image", "List", String])
|
// .setCheck(["esp32_image", "List", String])
|
||||||
.appendField(new Blockly.FieldDropdown(OPERATORS), 'OP');
|
.appendField(new Blockly.FieldDropdown(this.OPERATORS), 'OP');
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
var thisBlock = this;
|
var thisBlock = this;
|
||||||
this.setTooltip(function () {
|
this.setTooltip(function () {
|
||||||
@@ -212,7 +221,11 @@ export const image_arithmetic = {
|
|||||||
};
|
};
|
||||||
return TOOLTIPS[mode];
|
return TOOLTIPS[mode];
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
|
OPERATORS: [
|
||||||
|
[Blockly.Msg.MICROBIT_DISPLAY_UNION, 'add'],
|
||||||
|
[Blockly.Msg.MICROBIT_DISPLAY_MINUS, 'sub']
|
||||||
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
export const image_invert = {
|
export const image_invert = {
|
||||||
@@ -228,12 +241,6 @@ export const image_invert = {
|
|||||||
|
|
||||||
export const display_shift = {
|
export const display_shift = {
|
||||||
init: function () {
|
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.setHelpUrl(Blockly.Msg.MATH_TRIG_HELPURL);
|
||||||
this.setColour(DISPLAY_ONBOARD_HUE);
|
this.setColour(DISPLAY_ONBOARD_HUE);
|
||||||
// this.setOutput(true);
|
// this.setOutput(true);
|
||||||
@@ -244,7 +251,7 @@ export const display_shift = {
|
|||||||
.appendField(Blockly.Msg.DISPLAY_IMAGE_LET)
|
.appendField(Blockly.Msg.DISPLAY_IMAGE_LET)
|
||||||
this.appendDummyInput('')
|
this.appendDummyInput('')
|
||||||
.appendField(Blockly.Msg.DISPLAY_IMAGE_LET2)
|
.appendField(Blockly.Msg.DISPLAY_IMAGE_LET2)
|
||||||
.appendField(new Blockly.FieldDropdown(OPERATORS), 'OP');
|
.appendField(new Blockly.FieldDropdown(this.OPERATORS), 'OP');
|
||||||
this.appendValueInput('val')
|
this.appendValueInput('val')
|
||||||
.appendField(Blockly.Msg.DISPLAY_IMAGE_SHIFT)
|
.appendField(Blockly.Msg.DISPLAY_IMAGE_SHIFT)
|
||||||
.setCheck(Number);
|
.setCheck(Number);
|
||||||
@@ -264,7 +271,13 @@ export const display_shift = {
|
|||||||
};
|
};
|
||||||
return mode0 + mode1 + TOOLTIPS[mode] + mode2;
|
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 = {
|
export const display_get_pixel = {
|
||||||
@@ -339,16 +352,8 @@ export const display_clear = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//mixgo_me onboard_matrix below:
|
//mixgo_me onboard_matrix below:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const mixgome_display_image_create = {
|
export const mixgome_display_image_create = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.appendDummyInput('')
|
this.appendDummyInput('')
|
||||||
@@ -406,28 +411,23 @@ export const mixgo_display_image_create_new = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const mixgome_display_font = {
|
export const mixgome_display_font = {
|
||||||
init: function () {
|
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.setColour(DISPLAY_ONBOARD_HUE);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.OLED_SET_FONT)
|
.appendField(Blockly.Msg.OLED_SET_FONT)
|
||||||
.appendField(new Blockly.FieldDropdown(OPERATORS), 'OP');
|
.appendField(new Blockly.FieldDropdown(this.OPERATORS), 'OP');
|
||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
this.setInputsInline(true);
|
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
|
//mpython
|
||||||
|
|
||||||
export const onboard_oled_show_image = {
|
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 = {
|
export const onboard_oled_show_frame_string_delay = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(DISPLAY_ONBOARD_HUE);
|
this.setColour(DISPLAY_ONBOARD_HUE);
|
||||||
@@ -614,7 +613,6 @@ export const mpython_display_shape_rect = {
|
|||||||
"type": "input_value",
|
"type": "input_value",
|
||||||
//"check": "Number"
|
//"check": "Number"
|
||||||
}
|
}
|
||||||
|
|
||||||
],
|
],
|
||||||
"inputsInline": true,
|
"inputsInline": true,
|
||||||
"helpUrl": Blockly.Msg.mpython_HELPURL,
|
"helpUrl": Blockly.Msg.mpython_HELPURL,
|
||||||
@@ -665,7 +663,6 @@ export const mpython_display_hvline = {
|
|||||||
"type": "input_value",
|
"type": "input_value",
|
||||||
//"check": "Number"
|
//"check": "Number"
|
||||||
}
|
}
|
||||||
|
|
||||||
],
|
],
|
||||||
"inputsInline": true,
|
"inputsInline": true,
|
||||||
"helpUrl": Blockly.Msg.mpython_HELPURL,
|
"helpUrl": Blockly.Msg.mpython_HELPURL,
|
||||||
@@ -709,7 +706,6 @@ export const mpython_display_line = {
|
|||||||
"type": "input_value",
|
"type": "input_value",
|
||||||
//"check": "Number"
|
//"check": "Number"
|
||||||
}
|
}
|
||||||
|
|
||||||
],
|
],
|
||||||
"inputsInline": true,
|
"inputsInline": true,
|
||||||
"helpUrl": Blockly.Msg.mpython_HELPURL,
|
"helpUrl": Blockly.Msg.mpython_HELPURL,
|
||||||
@@ -832,8 +828,6 @@ export const mpython_pbm_image = {
|
|||||||
|
|
||||||
//mixbot onboard_matrix below:
|
//mixbot onboard_matrix below:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const mixbot_display_image_create = {
|
export const mixbot_display_image_create = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.appendDummyInput('')
|
this.appendDummyInput('')
|
||||||
@@ -889,21 +883,20 @@ export const mixbot_display_bright_screen = {
|
|||||||
|
|
||||||
export const mixbot_display_rotate = {
|
export const mixbot_display_rotate = {
|
||||||
init: function () {
|
init: function () {
|
||||||
var OPERATORS = [
|
this.setColour(DISPLAY_ONBOARD_HUE);
|
||||||
|
this.appendDummyInput()
|
||||||
|
.appendField(Blockly.Msg.MIXLY_MIXBOT_SCREEN_ROTATE)
|
||||||
|
.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.mixpy_PL_PIE_SHADOW_N, '0'],
|
||||||
[Blockly.Msg.CLOCKWISE + '90' + Blockly.Msg.blockpy_setheading_degree, '1'],
|
[Blockly.Msg.CLOCKWISE + '90' + Blockly.Msg.blockpy_setheading_degree, '1'],
|
||||||
[Blockly.Msg.CLOCKWISE + '180' + Blockly.Msg.blockpy_setheading_degree, '2'],
|
[Blockly.Msg.CLOCKWISE + '180' + Blockly.Msg.blockpy_setheading_degree, '2'],
|
||||||
[Blockly.Msg.CLOCKWISE + '270' + Blockly.Msg.blockpy_setheading_degree, '3']
|
[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');
|
|
||||||
this.setPreviousStatement(true, null);
|
|
||||||
this.setNextStatement(true, null);
|
|
||||||
this.setInputsInline(true);
|
|
||||||
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const bitbot_display_image_create = {
|
export const bitbot_display_image_create = {
|
||||||
@@ -1042,7 +1035,6 @@ export const onboard_tft_display_shape_rect = {
|
|||||||
"type": "input_value",
|
"type": "input_value",
|
||||||
//"check": "Number"
|
//"check": "Number"
|
||||||
}
|
}
|
||||||
|
|
||||||
],
|
],
|
||||||
"inputsInline": true,
|
"inputsInline": true,
|
||||||
"helpUrl": Blockly.Msg.mpython_HELPURL,
|
"helpUrl": Blockly.Msg.mpython_HELPURL,
|
||||||
@@ -1090,7 +1082,6 @@ export const onboard_tft_display_hvline = {
|
|||||||
"type": "input_value",
|
"type": "input_value",
|
||||||
//"check": "Number"
|
//"check": "Number"
|
||||||
}
|
}
|
||||||
|
|
||||||
],
|
],
|
||||||
"inputsInline": true,
|
"inputsInline": true,
|
||||||
"helpUrl": Blockly.Msg.mpython_HELPURL,
|
"helpUrl": Blockly.Msg.mpython_HELPURL,
|
||||||
@@ -1134,7 +1125,6 @@ export const onboard_tft_display_line = {
|
|||||||
"type": "input_value",
|
"type": "input_value",
|
||||||
//"check": "Number"
|
//"check": "Number"
|
||||||
}
|
}
|
||||||
|
|
||||||
],
|
],
|
||||||
"inputsInline": true,
|
"inputsInline": true,
|
||||||
"helpUrl": Blockly.Msg.mpython_HELPURL,
|
"helpUrl": Blockly.Msg.mpython_HELPURL,
|
||||||
@@ -1314,7 +1304,6 @@ export const onboard_tft_display_shape_circle = {
|
|||||||
"type": "input_value",
|
"type": "input_value",
|
||||||
//"check": "Number"
|
//"check": "Number"
|
||||||
}
|
}
|
||||||
|
|
||||||
],
|
],
|
||||||
"inputsInline": true,
|
"inputsInline": true,
|
||||||
"helpUrl": Blockly.Msg.mpython_HELPURL,
|
"helpUrl": Blockly.Msg.mpython_HELPURL,
|
||||||
|
|||||||
@@ -188,8 +188,7 @@ export const factory_declare = {
|
|||||||
this.setPreviousStatement(true);
|
this.setPreviousStatement(true);
|
||||||
this.setNextStatement(true);
|
this.setNextStatement(true);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
export const factory_callMethod_noreturn = {
|
export const factory_callMethod_noreturn = {
|
||||||
init: function () {
|
init: function () {
|
||||||
|
|||||||
@@ -149,7 +149,6 @@ export const inout_analog_atten = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export const inout_pin_pressed = {
|
export const inout_pin_pressed = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(BASE_HUE);
|
this.setColour(BASE_HUE);
|
||||||
@@ -174,7 +173,11 @@ export const inout_pin_attachInterrupt = {
|
|||||||
.setCheck(Number);
|
.setCheck(Number);
|
||||||
this.appendDummyInput("")
|
this.appendDummyInput("")
|
||||||
.appendField(Blockly.Msg.MIXLY_MODE)
|
.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')
|
this.appendValueInput('DO')
|
||||||
.appendField(Blockly.Msg.MIXLY_DO)
|
.appendField(Blockly.Msg.MIXLY_DO)
|
||||||
this.setPreviousStatement(true);
|
this.setPreviousStatement(true);
|
||||||
|
|||||||
@@ -264,7 +264,6 @@ export const iot_publish_container = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export const iot_publish_item = {
|
export const iot_publish_item = {
|
||||||
/**
|
/**
|
||||||
* Mutator bolck for adding items.
|
* Mutator bolck for adding items.
|
||||||
@@ -297,7 +296,6 @@ export const iot_create_with_item = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export const iot_mixio_connect = {
|
export const iot_mixio_connect = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(IOT_HUE);
|
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 = {
|
export const IOT_EMQX_INIT_AND_CONNECT_BY_MIXLY_CODE = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(IOT_HUE);
|
this.setColour(IOT_HUE);
|
||||||
@@ -507,7 +504,6 @@ export const IOT_EMQX_INIT_AND_CONNECT_BY_MIXLY_CODE = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export const iot_mixly_key = {
|
export const iot_mixly_key = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.VISITOR_ID = Mixly.Config.BOARD.visitorId.str32.substring(0, 8).toUpperCase();
|
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.setPreviousStatement(true);
|
||||||
this.setNextStatement(true);
|
this.setNextStatement(true);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
@@ -22,7 +22,6 @@ export const network_init = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export const network_open = {
|
export const network_open = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(NETWORK_HUE);
|
this.setColour(NETWORK_HUE);
|
||||||
@@ -395,10 +394,8 @@ export const requests_get = {
|
|||||||
.appendField(Blockly.Msg.DISPLAY_IMAGE_LET2)
|
.appendField(Blockly.Msg.DISPLAY_IMAGE_LET2)
|
||||||
.setCheck(String);
|
.setCheck(String);
|
||||||
this.appendDummyInput("")
|
this.appendDummyInput("")
|
||||||
|
|
||||||
.appendField(Blockly.Msg.blockpy_REQUESTS_GET)
|
.appendField(Blockly.Msg.blockpy_REQUESTS_GET)
|
||||||
.appendField(new Blockly.FieldTextInput('response'), 'VAR')
|
.appendField(new Blockly.FieldTextInput('response'), 'VAR')
|
||||||
|
|
||||||
this.setPreviousStatement(true);
|
this.setPreviousStatement(true);
|
||||||
this.setNextStatement(true);
|
this.setNextStatement(true);
|
||||||
this.setTooltip(Blockly.Msg.blockpy_REQUESTS_GET_TOOLTIP);
|
this.setTooltip(Blockly.Msg.blockpy_REQUESTS_GET_TOOLTIP);
|
||||||
@@ -411,23 +408,15 @@ export const requests_get = {
|
|||||||
this.setTitleValue(newName, 'VAR');
|
this.setTitleValue(newName, 'VAR');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export const requests_attribute = {
|
export const requests_attribute = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.appendValueInput('VAL')
|
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.setColour(NETWORK_HUE);
|
||||||
this.appendDummyInput("")
|
this.appendDummyInput("")
|
||||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_JS_GET)
|
.appendField(Blockly.Msg.MIXLY_MICROBIT_JS_GET)
|
||||||
.appendField(new Blockly.FieldDropdown(attr), 'ATTR')
|
.appendField(new Blockly.FieldDropdown(this.ATTR), 'ATTR')
|
||||||
|
|
||||||
|
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
this.setOutput(true, String);
|
this.setOutput(true, String);
|
||||||
var thisBlock = this;
|
var thisBlock = this;
|
||||||
@@ -440,29 +429,26 @@ export const requests_attribute = {
|
|||||||
};
|
};
|
||||||
return TOOLTIPS[mode];
|
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 = {
|
export const requests_method = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.appendValueInput("VAR")
|
this.appendValueInput("VAR")
|
||||||
.appendField(Blockly.Msg.DISPLAY_IMAGE_LET2)
|
.appendField(Blockly.Msg.DISPLAY_IMAGE_LET2)
|
||||||
.setCheck(String);
|
.setCheck(String);
|
||||||
var method = [
|
|
||||||
['post', 'post'], ['put', 'put'],
|
|
||||||
['delete', 'delete'], ['head', 'head'],
|
|
||||||
['option', 'option']
|
|
||||||
];
|
|
||||||
this.setColour(NETWORK_HUE);
|
this.setColour(NETWORK_HUE);
|
||||||
this.appendDummyInput("")
|
this.appendDummyInput("")
|
||||||
.appendField(Blockly.Msg.blockpy_CONDUCT)
|
.appendField(Blockly.Msg.blockpy_CONDUCT)
|
||||||
.appendField(new Blockly.FieldDropdown(method), 'DIR')
|
.appendField(new Blockly.FieldDropdown(this.METHOD), 'DIR')
|
||||||
this.appendDummyInput("")
|
this.appendDummyInput("")
|
||||||
.appendField(Blockly.Msg.blockpy_REQUESTS)
|
.appendField(Blockly.Msg.blockpy_REQUESTS)
|
||||||
|
|
||||||
|
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
this.setPreviousStatement(true);
|
this.setPreviousStatement(true);
|
||||||
this.setNextStatement(true);
|
this.setNextStatement(true);
|
||||||
@@ -475,7 +461,12 @@ export const requests_method = {
|
|||||||
};
|
};
|
||||||
return TOOLTIPS[mode];
|
return TOOLTIPS[mode];
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
|
METHOD: [
|
||||||
|
['post', 'post'], ['put', 'put'],
|
||||||
|
['delete', 'delete'], ['head', 'head'],
|
||||||
|
['option', 'option']
|
||||||
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ntptime_time = {
|
export const ntptime_time = {
|
||||||
@@ -523,7 +514,11 @@ export const requests_get2 = {
|
|||||||
.setCheck(String);
|
.setCheck(String);
|
||||||
this.appendDummyInput("")
|
this.appendDummyInput("")
|
||||||
.appendField(Blockly.Msg.blockpy_CONDUCT)
|
.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.blockpy_REQUESTS)
|
||||||
.appendField(Blockly.Msg.MIXPY_REQUESTS_GET_RESULT)
|
.appendField(Blockly.Msg.MIXPY_REQUESTS_GET_RESULT)
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
@@ -540,7 +535,11 @@ export const requests_post = {
|
|||||||
.setCheck(String);
|
.setCheck(String);
|
||||||
this.appendDummyInput("")
|
this.appendDummyInput("")
|
||||||
.appendField(Blockly.Msg.blockpy_CONDUCT)
|
.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)
|
.appendField(Blockly.Msg.blockpy_REQUESTS)
|
||||||
this.appendValueInput("data")
|
this.appendValueInput("data")
|
||||||
.appendField(Blockly.Msg.blockpy_REQUESTS + Blockly.Msg.OLED_STRING)
|
.appendField(Blockly.Msg.blockpy_REQUESTS + Blockly.Msg.OLED_STRING)
|
||||||
@@ -555,21 +554,20 @@ export const requests_post = {
|
|||||||
export const requests_attribute2 = {
|
export const requests_attribute2 = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.appendValueInput('VAL')
|
this.appendValueInput('VAL')
|
||||||
|
this.setColour(COMMUNICATE_HUE);
|
||||||
var attr = [
|
this.appendDummyInput("")
|
||||||
|
.appendField(Blockly.Msg.MIXLY_MICROBIT_JS_GET)
|
||||||
|
.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_TEXT, 'text'],
|
||||||
[Blockly.Msg.blockpy_REQUESTS_GET_ATTR_JSON, 'json()'],
|
[Blockly.Msg.blockpy_REQUESTS_GET_ATTR_JSON, 'json()'],
|
||||||
[Blockly.Msg.blockpy_REQUESTS_GET_ATTR_STATUS_CODE, 'status_code'],
|
[Blockly.Msg.blockpy_REQUESTS_GET_ATTR_STATUS_CODE, 'status_code'],
|
||||||
[Blockly.Msg.blockpy_REQUESTS_GET_ATTR_CONTENT, 'content'],
|
[Blockly.Msg.blockpy_REQUESTS_GET_ATTR_CONTENT, 'content'],
|
||||||
[Blockly.Msg.MIXPY_TEXT_ENCODE, 'encoding']
|
[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')
|
|
||||||
this.setInputsInline(true);
|
|
||||||
this.setOutput(true, String);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//educore_networke
|
//educore_networke
|
||||||
@@ -596,8 +594,6 @@ export const educore_wifi_connect = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const educore_mqtt_connect = {
|
export const educore_mqtt_connect = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(COMMUNICATE_HUE);
|
this.setColour(COMMUNICATE_HUE);
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ const NOVAG1_HUE = 100;
|
|||||||
|
|
||||||
export const get_potential_num = {
|
export const get_potential_num = {
|
||||||
init: function () {
|
init: function () {
|
||||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2];
|
||||||
if (version == "mixgo_nova") { var name = 'Nova G1' }
|
if (version == "mixgo_nova") { var name = 'Nova G1' }
|
||||||
this.setColour(NOVAG1_HUE);
|
this.setColour(NOVAG1_HUE);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
@@ -14,11 +14,11 @@ export const get_potential_num = {
|
|||||||
this.setOutput(true, Number);
|
this.setOutput(true, Number);
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
export const nova_g1_motor = {
|
export const nova_g1_motor = {
|
||||||
init: function () {
|
init: function () {
|
||||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2];
|
||||||
if (version == "mixgo_nova") { var name = 'Nova G1' }
|
if (version == "mixgo_nova") { var name = 'Nova G1' }
|
||||||
this.setColour(NOVAG1_HUE);
|
this.setColour(NOVAG1_HUE);
|
||||||
this.appendValueInput('PIN')
|
this.appendValueInput('PIN')
|
||||||
@@ -43,11 +43,11 @@ export const nova_g1_motor = {
|
|||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
export const nova_g1_usb = {
|
export const nova_g1_usb = {
|
||||||
init: function () {
|
init: function () {
|
||||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2];
|
||||||
if (version == "mixgo_nova") { var name = 'Nova G1' }
|
if (version == "mixgo_nova") { var name = 'Nova G1' }
|
||||||
this.setColour(NOVAG1_HUE);
|
this.setColour(NOVAG1_HUE);
|
||||||
this.appendValueInput('PIN')
|
this.appendValueInput('PIN')
|
||||||
@@ -63,11 +63,11 @@ export const nova_g1_usb = {
|
|||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
export const nova_g1_spk_en = {
|
export const nova_g1_spk_en = {
|
||||||
init: function () {
|
init: function () {
|
||||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2];
|
||||||
if (version == "mixgo_nova") { var name = 'Nova G1' }
|
if (version == "mixgo_nova") { var name = 'Nova G1' }
|
||||||
this.setColour(NOVAG1_HUE);
|
this.setColour(NOVAG1_HUE);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
@@ -81,4 +81,4 @@ export const nova_g1_spk_en = {
|
|||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
@@ -5,7 +5,7 @@ const PEG1_HUE = 100;
|
|||||||
|
|
||||||
export const pe_g1_use_i2c_init = {
|
export const pe_g1_use_i2c_init = {
|
||||||
init: function () {
|
init: function () {
|
||||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2];
|
||||||
if (version == "mixgo_ce") { var name = 'CE G6' }
|
if (version == "mixgo_ce") { var name = 'CE G6' }
|
||||||
else if (version == "mixgo_pe") { var name = 'PE G1' }
|
else if (version == "mixgo_pe") { var name = 'PE G1' }
|
||||||
this.setColour(PEG1_HUE);
|
this.setColour(PEG1_HUE);
|
||||||
@@ -26,7 +26,7 @@ export const pe_g1_use_i2c_init = {
|
|||||||
|
|
||||||
export const pe_g1_battery_left = {
|
export const pe_g1_battery_left = {
|
||||||
init: function () {
|
init: function () {
|
||||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2];
|
||||||
if (version == "mixgo_ce") { var name = 'CE G6' }
|
if (version == "mixgo_ce") { var name = 'CE G6' }
|
||||||
else if (version == "mixgo_pe") { var name = 'PE G1' }
|
else if (version == "mixgo_pe") { var name = 'PE G1' }
|
||||||
this.setColour(PEG1_HUE);
|
this.setColour(PEG1_HUE);
|
||||||
@@ -42,7 +42,7 @@ export const pe_g1_battery_left = {
|
|||||||
|
|
||||||
export const pe_g1_dc_motor = {
|
export const pe_g1_dc_motor = {
|
||||||
init: function () {
|
init: function () {
|
||||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2];
|
||||||
if (version == "mixgo_ce") { var name = 'CE G6' }
|
if (version == "mixgo_ce") { var name = 'CE G6' }
|
||||||
else if (version == "mixgo_pe") { var name = 'PE G1' }
|
else if (version == "mixgo_pe") { var name = 'PE G1' }
|
||||||
this.setColour(PEG1_HUE);
|
this.setColour(PEG1_HUE);
|
||||||
@@ -70,11 +70,11 @@ export const pe_g1_dc_motor = {
|
|||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
export const pe_g1_dc_motor_speed = {
|
export const pe_g1_dc_motor_speed = {
|
||||||
init: function () {
|
init: function () {
|
||||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2];
|
||||||
if (version == "mixgo_ce") { var name = 'CE G6' }
|
if (version == "mixgo_ce") { var name = 'CE G6' }
|
||||||
else if (version == "mixgo_pe") { var name = 'PE G1' }
|
else if (version == "mixgo_pe") { var name = 'PE G1' }
|
||||||
this.setColour(PEG1_HUE);
|
this.setColour(PEG1_HUE);
|
||||||
@@ -90,11 +90,11 @@ export const pe_g1_dc_motor_speed = {
|
|||||||
this.setOutput(true, Number);
|
this.setOutput(true, Number);
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
export const pe_g1_servo_set_angle = {
|
export const pe_g1_servo_set_angle = {
|
||||||
init: function () {
|
init: function () {
|
||||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2];
|
||||||
if (version == "mixgo_ce") { var name = 'CE G6' }
|
if (version == "mixgo_ce") { var name = 'CE G6' }
|
||||||
else if (version == "mixgo_pe") { var name = 'PE G1' }
|
else if (version == "mixgo_pe") { var name = 'PE G1' }
|
||||||
this.setColour(PEG1_HUE);
|
this.setColour(PEG1_HUE);
|
||||||
@@ -118,7 +118,7 @@ export const pe_g1_servo_set_angle = {
|
|||||||
|
|
||||||
export const pe_g1_servo_set_speed = {
|
export const pe_g1_servo_set_speed = {
|
||||||
init: function () {
|
init: function () {
|
||||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2];
|
||||||
if (version == "mixgo_ce") { var name = 'CE G6' }
|
if (version == "mixgo_ce") { var name = 'CE G6' }
|
||||||
else if (version == "mixgo_pe") { var name = 'PE G1' }
|
else if (version == "mixgo_pe") { var name = 'PE G1' }
|
||||||
this.setColour(PEG1_HUE);
|
this.setColour(PEG1_HUE);
|
||||||
@@ -144,7 +144,7 @@ export const pe_g1_servo_set_speed = {
|
|||||||
|
|
||||||
export const pe_g1_servo_get_angle = {
|
export const pe_g1_servo_get_angle = {
|
||||||
init: function () {
|
init: function () {
|
||||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2];
|
||||||
if (version == "mixgo_ce") { var name = 'CE G6' }
|
if (version == "mixgo_ce") { var name = 'CE G6' }
|
||||||
else if (version == "mixgo_pe") { var name = 'PE G1' }
|
else if (version == "mixgo_pe") { var name = 'PE G1' }
|
||||||
this.setColour(PEG1_HUE);
|
this.setColour(PEG1_HUE);
|
||||||
@@ -163,7 +163,7 @@ export const pe_g1_servo_get_angle = {
|
|||||||
|
|
||||||
export const pe_g1_servo_get_speed = {
|
export const pe_g1_servo_get_speed = {
|
||||||
init: function () {
|
init: function () {
|
||||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2];
|
||||||
if (version == "mixgo_ce") { var name = 'CE G6' }
|
if (version == "mixgo_ce") { var name = 'CE G6' }
|
||||||
else if (version == "mixgo_pe") { var name = 'PE G1' }
|
else if (version == "mixgo_pe") { var name = 'PE G1' }
|
||||||
this.setColour(PEG1_HUE);
|
this.setColour(PEG1_HUE);
|
||||||
@@ -173,7 +173,6 @@ export const pe_g1_servo_get_speed = {
|
|||||||
this.appendValueInput('PIN')
|
this.appendValueInput('PIN')
|
||||||
.appendField('360°' + Blockly.Msg.MIXLY_SERVO)
|
.appendField('360°' + Blockly.Msg.MIXLY_SERVO)
|
||||||
.appendField(Blockly.Msg.LCD_NUMBERING)
|
.appendField(Blockly.Msg.LCD_NUMBERING)
|
||||||
|
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.MIXLY_GET + Blockly.Msg.MIXLY_SPEED);
|
.appendField(Blockly.Msg.MIXLY_GET + Blockly.Msg.MIXLY_SPEED);
|
||||||
this.setOutput(true, Number);
|
this.setOutput(true, Number);
|
||||||
|
|||||||
@@ -103,7 +103,6 @@ export const i2c_B_pin = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export const spi_A_pin = {
|
export const spi_A_pin = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(PINS_HUE);
|
this.setColour(PINS_HUE);
|
||||||
|
|||||||
@@ -57,7 +57,11 @@ export const sensor_mixgo_button_attachInterrupt = {
|
|||||||
.setCheck(Number);
|
.setCheck(Number);
|
||||||
this.appendDummyInput("")
|
this.appendDummyInput("")
|
||||||
.appendField(Blockly.Msg.MIXLY_MODE)
|
.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')
|
this.appendValueInput('DO')
|
||||||
.appendField(Blockly.Msg.MIXLY_DO)
|
.appendField(Blockly.Msg.MIXLY_DO)
|
||||||
this.setPreviousStatement(true);
|
this.setPreviousStatement(true);
|
||||||
@@ -66,7 +70,6 @@ export const sensor_mixgo_button_attachInterrupt = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export const sensor_mixgo_extern_button_is_pressed = {
|
export const sensor_mixgo_extern_button_is_pressed = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(SENSOR_HUE);
|
this.setColour(SENSOR_HUE);
|
||||||
@@ -128,7 +131,11 @@ export const sensor_mixgo_extern_button_attachInterrupt = {
|
|||||||
.setCheck(Number);
|
.setCheck(Number);
|
||||||
this.appendDummyInput("")
|
this.appendDummyInput("")
|
||||||
.appendField(Blockly.Msg.MIXLY_MODE)
|
.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')
|
this.appendValueInput('DO')
|
||||||
.appendField(Blockly.Msg.MIXLY_DO)
|
.appendField(Blockly.Msg.MIXLY_DO)
|
||||||
this.setPreviousStatement(true);
|
this.setPreviousStatement(true);
|
||||||
@@ -145,7 +152,19 @@ export const sensor_mpu9250_attachGestureInterrupt = {
|
|||||||
.setCheck("var");
|
.setCheck("var");
|
||||||
this.appendDummyInput("")
|
this.appendDummyInput("")
|
||||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_JS_CURRENT_GESTURE)
|
.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')
|
this.appendStatementInput('DO')
|
||||||
.appendField(Blockly.Msg.MIXLY_DO);
|
.appendField(Blockly.Msg.MIXLY_DO);
|
||||||
this.setPreviousStatement(true);
|
this.setPreviousStatement(true);
|
||||||
@@ -183,7 +202,15 @@ export const sensor_mpu9250_gesture = {
|
|||||||
.setCheck("var");
|
.setCheck("var");
|
||||||
this.appendDummyInput("")
|
this.appendDummyInput("")
|
||||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_JS_CURRENT_GESTURE)
|
.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.setOutput(true);
|
||||||
var thisBlock = this;
|
var thisBlock = this;
|
||||||
this.setTooltip(function () {
|
this.setTooltip(function () {
|
||||||
@@ -244,7 +271,6 @@ export const sensor_mpu9250_get_acceleration = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export const sensor_adxl345_get_acceleration = {
|
export const sensor_adxl345_get_acceleration = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(SENSOR_HUE);
|
this.setColour(SENSOR_HUE);
|
||||||
@@ -279,7 +305,6 @@ export const sensor_adxl345_get_acceleration = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export const sensor_light_level = {
|
export const sensor_light_level = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(SENSOR_HUE);
|
this.setColour(SENSOR_HUE);
|
||||||
@@ -305,6 +330,7 @@ export const sensor_mpu9250_calibrate_compass = {
|
|||||||
this.setTooltip(Blockly.Msg.MIXLY_MICROBIT_JS_CALIBRATE_COMPASS);
|
this.setTooltip(Blockly.Msg.MIXLY_MICROBIT_JS_CALIBRATE_COMPASS);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// export const sensor_mpu9250_is_compass_calibrated = {
|
// export const sensor_mpu9250_is_compass_calibrated = {
|
||||||
// init: function(){
|
// init: function(){
|
||||||
// this.setColour(SENSOR_HUE);
|
// this.setColour(SENSOR_HUE);
|
||||||
@@ -352,7 +378,10 @@ export const sensor_mpu9250_field_strength = {
|
|||||||
.setCheck("var");
|
.setCheck("var");
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_JS_GET_COMPASS)
|
.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.setOutput(true, Number);
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
var thisBlock = this;
|
var thisBlock = this;
|
||||||
@@ -500,16 +529,17 @@ export const HCSR04 = {
|
|||||||
|
|
||||||
export const sensor_dht11 = {
|
export const sensor_dht11 = {
|
||||||
init: function () {
|
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.setColour(SENSOR_HUE);
|
||||||
this.appendValueInput("PIN", Number)
|
this.appendValueInput("PIN", Number)
|
||||||
.appendField(new Blockly.FieldDropdown([['DHT11', 'dht11']
|
.appendField(new Blockly.FieldDropdown([
|
||||||
, ['DHT22', 'dht22']//, ['DHT21', '21'], ['DHT33', '33'], ['DHT44', '44']
|
['DHT11', 'dht11'],
|
||||||
|
['DHT22', 'dht22']
|
||||||
|
//, ['DHT21', '21'], ['DHT33', '33'], ['DHT44', '44']
|
||||||
]), 'TYPE')
|
]), 'TYPE')
|
||||||
.appendField(Blockly.Msg.MIXLY_PIN)
|
.appendField(Blockly.Msg.MIXLY_PIN)
|
||||||
.setCheck(Number);
|
.setCheck(Number);
|
||||||
this.appendDummyInput("")
|
this.appendDummyInput("")
|
||||||
.appendField(new Blockly.FieldDropdown(WHAT), "WHAT");
|
.appendField(new Blockly.FieldDropdown(this.METHOD), "WHAT");
|
||||||
this.setOutput(true, Number);
|
this.setOutput(true, Number);
|
||||||
var thisBlock = this;
|
var thisBlock = this;
|
||||||
this.setTooltip(function () {
|
this.setTooltip(function () {
|
||||||
@@ -521,7 +551,12 @@ export const sensor_dht11 = {
|
|||||||
};
|
};
|
||||||
return TOOLTIPS[op];
|
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 () {
|
init: function () {
|
||||||
this.setColour(SENSOR_HUE);
|
this.setColour(SENSOR_HUE);
|
||||||
this.appendDummyInput("")
|
this.appendDummyInput("")
|
||||||
.appendField(new Blockly.FieldDropdown([["1", "touch1"], ["2", "touch2"]]), 'op')
|
.appendField(new Blockly.FieldDropdown([
|
||||||
|
["1", "touch1"],
|
||||||
|
["2", "touch2"]
|
||||||
|
]), 'op')
|
||||||
this.setOutput(true);
|
this.setOutput(true);
|
||||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_INOUT_HIGHLOW);
|
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 = {
|
export const sensor_mixgo_pin_near = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(SENSOR_HUE);
|
this.setColour(SENSOR_HUE);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_PY_STORAGE_GET)
|
.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);
|
.appendField(Blockly.Msg.MIXLY_ESP32_NEAR);
|
||||||
this.setOutput(true, Number);
|
this.setOutput(true, Number);
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
|
|||||||
@@ -65,7 +65,11 @@ export const sensor_mixgo_extern_button_attachInterrupt = {
|
|||||||
.setCheck(Number);
|
.setCheck(Number);
|
||||||
this.appendDummyInput("")
|
this.appendDummyInput("")
|
||||||
.appendField(Blockly.Msg.MIXLY_MODE)
|
.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')
|
this.appendValueInput('DO')
|
||||||
.appendField(Blockly.Msg.MIXLY_DO)
|
.appendField(Blockly.Msg.MIXLY_DO)
|
||||||
this.setPreviousStatement(true);
|
this.setPreviousStatement(true);
|
||||||
@@ -74,7 +78,6 @@ export const sensor_mixgo_extern_button_attachInterrupt = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export const sensor_mpu9250_attachGestureInterrupt = {
|
export const sensor_mpu9250_attachGestureInterrupt = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(SENSOR_EXTERN_HUE);
|
this.setColour(SENSOR_EXTERN_HUE);
|
||||||
@@ -83,7 +86,17 @@ export const sensor_mpu9250_attachGestureInterrupt = {
|
|||||||
.setCheck("var");
|
.setCheck("var");
|
||||||
this.appendDummyInput("")
|
this.appendDummyInput("")
|
||||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_JS_CURRENT_GESTURE)
|
.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')
|
this.appendStatementInput('DO')
|
||||||
.appendField(Blockly.Msg.MIXLY_DO);
|
.appendField(Blockly.Msg.MIXLY_DO);
|
||||||
this.setPreviousStatement(true);
|
this.setPreviousStatement(true);
|
||||||
@@ -113,7 +126,6 @@ export const sensor_mpu9250_attachGestureInterrupt = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export const sensor_adxl345_get_acceleration = {
|
export const sensor_adxl345_get_acceleration = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(SENSOR_EXTERN_HUE);
|
this.setColour(SENSOR_EXTERN_HUE);
|
||||||
@@ -148,8 +160,6 @@ export const sensor_adxl345_get_acceleration = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const sensor_light_level = {
|
export const sensor_light_level = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(SENSOR_EXTERN_HUE);
|
this.setColour(SENSOR_EXTERN_HUE);
|
||||||
@@ -161,20 +171,18 @@ export const sensor_light_level = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const sensor_dht11 = {
|
export const sensor_dht11 = {
|
||||||
init: function () {
|
init: function () {
|
||||||
var WHAT = [[Blockly.Msg.MIXLY_GETTEMPERATUE, 'temperature'], [Blockly.Msg.MIXLY_GETHUMIDITY, 'humidity']];
|
|
||||||
this.setColour(SENSOR_EXTERN_HUE);
|
this.setColour(SENSOR_EXTERN_HUE);
|
||||||
this.appendValueInput("PIN", Number)
|
this.appendValueInput("PIN", Number)
|
||||||
.appendField(new Blockly.FieldDropdown([['DHT11', 'DHT11']
|
.appendField(new Blockly.FieldDropdown([
|
||||||
, ['DHT22', 'DHT22']//, ['DHT21', '21'], ['DHT33', '33'], ['DHT44', '44']
|
['DHT11', 'DHT11'],
|
||||||
|
['DHT22', 'DHT22']//, ['DHT21', '21'], ['DHT33', '33'], ['DHT44', '44']
|
||||||
]), 'TYPE')
|
]), 'TYPE')
|
||||||
.appendField(Blockly.Msg.MIXLY_PIN)
|
.appendField(Blockly.Msg.MIXLY_PIN)
|
||||||
.setCheck(Number);
|
.setCheck(Number);
|
||||||
this.appendDummyInput("")
|
this.appendDummyInput("")
|
||||||
.appendField(new Blockly.FieldDropdown(WHAT), "WHAT");
|
.appendField(new Blockly.FieldDropdown(this.METHOD), "WHAT");
|
||||||
this.setOutput(true, Number);
|
this.setOutput(true, Number);
|
||||||
var thisBlock = this;
|
var thisBlock = this;
|
||||||
this.setTooltip(function () {
|
this.setTooltip(function () {
|
||||||
@@ -186,10 +194,13 @@ export const sensor_dht11 = {
|
|||||||
};
|
};
|
||||||
return TOOLTIPS[op];
|
return TOOLTIPS[op];
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
|
METHOD: [
|
||||||
|
[Blockly.Msg.MIXLY_GETTEMPERATUE, 'temperature'],
|
||||||
|
[Blockly.Msg.MIXLY_GETHUMIDITY, 'humidity']
|
||||||
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export const sensor_mixgo_extern_light = {
|
export const sensor_mixgo_extern_light = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(SENSOR_EXTERN_HUE);
|
this.setColour(SENSOR_EXTERN_HUE);
|
||||||
@@ -222,14 +233,15 @@ export const sensor_mixgo_extern_sound = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const sensor_mixgo_extern_pin_near = {
|
export const sensor_mixgo_extern_pin_near = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(SENSOR_EXTERN_HUE);
|
this.setColour(SENSOR_EXTERN_HUE);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_PY_STORAGE_GET)
|
.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);
|
.appendField(Blockly.Msg.MIXLY_ESP32_NEAR);
|
||||||
this.setOutput(true, Number);
|
this.setOutput(true, Number);
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
@@ -327,7 +339,6 @@ export const sensor_lm35 = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//pe
|
//pe
|
||||||
export const sensor_use_i2c_init = {
|
export const sensor_use_i2c_init = {
|
||||||
init: function () {
|
init: function () {
|
||||||
@@ -637,7 +648,7 @@ export const CI130X_BROADCAST = {
|
|||||||
this.setNextStatement(true);
|
this.setNextStatement(true);
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
export const CI130X_SET_SYSTEM_CMD = {
|
export const CI130X_SET_SYSTEM_CMD = {
|
||||||
init: function () {
|
init: function () {
|
||||||
@@ -910,7 +921,15 @@ export const sensor_mpu9250_gesture = {
|
|||||||
.setCheck("var");
|
.setCheck("var");
|
||||||
this.appendDummyInput("")
|
this.appendDummyInput("")
|
||||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_JS_CURRENT_GESTURE)
|
.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.setOutput(true);
|
||||||
var thisBlock = this;
|
var thisBlock = this;
|
||||||
this.setTooltip(function () {
|
this.setTooltip(function () {
|
||||||
@@ -1052,7 +1071,6 @@ export const sensor_mpu9250_calibrate_compass = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export const sensor_mpu9250_temperature = {
|
export const sensor_mpu9250_temperature = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(SENSOR_EXTERN_HUE);
|
this.setColour(SENSOR_EXTERN_HUE);
|
||||||
@@ -1068,7 +1086,6 @@ export const sensor_mpu9250_temperature = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export const sensor_mpu9250_field_strength = {
|
export const sensor_mpu9250_field_strength = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(SENSOR_EXTERN_HUE);
|
this.setColour(SENSOR_EXTERN_HUE);
|
||||||
@@ -1077,7 +1094,10 @@ export const sensor_mpu9250_field_strength = {
|
|||||||
.setCheck("var");
|
.setCheck("var");
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_JS_GET_COMPASS)
|
.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.setOutput(true, Number);
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
var thisBlock = this;
|
var thisBlock = this;
|
||||||
@@ -1298,7 +1318,6 @@ export const weather_uart_mixio = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const weather_set_label = {
|
export const weather_set_label = {
|
||||||
|
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(SENSOR_EXTERN_HUE);
|
this.setColour(SENSOR_EXTERN_HUE);
|
||||||
this.appendValueInput('SUB')
|
this.appendValueInput('SUB')
|
||||||
@@ -1314,18 +1333,15 @@ export const weather_set_label = {
|
|||||||
this.setNextStatement(true);
|
this.setNextStatement(true);
|
||||||
this.setTooltip();
|
this.setTooltip();
|
||||||
},
|
},
|
||||||
|
|
||||||
mutationToDom: function () {
|
mutationToDom: function () {
|
||||||
var container = document.createElement('mutation');
|
var container = document.createElement('mutation');
|
||||||
container.setAttribute('items', this.itemCount_);
|
container.setAttribute('items', this.itemCount_);
|
||||||
return container;
|
return container;
|
||||||
},
|
},
|
||||||
|
|
||||||
domToMutation: function (xmlElement) {
|
domToMutation: function (xmlElement) {
|
||||||
this.itemCount_ = parseInt(xmlElement.getAttribute('items'), 10);
|
this.itemCount_ = parseInt(xmlElement.getAttribute('items'), 10);
|
||||||
this.updateShape_();
|
this.updateShape_();
|
||||||
},
|
},
|
||||||
|
|
||||||
decompose: function (workspace) {
|
decompose: function (workspace) {
|
||||||
var containerBlock =
|
var containerBlock =
|
||||||
workspace.newBlock('weather_set_label_container');
|
workspace.newBlock('weather_set_label_container');
|
||||||
@@ -1339,7 +1355,6 @@ export const weather_set_label = {
|
|||||||
}
|
}
|
||||||
return containerBlock;
|
return containerBlock;
|
||||||
},
|
},
|
||||||
|
|
||||||
compose: function (containerBlock) {
|
compose: function (containerBlock) {
|
||||||
var itemBlock = containerBlock.getInputTargetBlock('STACK');
|
var itemBlock = containerBlock.getInputTargetBlock('STACK');
|
||||||
// Count number of inputs.
|
// Count number of inputs.
|
||||||
@@ -1361,7 +1376,6 @@ export const weather_set_label = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
saveConnections: function (containerBlock) {
|
saveConnections: function (containerBlock) {
|
||||||
var itemBlock = containerBlock.getInputTargetBlock('STACK');
|
var itemBlock = containerBlock.getInputTargetBlock('STACK');
|
||||||
var i = 0;
|
var i = 0;
|
||||||
@@ -1373,7 +1387,6 @@ export const weather_set_label = {
|
|||||||
itemBlock.nextConnection.targetBlock();
|
itemBlock.nextConnection.targetBlock();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
updateShape_: function () {
|
updateShape_: function () {
|
||||||
// Delete everything.
|
// Delete everything.
|
||||||
if (this.getInput('EMPTY')) {
|
if (this.getInput('EMPTY')) {
|
||||||
@@ -1399,6 +1412,7 @@ export const weather_set_label = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const weather_set_label_container = {
|
export const weather_set_label_container = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(SENSOR_EXTERN_HUE);
|
this.setColour(SENSOR_EXTERN_HUE);
|
||||||
@@ -1562,8 +1576,7 @@ export const PS2_init = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const PSBUTTON = [
|
||||||
var PSBUTTON = [
|
|
||||||
[Blockly.Msg.PS2_TRIANGLE, "PSB_GREEN"],
|
[Blockly.Msg.PS2_TRIANGLE, "PSB_GREEN"],
|
||||||
[Blockly.Msg.PS2_CIRCLE, "PSB_RED"],
|
[Blockly.Msg.PS2_CIRCLE, "PSB_RED"],
|
||||||
[Blockly.Msg.PS2_CROSS, "PSB_BLUE"],
|
[Blockly.Msg.PS2_CROSS, "PSB_BLUE"],
|
||||||
@@ -1650,18 +1663,18 @@ export const PS2_Buttons = {
|
|||||||
export const PS2_stk = {
|
export const PS2_stk = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(SENSOR_EXTERN_HUE);
|
this.setColour(SENSOR_EXTERN_HUE);
|
||||||
var PSSTK = [
|
this.appendDummyInput("")
|
||||||
|
.appendField(Blockly.Msg.PS2_stick)
|
||||||
|
.appendField(new Blockly.FieldDropdown(this.PSSTK), "psstk");
|
||||||
|
this.setOutput(true, Number);
|
||||||
|
this.setTooltip('');
|
||||||
|
},
|
||||||
|
PSSTK: [
|
||||||
[Blockly.Msg.PS2_RX, "0"],
|
[Blockly.Msg.PS2_RX, "0"],
|
||||||
[Blockly.Msg.PS2_RY, "1"],
|
[Blockly.Msg.PS2_RY, "1"],
|
||||||
[Blockly.Msg.PS2_LX, "2"],
|
[Blockly.Msg.PS2_LX, "2"],
|
||||||
[Blockly.Msg.PS2_LY, "3"],
|
[Blockly.Msg.PS2_LY, "3"],
|
||||||
];
|
]
|
||||||
this.appendDummyInput("")
|
|
||||||
.appendField(Blockly.Msg.PS2_stick)
|
|
||||||
.appendField(new Blockly.FieldDropdown(PSSTK), "psstk");
|
|
||||||
this.setOutput(true, Number);
|
|
||||||
this.setTooltip('');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const PS2_init_new = {
|
export const PS2_init_new = {
|
||||||
@@ -1722,20 +1735,20 @@ export const PS2_Buttons_new = {
|
|||||||
export const PS2_stk_new = {
|
export const PS2_stk_new = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(SENSOR_EXTERN_HUE);
|
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')
|
this.appendValueInput('SUB')
|
||||||
.appendField(Blockly.Msg.PS2);
|
.appendField(Blockly.Msg.PS2);
|
||||||
this.appendDummyInput("")
|
this.appendDummyInput("")
|
||||||
.appendField(Blockly.Msg.MIXLY_JOYSTICK)
|
.appendField(Blockly.Msg.MIXLY_JOYSTICK)
|
||||||
.appendField(new Blockly.FieldDropdown(PSSTK), "psstk");
|
.appendField(new Blockly.FieldDropdown(this.PSSTK), "psstk");
|
||||||
this.setOutput(true, Number);
|
this.setOutput(true, Number);
|
||||||
this.setTooltip('');
|
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 = {
|
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_PM25_SENSOR, "PM"],
|
||||||
[Blockly.Msg.MIXLY_GNSS_SENSOR, "GNSS"]
|
[Blockly.Msg.MIXLY_GNSS_SENSOR, "GNSS"]
|
||||||
]), "sensor");
|
]), "sensor");
|
||||||
|
|
||||||
|
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
@@ -1782,7 +1793,7 @@ export const pm25_get_data = {
|
|||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
this.setTooltip(Blockly.Msg.MIXLY_PM_CONCENTRATION_TOOLTIP);
|
this.setTooltip(Blockly.Msg.MIXLY_PM_CONCENTRATION_TOOLTIP);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
export const gnss_have_data = {
|
export const gnss_have_data = {
|
||||||
init: function () {
|
init: function () {
|
||||||
@@ -1832,7 +1843,10 @@ export const robot_button_extern_get_value = {
|
|||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.ME_GO_MOTOR_EXTERN + Blockly.Msg.MIXLY_BUTTON)
|
.appendField(Blockly.Msg.ME_GO_MOTOR_EXTERN + Blockly.Msg.MIXLY_BUTTON)
|
||||||
.appendField(Blockly.Msg.PIN_NUMBERING)
|
.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()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.TURTLE_POS)
|
.appendField(Blockly.Msg.TURTLE_POS)
|
||||||
.appendField(new Blockly.FieldDropdown([
|
.appendField(new Blockly.FieldDropdown([
|
||||||
@@ -1847,7 +1861,7 @@ export const robot_button_extern_get_value = {
|
|||||||
this.setOutput(true, Number);
|
this.setOutput(true, Number);
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
export const robot_touch_extern_get_value = {
|
export const robot_touch_extern_get_value = {
|
||||||
init: function () {
|
init: function () {
|
||||||
@@ -1855,13 +1869,16 @@ export const robot_touch_extern_get_value = {
|
|||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.ME_GO_MOTOR_EXTERN + Blockly.Msg.MIXLY_MICROBIT_JS_INOUT_EVENT_TOUCH + Blockly.Msg.MSG.catSensor)
|
.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(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()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.MIXLY_MIXBOT_EXTERN_TOUCHED + "?")
|
.appendField(Blockly.Msg.MIXLY_MIXBOT_EXTERN_TOUCHED + "?")
|
||||||
this.setOutput(true, Boolean);
|
this.setOutput(true, Boolean);
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
export const robot_infrared_extern_get_value = {
|
export const robot_infrared_extern_get_value = {
|
||||||
init: function () {
|
init: function () {
|
||||||
@@ -1869,13 +1886,16 @@ export const robot_infrared_extern_get_value = {
|
|||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.ME_GO_MOTOR_EXTERN + Blockly.Msg.MIXLY_ESP32_EXTERN_NEAR)
|
.appendField(Blockly.Msg.ME_GO_MOTOR_EXTERN + Blockly.Msg.MIXLY_ESP32_EXTERN_NEAR)
|
||||||
.appendField(Blockly.Msg.PIN_NUMBERING)
|
.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()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.MIXLY_GET + Blockly.Msg.MIXLY_DATA)
|
.appendField(Blockly.Msg.MIXLY_GET + Blockly.Msg.MIXLY_DATA)
|
||||||
this.setOutput(true, Number);
|
this.setOutput(true, Number);
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
export const robot_infrared_extern_grey_get_value = {
|
export const robot_infrared_extern_grey_get_value = {
|
||||||
init: function () {
|
init: function () {
|
||||||
@@ -1883,13 +1903,16 @@ export const robot_infrared_extern_grey_get_value = {
|
|||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.ME_GO_MOTOR_EXTERN + Blockly.Msg.MIXLY_ESP32_EXTERN_GRAY_NEAR)
|
.appendField(Blockly.Msg.ME_GO_MOTOR_EXTERN + Blockly.Msg.MIXLY_ESP32_EXTERN_GRAY_NEAR)
|
||||||
.appendField(Blockly.Msg.PIN_NUMBERING)
|
.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()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.MIXLY_GET + Blockly.Msg.MIXLY_DATA)
|
.appendField(Blockly.Msg.MIXLY_GET + Blockly.Msg.MIXLY_DATA)
|
||||||
this.setOutput(true, Number);
|
this.setOutput(true, Number);
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
export const robot_potentiometer_extern_get_value = {
|
export const robot_potentiometer_extern_get_value = {
|
||||||
init: function () {
|
init: function () {
|
||||||
@@ -1897,13 +1920,16 @@ export const robot_potentiometer_extern_get_value = {
|
|||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.ME_GO_MOTOR_EXTERN + Blockly.Msg.MIXLY_KNOB_POTENTIOMETER)
|
.appendField(Blockly.Msg.ME_GO_MOTOR_EXTERN + Blockly.Msg.MIXLY_KNOB_POTENTIOMETER)
|
||||||
.appendField(Blockly.Msg.PIN_NUMBERING)
|
.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()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.MIXLY_GET + Blockly.Msg.MIXLY_DATA)
|
.appendField(Blockly.Msg.MIXLY_GET + Blockly.Msg.MIXLY_DATA)
|
||||||
this.setOutput(true, Number);
|
this.setOutput(true, Number);
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
export const robot_color_extern_get_value = {
|
export const robot_color_extern_get_value = {
|
||||||
init: function () {
|
init: function () {
|
||||||
@@ -1911,7 +1937,10 @@ export const robot_color_extern_get_value = {
|
|||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.ME_GO_MOTOR_EXTERN + Blockly.Msg.HTML_COLOUR + Blockly.Msg.MSG.catSensor)
|
.appendField(Blockly.Msg.ME_GO_MOTOR_EXTERN + Blockly.Msg.HTML_COLOUR + Blockly.Msg.MSG.catSensor)
|
||||||
.appendField(Blockly.Msg.PIN_NUMBERING)
|
.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()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.MIXLY_GET)
|
.appendField(Blockly.Msg.MIXLY_GET)
|
||||||
.appendField(new Blockly.FieldDropdown([
|
.appendField(new Blockly.FieldDropdown([
|
||||||
@@ -1924,7 +1953,7 @@ export const robot_color_extern_get_value = {
|
|||||||
this.setOutput(true, Boolean);
|
this.setOutput(true, Boolean);
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
export const mixbot_sensor_extern_get_addr = {
|
export const mixbot_sensor_extern_get_addr = {
|
||||||
init: function () {
|
init: function () {
|
||||||
@@ -1945,7 +1974,7 @@ export const mixbot_sensor_extern_get_addr = {
|
|||||||
this.setOutput(true);
|
this.setOutput(true);
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
export const mixbot_sensor_extern_set_addr = {
|
export const mixbot_sensor_extern_set_addr = {
|
||||||
init: function () {
|
init: function () {
|
||||||
@@ -1975,7 +2004,7 @@ export const mixbot_sensor_extern_set_addr = {
|
|||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
export const robot_sonar_extern_get_value = {
|
export const robot_sonar_extern_get_value = {
|
||||||
init: function () {
|
init: function () {
|
||||||
@@ -1983,13 +2012,16 @@ export const robot_sonar_extern_get_value = {
|
|||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.ME_GO_MOTOR_EXTERN + Blockly.Msg.MIXLY_EXTERN_SONAR)
|
.appendField(Blockly.Msg.ME_GO_MOTOR_EXTERN + Blockly.Msg.MIXLY_EXTERN_SONAR)
|
||||||
.appendField(Blockly.Msg.PIN_NUMBERING)
|
.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()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.MIXLY_GET + Blockly.Msg.MIXLY_DATA + '(cm)')
|
.appendField(Blockly.Msg.MIXLY_GET + Blockly.Msg.MIXLY_DATA + '(cm)')
|
||||||
this.setOutput(true, Number);
|
this.setOutput(true, Number);
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
export const robot_sonar_extern_led = {
|
export const robot_sonar_extern_led = {
|
||||||
init: function () {
|
init: function () {
|
||||||
@@ -1997,7 +2029,10 @@ export const robot_sonar_extern_led = {
|
|||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.ME_GO_MOTOR_EXTERN + Blockly.Msg.MIXLY_EXTERN_SONAR)
|
.appendField(Blockly.Msg.ME_GO_MOTOR_EXTERN + Blockly.Msg.MIXLY_EXTERN_SONAR)
|
||||||
.appendField(Blockly.Msg.PIN_NUMBERING)
|
.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()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.MIXLY_EXTERN_INDICATOR_LIGHT)
|
.appendField(Blockly.Msg.MIXLY_EXTERN_INDICATOR_LIGHT)
|
||||||
this.appendValueInput('light')
|
this.appendValueInput('light')
|
||||||
@@ -2010,7 +2045,7 @@ export const robot_sonar_extern_led = {
|
|||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
export const sensor_weather_solo_init = {
|
export const sensor_weather_solo_init = {
|
||||||
init: function () {
|
init: function () {
|
||||||
@@ -2249,4 +2284,4 @@ export const weigh_sensor_get_weight = {
|
|||||||
this.setOutput(true);
|
this.setOutput(true);
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
@@ -62,7 +62,11 @@ export const sensor_mixgo_button_attachInterrupt = {
|
|||||||
.setCheck(Number);
|
.setCheck(Number);
|
||||||
this.appendDummyInput("")
|
this.appendDummyInput("")
|
||||||
.appendField(Blockly.Msg.MIXLY_MODE)
|
.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')
|
this.appendValueInput('DO')
|
||||||
.appendField(Blockly.Msg.MIXLY_DO)
|
.appendField(Blockly.Msg.MIXLY_DO)
|
||||||
this.setPreviousStatement(true);
|
this.setPreviousStatement(true);
|
||||||
@@ -121,7 +125,11 @@ export const sensor_mixgocar42_button_attachInterrupt = {
|
|||||||
.appendField(Blockly.Msg.MIXLY_BUTTON)
|
.appendField(Blockly.Msg.MIXLY_BUTTON)
|
||||||
this.appendDummyInput("")
|
this.appendDummyInput("")
|
||||||
.appendField(Blockly.Msg.MIXLY_MODE)
|
.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')
|
this.appendValueInput('DO')
|
||||||
.appendField(Blockly.Msg.MIXLY_DO)
|
.appendField(Blockly.Msg.MIXLY_DO)
|
||||||
this.setPreviousStatement(true);
|
this.setPreviousStatement(true);
|
||||||
@@ -183,7 +191,6 @@ export const sensor_mixgo_touch_slide = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export const sensor_distance_hrsc04 = {
|
export const sensor_distance_hrsc04 = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(SENSOR_ONBOARD_HUE);
|
this.setColour(SENSOR_ONBOARD_HUE);
|
||||||
@@ -258,8 +265,6 @@ export const RTC_set_date = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const HCSR04 = {
|
export const HCSR04 = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(SENSOR_ONBOARD_HUE);
|
this.setColour(SENSOR_ONBOARD_HUE);
|
||||||
@@ -275,7 +280,6 @@ export const HCSR04 = {
|
|||||||
this.setOutput(true, Number);
|
this.setOutput(true, Number);
|
||||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_BLOCKGROUP_CHAOSHENGBO);
|
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_BLOCKGROUP_CHAOSHENGBO);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const sensor_mixgo_light = {
|
export const sensor_mixgo_light = {
|
||||||
@@ -289,12 +293,14 @@ export const sensor_mixgo_light = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export const number1 = {
|
export const number1 = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(SENSOR_ONBOARD_HUE);
|
this.setColour(SENSOR_ONBOARD_HUE);
|
||||||
this.appendDummyInput("")
|
this.appendDummyInput("")
|
||||||
.appendField(new Blockly.FieldDropdown([["1", "touch1"], ["2", "touch2"]]), 'op')
|
.appendField(new Blockly.FieldDropdown([
|
||||||
|
["1", "touch1"],
|
||||||
|
["2", "touch2"]
|
||||||
|
]), 'op')
|
||||||
this.setOutput(true);
|
this.setOutput(true);
|
||||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_INOUT_HIGHLOW);
|
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_INOUT_HIGHLOW);
|
||||||
}
|
}
|
||||||
@@ -304,7 +310,12 @@ export const number2 = {
|
|||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(SENSOR_ONBOARD_HUE);
|
this.setColour(SENSOR_ONBOARD_HUE);
|
||||||
this.appendDummyInput("")
|
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.setOutput(true);
|
||||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_INOUT_HIGHLOW);
|
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_INOUT_HIGHLOW);
|
||||||
}
|
}
|
||||||
@@ -314,7 +325,13 @@ export const number3 = {
|
|||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(SENSOR_ONBOARD_HUE);
|
this.setColour(SENSOR_ONBOARD_HUE);
|
||||||
this.appendDummyInput("")
|
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.setOutput(true);
|
||||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_INOUT_HIGHLOW);
|
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_INOUT_HIGHLOW);
|
||||||
}
|
}
|
||||||
@@ -324,7 +341,13 @@ export const number4 = {
|
|||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(SENSOR_ONBOARD_HUE);
|
this.setColour(SENSOR_ONBOARD_HUE);
|
||||||
this.appendDummyInput("")
|
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.setOutput(true);
|
||||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_INOUT_HIGHLOW);
|
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_INOUT_HIGHLOW);
|
||||||
}
|
}
|
||||||
@@ -334,7 +357,12 @@ export const number5 = {
|
|||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(SENSOR_ONBOARD_HUE);
|
this.setColour(SENSOR_ONBOARD_HUE);
|
||||||
this.appendDummyInput("")
|
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.setOutput(true);
|
||||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_INOUT_HIGHLOW);
|
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_INOUT_HIGHLOW);
|
||||||
}
|
}
|
||||||
@@ -344,7 +372,10 @@ export const number6 = {
|
|||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(SENSOR_ONBOARD_HUE);
|
this.setColour(SENSOR_ONBOARD_HUE);
|
||||||
this.appendDummyInput("")
|
this.appendDummyInput("")
|
||||||
.appendField(new Blockly.FieldDropdown([["3", "3"], ["4", "4"]]), 'op')
|
.appendField(new Blockly.FieldDropdown([
|
||||||
|
["3", "3"],
|
||||||
|
["4", "4"]
|
||||||
|
]), 'op')
|
||||||
this.setOutput(true);
|
this.setOutput(true);
|
||||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_INOUT_HIGHLOW);
|
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_INOUT_HIGHLOW);
|
||||||
}
|
}
|
||||||
@@ -354,7 +385,10 @@ export const number7 = {
|
|||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(SENSOR_ONBOARD_HUE);
|
this.setColour(SENSOR_ONBOARD_HUE);
|
||||||
this.appendDummyInput("")
|
this.appendDummyInput("")
|
||||||
.appendField(new Blockly.FieldDropdown([["0", "0"], ["1", "1"]]), 'op')
|
.appendField(new Blockly.FieldDropdown([
|
||||||
|
["0", "0"],
|
||||||
|
["1", "1"]
|
||||||
|
]), 'op')
|
||||||
this.setOutput(true);
|
this.setOutput(true);
|
||||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_INOUT_HIGHLOW);
|
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.setColour(SENSOR_ONBOARD_HUE);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_PY_STORAGE_GET)
|
.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);
|
.appendField(Blockly.Msg.MIXLY_ESP32_NEAR);
|
||||||
this.setOutput(true, Number);
|
this.setOutput(true, Number);
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
@@ -418,13 +455,15 @@ export const sensor_mixgo_pin_near = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export const sensor_mixgo_nova_pin_near = {
|
export const sensor_mixgo_nova_pin_near = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(SENSOR_ONBOARD_HUE);
|
this.setColour(SENSOR_ONBOARD_HUE);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_PY_STORAGE_GET)
|
.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);
|
.appendField(Blockly.Msg.MIXLY_ESP32_NEAR);
|
||||||
this.setOutput(true, Number);
|
this.setOutput(true, Number);
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
@@ -447,7 +486,10 @@ export const sensor_mixgo_nova_LTR308 = {
|
|||||||
this.setColour(SENSOR_ONBOARD_HUE);
|
this.setColour(SENSOR_ONBOARD_HUE);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_PY_STORAGE_GET)
|
.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);
|
.appendField(Blockly.Msg.MIXLY_ESP32_EXTERN_LIGHT + Blockly.Msg.MIXLY_DATA);
|
||||||
this.setOutput(true, Number);
|
this.setOutput(true, Number);
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
@@ -671,7 +713,6 @@ export const sensor_aht11 = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export const sensor_get_temperature = {
|
export const sensor_get_temperature = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(SENSOR_ONBOARD_HUE);
|
this.setColour(SENSOR_ONBOARD_HUE);
|
||||||
@@ -682,10 +723,6 @@ export const sensor_get_temperature = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const sensor_hp203 = {
|
export const sensor_hp203 = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(SENSOR_ONBOARD_HUE);
|
this.setColour(SENSOR_ONBOARD_HUE);
|
||||||
@@ -815,7 +852,15 @@ export const sensor_onboard_mpu9250_gesture = {
|
|||||||
.appendField("MPU9250")
|
.appendField("MPU9250")
|
||||||
this.appendDummyInput("")
|
this.appendDummyInput("")
|
||||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_JS_CURRENT_GESTURE)
|
.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.setOutput(true);
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
var thisBlock = this;
|
var thisBlock = this;
|
||||||
@@ -954,7 +999,6 @@ export const sensor_onboard_mpu9250_calibrate_compass = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export const sensor_onboard_mpu9250_temperature = {
|
export const sensor_onboard_mpu9250_temperature = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(SENSOR_ONBOARD_HUE);
|
this.setColour(SENSOR_ONBOARD_HUE);
|
||||||
@@ -969,7 +1013,6 @@ export const sensor_onboard_mpu9250_temperature = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export const sensor_onboard_mpu9250_field_strength = {
|
export const sensor_onboard_mpu9250_field_strength = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(SENSOR_ONBOARD_HUE);
|
this.setColour(SENSOR_ONBOARD_HUE);
|
||||||
@@ -977,7 +1020,10 @@ export const sensor_onboard_mpu9250_field_strength = {
|
|||||||
.appendField("MPU9250")
|
.appendField("MPU9250")
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_JS_GET_COMPASS)
|
.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.setOutput(true, Number);
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
var thisBlock = this;
|
var thisBlock = this;
|
||||||
@@ -1061,10 +1107,8 @@ export const sensor_mixgo_cc_mmc5603_calibrate_compass = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//mixgo_me onboard_sensor blocks:
|
//mixgo_me onboard_sensor blocks:
|
||||||
|
|
||||||
|
|
||||||
export const sensor_mixgome_temperature = {
|
export const sensor_mixgome_temperature = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(SENSOR_ONBOARD_HUE);
|
this.setColour(SENSOR_ONBOARD_HUE);
|
||||||
@@ -1079,7 +1123,6 @@ export const sensor_mixgome_temperature = {
|
|||||||
|
|
||||||
//mixgo_ce onboard_sensor blocks:
|
//mixgo_ce onboard_sensor blocks:
|
||||||
|
|
||||||
|
|
||||||
export const sensor_mixgoce_temperature = {
|
export const sensor_mixgoce_temperature = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(SENSOR_ONBOARD_HUE);
|
this.setColour(SENSOR_ONBOARD_HUE);
|
||||||
@@ -1092,9 +1135,6 @@ export const sensor_mixgoce_temperature = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const sensor_mpython_qmi8658_get_gyro = {
|
export const sensor_mpython_qmi8658_get_gyro = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(SENSOR_ONBOARD_HUE);
|
this.setColour(SENSOR_ONBOARD_HUE);
|
||||||
@@ -1137,15 +1177,15 @@ export const sensor_mpython_qmi8658_temperature = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const sensor_rm_pin_near_double = {
|
export const sensor_rm_pin_near_double = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(SENSOR_ONBOARD_HUE);
|
this.setColour(SENSOR_ONBOARD_HUE);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_PY_STORAGE_GET)
|
.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);
|
.appendField(Blockly.Msg.MIXLY_ESP32_NEAR);
|
||||||
this.setOutput(true, Number);
|
this.setOutput(true, Number);
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
@@ -1254,7 +1294,6 @@ export const sensor_mixgocar_pin_near_state_change = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export const sensor_mixgocar_battery_left = {
|
export const sensor_mixgocar_battery_left = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(SENSOR_ONBOARD_HUE);
|
this.setColour(SENSOR_ONBOARD_HUE);
|
||||||
@@ -1267,7 +1306,6 @@ export const sensor_mixgocar_battery_left = {
|
|||||||
|
|
||||||
//mixbot onboard_sensor below:
|
//mixbot onboard_sensor below:
|
||||||
|
|
||||||
|
|
||||||
export const sensor_mixbot_patrol_calibrate = {
|
export const sensor_mixbot_patrol_calibrate = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(SENSOR_ONBOARD_HUE);
|
this.setColour(SENSOR_ONBOARD_HUE);
|
||||||
@@ -1319,8 +1357,6 @@ export const sensor_mixbot_temperature = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const sensor_mixbot_get_gyro = {
|
export const sensor_mixbot_get_gyro = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(SENSOR_ONBOARD_HUE);
|
this.setColour(SENSOR_ONBOARD_HUE);
|
||||||
|
|||||||
@@ -53,7 +53,12 @@ export const serial_print_hex = {
|
|||||||
.appendField(new Blockly.FieldDropdown([['uart1', '1']]), 'mode')
|
.appendField(new Blockly.FieldDropdown([['uart1', '1']]), 'mode')
|
||||||
.appendField(Blockly.Msg.MIXLY_SERIAL_PRINTLN);
|
.appendField(Blockly.Msg.MIXLY_SERIAL_PRINTLN);
|
||||||
this.appendValueInput("CONTENT", Number)
|
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);
|
.setCheck(Number);
|
||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
@@ -147,7 +152,20 @@ export const serial_softserial_new = {
|
|||||||
.setAlign(Blockly.inputs.Align.RIGHT);
|
.setAlign(Blockly.inputs.Align.RIGHT);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.MIXLY_SERIAL_BEGIN)
|
.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.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
@@ -160,11 +178,27 @@ export const serial_softserial = {
|
|||||||
this.setColour(SERIAL_HUE);
|
this.setColour(SERIAL_HUE);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.MIXLY_SETUP)
|
.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.setFieldValue('1','mode')
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.MIXLY_SERIAL_BEGIN)
|
.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.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
@@ -177,7 +211,20 @@ export const serial_begin = {
|
|||||||
this.setColour(SERIAL_HUE);
|
this.setColour(SERIAL_HUE);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField("Serial " + Blockly.Msg.MIXLY_SERIAL_BEGIN)
|
.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.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
@@ -194,7 +241,7 @@ export const system_input = {
|
|||||||
this.setOutput(true);
|
this.setOutput(true);
|
||||||
this.setTooltip(Blockly.Msg.INOUT_input_TOOLTIP);
|
this.setTooltip(Blockly.Msg.INOUT_input_TOOLTIP);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
export const system_print = {
|
export const system_print = {
|
||||||
init: function () {
|
init: function () {
|
||||||
@@ -233,10 +280,8 @@ export const system_print_end = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const system_print_many = {
|
export const system_print_many = {
|
||||||
|
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(SERIAL_HUE);
|
this.setColour(SERIAL_HUE);
|
||||||
|
|
||||||
this.itemCount_ = 2;
|
this.itemCount_ = 2;
|
||||||
this.updateShape_();
|
this.updateShape_();
|
||||||
this.setPreviousStatement(false);
|
this.setPreviousStatement(false);
|
||||||
@@ -247,18 +292,15 @@ export const system_print_many = {
|
|||||||
this.setNextStatement(true);
|
this.setNextStatement(true);
|
||||||
this.setTooltip(Blockly.Msg.MIXLY_MIXPY_INOUT_PRINT_MANY_TOOLTIP);
|
this.setTooltip(Blockly.Msg.MIXLY_MIXPY_INOUT_PRINT_MANY_TOOLTIP);
|
||||||
},
|
},
|
||||||
|
|
||||||
mutationToDom: function () {
|
mutationToDom: function () {
|
||||||
var container = document.createElement('mutation');
|
var container = document.createElement('mutation');
|
||||||
container.setAttribute('items', this.itemCount_);
|
container.setAttribute('items', this.itemCount_);
|
||||||
return container;
|
return container;
|
||||||
},
|
},
|
||||||
|
|
||||||
domToMutation: function (xmlElement) {
|
domToMutation: function (xmlElement) {
|
||||||
this.itemCount_ = parseInt(xmlElement.getAttribute('items'), 10);
|
this.itemCount_ = parseInt(xmlElement.getAttribute('items'), 10);
|
||||||
this.updateShape_();
|
this.updateShape_();
|
||||||
},
|
},
|
||||||
|
|
||||||
decompose: function (workspace) {
|
decompose: function (workspace) {
|
||||||
var containerBlock =
|
var containerBlock =
|
||||||
workspace.newBlock('system_print_container');
|
workspace.newBlock('system_print_container');
|
||||||
@@ -272,7 +314,6 @@ export const system_print_many = {
|
|||||||
}
|
}
|
||||||
return containerBlock;
|
return containerBlock;
|
||||||
},
|
},
|
||||||
|
|
||||||
compose: function (containerBlock) {
|
compose: function (containerBlock) {
|
||||||
var itemBlock = containerBlock.getInputTargetBlock('STACK');
|
var itemBlock = containerBlock.getInputTargetBlock('STACK');
|
||||||
// Count number of inputs.
|
// Count number of inputs.
|
||||||
@@ -294,7 +335,6 @@ export const system_print_many = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
saveConnections: function (containerBlock) {
|
saveConnections: function (containerBlock) {
|
||||||
var itemBlock = containerBlock.getInputTargetBlock('STACK');
|
var itemBlock = containerBlock.getInputTargetBlock('STACK');
|
||||||
var i = 0;
|
var i = 0;
|
||||||
@@ -306,7 +346,6 @@ export const system_print_many = {
|
|||||||
itemBlock.nextConnection.targetBlock();
|
itemBlock.nextConnection.targetBlock();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
updateShape_: function () {
|
updateShape_: function () {
|
||||||
// Delete everything.
|
// Delete everything.
|
||||||
if (this.getInput('EMPTY')) {
|
if (this.getInput('EMPTY')) {
|
||||||
@@ -332,6 +371,7 @@ export const system_print_many = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const system_print_container = {
|
export const system_print_container = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(SERIAL_HUE);
|
this.setColour(SERIAL_HUE);
|
||||||
@@ -365,7 +405,10 @@ export const serial_send_to_ai = {
|
|||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.LANG_CONTROLS_FOR_INPUT_TO + Blockly.Msg.MIXLY_OTHER + 'MP' + Blockly.Msg.MIXLY_DEVICE)
|
.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(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.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,11 @@ export const controls_delay_new = {
|
|||||||
this.appendValueInput("DELAY_TIME", Number)
|
this.appendValueInput("DELAY_TIME", Number)
|
||||||
.setCheck(Number);
|
.setCheck(Number);
|
||||||
this.appendDummyInput("")
|
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.setFieldValue('s', 'Time')
|
||||||
this.setPreviousStatement(true, null);
|
this.setPreviousStatement(true, null);
|
||||||
this.setNextStatement(true, null);
|
this.setNextStatement(true, null);
|
||||||
@@ -26,7 +30,11 @@ export const controls_delay = {
|
|||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.MIXLY_DELAY)
|
.appendField(Blockly.Msg.MIXLY_DELAY)
|
||||||
this.appendDummyInput("")
|
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)
|
this.appendValueInput("DELAY_TIME", Number)
|
||||||
.setCheck(Number);
|
.setCheck(Number);
|
||||||
this.setFieldValue('ms', 'Time')
|
this.setFieldValue('ms', 'Time')
|
||||||
@@ -67,7 +75,10 @@ export const controls_millis = {
|
|||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.MIXLY_RUNTIME);
|
.appendField(Blockly.Msg.MIXLY_RUNTIME);
|
||||||
this.appendDummyInput("")
|
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.setOutput(true, Number);
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
this.setTooltip(Blockly.Msg.MIXLY_ESP32_CONTROLS_MILLIS_TOOLTIP);
|
this.setTooltip(Blockly.Msg.MIXLY_ESP32_CONTROLS_MILLIS_TOOLTIP);
|
||||||
@@ -92,7 +103,6 @@ export const controls_uname = {
|
|||||||
this.setColour(SYSTEM_HUE);
|
this.setColour(SYSTEM_HUE);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_PY_CONTORL_UNAME);
|
.appendField(Blockly.Msg.MIXLY_MICROBIT_PY_CONTORL_UNAME);
|
||||||
|
|
||||||
this.setInputsInline(true);
|
this.setInputsInline(true);
|
||||||
this.setOutput(true);
|
this.setOutput(true);
|
||||||
this.setTooltip(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN + Blockly.Msg.MIXLY_MICROBIT_PY_CONTORL_UNAME);
|
this.setTooltip(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN + Blockly.Msg.MIXLY_MICROBIT_PY_CONTORL_UNAME);
|
||||||
@@ -137,7 +147,10 @@ export const system_timer = {
|
|||||||
this.appendDummyInput("")
|
this.appendDummyInput("")
|
||||||
.appendField(Blockly.Msg.MIXLY_mSecond)
|
.appendField(Blockly.Msg.MIXLY_mSecond)
|
||||||
.appendField(Blockly.Msg.MIXLY_MODE)
|
.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')
|
this.appendValueInput('callback')
|
||||||
.appendField(Blockly.Msg.MIXLY_DO)
|
.appendField(Blockly.Msg.MIXLY_DO)
|
||||||
this.setPreviousStatement(true);
|
this.setPreviousStatement(true);
|
||||||
|
|||||||
@@ -229,7 +229,6 @@ export const actuator_use_uart_init = function (_, generator) {
|
|||||||
var code = v + '=ns9300.NS9300(' + key + ')\n';
|
var code = v + '=ns9300.NS9300(' + key + ')\n';
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const player_whether_stop = function (_, generator) {
|
export const player_whether_stop = function (_, generator) {
|
||||||
|
|||||||
@@ -773,5 +773,4 @@ export const get_keyboard_light = function (_,generator){
|
|||||||
var key = this.getFieldValue('key');
|
var key = this.getFieldValue('key');
|
||||||
var code = "onboard_bot.hid_keyboard_state()["+ key +']';
|
var code = "onboard_bot.hid_keyboard_state()["+ key +']';
|
||||||
return [code,generator.ORDER_ATOMIC]
|
return [code,generator.ORDER_ATOMIC]
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -143,7 +143,6 @@ export const mpython_blynktimer = function (_, generator) {
|
|||||||
def blynk_timer${Num}():
|
def blynk_timer${Num}():
|
||||||
`
|
`
|
||||||
+ branch;
|
+ branch;
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,9 +190,7 @@ export const mpython_blynk_email = function (_, generator) {
|
|||||||
export const mpython_blynk_set_property = function (_, generator) {
|
export const mpython_blynk_set_property = function (_, generator) {
|
||||||
var attribute_value = generator.valueToCode(this, 'attribute_value', generator.ORDER_ATOMIC);
|
var attribute_value = generator.valueToCode(this, 'attribute_value', generator.ORDER_ATOMIC);
|
||||||
var attribute_name = generator.valueToCode(this, 'attribute_name', generator.ORDER_ATOMIC);
|
var attribute_name = generator.valueToCode(this, 'attribute_name', generator.ORDER_ATOMIC);
|
||||||
|
|
||||||
var code = `blynk.set_property(pin, ${attribute_name}, ${attribute_value})` + '\n';
|
var code = `blynk.set_property(pin, ${attribute_name}, ${attribute_value})` + '\n';
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,8 +19,7 @@ export const ce_go_led_bright = function (_, generator) {
|
|||||||
generator.definitions_['import_me_go_car'] = 'from me_go import car';
|
generator.definitions_['import_me_go_car'] = 'from me_go import car';
|
||||||
} else if (version == "mixgo_mini") {
|
} else if (version == "mixgo_mini") {
|
||||||
generator.definitions_['import_mini_go_car'] = 'from mini_go import car';
|
generator.definitions_['import_mini_go_car'] = 'from mini_go import car';
|
||||||
}
|
} else if (version == "mixgo_ce") {
|
||||||
else if (version == "mixgo_ce") {
|
|
||||||
generator.definitions_['import_ce_go_car'] = 'from ce_go import car';
|
generator.definitions_['import_ce_go_car'] = 'from ce_go import car';
|
||||||
}
|
}
|
||||||
var op = generator.valueToCode(this, 'led', generator.ORDER_ATOMIC);
|
var op = generator.valueToCode(this, 'led', generator.ORDER_ATOMIC);
|
||||||
@@ -33,8 +32,7 @@ export const ce_go_get_led_bright = function (_, generator) {
|
|||||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
||||||
if (version == "mixgo_me" || version == "mixgo_cc") {
|
if (version == "mixgo_me" || version == "mixgo_cc") {
|
||||||
generator.definitions_['import_me_go_car'] = 'from me_go import car';
|
generator.definitions_['import_me_go_car'] = 'from me_go import car';
|
||||||
}
|
} else if (version == "mixgo_ce") {
|
||||||
else if (version == "mixgo_ce") {
|
|
||||||
generator.definitions_['import_ce_go_car'] = 'from ce_go import car';
|
generator.definitions_['import_ce_go_car'] = 'from ce_go import car';
|
||||||
} else if (version == "mixgo_mini") {
|
} else if (version == "mixgo_mini") {
|
||||||
generator.definitions_['import_mini_go_car'] = 'from mini_go import car';
|
generator.definitions_['import_mini_go_car'] = 'from mini_go import car';
|
||||||
@@ -48,8 +46,7 @@ export const ce_go_get_led_state = function (_, generator) {
|
|||||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
||||||
if (version == "mixgo_me" || version == "mixgo_cc") {
|
if (version == "mixgo_me" || version == "mixgo_cc") {
|
||||||
generator.definitions_['import_me_go_car'] = 'from me_go import car';
|
generator.definitions_['import_me_go_car'] = 'from me_go import car';
|
||||||
}
|
} else if (version == "mixgo_ce") {
|
||||||
else if (version == "mixgo_ce") {
|
|
||||||
generator.definitions_['import_ce_go_car'] = 'from ce_go import car';
|
generator.definitions_['import_ce_go_car'] = 'from ce_go import car';
|
||||||
} else if (version == "mixgo_mini") {
|
} else if (version == "mixgo_mini") {
|
||||||
generator.definitions_['import_mini_go_car'] = 'from mini_go import car';
|
generator.definitions_['import_mini_go_car'] = 'from mini_go import car';
|
||||||
@@ -63,8 +60,7 @@ export const ce_go_led_brightness = function (_, generator) {
|
|||||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
||||||
if (version == "mixgo_me" || version == "mixgo_cc") {
|
if (version == "mixgo_me" || version == "mixgo_cc") {
|
||||||
generator.definitions_['import_me_go_car'] = 'from me_go import car';
|
generator.definitions_['import_me_go_car'] = 'from me_go import car';
|
||||||
}
|
} else if (version == "mixgo_ce") {
|
||||||
else if (version == "mixgo_ce") {
|
|
||||||
generator.definitions_['import_ce_go_car'] = 'from ce_go import car';
|
generator.definitions_['import_ce_go_car'] = 'from ce_go import car';
|
||||||
} else if (version == "mixgo_mini") {
|
} else if (version == "mixgo_mini") {
|
||||||
generator.definitions_['import_mini_go_car'] = 'from mini_go import car';
|
generator.definitions_['import_mini_go_car'] = 'from mini_go import car';
|
||||||
@@ -79,8 +75,7 @@ export const ce_go_stepper_keep = function (_, generator) {
|
|||||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
||||||
if (version == "mixgo_me" || version == "mixgo_cc") {
|
if (version == "mixgo_me" || version == "mixgo_cc") {
|
||||||
generator.definitions_['import_me_go_car'] = 'from me_go import car';
|
generator.definitions_['import_me_go_car'] = 'from me_go import car';
|
||||||
}
|
} else if (version == "mixgo_ce") {
|
||||||
else if (version == "mixgo_ce") {
|
|
||||||
generator.definitions_['import_ce_go_car'] = 'from ce_go import car';
|
generator.definitions_['import_ce_go_car'] = 'from ce_go import car';
|
||||||
} else if (version == "mixgo_mini") {
|
} else if (version == "mixgo_mini") {
|
||||||
generator.definitions_['import_mini_go_car'] = 'from mini_go import car';
|
generator.definitions_['import_mini_go_car'] = 'from mini_go import car';
|
||||||
@@ -95,8 +90,7 @@ export const ce_go_stepper_stop = function (_, generator) {
|
|||||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
||||||
if (version == "mixgo_me" || version == "mixgo_cc") {
|
if (version == "mixgo_me" || version == "mixgo_cc") {
|
||||||
generator.definitions_['import_me_go_car'] = 'from me_go import car';
|
generator.definitions_['import_me_go_car'] = 'from me_go import car';
|
||||||
}
|
} else if (version == "mixgo_ce") {
|
||||||
else if (version == "mixgo_ce") {
|
|
||||||
generator.definitions_['import_ce_go_car'] = 'from ce_go import car';
|
generator.definitions_['import_ce_go_car'] = 'from ce_go import car';
|
||||||
} else if (version == "mixgo_mini") {
|
} else if (version == "mixgo_mini") {
|
||||||
generator.definitions_['import_mini_go_car'] = 'from mini_go import car';
|
generator.definitions_['import_mini_go_car'] = 'from mini_go import car';
|
||||||
@@ -110,8 +104,7 @@ export const ce_go_dc_motor = function (_, generator) {
|
|||||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
||||||
if (version == "mixgo_me" || version == "mixgo_cc") {
|
if (version == "mixgo_me" || version == "mixgo_cc") {
|
||||||
generator.definitions_['import_me_go_car'] = 'from me_go import car';
|
generator.definitions_['import_me_go_car'] = 'from me_go import car';
|
||||||
}
|
} else if (version == "mixgo_ce") {
|
||||||
else if (version == "mixgo_ce") {
|
|
||||||
generator.definitions_['import_ce_go_car'] = 'from ce_go import car';
|
generator.definitions_['import_ce_go_car'] = 'from ce_go import car';
|
||||||
} else if (version == "mixgo_mini") {
|
} else if (version == "mixgo_mini") {
|
||||||
generator.definitions_['import_mini_go_car'] = 'from mini_go import car';
|
generator.definitions_['import_mini_go_car'] = 'from mini_go import car';
|
||||||
@@ -132,8 +125,7 @@ export const ce_go_hall_attachInterrupt = function (_, generator) {
|
|||||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
||||||
if (version == "mixgo_me" || version == "mixgo_cc") {
|
if (version == "mixgo_me" || version == "mixgo_cc") {
|
||||||
generator.definitions_['import_me_go_hall_' + dropdown_mode] = 'from me_go import hall_' + dropdown_mode;
|
generator.definitions_['import_me_go_hall_' + dropdown_mode] = 'from me_go import hall_' + dropdown_mode;
|
||||||
}
|
} else if (version == "mixgo_ce") {
|
||||||
else if (version == "mixgo_ce") {
|
|
||||||
generator.definitions_['import_ce_go_hall_' + dropdown_mode] = 'from ce_go import hall_' + dropdown_mode;
|
generator.definitions_['import_ce_go_hall_' + dropdown_mode] = 'from ce_go import hall_' + dropdown_mode;
|
||||||
} else if (version == "mixgo_mini") {
|
} else if (version == "mixgo_mini") {
|
||||||
generator.definitions_['import_mini_go_hall' + dropdown_mode] = 'from mini_go import hall_' + dropdown_mode;
|
generator.definitions_['import_mini_go_hall' + dropdown_mode] = 'from mini_go import hall_' + dropdown_mode;
|
||||||
@@ -149,8 +141,7 @@ export const ce_go_hall_initialize = function (_, generator) {
|
|||||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
||||||
if (version == "mixgo_me" || version == "mixgo_cc") {
|
if (version == "mixgo_me" || version == "mixgo_cc") {
|
||||||
generator.definitions_['import_me_go_hall_' + dropdown_mode] = 'from me_go import hall_' + dropdown_mode;
|
generator.definitions_['import_me_go_hall_' + dropdown_mode] = 'from me_go import hall_' + dropdown_mode;
|
||||||
}
|
} else if (version == "mixgo_ce") {
|
||||||
else if (version == "mixgo_ce") {
|
|
||||||
generator.definitions_['import_ce_go_hall_' + dropdown_mode] = 'from ce_go import hall_' + dropdown_mode;
|
generator.definitions_['import_ce_go_hall_' + dropdown_mode] = 'from ce_go import hall_' + dropdown_mode;
|
||||||
} else if (version == "mixgo_mini") {
|
} else if (version == "mixgo_mini") {
|
||||||
generator.definitions_['import_mini_go_hall' + dropdown_mode] = 'from mini_go import hall_' + dropdown_mode;
|
generator.definitions_['import_mini_go_hall' + dropdown_mode] = 'from mini_go import hall_' + dropdown_mode;
|
||||||
@@ -170,8 +161,7 @@ export const ce_go_hall_data = function (_, generator) {
|
|||||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
||||||
if (version == "mixgo_me" || version == "mixgo_cc") {
|
if (version == "mixgo_me" || version == "mixgo_cc") {
|
||||||
generator.definitions_['import_me_go_hall_' + dropdown_mode] = 'from me_go import hall_' + dropdown_mode;
|
generator.definitions_['import_me_go_hall_' + dropdown_mode] = 'from me_go import hall_' + dropdown_mode;
|
||||||
}
|
} else if (version == "mixgo_ce") {
|
||||||
else if (version == "mixgo_ce") {
|
|
||||||
generator.definitions_['import_ce_go_hall_' + dropdown_mode] = 'from ce_go import hall_' + dropdown_mode;
|
generator.definitions_['import_ce_go_hall_' + dropdown_mode] = 'from ce_go import hall_' + dropdown_mode;
|
||||||
} else if (version == "mixgo_mini") {
|
} else if (version == "mixgo_mini") {
|
||||||
generator.definitions_['import_mini_go_hall' + dropdown_mode] = 'from mini_go import hall_' + dropdown_mode;
|
generator.definitions_['import_mini_go_hall' + dropdown_mode] = 'from mini_go import hall_' + dropdown_mode;
|
||||||
@@ -185,8 +175,7 @@ export const ce_go_pin_near_line = function (_, generator) {
|
|||||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
||||||
if (version == "mixgo_me" || version == "mixgo_cc") {
|
if (version == "mixgo_me" || version == "mixgo_cc") {
|
||||||
generator.definitions_['import_me_go_hall'] = 'from me_go import car';
|
generator.definitions_['import_me_go_hall'] = 'from me_go import car';
|
||||||
}
|
} else if (version == "mixgo_ce") {
|
||||||
else if (version == "mixgo_ce") {
|
|
||||||
generator.definitions_['import_ce_go_hall'] = 'from ce_go import car';
|
generator.definitions_['import_ce_go_hall'] = 'from ce_go import car';
|
||||||
} else if (version == "mixgo_mini") {
|
} else if (version == "mixgo_mini") {
|
||||||
generator.definitions_['import_mini_go_hall'] = 'from mini_go import car';
|
generator.definitions_['import_mini_go_hall'] = 'from mini_go import car';
|
||||||
@@ -200,8 +189,7 @@ export const ce_go_pin_near = function (_, generator) {
|
|||||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
||||||
if (version == "mixgo_me" || version == "mixgo_cc") {
|
if (version == "mixgo_me" || version == "mixgo_cc") {
|
||||||
generator.definitions_['import_me_go_hall'] = 'from me_go import car';
|
generator.definitions_['import_me_go_hall'] = 'from me_go import car';
|
||||||
}
|
} else if (version == "mixgo_ce") {
|
||||||
else if (version == "mixgo_ce") {
|
|
||||||
generator.definitions_['import_ce_go_hall'] = 'from ce_go import car';
|
generator.definitions_['import_ce_go_hall'] = 'from ce_go import car';
|
||||||
} else if (version == "mixgo_mini") {
|
} else if (version == "mixgo_mini") {
|
||||||
generator.definitions_['import_mini_go_hall'] = 'from mini_go import car';
|
generator.definitions_['import_mini_go_hall'] = 'from mini_go import car';
|
||||||
@@ -215,8 +203,7 @@ export const ce_go_pin_near_state_change = function (_, generator) {
|
|||||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
||||||
if (version == "mixgo_me" || version == "mixgo_cc") {
|
if (version == "mixgo_me" || version == "mixgo_cc") {
|
||||||
generator.definitions_['import_me_go_hall'] = 'from me_go import car';
|
generator.definitions_['import_me_go_hall'] = 'from me_go import car';
|
||||||
}
|
} else if (version == "mixgo_ce") {
|
||||||
else if (version == "mixgo_ce") {
|
|
||||||
generator.definitions_['import_ce_go_hall'] = 'from ce_go import car';
|
generator.definitions_['import_ce_go_hall'] = 'from ce_go import car';
|
||||||
} else if (version == "mixgo_mini") {
|
} else if (version == "mixgo_mini") {
|
||||||
generator.definitions_['import_mini_go_hall'] = 'from mini_go import car';
|
generator.definitions_['import_mini_go_hall'] = 'from mini_go import car';
|
||||||
@@ -229,8 +216,7 @@ export const sensor_mixgome_eulerangles = function (_, generator) {
|
|||||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
||||||
if (version == "mixgo_me" || version == "mixgo_cc") {
|
if (version == "mixgo_me" || version == "mixgo_cc") {
|
||||||
generator.definitions_['import_mixgo_me_onboard_mxc6655xa'] = "from mixgo_me import onboard_mxc6655xa";
|
generator.definitions_['import_mixgo_me_onboard_mxc6655xa'] = "from mixgo_me import onboard_mxc6655xa";
|
||||||
}
|
} else if (version == "mixgo_ce") {
|
||||||
else if (version == "mixgo_ce") {
|
|
||||||
generator.definitions_['import_mixgo_ce_onboard_mxc6655xa'] = "from mixgo_ce import onboard_mxc6655xa";
|
generator.definitions_['import_mixgo_ce_onboard_mxc6655xa'] = "from mixgo_ce import onboard_mxc6655xa";
|
||||||
} else if (version == "mixgo_mini") {
|
} else if (version == "mixgo_mini") {
|
||||||
generator.definitions_['import_mini_onboard_mxc6655xa'] = 'from mini_go import onboard_mxc6655xa';
|
generator.definitions_['import_mini_onboard_mxc6655xa'] = 'from mini_go import onboard_mxc6655xa';
|
||||||
@@ -245,8 +231,7 @@ export const ce_go_pin_light = function (_, generator) {
|
|||||||
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
var version = Mixly.Boards.getSelectedBoardKey().split(':')[2]
|
||||||
if (version == "mixgo_me" || version == "mixgo_cc") {
|
if (version == "mixgo_me" || version == "mixgo_cc") {
|
||||||
generator.definitions_['import_me_go_hall'] = 'from me_go import car';
|
generator.definitions_['import_me_go_hall'] = 'from me_go import car';
|
||||||
}
|
} else if (version == "mixgo_ce") {
|
||||||
else if (version == "mixgo_ce") {
|
|
||||||
generator.definitions_['import_ce_go_hall'] = 'from ce_go import car';
|
generator.definitions_['import_ce_go_hall'] = 'from ce_go import car';
|
||||||
} else if (version == "mixgo_mini") {
|
} else if (version == "mixgo_mini") {
|
||||||
generator.definitions_['import_mini_go_hall'] = 'from mini_go import car';
|
generator.definitions_['import_mini_go_hall'] = 'from mini_go import car';
|
||||||
|
|||||||
@@ -50,7 +50,6 @@ export const communicate_i2c_master_read = function (block, generator) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const communicate_i2c_available = function (block, generator) {
|
export const communicate_i2c_available = function (block, generator) {
|
||||||
|
|
||||||
var name = generator.valueToCode(this, 'VAR', generator.ORDER_ATOMIC);
|
var name = generator.valueToCode(this, 'VAR', generator.ORDER_ATOMIC);
|
||||||
var code = "" + name + ".available()";
|
var code = "" + name + ".available()";
|
||||||
return [code, generator.ORDER_ATOMIC];
|
return [code, generator.ORDER_ATOMIC];
|
||||||
@@ -451,7 +450,15 @@ export const espnow_radio_recv = function (block, generator) {
|
|||||||
generator.definitions_['var_declare_ESPNow_radio'] = 'ESPNow_radio = radio.ESPNow()';
|
generator.definitions_['var_declare_ESPNow_radio'] = 'ESPNow_radio = radio.ESPNow()';
|
||||||
var doCode = generator.statementToCode(block, 'DO') || generator.PASS;
|
var doCode = generator.statementToCode(block, 'DO') || generator.PASS;
|
||||||
generator.definitions_['def_ESPNow_radio_recv'] = 'def ESPNow_radio_recv(mac,ESPNow_radio_msg):\n' + doCode;
|
generator.definitions_['def_ESPNow_radio_recv'] = 'def ESPNow_radio_recv(mac,ESPNow_radio_msg):\n' + doCode;
|
||||||
generator.definitions_['def_ESPNow_radio_recv_all'] = '_radio_msg_list = []\n' + 'def ESPNow_radio_recv_callback(mac,ESPNow_radio_msg):\n' + ' global _radio_msg_list\n' + ' try: ESPNow_radio_recv(mac,ESPNow_radio_msg)\n' + ' except: pass\n' + ' if str(ESPNow_radio_msg) in _radio_msg_list:\n' + " eval('radio_recv_' + bytes.decode(ubinascii.hexlify(ESPNow_radio_msg)) + '()')\n";
|
generator.definitions_['def_ESPNow_radio_recv_all'] = '_radio_msg_list = []\n'
|
||||||
|
+ 'def ESPNow_radio_recv_callback(mac,ESPNow_radio_msg):\n'
|
||||||
|
+ ' global _radio_msg_list\n'
|
||||||
|
+ ' try:\n'
|
||||||
|
+ ' ESPNow_radio_recv(mac,ESPNow_radio_msg)\n'
|
||||||
|
+ ' except:\n'
|
||||||
|
+ ' pass\n'
|
||||||
|
+ ' if str(ESPNow_radio_msg) in _radio_msg_list:\n'
|
||||||
|
+ " eval('radio_recv_' + bytes.decode(ubinascii.hexlify(ESPNow_radio_msg)) + '()')\n";
|
||||||
generator.definitions_['ESPNow_radio_recv_callback'] = "ESPNow_radio.recv_cb(ESPNow_radio_recv_callback)\n";
|
generator.definitions_['ESPNow_radio_recv_callback'] = "ESPNow_radio.recv_cb(ESPNow_radio_recv_callback)\n";
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
@@ -506,7 +513,15 @@ export const espnow_radio_recv_certain_msg = function (block, generator) {
|
|||||||
generator.definitions_['import_ubinascii'] = 'import ubinascii';
|
generator.definitions_['import_ubinascii'] = 'import ubinascii';
|
||||||
generator.definitions_['var_declare_ESPNow_radio'] = 'ESPNow_radio = radio.ESPNow()';
|
generator.definitions_['var_declare_ESPNow_radio'] = 'ESPNow_radio = radio.ESPNow()';
|
||||||
var doCode = generator.statementToCode(block, 'DO') || generator.PASS;
|
var doCode = generator.statementToCode(block, 'DO') || generator.PASS;
|
||||||
generator.definitions_['def_ESPNow_radio_recv_all'] = '_radio_msg_list = []\n' + 'def ESPNow_radio_recv_callback(mac,ESPNow_radio_msg):\n' + ' global _radio_msg_list\n' + ' try: ESPNow_radio_recv(mac,ESPNow_radio_msg)\n' + ' except: pass\n' + ' if str(ESPNow_radio_msg) in _radio_msg_list:\n' + " eval('radio_recv_' + bytes.decode(ubinascii.hexlify(ESPNow_radio_msg)) + '()')\n";
|
generator.definitions_['def_ESPNow_radio_recv_all'] = '_radio_msg_list = []\n'
|
||||||
|
+ 'def ESPNow_radio_recv_callback(mac,ESPNow_radio_msg):\n'
|
||||||
|
+ ' global _radio_msg_list\n'
|
||||||
|
+ ' try:\n'
|
||||||
|
+ ' ESPNow_radio_recv(mac,ESPNow_radio_msg)\n'
|
||||||
|
+ ' except:\n'
|
||||||
|
+ ' pass\n'
|
||||||
|
+ ' if str(ESPNow_radio_msg) in _radio_msg_list:\n'
|
||||||
|
+ " eval('radio_recv_' + bytes.decode(ubinascii.hexlify(ESPNow_radio_msg)) + '()')\n";
|
||||||
generator.definitions_['ESPNow_radio_recv_callback'] = "ESPNow_radio.recv_cb(ESPNow_radio_recv_callback)\n";
|
generator.definitions_['ESPNow_radio_recv_callback'] = "ESPNow_radio.recv_cb(ESPNow_radio_recv_callback)\n";
|
||||||
var message = block.getFieldValue('msg');
|
var message = block.getFieldValue('msg');
|
||||||
var message_utf8 = toUTF8Hex(message);
|
var message_utf8 = toUTF8Hex(message);
|
||||||
|
|||||||
@@ -302,8 +302,7 @@ export const image_arithmetic = function (block, generator) {
|
|||||||
var code = '';
|
var code = '';
|
||||||
if (op == 'INTERSECTION') {
|
if (op == 'INTERSECTION') {
|
||||||
code = imga + '-(' + imga + '-' + imgb + ')';
|
code = imga + '-(' + imga + '-' + imgb + ')';
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
code = imga + op + imgb;
|
code = imga + op + imgb;
|
||||||
}
|
}
|
||||||
return [code, generator.ORDER_ATOMIC];
|
return [code, generator.ORDER_ATOMIC];
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ export const display_show_image_or_string_delay = function (_, generator) {
|
|||||||
var code = "onboard_tft.shows(" + data + ", space=" + space + ', center=' + op + ")\n";
|
var code = "onboard_tft.shows(" + data + ", space=" + space + ', center=' + op + ")\n";
|
||||||
return code;
|
return code;
|
||||||
} else if (version == "educore") {
|
} else if (version == "educore") {
|
||||||
generator.definitions_['import_' + version + 'oled'] = "from " + version + " import oled";
|
generator.definitions_['import_' + version + '_oled'] = "from " + version + " import oled";
|
||||||
var code = "oled.print(" + data + ', space=' + space + ', center=' + op + ")\n";
|
var code = "oled.print(" + data + ', space=' + space + ', center=' + op + ")\n";
|
||||||
}
|
}
|
||||||
generator.definitions_['import_' + version + '_onboard_matrix'] = "from " + version + " import onboard_matrix";
|
generator.definitions_['import_' + version + '_onboard_matrix'] = "from " + version + " import onboard_matrix";
|
||||||
@@ -54,7 +54,6 @@ export const display_show_frame_string = function (_, generator) {
|
|||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export const display_show_frame_string_delay = function (_, generator) {
|
export const display_show_frame_string_delay = function (_, generator) {
|
||||||
var version = Boards.getSelectedBoardKey().split(':')[2];
|
var version = Boards.getSelectedBoardKey().split(':')[2];
|
||||||
var data = generator.valueToCode(this, 'data', generator.ORDER_ASSIGNMENT);
|
var data = generator.valueToCode(this, 'data', generator.ORDER_ASSIGNMENT);
|
||||||
@@ -101,7 +100,6 @@ export const display_scroll_string_delay = function (_, generator) {
|
|||||||
var code = "onboard_oled.scroll(" + data + ', speed=' + time + ', space=' + space + ")\n";
|
var code = "onboard_oled.scroll(" + data + ', speed=' + time + ', space=' + space + ")\n";
|
||||||
} else if (version == 'mixgo_nova') {
|
} else if (version == 'mixgo_nova') {
|
||||||
generator.definitions_['import_' + version + '_onboard_tft'] = "from " + version + " import onboard_tft";
|
generator.definitions_['import_' + version + '_onboard_tft'] = "from " + version + " import onboard_tft";
|
||||||
var color = generator.valueToCode(this, 'VAR', generator.ORDER_ATOMIC);
|
|
||||||
var code = "onboard_tft.scroll(" + data + ', y=0, size=5, speed=' + time + ', space=' + space + ', color=0xffff)\n';
|
var code = "onboard_tft.scroll(" + data + ', y=0, size=5, speed=' + time + ', space=' + space + ', color=0xffff)\n';
|
||||||
} else {
|
} else {
|
||||||
generator.definitions_['import_' + version + '_onboard_matrix'] = "from " + version + " import onboard_matrix";
|
generator.definitions_['import_' + version + '_onboard_matrix'] = "from " + version + " import onboard_matrix";
|
||||||
@@ -211,7 +209,6 @@ export const display_image_create = function (block, generator) {
|
|||||||
correct = 55 - j
|
correct = 55 - j
|
||||||
}
|
}
|
||||||
colorNum += Number(colours[block.getFieldValue(i + '-' + j)]) * Math.pow(2, 31 - correct);
|
colorNum += Number(colours[block.getFieldValue(i + '-' + j)]) * Math.pow(2, 31 - correct);
|
||||||
|
|
||||||
}
|
}
|
||||||
colorRow += pad(colorNum.toString(16));
|
colorRow += pad(colorNum.toString(16));
|
||||||
colorList.unshift(colorRow);
|
colorList.unshift(colorRow);
|
||||||
|
|||||||
@@ -198,7 +198,6 @@ export const requests_get = function (_, generator) {
|
|||||||
Blockly.Variables.NAME_TYPE);
|
Blockly.Variables.NAME_TYPE);
|
||||||
var str = generator.valueToCode(this, 'DOMAIN', generator.ORDER_ATOMIC);
|
var str = generator.valueToCode(this, 'DOMAIN', generator.ORDER_ATOMIC);
|
||||||
var code = varName + '= ' + 'requests.get(' + str + ')\n';
|
var code = varName + '= ' + 'requests.get(' + str + ')\n';
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,7 +235,6 @@ export const requests_get2 = function (_, generator) {
|
|||||||
var str = generator.valueToCode(this, 'URL', generator.ORDER_ATOMIC);
|
var str = generator.valueToCode(this, 'URL', generator.ORDER_ATOMIC);
|
||||||
var code = 'urequests.' + dropdown_type + '(' + str + ')';
|
var code = 'urequests.' + dropdown_type + '(' + str + ')';
|
||||||
return [code, generator.ORDER_ATOMIC];
|
return [code, generator.ORDER_ATOMIC];
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const requests_attribute2 = function (_, generator) {
|
export const requests_attribute2 = function (_, generator) {
|
||||||
|
|||||||
@@ -363,14 +363,11 @@ export const sensor_ucs12071_extern = function (_, generator) {
|
|||||||
generator.definitions_['import_ucs12071'] = 'import ucs12071';
|
generator.definitions_['import_ucs12071'] = 'import ucs12071';
|
||||||
if (key == '0') {
|
if (key == '0') {
|
||||||
var code = sub + '.color()';
|
var code = sub + '.color()';
|
||||||
}
|
} else if (key == '1') {
|
||||||
else if (key == '1') {
|
|
||||||
var code = sub + '.color_raw()';
|
var code = sub + '.color_raw()';
|
||||||
}
|
} else if (key == '2') {
|
||||||
else if (key == '2') {
|
|
||||||
var code = sub + '.als()';
|
var code = sub + '.als()';
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
var code = sub + '.ir()';
|
var code = sub + '.ir()';
|
||||||
}
|
}
|
||||||
return [code, generator.ORDER_ATOMIC];
|
return [code, generator.ORDER_ATOMIC];
|
||||||
@@ -524,8 +521,7 @@ export const weather_set_label = function (_, generator) {
|
|||||||
var code = new Array(this.itemCount_);
|
var code = new Array(this.itemCount_);
|
||||||
var default_value = '0';
|
var default_value = '0';
|
||||||
for (var n = 0; n < this.itemCount_; n++) {
|
for (var n = 0; n < this.itemCount_; n++) {
|
||||||
code[n] = generator.valueToCode(this, 'ADD' + n,
|
code[n] = generator.valueToCode(this, 'ADD' + n, generator.ORDER_NONE) || default_value;
|
||||||
generator.ORDER_NONE) || default_value;
|
|
||||||
}
|
}
|
||||||
var code = sub + '.label(' + code.join(', ') + ')\n';
|
var code = sub + '.label(' + code.join(', ') + ')\n';
|
||||||
return code;
|
return code;
|
||||||
|
|||||||
@@ -98,13 +98,10 @@ export const system_print_end = function (_, generator) {
|
|||||||
export const system_print_many = function (_, generator) {
|
export const system_print_many = function (_, generator) {
|
||||||
var code = new Array(this.itemCount_);
|
var code = new Array(this.itemCount_);
|
||||||
var default_value = '0';
|
var default_value = '0';
|
||||||
|
|
||||||
for (var n = 0; n < this.itemCount_; n++) {
|
for (var n = 0; n < this.itemCount_; n++) {
|
||||||
|
|
||||||
code[n] = generator.valueToCode(this, 'ADD' + n,
|
code[n] = generator.valueToCode(this, 'ADD' + n,
|
||||||
generator.ORDER_NONE) || default_value;
|
generator.ORDER_NONE) || default_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
var code = 'print(' + code.join(', ') + ')\n';
|
var code = 'print(' + code.join(', ') + ')\n';
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,8 +40,7 @@ export const Weather_now_content = function (_, generator) {
|
|||||||
var content = this.getFieldValue('content');
|
var content = this.getFieldValue('content');
|
||||||
if (content == 'none') {
|
if (content == 'none') {
|
||||||
var code = 'Weather_now.analysis()';
|
var code = 'Weather_now.analysis()';
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
var code = 'Weather_now.analysis("' + content + '")';
|
var code = 'Weather_now.analysis("' + content + '")';
|
||||||
}
|
}
|
||||||
return [code, generator.ORDER_ATOMIC];
|
return [code, generator.ORDER_ATOMIC];
|
||||||
@@ -52,8 +51,7 @@ export const Air_now_content = function (_, generator) {
|
|||||||
var content = this.getFieldValue('content');
|
var content = this.getFieldValue('content');
|
||||||
if (content == 'none') {
|
if (content == 'none') {
|
||||||
var code = 'Air_now.analysis()';
|
var code = 'Air_now.analysis()';
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
var code = 'Air_now.analysis("' + content + '")';
|
var code = 'Air_now.analysis("' + content + '")';
|
||||||
}
|
}
|
||||||
return [code, generator.ORDER_ATOMIC];
|
return [code, generator.ORDER_ATOMIC];
|
||||||
@@ -64,8 +62,7 @@ export const Weather_alarm_content = function (_, generator) {
|
|||||||
var content = this.getFieldValue('content');
|
var content = this.getFieldValue('content');
|
||||||
if (content == 'none') {
|
if (content == 'none') {
|
||||||
var code = 'Weather_alarm.analysis()';
|
var code = 'Weather_alarm.analysis()';
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
var code = 'Weather_alarm.analysis("' + content + '")';
|
var code = 'Weather_alarm.analysis("' + content + '")';
|
||||||
}
|
}
|
||||||
return [code, generator.ORDER_ATOMIC];
|
return [code, generator.ORDER_ATOMIC];
|
||||||
@@ -76,8 +73,7 @@ export const Life_suggestion_content = function (_, generator) {
|
|||||||
var content = this.getFieldValue('content');
|
var content = this.getFieldValue('content');
|
||||||
if (content == 'none') {
|
if (content == 'none') {
|
||||||
var code = 'Life_suggestion.analysis()';
|
var code = 'Life_suggestion.analysis()';
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
var code = 'Life_suggestion.analysis("' + content + '")';
|
var code = 'Life_suggestion.analysis("' + content + '")';
|
||||||
}
|
}
|
||||||
return [code, generator.ORDER_ATOMIC];
|
return [code, generator.ORDER_ATOMIC];
|
||||||
@@ -88,8 +84,7 @@ export const Tide_daily_content = function (_, generator) {
|
|||||||
var content = this.getFieldValue('content');
|
var content = this.getFieldValue('content');
|
||||||
if (content == 'none') {
|
if (content == 'none') {
|
||||||
var code = 'Tide_daily.analysis()';
|
var code = 'Tide_daily.analysis()';
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
var code = 'Tide_daily.analysis("' + content + '")';
|
var code = 'Tide_daily.analysis("' + content + '")';
|
||||||
}
|
}
|
||||||
return [code, generator.ORDER_ATOMIC];
|
return [code, generator.ORDER_ATOMIC];
|
||||||
@@ -100,8 +95,7 @@ export const Location_search_content = function (_, generator) {
|
|||||||
var content = this.getFieldValue('content');
|
var content = this.getFieldValue('content');
|
||||||
if (content == 'none') {
|
if (content == 'none') {
|
||||||
var code = 'Location_search.analysis()';
|
var code = 'Location_search.analysis()';
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
var code = 'Location_search.analysis("' + content + '")';
|
var code = 'Location_search.analysis("' + content + '")';
|
||||||
}
|
}
|
||||||
return [code, generator.ORDER_ATOMIC];
|
return [code, generator.ORDER_ATOMIC];
|
||||||
@@ -123,8 +117,7 @@ export const Weather_daily_content = function (_, generator) {
|
|||||||
var day = generator.valueToCode(this, 'day', generator.ORDER_ATOMIC);
|
var day = generator.valueToCode(this, 'day', generator.ORDER_ATOMIC);
|
||||||
if (content == 'none') {
|
if (content == 'none') {
|
||||||
var code = 'Weather_daily.analysis(' + day + ')';
|
var code = 'Weather_daily.analysis(' + day + ')';
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
var code = 'Weather_daily.analysis(' + day + ', "' + content + '")';
|
var code = 'Weather_daily.analysis(' + day + ', "' + content + '")';
|
||||||
}
|
}
|
||||||
return [code, generator.ORDER_ATOMIC];
|
return [code, generator.ORDER_ATOMIC];
|
||||||
@@ -136,8 +129,7 @@ export const Air_daily_content = function (_, generator) {
|
|||||||
var day = generator.valueToCode(this, 'day', generator.ORDER_ATOMIC);
|
var day = generator.valueToCode(this, 'day', generator.ORDER_ATOMIC);
|
||||||
if (content == 'none') {
|
if (content == 'none') {
|
||||||
var code = 'Air_daily.analysis(' + day + ')';
|
var code = 'Air_daily.analysis(' + day + ')';
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
var code = 'Air_daily.analysis(' + day + ', "' + content + '")';
|
var code = 'Air_daily.analysis(' + day + ', "' + content + '")';
|
||||||
}
|
}
|
||||||
return [code, generator.ORDER_ATOMIC];
|
return [code, generator.ORDER_ATOMIC];
|
||||||
@@ -149,8 +141,7 @@ export const Geo_sun_content = function (_, generator) {
|
|||||||
var day = generator.valueToCode(this, 'day', generator.ORDER_ATOMIC);
|
var day = generator.valueToCode(this, 'day', generator.ORDER_ATOMIC);
|
||||||
if (content == 'none') {
|
if (content == 'none') {
|
||||||
var code = 'Geo_sun.analysis(' + day + ')';
|
var code = 'Geo_sun.analysis(' + day + ')';
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
var code = 'Geo_sun.analysis(' + day + ', "' + content + '")';
|
var code = 'Geo_sun.analysis(' + day + ', "' + content + '")';
|
||||||
}
|
}
|
||||||
return [code, generator.ORDER_ATOMIC];
|
return [code, generator.ORDER_ATOMIC];
|
||||||
@@ -162,8 +153,7 @@ export const Geo_moon_content = function (_, generator) {
|
|||||||
var day = generator.valueToCode(this, 'day', generator.ORDER_ATOMIC);
|
var day = generator.valueToCode(this, 'day', generator.ORDER_ATOMIC);
|
||||||
if (content == 'none') {
|
if (content == 'none') {
|
||||||
var code = 'Geo_moon.analysis(' + day + ')';
|
var code = 'Geo_moon.analysis(' + day + ')';
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
var code = 'Geo_moon.analysis(' + day + ', "' + content + '")';
|
var code = 'Geo_moon.analysis(' + day + ', "' + content + '")';
|
||||||
}
|
}
|
||||||
return [code, generator.ORDER_ATOMIC];
|
return [code, generator.ORDER_ATOMIC];
|
||||||
|
|||||||
Reference in New Issue
Block a user