refactor(boards): 规范化arduino板卡代码
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -2,22 +2,23 @@ import * as Blockly from 'blockly/core';
|
||||
|
||||
const TEXTS_HUE = 160;
|
||||
|
||||
|
||||
export const text_base64_url_codec = {
|
||||
init: function () {
|
||||
this.appendValueInput("VALUE")
|
||||
this.appendValueInput('VALUE')
|
||||
.setCheck(null)
|
||||
.setAlign(Blockly.inputs.Align.LEFT)
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
["Base64", "BASE64"],
|
||||
["URL", "URL"]
|
||||
]), "TYPE")
|
||||
['Base64', 'BASE64'],
|
||||
['URL', 'URL']
|
||||
]), 'TYPE')
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
["编码", "ENCODE"],
|
||||
["解码", "DECODE"]
|
||||
]), "OPTION");
|
||||
[Blockly.Msg.MIXPY_TEXT_ENCODE, 'ENCODE'],
|
||||
[Blockly.Msg.MIXPY_TEXT_DECODE, 'DECODE']
|
||||
]), 'OPTION');
|
||||
this.setOutput(true, null);
|
||||
this.setColour(TEXTS_HUE);
|
||||
this.setTooltip("");
|
||||
this.setHelpUrl("");
|
||||
this.setTooltip('');
|
||||
this.setHelpUrl('');
|
||||
}
|
||||
};
|
||||
@@ -1,21 +1,21 @@
|
||||
import * as Blockly from 'blockly/core';
|
||||
import { Variables } from 'blockly/core';
|
||||
|
||||
|
||||
const VARIABLES_HUE = 330;
|
||||
|
||||
// ************************************************************************
|
||||
// THIS SECTION IS INSERTED INTO BLOCKLY BY BLOCKLYDUINO.
|
||||
|
||||
export const variables_declare = {
|
||||
// Variable setter.
|
||||
init: function () {
|
||||
this.setColour(VARIABLES_HUE);
|
||||
this.appendValueInput('VALUE', null)
|
||||
.appendField(Blockly.Msg.MIXLY_DECLARE)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_GLOBAL_VARIABLE, "global_variate"], [Blockly.Msg.MIXLY_LOCAL_VARIABLE, "local_variate"]]), "variables_type")
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_GLOBAL_VARIABLE, 'global_variate'],
|
||||
[Blockly.Msg.MIXLY_LOCAL_VARIABLE, 'local_variate']
|
||||
]), 'variables_type')
|
||||
.appendField(new Blockly.FieldTextInput('item'), 'VAR')
|
||||
.appendField(Blockly.Msg.MIXLY_AS)
|
||||
.appendField(new Blockly.FieldDropdown(Variables.DATA_TYPE), "TYPE")
|
||||
.appendField(new Blockly.FieldDropdown(Variables.DATA_TYPE), 'TYPE')
|
||||
.appendField(Blockly.Msg.MIXLY_VALUE);
|
||||
this.setPreviousStatement(true);
|
||||
this.setNextStatement(true);
|
||||
@@ -30,7 +30,6 @@ export const variables_declare = {
|
||||
}
|
||||
}
|
||||
};
|
||||
// ************************************************************************
|
||||
|
||||
export const variables_get = {
|
||||
init: function () {
|
||||
@@ -47,15 +46,7 @@ export const variables_get = {
|
||||
if (Blockly.Names.equals(oldName, this.getFieldValue('VAR'))) {
|
||||
this.setFieldValue(newName, 'VAR');
|
||||
}
|
||||
}/*,
|
||||
onchange: function() {
|
||||
var varName = Blockly.Arduino.variableDB_.getName(this.getFieldValue('VAR'),Blockly.Variables.NAME_TYPE);
|
||||
if(Blockly.Arduino.definitions_['var_declare'+varName]){
|
||||
this.setWarningText(null);
|
||||
}else{
|
||||
this.setWarningText(Blockly.Msg.MIXLY_WARNING_NOT_DECLARE);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
};
|
||||
|
||||
export const variables_set = {
|
||||
@@ -77,6 +68,7 @@ export const variables_set = {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Block for basic data type change.
|
||||
* @this Blockly.Block
|
||||
@@ -90,8 +82,4 @@ export const variables_change = {
|
||||
this.setOutput(true);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_VARIABLES_CHANGE);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
1185
boards/default_src/arduino/templates/json/cities.json
Normal file
1185
boards/default_src/arduino/templates/json/cities.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -128,17 +128,53 @@ export const servo_read_degrees1 = {
|
||||
}
|
||||
};
|
||||
|
||||
var TONE_NOTES = [["NOTE_C3", "131"], ["NOTE_D3", "147"], ["NOTE_E3", "165"], ["NOTE_F3", "175"], ["NOTE_G3", "196"], ["NOTE_A3", "220"], ["NOTE_B3", "247"], ["NOTE_C4", "262"], ["NOTE_D4", "294"], ["NOTE_E4", "330"], ["NOTE_F4", "349"], ["NOTE_G4", "392"], ["NOTE_A4", "440"], ["NOTE_B4", "494"], ["NOTE_C5", "523"], ["NOTE_D5", "587"], ["NOTE_E5", "659"], ["NOTE_F5", "698"], ["NOTE_G5", "784"], ["NOTE_A5", "880"], ["NOTE_B5", "988"], ["NOTE_C6", "1047"], ["NOTE_D6", "1175"], ["NOTE_E6", "1319"], ["NOTE_F6", "1397"], ["NOTE_G6", "1568"], ["NOTE_A6", "1760"], ["NOTE_B6", "1976"], ["NOTE_C7", "2093"], ["NOTE_D7", "2349"], ["NOTE_E7", "2637"], ["NOTE_F7", "2794"], ["NOTE_G7", "3136"], ["NOTE_A7", "3520"], ["NOTE_B7", "3951"]];
|
||||
|
||||
export const tone_notes = {
|
||||
init: function () {
|
||||
this.setColour(ACTUATOR_HUE);
|
||||
this.appendDummyInput("")
|
||||
.appendField(new Blockly.FieldDropdown(TONE_NOTES), 'STAT');
|
||||
.appendField(new Blockly.FieldDropdown(this.TONE_NOTES), 'STAT');
|
||||
this.setOutput(true, Number);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_TONE_NOTE);
|
||||
}
|
||||
},
|
||||
TONE_NOTES: [
|
||||
["NOTE_C3", "131"],
|
||||
["NOTE_D3", "147"],
|
||||
["NOTE_E3", "165"],
|
||||
["NOTE_F3", "175"],
|
||||
["NOTE_G3", "196"],
|
||||
["NOTE_A3", "220"],
|
||||
["NOTE_B3", "247"],
|
||||
["NOTE_C4", "262"],
|
||||
["NOTE_D4", "294"],
|
||||
["NOTE_E4", "330"],
|
||||
["NOTE_F4", "349"],
|
||||
["NOTE_G4", "392"],
|
||||
["NOTE_A4", "440"],
|
||||
["NOTE_B4", "494"],
|
||||
["NOTE_C5", "523"],
|
||||
["NOTE_D5", "587"],
|
||||
["NOTE_E5", "659"],
|
||||
["NOTE_F5", "698"],
|
||||
["NOTE_G5", "784"],
|
||||
["NOTE_A5", "880"],
|
||||
["NOTE_B5", "988"],
|
||||
["NOTE_C6", "1047"],
|
||||
["NOTE_D6", "1175"],
|
||||
["NOTE_E6", "1319"],
|
||||
["NOTE_F6", "1397"],
|
||||
["NOTE_G6", "1568"],
|
||||
["NOTE_A6", "1760"],
|
||||
["NOTE_B6", "1976"],
|
||||
["NOTE_C7", "2093"],
|
||||
["NOTE_D7", "2349"],
|
||||
["NOTE_E7", "2637"],
|
||||
["NOTE_F7", "2794"],
|
||||
["NOTE_G7", "3136"],
|
||||
["NOTE_A7", "3520"],
|
||||
["NOTE_B7", "3951"]
|
||||
]
|
||||
};
|
||||
|
||||
export const controls_tone = {
|
||||
init: function () {
|
||||
this.setColour(ACTUATOR_HUE);
|
||||
@@ -156,6 +192,7 @@ export const controls_tone = {
|
||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_BLOCKGROUP_TONE);
|
||||
}
|
||||
};
|
||||
|
||||
export const controls_notone = {
|
||||
init: function () {
|
||||
this.setColour(ACTUATOR_HUE);
|
||||
@@ -169,6 +206,7 @@ export const controls_notone = {
|
||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_BLOCKGROUP_NOTONE);
|
||||
}
|
||||
};
|
||||
|
||||
export const controls_tone_noTimer = {
|
||||
init: function () {
|
||||
this.setColour(ACTUATOR_HUE);
|
||||
@@ -233,7 +271,7 @@ export const group_stepper_setup = {
|
||||
this.setNextStatement(true, null);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_STEPPER_STEP);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const group_stepper_setup2 = {
|
||||
init: function () {
|
||||
@@ -269,7 +307,7 @@ export const group_stepper_setup2 = {
|
||||
this.setNextStatement(true, null);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_STEPPER_STEP2);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const group_stepper_move = {
|
||||
init: function () {
|
||||
@@ -286,8 +324,7 @@ export const group_stepper_move = {
|
||||
this.setInputsInline(true);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_STEPPER_MOVE);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
export const RGB_color_seclet = {
|
||||
init: function () {
|
||||
@@ -322,12 +359,6 @@ export const RGB_color_rgb = {
|
||||
}
|
||||
};
|
||||
|
||||
var DISPLAY_RGB_TYPE = [
|
||||
["NEO_GRB", "NEO_GRB"],
|
||||
["NEO_RGB", "NEO_RGB"],
|
||||
["NEO_RGBW", "NEO_RGBW"]
|
||||
];
|
||||
|
||||
//RGB
|
||||
export const display_rgb_init = {
|
||||
init: function () {
|
||||
@@ -339,7 +370,7 @@ export const display_rgb_init = {
|
||||
.setAlign(Blockly.inputs.Align.RIGHT);
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_MICROPYTHON_SOCKET_TYPE)
|
||||
.appendField(new Blockly.FieldDropdown(DISPLAY_RGB_TYPE), "TYPE");
|
||||
.appendField(new Blockly.FieldDropdown(this.DISPLAY_RGB_TYPE), "TYPE");
|
||||
this.appendValueInput("LEDCOUNT")
|
||||
.setCheck(Number)
|
||||
.setAlign(Blockly.inputs.Align.RIGHT)
|
||||
@@ -349,7 +380,12 @@ export const display_rgb_init = {
|
||||
this.setNextStatement(true, null);
|
||||
this.setTooltip('');
|
||||
// this.setFieldValue("12", "PIN");
|
||||
}
|
||||
},
|
||||
DISPLAY_RGB_TYPE: [
|
||||
["NEO_GRB", "NEO_GRB"],
|
||||
["NEO_RGB", "NEO_RGB"],
|
||||
["NEO_RGBW", "NEO_RGBW"]
|
||||
]
|
||||
};
|
||||
|
||||
export const display_rgb_Brightness = {
|
||||
@@ -372,7 +408,6 @@ export const display_rgb_Brightness = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export const display_rgb = {
|
||||
init: function () {
|
||||
this.setColour(ACTUATOR_HUE);
|
||||
@@ -411,12 +446,6 @@ export const display_rgb_show = {
|
||||
}
|
||||
};
|
||||
|
||||
var DISPLAY_RAINBOW_TYPE = [
|
||||
[Blockly.Msg.MIXLY_RGB_DISPLAY_RAINBOW_TYPE_1, "normal"],
|
||||
[Blockly.Msg.MIXLY_RGB_DISPLAY_RAINBOW_TYPE_2, "change"]
|
||||
];
|
||||
|
||||
|
||||
export const display_rgb_rainbow1 = {
|
||||
init: function () {
|
||||
this.setColour(ACTUATOR_HUE);
|
||||
@@ -463,7 +492,7 @@ export const display_rgb_rainbow3 = {
|
||||
.appendField(new Blockly.FieldDropdown(Profile.default.digital), "PIN")
|
||||
.setAlign(Blockly.inputs.Align.RIGHT);
|
||||
this.appendDummyInput("")
|
||||
.appendField(new Blockly.FieldDropdown(DISPLAY_RAINBOW_TYPE), "TYPE");
|
||||
.appendField(new Blockly.FieldDropdown(this.DISPLAY_RAINBOW_TYPE), "TYPE");
|
||||
this.appendValueInput("rainbow_color")
|
||||
.setCheck(Number)
|
||||
.setAlign(Blockly.inputs.Align.RIGHT)
|
||||
@@ -472,7 +501,11 @@ export const display_rgb_rainbow3 = {
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
// this.setFieldValue("12", "PIN");
|
||||
}
|
||||
},
|
||||
DISPLAY_RAINBOW_TYPE: [
|
||||
[Blockly.Msg.MIXLY_RGB_DISPLAY_RAINBOW_TYPE_1, "normal"],
|
||||
[Blockly.Msg.MIXLY_RGB_DISPLAY_RAINBOW_TYPE_2, "change"]
|
||||
]
|
||||
};
|
||||
|
||||
export const RGB_color_HSV = {
|
||||
@@ -505,18 +538,13 @@ export const RGB_color_HSV = {
|
||||
this.setTooltip('色调范围0-65536;饱和度范围0-255;明度范围0-255');
|
||||
}
|
||||
};
|
||||
//电机驱动类型
|
||||
var MOTOR_TYPE = [
|
||||
["L293", "L293"],
|
||||
["L298", "L298"],
|
||||
["TB6612FNG", "TB6612FNG"]
|
||||
];
|
||||
|
||||
export const Mixly_motor = {
|
||||
init: function () {
|
||||
this.setColour(ACTUATOR_HUE);
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_MOTOR)
|
||||
.appendField(new Blockly.FieldDropdown(MOTOR_TYPE), "MOTOR_TYPE");
|
||||
.appendField(new Blockly.FieldDropdown(this.MOTOR_TYPE), "MOTOR_TYPE");
|
||||
this.appendDummyInput("")
|
||||
this.appendValueInput("PIN1")
|
||||
.setCheck(Number)
|
||||
@@ -536,8 +564,14 @@ export const Mixly_motor = {
|
||||
this.setInputsInline(true);
|
||||
this.setPreviousStatement(true);
|
||||
this.setNextStatement(true);
|
||||
}
|
||||
},
|
||||
MOTOR_TYPE: [
|
||||
["L293", "L293"],
|
||||
["L298", "L298"],
|
||||
["TB6612FNG", "TB6612FNG"]
|
||||
]
|
||||
};
|
||||
|
||||
export const Motor_8833 = {
|
||||
init: function () {
|
||||
this.setColour(ACTUATOR_HUE);
|
||||
@@ -562,23 +596,6 @@ export const Motor_8833 = {
|
||||
}
|
||||
};
|
||||
|
||||
//MP3播放控制
|
||||
var GD5800_MP3_CONTROL_TYPE = [
|
||||
[Blockly.Msg.MIXLY_MP3_PLAY, "play();"],
|
||||
[Blockly.Msg.MIXLY_MP3_PAUSE, "pause();"],
|
||||
[Blockly.Msg.MIXLY_MP3_NEXT, "next();"],
|
||||
[Blockly.Msg.MIXLY_MP3_PREV, "prev();"],
|
||||
[Blockly.Msg.MIXLY_MP3_VOL_UP, "volumeUp();"],
|
||||
[Blockly.Msg.MIXLY_MP3_VOL_DOWN, "volumeDn();"]
|
||||
];
|
||||
|
||||
//MP3 GD5800 设置设备USB/Flash
|
||||
var GD5800_MP3_Device = [
|
||||
["Flash", "MP3_DEVICE_FLASH"],//内部Flash
|
||||
[Blockly.Msg.MIXLY_MP3_UDISK, "MP3_DEVICE_UDISK"]//外部U盘
|
||||
];
|
||||
|
||||
|
||||
//GD5800 MP3播放设备选择
|
||||
export const GD5800_MP3_Set_Device = {
|
||||
init: function () {
|
||||
@@ -594,13 +611,17 @@ export const GD5800_MP3_Set_Device = {
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_MP3_SOURCE)
|
||||
.appendField(Blockly.Msg.MIXLY_STAT)
|
||||
.appendField(new Blockly.FieldDropdown(GD5800_MP3_Device), "DEVICEID");
|
||||
.appendField(new Blockly.FieldDropdown(this.GD5800_MP3_Device), "DEVICEID");
|
||||
this.setInputsInline(true);
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setTooltip();
|
||||
this.setHelpUrl();
|
||||
}
|
||||
},
|
||||
GD5800_MP3_Device: [
|
||||
["Flash", "MP3_DEVICE_FLASH"],//内部Flash
|
||||
[Blockly.Msg.MIXLY_MP3_UDISK, "MP3_DEVICE_UDISK"]//外部U盘
|
||||
]
|
||||
};
|
||||
|
||||
//GD5800 MP3模块
|
||||
@@ -617,23 +638,23 @@ export const GD5800_MP3_CONTROL = {
|
||||
.setCheck(Number);
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_STAT)
|
||||
.appendField(new Blockly.FieldDropdown(GD5800_MP3_CONTROL_TYPE), "CONTROL_TYPE");
|
||||
.appendField(new Blockly.FieldDropdown(this.GD5800_MP3_CONTROL_TYPE), "CONTROL_TYPE");
|
||||
this.setInputsInline(true);
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setTooltip();
|
||||
this.setHelpUrl();
|
||||
}
|
||||
},
|
||||
GD5800_MP3_CONTROL_TYPE: [
|
||||
[Blockly.Msg.MIXLY_MP3_PLAY, "play();"],
|
||||
[Blockly.Msg.MIXLY_MP3_PAUSE, "pause();"],
|
||||
[Blockly.Msg.MIXLY_MP3_NEXT, "next();"],
|
||||
[Blockly.Msg.MIXLY_MP3_PREV, "prev();"],
|
||||
[Blockly.Msg.MIXLY_MP3_VOL_UP, "volumeUp();"],
|
||||
[Blockly.Msg.MIXLY_MP3_VOL_DOWN, "volumeDn();"]
|
||||
]
|
||||
};
|
||||
|
||||
//MP3循环模式
|
||||
var GD5800_MP3_LOOP_MODE_TYPE = [
|
||||
[Blockly.Msg.MIXLY_MP3_LOOP_ALL, "MP3_LOOP_ALL"],
|
||||
[Blockly.Msg.MIXLY_MP3_LOOP_FOLDER, "MP3_LOOP_FOLDER"],
|
||||
[Blockly.Msg.MIXLY_MP3_LOOP_ONE, "MP3_LOOP_ONE"],
|
||||
[Blockly.Msg.MIXLY_MP3_LOOP_RAM, "MP3_LOOP_RAM"]
|
||||
];
|
||||
|
||||
//GD5800 MP3模块循环模式
|
||||
export const GD5800_MP3_LOOP_MODE = {
|
||||
init: function () {
|
||||
@@ -649,25 +670,21 @@ export const GD5800_MP3_LOOP_MODE = {
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_MP3_LOOP_MODE)
|
||||
.appendField(Blockly.Msg.MIXLY_STAT)
|
||||
.appendField(new Blockly.FieldDropdown(GD5800_MP3_LOOP_MODE_TYPE), "LOOP_MODE");
|
||||
.appendField(new Blockly.FieldDropdown(this.GD5800_MP3_LOOP_MODE_TYPE), "LOOP_MODE");
|
||||
this.setInputsInline(true);
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setTooltip();
|
||||
this.setHelpUrl();
|
||||
}
|
||||
},
|
||||
GD5800_MP3_LOOP_MODE_TYPE: [
|
||||
[Blockly.Msg.MIXLY_MP3_LOOP_ALL, "MP3_LOOP_ALL"],
|
||||
[Blockly.Msg.MIXLY_MP3_LOOP_FOLDER, "MP3_LOOP_FOLDER"],
|
||||
[Blockly.Msg.MIXLY_MP3_LOOP_ONE, "MP3_LOOP_ONE"],
|
||||
[Blockly.Msg.MIXLY_MP3_LOOP_RAM, "MP3_LOOP_RAM"]
|
||||
]
|
||||
};
|
||||
|
||||
//MP3 设置EQ
|
||||
var GD5800_MP3_EQ_MODE_TYPE = [
|
||||
[Blockly.Msg.MIXLY_MP3_EQ_NORMAL, "MP3_EQ_NORMAL"],
|
||||
[Blockly.Msg.MIXLY_MP3_EQ_POP, "MP3_EQ_POP"],
|
||||
[Blockly.Msg.MIXLY_MP3_EQ_ROCK, "MP3_EQ_ROCK"],
|
||||
[Blockly.Msg.MIXLY_MP3_EQ_JAZZ, "MP3_EQ_JAZZ"],
|
||||
[Blockly.Msg.MIXLY_MP3_EQ_CLASSIC, "MP3_EQ_CLASSIC"],
|
||||
[Blockly.Msg.MIXLY_MP3_EQ_BASS, "MP3_EQ_BASS"]
|
||||
];
|
||||
|
||||
//GD5800 MP3模块EQ模式
|
||||
export const GD5800_MP3_EQ_MODE = {
|
||||
init: function () {
|
||||
@@ -683,13 +700,21 @@ export const GD5800_MP3_EQ_MODE = {
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_MP3_EQ_MODE)
|
||||
.appendField(Blockly.Msg.MIXLY_STAT)
|
||||
.appendField(new Blockly.FieldDropdown(GD5800_MP3_EQ_MODE_TYPE), "EQ_MODE");
|
||||
.appendField(new Blockly.FieldDropdown(this.GD5800_MP3_EQ_MODE_TYPE), "EQ_MODE");
|
||||
this.setInputsInline(true);
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setTooltip();
|
||||
this.setHelpUrl();
|
||||
}
|
||||
},
|
||||
GD5800_MP3_EQ_MODE_TYPE: [
|
||||
[Blockly.Msg.MIXLY_MP3_EQ_NORMAL, "MP3_EQ_NORMAL"],
|
||||
[Blockly.Msg.MIXLY_MP3_EQ_POP, "MP3_EQ_POP"],
|
||||
[Blockly.Msg.MIXLY_MP3_EQ_ROCK, "MP3_EQ_ROCK"],
|
||||
[Blockly.Msg.MIXLY_MP3_EQ_JAZZ, "MP3_EQ_JAZZ"],
|
||||
[Blockly.Msg.MIXLY_MP3_EQ_CLASSIC, "MP3_EQ_CLASSIC"],
|
||||
[Blockly.Msg.MIXLY_MP3_EQ_BASS, "MP3_EQ_BASS"]
|
||||
]
|
||||
};
|
||||
|
||||
//GD5800 MP3模块设置音量
|
||||
@@ -742,8 +767,6 @@ export const GD5800_MP3_PLAY_NUM = {
|
||||
}
|
||||
};
|
||||
|
||||
var VOICE_LIST = [["老师", "0x00"], ["爸爸", "0x01"], ["妈妈", "0x02"], ["爷爷", "0x03"], ["奶奶", "0x04"], ["姥姥", "0x05"], ["姥爷", "0x06"], ["哥哥", "0x07"], ["姐姐", "0x08"], ["叔叔", "0x09"], ["阿姨", "0x0A"], ["上午", "0x0B"], ["下午", "0x0C"], ["晚上", "0x0D"], ["前方", "0x0E"], ["厘米", "0x0F"], ["新年快乐", "0x10"], ["身体健康", "0x11"], ["工作顺利", "0x12"], ["学习进步", "0x13"], ["您好", "0x14"], ["谢谢", "0x15"], ["的", "0x16"], ["祝", "0x17"], ["慢走", "0x18"], ["欢迎光临", "0x19"], ["亲爱的", "0x1A"], ["同学们", "0x1B"], ["工作辛苦了", "0x1C"], ["点", "0x1D"], ["打开", "0x1E"], ["关闭", "0x1F"], ["千", "0x20"], ["百", "0x21"], ["十", "0x22"], ["1", "0x23"], ["2", "0x24"], ["3", "0x25"], ["4", "0x26"], ["5", "0x27"], ["6", "0x28"], ["7", "0x29"], ["8", "0x2A"], ["9", "0x2B"], ["0", "0x2C"], ["当前", "0x2D"], ["转", "0x2E"], ["左", "0x2F"], ["右", "0x30"], ["请", "0x31"], ["已", "0x32"], ["现在", "0x33"], ["是", "0x34"], ["红灯", "0x35"], ["绿灯", "0x36"], ["黄灯", "0x37"], ["温度", "0x38"], ["湿度", "0x39"], ["欢迎常来", "0x3A"], ["还有", "0x3B"], ["秒", "0x3C"], ["分", "0x3D"], ["变", "0x3E"], ["等", "0x3F"], ["下一次", "0x40"], ["功能", "0x41"], ["障碍物", "0x42"], ["世界那么大,我想去看看", "0x43"]];
|
||||
|
||||
export const voice_module = {
|
||||
init: function () {
|
||||
this.setColour(ACTUATOR_HUE);
|
||||
@@ -754,12 +777,82 @@ export const voice_module = {
|
||||
.setCheck(Number);
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_MP3_PLAY)
|
||||
.appendField(new Blockly.FieldDropdown(VOICE_LIST), "VOICE");
|
||||
.appendField(new Blockly.FieldDropdown(this.VOICE_LIST), "VOICE");
|
||||
this.appendValueInput("WAIT").setCheck(Number).appendField(Blockly.Msg.MIXLY_MICROBIT_WAIT);
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
},
|
||||
VOICE_LIST: [
|
||||
["老师", "0x00"],
|
||||
["爸爸", "0x01"],
|
||||
["妈妈", "0x02"],
|
||||
["爷爷", "0x03"],
|
||||
["奶奶", "0x04"],
|
||||
["姥姥", "0x05"],
|
||||
["姥爷", "0x06"],
|
||||
["哥哥", "0x07"],
|
||||
["姐姐", "0x08"],
|
||||
["叔叔", "0x09"],
|
||||
["阿姨", "0x0A"],
|
||||
["上午", "0x0B"],
|
||||
["下午", "0x0C"],
|
||||
["晚上", "0x0D"],
|
||||
["前方", "0x0E"],
|
||||
["厘米", "0x0F"],
|
||||
["新年快乐", "0x10"],
|
||||
["身体健康", "0x11"],
|
||||
["工作顺利", "0x12"],
|
||||
["学习进步", "0x13"],
|
||||
["您好", "0x14"],
|
||||
["谢谢", "0x15"],
|
||||
["的", "0x16"],
|
||||
["祝", "0x17"],
|
||||
["慢走", "0x18"],
|
||||
["欢迎光临", "0x19"],
|
||||
["亲爱的", "0x1A"],
|
||||
["同学们", "0x1B"],
|
||||
["工作辛苦了", "0x1C"],
|
||||
["点", "0x1D"],
|
||||
["打开", "0x1E"],
|
||||
["关闭", "0x1F"],
|
||||
["千", "0x20"],
|
||||
["百", "0x21"],
|
||||
["十", "0x22"],
|
||||
["1", "0x23"],
|
||||
["2", "0x24"],
|
||||
["3", "0x25"],
|
||||
["4", "0x26"],
|
||||
["5", "0x27"],
|
||||
["6", "0x28"],
|
||||
["7", "0x29"],
|
||||
["8", "0x2A"],
|
||||
["9", "0x2B"],
|
||||
["0", "0x2C"],
|
||||
["当前", "0x2D"],
|
||||
["转", "0x2E"],
|
||||
["左", "0x2F"],
|
||||
["右", "0x30"],
|
||||
["请", "0x31"],
|
||||
["已", "0x32"],
|
||||
["现在", "0x33"],
|
||||
["是", "0x34"],
|
||||
["红灯", "0x35"],
|
||||
["绿灯", "0x36"],
|
||||
["黄灯", "0x37"],
|
||||
["温度", "0x38"],
|
||||
["湿度", "0x39"],
|
||||
["欢迎常来", "0x3A"],
|
||||
["还有", "0x3B"],
|
||||
["秒", "0x3C"],
|
||||
["分", "0x3D"],
|
||||
["变", "0x3E"],
|
||||
["等", "0x3F"],
|
||||
["下一次", "0x40"],
|
||||
["功能", "0x41"],
|
||||
["障碍物", "0x42"],
|
||||
["世界那么大,我想去看看", "0x43"]
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
@@ -767,21 +860,11 @@ export const voice_module = {
|
||||
export const AFMotorRun = {
|
||||
init: function () {
|
||||
this.setColour(ACTUATOR_HUE);
|
||||
var MOTOR = [
|
||||
["M1", "1"],
|
||||
["M2", "2"],
|
||||
["M3", "3"],
|
||||
["M4", "4"],
|
||||
];
|
||||
var DIRECTION = [
|
||||
[Blockly.Msg.MIXLY_FORWARD, "FORWARD"],
|
||||
[Blockly.Msg.MIXLY_BACKWARD, "BACKWARD"],
|
||||
];
|
||||
this.appendDummyInput("")
|
||||
.appendField("AFMotor" + Blockly.Msg.MIXLY_MOTOR)
|
||||
.appendField(new Blockly.FieldDropdown(MOTOR), "motor")
|
||||
.appendField(new Blockly.FieldDropdown(this.MOTOR), "motor")
|
||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_Direction)
|
||||
.appendField(new Blockly.FieldDropdown(DIRECTION), "direction")
|
||||
.appendField(new Blockly.FieldDropdown(this.DIRECTION), "direction")
|
||||
.appendField(Blockly.Msg.MIXLY_SPEED);
|
||||
this.appendValueInput("speed", Number)
|
||||
.setCheck(Number);
|
||||
@@ -789,26 +872,35 @@ export const AFMotorRun = {
|
||||
this.setPreviousStatement(true);
|
||||
this.setNextStatement(true);
|
||||
this.setTooltip('');
|
||||
}
|
||||
},
|
||||
MOTOR: [
|
||||
["M1", "1"],
|
||||
["M2", "2"],
|
||||
["M3", "3"],
|
||||
["M4", "4"],
|
||||
],
|
||||
DIRECTION: [
|
||||
[Blockly.Msg.MIXLY_FORWARD, "FORWARD"],
|
||||
[Blockly.Msg.MIXLY_BACKWARD, "BACKWARD"],
|
||||
]
|
||||
};
|
||||
|
||||
//DCMotorStop
|
||||
export const AFMotorStop = {
|
||||
init: function () {
|
||||
this.setColour(ACTUATOR_HUE);
|
||||
var MOTOR = [
|
||||
["M1", "1"],
|
||||
["M2", "2"],
|
||||
["M3", "3"],
|
||||
["M4", "4"],
|
||||
];
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_STOP + "AFMotor" + Blockly.Msg.MIXLY_MOTOR)
|
||||
.appendField(new Blockly.FieldDropdown(MOTOR), "motor");
|
||||
.appendField(new Blockly.FieldDropdown(this.MOTOR), "motor");
|
||||
this.setPreviousStatement(true);
|
||||
this.setNextStatement(true);
|
||||
|
||||
}
|
||||
},
|
||||
MOTOR: [
|
||||
["M1", "1"],
|
||||
["M2", "2"],
|
||||
["M3", "3"],
|
||||
["M4", "4"],
|
||||
]
|
||||
};
|
||||
|
||||
//初始化DFPlayer Mini
|
||||
@@ -833,7 +925,13 @@ export const arduino_dfplayer_mini_begin = {
|
||||
export const arduino_dfplayer_mini_pin = {
|
||||
init: function () {
|
||||
this.appendDummyInput()
|
||||
.appendField(new Blockly.FieldDropdown([["Serial", "Serial"], ["SoftwareSerial", "mySerial"], ["SoftwareSerial1", "mySerial1"], ["SoftwareSerial2", "mySerial2"], ["SoftwareSerial3", "mySerial3"]]), "pin_type");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
["Serial", "Serial"],
|
||||
["SoftwareSerial", "mySerial"],
|
||||
["SoftwareSerial1", "mySerial1"],
|
||||
["SoftwareSerial2", "mySerial2"],
|
||||
["SoftwareSerial3", "mySerial3"]
|
||||
]), "pin_type");
|
||||
this.setInputsInline(true);
|
||||
this.setOutput(true, null);
|
||||
this.setColour(65);
|
||||
@@ -886,7 +984,10 @@ export const arduino_dfplayer_mini_volume_up_down = {
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.YX5200_MP3)
|
||||
.appendField(new Blockly.FieldTextInput("myPlayer"), "dfplayer_name")
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_MP3_VOL_UP, "volumeUp"], [Blockly.Msg.MIXLY_MP3_VOL_DOWN, "volumeDown"]]), "volume_type");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_MP3_VOL_UP, "volumeUp"],
|
||||
[Blockly.Msg.MIXLY_MP3_VOL_DOWN, "volumeDown"]
|
||||
]), "volume_type");
|
||||
this.setInputsInline(true);
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
@@ -918,7 +1019,14 @@ export const arduino_dfplayer_mini_EQ = {
|
||||
export const arduino_dfplayer_mini_EQ_type = {
|
||||
init: function () {
|
||||
this.appendDummyInput()
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_MP3_EQ_NORMAL, "DFPLAYER_EQ_NORMAL"], [Blockly.Msg.MIXLY_MP3_EQ_POP, "DFPLAYER_EQ_POP"], [Blockly.Msg.MIXLY_MP3_EQ_ROCK, "DFPLAYER_EQ_ROCK"], [Blockly.Msg.MIXLY_MP3_EQ_CLASSIC, "DFPLAYER_EQ_CLASSIC"], [Blockly.Msg.MIXLY_MP3_EQ_JAZZ, "DFPLAYER_EQ_JAZZ"], [Blockly.Msg.MIXLY_MP3_EQ_BASS, "DFPLAYER_EQ_BASS"]]), "eq_type");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_MP3_EQ_NORMAL, "DFPLAYER_EQ_NORMAL"],
|
||||
[Blockly.Msg.MIXLY_MP3_EQ_POP, "DFPLAYER_EQ_POP"],
|
||||
[Blockly.Msg.MIXLY_MP3_EQ_ROCK, "DFPLAYER_EQ_ROCK"],
|
||||
[Blockly.Msg.MIXLY_MP3_EQ_CLASSIC, "DFPLAYER_EQ_CLASSIC"],
|
||||
[Blockly.Msg.MIXLY_MP3_EQ_JAZZ, "DFPLAYER_EQ_JAZZ"],
|
||||
[Blockly.Msg.MIXLY_MP3_EQ_BASS, "DFPLAYER_EQ_BASS"]
|
||||
]), "eq_type");
|
||||
this.setInputsInline(true);
|
||||
this.setOutput(true, null);
|
||||
this.setColour(ACTUATOR_HUE);
|
||||
@@ -949,7 +1057,13 @@ export const arduino_dfplayer_mini_outputDevice = {
|
||||
export const arduino_dfplayer_mini_outputDevice_type = {
|
||||
init: function () {
|
||||
this.appendDummyInput()
|
||||
.appendField(new Blockly.FieldDropdown([["SD卡", "DFPLAYER_DEVICE_SD"], ["U盘", "DFPLAYER_DEVICE_U_DISK"], ["AUX", "DFPLAYER_DEVICE_AUX"], ["SLEEP", "DFPLAYER_DEVICE_SLEEP"], ["FLASH", "DFPLAYER_DEVICE_FLASH"]]), "outputdevice_type");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
["SD卡", "DFPLAYER_DEVICE_SD"],
|
||||
["U盘", "DFPLAYER_DEVICE_U_DISK"],
|
||||
["AUX", "DFPLAYER_DEVICE_AUX"],
|
||||
["SLEEP", "DFPLAYER_DEVICE_SLEEP"],
|
||||
["FLASH", "DFPLAYER_DEVICE_FLASH"]
|
||||
]), "outputdevice_type");
|
||||
this.setInputsInline(true);
|
||||
this.setOutput(true, null);
|
||||
this.setColour(ACTUATOR_HUE);
|
||||
@@ -961,34 +1075,34 @@ export const arduino_dfplayer_mini_outputDevice_type = {
|
||||
//DFPlayer Mini 设置-1
|
||||
export const arduino_dfplayer_set_1 = {
|
||||
init: function () {
|
||||
var DATA = [
|
||||
[Blockly.Msg.MIXLY_MP3_PREV, "previous"],
|
||||
[Blockly.Msg.MIXLY_MP3_NEXT, "next"],
|
||||
[Blockly.Msg.MIXLY_MP3_PLAY, "start"],
|
||||
[Blockly.Msg.MIXLY_MP3_PAUSE, "pause"],
|
||||
[Blockly.Msg.DFPLAYER_MINI_STOP_ADVERTISE, "stopAdvertise"],
|
||||
[Blockly.Msg.DFPLAYER_MINI_ENABLE_LOOP, "enableLoop"],
|
||||
[Blockly.Msg.DFPLAYER_MINI_DISABLE_LOOP, "disableLoop"],
|
||||
[Blockly.Msg.DFPLAYER_MINI_ENABLE_LOOP_ALL, "enableLoopAll"],
|
||||
[Blockly.Msg.DFPLAYER_MINI_DISABLE_LOOP_ALL, "disableLoopAll"],
|
||||
[Blockly.Msg.DFPLAYER_MINI_RANDOM_ALL, "randomAll"],
|
||||
[Blockly.Msg.DFPLAYER_MINI_ENABLE_DAC, "enableDAC"],
|
||||
[Blockly.Msg.DFPLAYER_MINI_DISABLE_DAC, "disableDAC"],
|
||||
[Blockly.Msg.DFPLAYER_MINI_SLEEP, "sleep"],
|
||||
[Blockly.Msg.HTML_RESET, "reset"]
|
||||
];
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.YX5200_MP3)
|
||||
.appendField(new Blockly.FieldTextInput("myPlayer"), "dfplayer_name")
|
||||
.appendField(" ")
|
||||
.appendField(new Blockly.FieldDropdown(DATA), "set_data");
|
||||
.appendField(new Blockly.FieldDropdown(this.DATA), "set_data");
|
||||
this.setInputsInline(true);
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setColour(ACTUATOR_HUE);
|
||||
this.setTooltip("");
|
||||
this.setHelpUrl("");
|
||||
}
|
||||
},
|
||||
DATA: [
|
||||
[Blockly.Msg.MIXLY_MP3_PREV, "previous"],
|
||||
[Blockly.Msg.MIXLY_MP3_NEXT, "next"],
|
||||
[Blockly.Msg.MIXLY_MP3_PLAY, "start"],
|
||||
[Blockly.Msg.MIXLY_MP3_PAUSE, "pause"],
|
||||
[Blockly.Msg.DFPLAYER_MINI_STOP_ADVERTISE, "stopAdvertise"],
|
||||
[Blockly.Msg.DFPLAYER_MINI_ENABLE_LOOP, "enableLoop"],
|
||||
[Blockly.Msg.DFPLAYER_MINI_DISABLE_LOOP, "disableLoop"],
|
||||
[Blockly.Msg.DFPLAYER_MINI_ENABLE_LOOP_ALL, "enableLoopAll"],
|
||||
[Blockly.Msg.DFPLAYER_MINI_DISABLE_LOOP_ALL, "disableLoopAll"],
|
||||
[Blockly.Msg.DFPLAYER_MINI_RANDOM_ALL, "randomAll"],
|
||||
[Blockly.Msg.DFPLAYER_MINI_ENABLE_DAC, "enableDAC"],
|
||||
[Blockly.Msg.DFPLAYER_MINI_DISABLE_DAC, "disableDAC"],
|
||||
[Blockly.Msg.DFPLAYER_MINI_SLEEP, "sleep"],
|
||||
[Blockly.Msg.HTML_RESET, "reset"]
|
||||
]
|
||||
};
|
||||
|
||||
//DFPlayer Mini 播放和循环指定曲目
|
||||
@@ -1000,7 +1114,12 @@ export const arduino_dfplayer_play_loop = {
|
||||
this.appendValueInput("play_data")
|
||||
.setCheck(null)
|
||||
.appendField(" ")
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_MP3_PLAY, "play"], [Blockly.Msg.MIXLY_MP3_LOOP_ONE, "loop"], [Blockly.Msg.DFPLAYER_MINI_ADVERTISE, "advertise"], [Blockly.Msg.DFPLAYER_MINI_PLAYMP3FOLDER, "playMp3Folder"]]), "play_type")
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_MP3_PLAY, "play"],
|
||||
[Blockly.Msg.MIXLY_MP3_LOOP_ONE, "loop"],
|
||||
[Blockly.Msg.DFPLAYER_MINI_ADVERTISE, "advertise"],
|
||||
[Blockly.Msg.DFPLAYER_MINI_PLAYMP3FOLDER, "playMp3Folder"]
|
||||
]), "play_type")
|
||||
.appendField(Blockly.Msg.DFPLAYER_MINI_SONG);
|
||||
this.setInputsInline(true);
|
||||
this.setPreviousStatement(true, null);
|
||||
@@ -1029,7 +1148,10 @@ export const arduino_dfplayer_playFolder = {
|
||||
this.appendValueInput("fold_data")
|
||||
.setCheck(null)
|
||||
.appendField(Blockly.Msg.MIXLY_MP3_PLAY)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.DFPLAYER_MINI_FOLDER, "playFolder"], [Blockly.Msg.DFPLAYER_MINI_LARGEFOLDER, "playLargeFolder"]]), "fold_type");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.DFPLAYER_MINI_FOLDER, "playFolder"],
|
||||
[Blockly.Msg.DFPLAYER_MINI_LARGEFOLDER, "playLargeFolder"]
|
||||
]), "fold_type");
|
||||
this.appendValueInput("play_data")
|
||||
.setCheck(null)
|
||||
.appendField(Blockly.Msg.DFPLAYER_MINI_SONG);
|
||||
@@ -1075,7 +1197,11 @@ export const arduino_dfplayer_read_now = {
|
||||
.appendField(new Blockly.FieldTextInput("myPlayer"), "dfplayer_name");
|
||||
this.appendDummyInput()
|
||||
.appendField(' ' + Blockly.Msg.MIXLY_GET)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_PULSEIN_STAT, "readState"], [Blockly.Msg.MIXLY_MP3_VOL, "readVolume"], [Blockly.Msg.MIXLY_MP3_EQ_MODE, "readEQ"]]), "read_type");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_PULSEIN_STAT, "readState"],
|
||||
[Blockly.Msg.MIXLY_MP3_VOL, "readVolume"],
|
||||
[Blockly.Msg.MIXLY_MP3_EQ_MODE, "readEQ"]
|
||||
]), "read_type");
|
||||
this.setInputsInline(true);
|
||||
this.setOutput(true, null);
|
||||
this.setColour(ACTUATOR_HUE);
|
||||
@@ -1094,7 +1220,10 @@ export const arduino_dfplayer_readFileCounts = {
|
||||
.setCheck(null)
|
||||
.appendField(' ' + Blockly.Msg.MIXLY_GET);
|
||||
this.appendDummyInput()
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.DFPLAYER_MINI_READ_FILE_COUNTS, "readFileCounts"], [Blockly.Msg.DFPLAYER_MINI_READ_CURRENT_FILE_NUMBER, "readCurrentFileNumber"]]), "play_data");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.DFPLAYER_MINI_READ_FILE_COUNTS, "readFileCounts"],
|
||||
[Blockly.Msg.DFPLAYER_MINI_READ_CURRENT_FILE_NUMBER, "readCurrentFileNumber"]
|
||||
]), "play_data");
|
||||
this.setInputsInline(true);
|
||||
this.setOutput(true, null);
|
||||
this.setColour(ACTUATOR_HUE);
|
||||
@@ -1129,7 +1258,10 @@ export const arduino_dfplayer_available = {
|
||||
.appendField(new Blockly.FieldTextInput("myPlayer"), "dfplayer_name");
|
||||
this.appendDummyInput()
|
||||
.appendField(".")
|
||||
.appendField(new Blockly.FieldDropdown([["available", "available"], ["readType", "readType"], ["read", "read"]]), "type");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
["available", "available"],
|
||||
["readType", "readType"], ["read", "read"]
|
||||
]), "type");
|
||||
this.setInputsInline(true);
|
||||
this.setOutput(true, null);
|
||||
this.setColour(ACTUATOR_HUE);
|
||||
@@ -1168,37 +1300,30 @@ export const arduino_dfplayer_available = {
|
||||
);
|
||||
}
|
||||
};
|
||||
var I2C_Motor_SELECT = [["M0", "0"], ["M1", "1"], ["M2", "2"], ["M3", "3"], ["M4", "4"], ["M5", "5"], ["M6", "6"], ["M7", "7"]];
|
||||
|
||||
export const I2Cmotor = {
|
||||
init: function () {
|
||||
this.setColour(ACTUATOR_HUE);
|
||||
this.appendDummyInput("")
|
||||
.appendField("I2C" + Blockly.Msg.MIXLY_MOTOR)
|
||||
.appendField(new Blockly.FieldDropdown(I2C_Motor_SELECT), "motor");
|
||||
.appendField(new Blockly.FieldDropdown(this.I2C_Motor_SELECT), "motor");
|
||||
this.appendValueInput("SPEED").setCheck(Number).appendField(Blockly.Msg.MIXLY_MOTOR_SPEED);
|
||||
this.setInputsInline(true);
|
||||
this.setPreviousStatement(true);
|
||||
this.setNextStatement(true);
|
||||
}
|
||||
},
|
||||
I2C_Motor_SELECT: [
|
||||
["M0", "0"],
|
||||
["M1", "1"],
|
||||
["M2", "2"],
|
||||
["M3", "3"],
|
||||
["M4", "4"],
|
||||
["M5", "5"],
|
||||
["M6", "6"],
|
||||
["M7", "7"]
|
||||
]
|
||||
};
|
||||
|
||||
//N910X MP3模块 控制
|
||||
var M9101X_S_MP3_CONTROL_TYPE = [
|
||||
[Blockly.Msg.MIXLY_MP3_PLAY, "play();"],
|
||||
[Blockly.Msg.MIXLY_MP3_PAUSE, "pause();"],
|
||||
[Blockly.Msg.MIXLY_STOP, "stop();"],
|
||||
[Blockly.Msg.MIXLY_MP3_NEXT, "play_down();"],
|
||||
[Blockly.Msg.MIXLY_MP3_PREV, "play_up();"],
|
||||
[Blockly.Msg.MIXLY_MP3_LOOP_ALL, "cycle_all();"],
|
||||
[Blockly.Msg.MIXLY_MP3_LOOP_ONE, "cycle_single();"],
|
||||
["切换到TF卡", "set_sd();"],
|
||||
["切换到" + Blockly.Msg.MIXLY_MP3_UDISK, "set_usb_flash();"],
|
||||
["切换到MP3模式", "set_mp3();"],
|
||||
["切换到flash模式", "set_flash();"],
|
||||
["切换音乐风格", "set_eq();"],
|
||||
];
|
||||
|
||||
export const M9101X_S_MP3_CONTROL = {
|
||||
init: function () {
|
||||
this.setColour(ACTUATOR_HUE);
|
||||
@@ -1206,14 +1331,31 @@ export const M9101X_S_MP3_CONTROL = {
|
||||
this.appendValueInput("PIN", Number)
|
||||
.appendField(Blockly.Msg.MIXLY_PIN)
|
||||
.setCheck(Number);
|
||||
this.appendDummyInput("").appendField(Blockly.Msg.MIXLY_STAT).appendField(new Blockly.FieldDropdown(M9101X_S_MP3_CONTROL_TYPE), "CONTROL_TYPE");
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_STAT)
|
||||
.appendField(new Blockly.FieldDropdown(this.M9101X_S_MP3_CONTROL_TYPE), "CONTROL_TYPE");
|
||||
this.setInputsInline(true);
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setTooltip();
|
||||
this.setHelpUrl();
|
||||
}
|
||||
},
|
||||
M9101X_S_MP3_CONTROL_TYPE: [
|
||||
[Blockly.Msg.MIXLY_MP3_PLAY, "play();"],
|
||||
[Blockly.Msg.MIXLY_MP3_PAUSE, "pause();"],
|
||||
[Blockly.Msg.MIXLY_STOP, "stop();"],
|
||||
[Blockly.Msg.MIXLY_MP3_NEXT, "play_down();"],
|
||||
[Blockly.Msg.MIXLY_MP3_PREV, "play_up();"],
|
||||
[Blockly.Msg.MIXLY_MP3_LOOP_ALL, "cycle_all();"],
|
||||
[Blockly.Msg.MIXLY_MP3_LOOP_ONE, "cycle_single();"],
|
||||
["切换到TF卡", "set_sd();"],
|
||||
["切换到" + Blockly.Msg.MIXLY_MP3_UDISK, "set_usb_flash();"],
|
||||
["切换到MP3模式", "set_mp3();"],
|
||||
["切换到flash模式", "set_flash();"],
|
||||
["切换音乐风格", "set_eq();"],
|
||||
]
|
||||
};
|
||||
|
||||
//N910X MP3模块 音量设置
|
||||
export const M9101X_S_MP3_VOL_CONTROL = {
|
||||
init: function () {
|
||||
|
||||
@@ -66,7 +66,7 @@ export const blynk_server = {
|
||||
};
|
||||
|
||||
//虚拟管脚选择
|
||||
var BLYNK_VIRTUALPIN_SELECT = [
|
||||
const BLYNK_VIRTUALPIN_SELECT = [
|
||||
["V0", "V0"],
|
||||
["V1", "V1"],
|
||||
["V2", "V2"],
|
||||
@@ -111,7 +111,7 @@ var BLYNK_VIRTUALPIN_SELECT = [
|
||||
];
|
||||
|
||||
//定时器选择
|
||||
var BLYNK_TIMER_SELECT = [
|
||||
const BLYNK_TIMER_SELECT = [
|
||||
["1", "1"],
|
||||
["2", "2"],
|
||||
["3", "3"],
|
||||
@@ -152,9 +152,9 @@ export const blynk_iot_push_data = {
|
||||
//从app端获取数据
|
||||
export const blynk_iot_get_data = {
|
||||
/**
|
||||
* Block for defining a procedure with no return value.
|
||||
* @this Blockly.Block
|
||||
*/
|
||||
* Block for defining a procedure with no return value.
|
||||
* @this Blockly.Block
|
||||
*/
|
||||
init: function () {
|
||||
this.setColour(BLYNK1_HUE);
|
||||
this.appendDummyInput("")
|
||||
@@ -173,17 +173,14 @@ export const blynk_iot_get_data = {
|
||||
this.setNextStatement(false, null);
|
||||
this.statementConnection_ = null;
|
||||
},
|
||||
|
||||
getVars: function () {
|
||||
return [this.getFieldValue("VAR")];
|
||||
},
|
||||
|
||||
renameVar: function (oldName, newName) {
|
||||
if (Blockly.Names.equals(oldName, this.getFieldValue("VAR"))) {
|
||||
this.setTitleValue(newName, "VAR");
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Add or remove the statement block from this function definition.
|
||||
* @param {boolean} hasStatements True if a statement block is needed.
|
||||
@@ -277,7 +274,6 @@ export const blynk_iot_get_data = {
|
||||
}
|
||||
this.updateParams_();
|
||||
// Blockly.Procedures.mutateCallers(this);
|
||||
|
||||
// Show or hide the statement input.
|
||||
this.setStatements_(xmlElement.getAttribute("statements") !== "false");
|
||||
},
|
||||
@@ -492,7 +488,7 @@ export const Blynk_connect_state = {
|
||||
}
|
||||
};
|
||||
|
||||
var BLYNK_CONNECT_STATE_SELECT = [
|
||||
const BLYNK_CONNECT_STATE_SELECT = [
|
||||
[Blockly.Msg.BLYNK_CONNECTED, 'BLYNK_CONNECTED'],
|
||||
[Blockly.Msg.BLYNK_DISCONNECTED, 'BLYNK_DISCONNECTED'],
|
||||
[Blockly.Msg.BLYNK_APP_CONNECTED, 'BLYNK_APP_CONNECTED'],
|
||||
@@ -588,26 +584,30 @@ export const blynk_iot_WidgetLED_VALUE = {
|
||||
}
|
||||
};
|
||||
|
||||
var AC_TYPE = [
|
||||
const AC_TYPE = [
|
||||
[Blockly.Msg.blynk_IOT_GREE, "Gree"],
|
||||
[Blockly.Msg.blynk_IOT_MIDEA, "Midea"],
|
||||
];
|
||||
|
||||
var AC_POWER = [
|
||||
const AC_POWER = [
|
||||
[Blockly.Msg.MIXLY_ON, "true"],
|
||||
[Blockly.Msg.MIXLY_OFF, "false"]
|
||||
];
|
||||
var AC_MODE = [
|
||||
|
||||
const AC_MODE = [
|
||||
[Blockly.Msg.blynk_IOT_FAN, "FAN"],
|
||||
[Blockly.Msg.blynk_IOT_HEAT, "HEAT"],
|
||||
[Blockly.Msg.blynk_IOT_COOL, "COOL"],
|
||||
[Blockly.Msg.blynk_IOT_DRY, "DRY"],
|
||||
[Blockly.Msg.blynk_IOT_AUTO, "AUTO"]];
|
||||
var AC_FAN = [
|
||||
[Blockly.Msg.blynk_IOT_AUTO, "AUTO"]
|
||||
];
|
||||
|
||||
const AC_FAN = [
|
||||
[Blockly.Msg.blynk_IOT_FAN_3, "FAN_3"],
|
||||
[Blockly.Msg.blynk_IOT_FAN_2, "FAN_2"],
|
||||
[Blockly.Msg.blynk_IOT_FAN_1, "FAN_1"],
|
||||
[Blockly.Msg.blynk_IOT_FAN_0, "FAN_0"]];
|
||||
[Blockly.Msg.blynk_IOT_FAN_0, "FAN_0"]
|
||||
];
|
||||
|
||||
//红外控制空调
|
||||
export const blynk_iot_ir_send_ac = {
|
||||
@@ -643,7 +643,9 @@ export const blynk_iot_ir_send_ac = {
|
||||
export const blynk_iot_ir_recv_raw = {
|
||||
init: function () {
|
||||
this.setColour(BLYNK1_HUE);
|
||||
this.appendValueInput("PIN", Number).appendField(Blockly.Msg.blynk_IOT_IR_RECEIVE_RAW).setCheck(Number);
|
||||
this.appendValueInput("PIN", Number)
|
||||
.appendField(Blockly.Msg.blynk_IOT_IR_RECEIVE_RAW)
|
||||
.setCheck(Number);
|
||||
// this.appendValueInput("PIN", Number).appendField(Blockly.Msg.MIXLY_PIN).setCheck(Number);
|
||||
this.setPreviousStatement(true);
|
||||
this.setNextStatement(true);
|
||||
|
||||
@@ -29,26 +29,28 @@ export const ir_recv = {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const TYPE = [
|
||||
['RC5', 'RC5'],
|
||||
['RC6', 'RC6'],
|
||||
['NEC', 'NEC'],
|
||||
['Sony', 'Sony'],
|
||||
['Panasonic', 'Panasonic'],
|
||||
['JVC', 'JVC'],
|
||||
['SAMSUNG', 'SAMSUNG'],
|
||||
['Whynter', 'Whynter'],
|
||||
['AiwaRCT501', 'AiwaRCT501'],
|
||||
['LG', 'LG'],
|
||||
['Sanyo', 'Sanyo'],
|
||||
['Mitsubishi', 'Mitsubishi'],
|
||||
['DISH', 'DISH'],
|
||||
['SharpRaw', 'SharpRaw'],
|
||||
['Denon', 'Denon']
|
||||
];
|
||||
|
||||
//红外发射模块(NEC)
|
||||
export const ir_send_nec = {
|
||||
init: function () {
|
||||
var TYPE = [
|
||||
['RC5', 'RC5'],
|
||||
['RC6', 'RC6'],
|
||||
['NEC', 'NEC'],
|
||||
['Sony', 'Sony'],
|
||||
['Panasonic', 'Panasonic'],
|
||||
['JVC', 'JVC'],
|
||||
['SAMSUNG', 'SAMSUNG'],
|
||||
['Whynter', 'Whynter'],
|
||||
['AiwaRCT501', 'AiwaRCT501'],
|
||||
['LG', 'LG'],
|
||||
['Sanyo', 'Sanyo'],
|
||||
['Mitsubishi', 'Mitsubishi'],
|
||||
['DISH', 'DISH'],
|
||||
['SharpRaw', 'SharpRaw'],
|
||||
['Denon', 'Denon']
|
||||
];
|
||||
this.setColour(COMMUNICATE_HUE);
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_IR_SEND_NEC1)
|
||||
@@ -117,8 +119,8 @@ export const ir_send_raw = {
|
||||
this.setTooltip(Blockly.Msg.MIXLY_IR_SEND_RAW_TOOLTIP);
|
||||
}
|
||||
};
|
||||
// IIC通信
|
||||
|
||||
// IIC通信
|
||||
// IIC初始化主机
|
||||
export const i2c_master_Init = {
|
||||
init: function () {
|
||||
@@ -131,6 +133,7 @@ export const i2c_master_Init = {
|
||||
this.setHelpUrl("");
|
||||
}
|
||||
};
|
||||
|
||||
// IIC初始化从机
|
||||
export const i2c_slave_Init = {
|
||||
init: function () {
|
||||
@@ -279,7 +282,6 @@ export const i2c_master_readerReg = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export const i2c_slave_onrequest = {
|
||||
init: function () {
|
||||
this.setColour(COMMUNICATE_HUE);
|
||||
@@ -383,9 +385,10 @@ export const spi_transfer = {
|
||||
this.setPreviousStatement(true);
|
||||
this.setNextStatement(true);
|
||||
this.setInputsInline(true);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_SPI_TRANSFER.replace('%1', Blockly.Arduino.valueToCode(this, 'pin', Blockly.Arduino.ORDER_ATOMIC)));
|
||||
const pinValue = Blockly.Arduino.valueToCode(this, 'pin', Blockly.Arduino.ORDER_ATOMIC);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_SPI_TRANSFER.replace('%1', pinValue));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//RFID
|
||||
export const RFID_init = {
|
||||
@@ -426,7 +429,6 @@ export const RFID_on = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//读卡号
|
||||
export const RFID_readcardnum = {
|
||||
init: function () {
|
||||
@@ -451,7 +453,6 @@ export const RFID_readcardnum = {
|
||||
}
|
||||
}; */
|
||||
|
||||
|
||||
export const RFID_in = {
|
||||
init: function () {
|
||||
this.appendValueInput("uid_")
|
||||
@@ -483,7 +484,6 @@ export const RFID_writecarddata = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//读数据块的内容
|
||||
export const RFID_readcarddata = {
|
||||
init: function () {
|
||||
@@ -510,7 +510,7 @@ export const RFID_serialprintcarddata = {
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
}
|
||||
}; */
|
||||
};*/
|
||||
|
||||
//关闭RFID
|
||||
export const RFID_off = {
|
||||
@@ -652,7 +652,12 @@ export const MFRC522_ReadCard = {
|
||||
export const spi_begin_slave = {
|
||||
init: function () {
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_SETUP + "SPI" + Blockly.Msg.MIXLY_DEVICE + Blockly.Msg.MIXLY_AS + Blockly.Msg.MIXLY_SALVE);
|
||||
.appendField(
|
||||
Blockly.Msg.MIXLY_SETUP
|
||||
+ "SPI" + Blockly.Msg.MIXLY_DEVICE
|
||||
+ Blockly.Msg.MIXLY_AS
|
||||
+ Blockly.Msg.MIXLY_SALVE
|
||||
);
|
||||
this.setInputsInline(true);
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
@@ -665,7 +670,12 @@ export const spi_begin_slave = {
|
||||
export const spi_begin_master = {
|
||||
init: function () {
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_SETUP + "SPI" + Blockly.Msg.MIXLY_DEVICE + Blockly.Msg.MIXLY_AS + Blockly.Msg.MIXLY_MASTER);
|
||||
.appendField(
|
||||
Blockly.Msg.MIXLY_SETUP
|
||||
+ "SPI" + Blockly.Msg.MIXLY_DEVICE
|
||||
+ Blockly.Msg.MIXLY_AS
|
||||
+ Blockly.Msg.MIXLY_MASTER
|
||||
);
|
||||
this.appendValueInput("spi_slave_pin")
|
||||
.setCheck(null)
|
||||
.setAlign(Blockly.inputs.Align.RIGHT)
|
||||
@@ -683,7 +693,11 @@ export const spi_transfer_Init = {
|
||||
init: function () {
|
||||
this.appendValueInput("slave_pin")
|
||||
.setCheck(null)
|
||||
.appendField("SPI" + Blockly.Msg.MIXLY_SEND_DATA + Blockly.Msg.MIXLY_SALVE + Blockly.Msg.MIXLY_PIN);
|
||||
.appendField(
|
||||
"SPI" + Blockly.Msg.MIXLY_SEND_DATA
|
||||
+ Blockly.Msg.MIXLY_SALVE
|
||||
+ Blockly.Msg.MIXLY_PIN
|
||||
);
|
||||
this.appendStatementInput("transfer_data")
|
||||
.setCheck(null);
|
||||
this.setInputsInline(true);
|
||||
@@ -699,7 +713,6 @@ export const spi_transfer_1 = {
|
||||
init: function () {
|
||||
this.appendValueInput("transfer_data")
|
||||
.setCheck(null)
|
||||
|
||||
.appendField("SPI" + Blockly.Msg.MIXLY_MICROPYTHON_SOCKET_SEND);
|
||||
this.setInputsInline(true);
|
||||
this.setPreviousStatement(true, null);
|
||||
@@ -730,7 +743,10 @@ export const spi_slave_interrupt = {
|
||||
init: function () {
|
||||
this.appendValueInput("slave_interrupt_input")
|
||||
.setCheck(null)
|
||||
.appendField("SPI " + Blockly.Msg.MIXLY_STM32_I2C_SLAVE_RECEIVE_EVENT + " " + Blockly.Msg.MIXLY_STM32_SPI_GET_REGISTER_DATA);
|
||||
.appendField(
|
||||
"SPI " + Blockly.Msg.MIXLY_STM32_I2C_SLAVE_RECEIVE_EVENT
|
||||
+ " " + Blockly.Msg.MIXLY_STM32_SPI_GET_REGISTER_DATA
|
||||
);
|
||||
this.appendStatementInput("slave_interrupt_data")
|
||||
.setCheck(null)
|
||||
.appendField(Blockly.Msg.MIXLY_MSTIMER2_DO);
|
||||
@@ -747,7 +763,10 @@ export const spi_slave_receive = {
|
||||
init: function () {
|
||||
this.appendValueInput("slave_receive_data")
|
||||
.setCheck(null)
|
||||
.appendField("SPI " + Blockly.Msg.MIXLY_SALVE + " " + Blockly.Msg.MIXLY_STM32_SPI_GET_REGISTER_DATA);
|
||||
.appendField(
|
||||
"SPI " + Blockly.Msg.MIXLY_SALVE
|
||||
+ " " + Blockly.Msg.MIXLY_STM32_SPI_GET_REGISTER_DATA
|
||||
);
|
||||
this.setInputsInline(true);
|
||||
this.setOutput(true, null);
|
||||
this.setColour(COMMUNICATE_HUE);
|
||||
|
||||
@@ -11,19 +11,15 @@ export const base_setup = {
|
||||
this.setHelpUrl(
|
||||
"https://mixly.readthedocs.io/zh_CN/latest/arduino/03.Control.html#id2"
|
||||
);
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
export const controls_delay = {
|
||||
init: function () {
|
||||
var UNIT = [
|
||||
[Blockly.Msg.MIXLY_MILLIS, "delay"],
|
||||
[Blockly.Msg.MIXLY_MILLISECOND, "delayMicroseconds"],
|
||||
];
|
||||
this.setColour(LOOPS_HUE);
|
||||
this.appendValueInput("DELAY_TIME", Number)
|
||||
.appendField(Blockly.Msg.MIXLY_DELAY)
|
||||
.appendField(new Blockly.FieldDropdown(UNIT), "UNIT")
|
||||
.appendField(new Blockly.FieldDropdown(this.UNIT), "UNIT")
|
||||
.setCheck(Number);
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
@@ -33,6 +29,10 @@ export const controls_delay = {
|
||||
"https://mixly.readthedocs.io/zh_CN/latest/arduino/03.Control.html#id9"
|
||||
);
|
||||
},
|
||||
UNIT: [
|
||||
[Blockly.Msg.MIXLY_MILLIS, "delay"],
|
||||
[Blockly.Msg.MIXLY_MILLISECOND, "delayMicroseconds"],
|
||||
]
|
||||
};
|
||||
|
||||
export const controls_for = {
|
||||
@@ -75,7 +75,7 @@ export const controls_for = {
|
||||
if (Blockly.Names.equals(oldName, this.getFieldValue("VAR"))) {
|
||||
this.setTitleValue(newName, "VAR");
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
export const controls_whileUntil = {
|
||||
@@ -101,13 +101,12 @@ export const controls_whileUntil = {
|
||||
return TOOLTIPS[op];
|
||||
});
|
||||
},
|
||||
OPERATORS: [
|
||||
[Blockly.Msg.LANG_CONTROLS_WHILEUNTIL_OPERATOR_WHILE, "WHILE"],
|
||||
[Blockly.Msg.LANG_CONTROLS_WHILEUNTIL_OPERATOR_UNTIL, "UNTIL"]
|
||||
]
|
||||
};
|
||||
|
||||
controls_whileUntil.OPERATORS = [
|
||||
[Blockly.Msg.LANG_CONTROLS_WHILEUNTIL_OPERATOR_WHILE, "WHILE"],
|
||||
[Blockly.Msg.LANG_CONTROLS_WHILEUNTIL_OPERATOR_UNTIL, "UNTIL"],
|
||||
];
|
||||
|
||||
export const controls_flow_statements = {
|
||||
init: function () {
|
||||
this.setColour(LOOPS_HUE);
|
||||
@@ -155,26 +154,25 @@ export const controls_flow_statements = {
|
||||
this.setWarningText(Blockly.Msg.LANG_CONTROLS_FLOW_STATEMENTS_WARNING);
|
||||
}
|
||||
},
|
||||
OPERATORS: [
|
||||
[Blockly.Msg.LANG_CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK, "BREAK"],
|
||||
[Blockly.Msg.LANG_CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE, "CONTINUE"],
|
||||
]
|
||||
};
|
||||
|
||||
controls_flow_statements.OPERATORS = [
|
||||
[Blockly.Msg.LANG_CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK, "BREAK"],
|
||||
[Blockly.Msg.LANG_CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE, "CONTINUE"],
|
||||
];
|
||||
|
||||
export const controls_millis = {
|
||||
init: function () {
|
||||
var UNIT = [
|
||||
[Blockly.Msg.MIXLY_MILLIS, "millis"],
|
||||
[Blockly.Msg.MIXLY_MILLISECOND, "micros"],
|
||||
];
|
||||
this.setColour(LOOPS_HUE);
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_RUNTIME)
|
||||
.appendField(new Blockly.FieldDropdown(UNIT), "UNIT");
|
||||
.appendField(new Blockly.FieldDropdown(this.UNIT), "UNIT");
|
||||
this.setOutput(true, Number);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_CONTROL_MILLIS);
|
||||
},
|
||||
UNIT: [
|
||||
[Blockly.Msg.MIXLY_MILLIS, "millis"],
|
||||
[Blockly.Msg.MIXLY_MILLISECOND, "micros"],
|
||||
]
|
||||
};
|
||||
|
||||
export const controls_if = {
|
||||
@@ -477,7 +475,7 @@ export const controls_if = {
|
||||
statementConnections[i].reconnect(this, "DO" + i);
|
||||
}
|
||||
elseStatementConnection && elseStatementConnection.reconnect(this, "ELSE");
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
export const controls_if_if = {
|
||||
@@ -491,7 +489,7 @@ export const controls_if_if = {
|
||||
this.appendStatementInput("STACK");
|
||||
this.setTooltip(Blockly.Msg.CONTROLS_IF_IF_TOOLTIP);
|
||||
this.contextMenu = false;
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
export const controls_if_elseif = {
|
||||
@@ -508,7 +506,7 @@ export const controls_if_elseif = {
|
||||
this.setNextStatement(true);
|
||||
this.setTooltip(Blockly.Msg.CONTROLS_IF_ELSEIF_TOOLTIP);
|
||||
this.contextMenu = false;
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
export const controls_if_else = {
|
||||
@@ -524,7 +522,7 @@ export const controls_if_else = {
|
||||
this.setPreviousStatement(true);
|
||||
this.setTooltip(Blockly.Msg.CONTROLS_IF_ELSE_TOOLTIP);
|
||||
this.contextMenu = false;
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
export const controls_switch_case = {
|
||||
@@ -687,7 +685,7 @@ export const controls_switch_case = {
|
||||
clauseBlock =
|
||||
clauseBlock.nextConnection && clauseBlock.nextConnection.targetBlock();
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
export const controls_switch = {
|
||||
@@ -700,7 +698,7 @@ export const controls_switch = {
|
||||
this.appendDummyInput().appendField("switch");
|
||||
this.appendStatementInput("STACK");
|
||||
this.contextMenu = false;
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
export const controls_case = {
|
||||
@@ -714,7 +712,7 @@ export const controls_case = {
|
||||
this.setPreviousStatement(true);
|
||||
this.setNextStatement(true);
|
||||
this.contextMenu = false;
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
export const controls_default = {
|
||||
@@ -727,7 +725,7 @@ export const controls_default = {
|
||||
this.appendDummyInput().appendField("default");
|
||||
this.setPreviousStatement(true);
|
||||
this.contextMenu = false;
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
export const controls_mstimer2 = {
|
||||
@@ -738,14 +736,15 @@ export const controls_mstimer2 = {
|
||||
.setAlign(Blockly.inputs.Align.RIGHT)
|
||||
.appendField("MsTimer2" + Blockly.Msg.MIXLY_MSTIMER2_EVERY);
|
||||
this.appendDummyInput().appendField("ms");
|
||||
this.appendStatementInput("DO").appendField(Blockly.Msg.MIXLY_MSTIMER2_DO);
|
||||
this.appendStatementInput("DO")
|
||||
.appendField(Blockly.Msg.MIXLY_MSTIMER2_DO);
|
||||
this.setPreviousStatement(true);
|
||||
this.setNextStatement(true);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_CONTROL_MSTIMER2);
|
||||
this.setHelpUrl(
|
||||
"https://mixly.readthedocs.io/zh_CN/latest/arduino/03.Control.html#MsTimer2"
|
||||
);
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
export const controls_mstimer2_start = {
|
||||
@@ -760,7 +759,7 @@ export const controls_mstimer2_start = {
|
||||
"https://mixly.readthedocs.io/zh_CN/latest/arduino/03.Control.html#id45"
|
||||
);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_CONTROL_MSTIMER2_START);
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
export const controls_mstimer2_stop = {
|
||||
@@ -775,52 +774,56 @@ export const controls_mstimer2_stop = {
|
||||
this.setHelpUrl(
|
||||
"https://mixly.readthedocs.io/zh_CN/latest/arduino/03.Control.html#id48"
|
||||
);
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
export const controls_end_program = {
|
||||
init: function () {
|
||||
this.setColour(LOOPS_HUE);
|
||||
this.appendDummyInput().appendField(Blockly.Msg.MIXLY_CONTROL_END_PROGRAM);
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_CONTROL_END_PROGRAM);
|
||||
this.setPreviousStatement(true);
|
||||
this.setNextStatement(true);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_CONTROL_END_PROGRAM);
|
||||
},
|
||||
}
|
||||
};
|
||||
export const controls_soft_reset = {
|
||||
init: function () {
|
||||
this.setColour(LOOPS_HUE);
|
||||
this.appendDummyInput().appendField(Blockly.Msg.SOFT_RESET);
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.SOFT_RESET);
|
||||
this.setPreviousStatement(true);
|
||||
this.setNextStatement(true);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_CONTROL_END_PROGRAM);
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
export const controls_interrupts = {
|
||||
init: function () {
|
||||
this.setColour(LOOPS_HUE);
|
||||
this.appendDummyInput().appendField(Blockly.Msg.MIXLY_CONTROL_INTERRUPTS);
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_CONTROL_INTERRUPTS);
|
||||
this.setPreviousStatement(true);
|
||||
this.setNextStatement(true);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_CONTROL_ALLOW_INTERRUPT);
|
||||
this.setHelpUrl(
|
||||
"https://mixly.readthedocs.io/zh_CN/latest/arduino/03.Control.html#id51"
|
||||
);
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
export const controls_nointerrupts = {
|
||||
init: function () {
|
||||
this.setColour(LOOPS_HUE);
|
||||
this.appendDummyInput().appendField(Blockly.Msg.MIXLY_CONTROL_NOINTERRUPTS);
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_CONTROL_NOINTERRUPTS);
|
||||
this.setPreviousStatement(true);
|
||||
this.setNextStatement(true);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_CONTROL_NOINTERRUPTS);
|
||||
this.setHelpUrl(
|
||||
"https://mixly.readthedocs.io/zh_CN/latest/arduino/03.Control.html#id55"
|
||||
);
|
||||
},
|
||||
}
|
||||
};
|
||||
export const base_delay = controls_delay;
|
||||
|
||||
@@ -829,30 +832,12 @@ export const simple_timer = {
|
||||
init: function () {
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_SIMPLE_TIMER)
|
||||
.appendField(
|
||||
new Blockly.FieldDropdown([
|
||||
["1", "1"],
|
||||
["2", "2"],
|
||||
["3", "3"],
|
||||
["4", "4"],
|
||||
["5", "5"],
|
||||
["6", "6"],
|
||||
["7", "7"],
|
||||
["8", "8"],
|
||||
["9", "9"],
|
||||
["10", "10"],
|
||||
["11", "11"],
|
||||
["12", "12"],
|
||||
["13", "13"],
|
||||
["14", "14"],
|
||||
["15", "15"],
|
||||
["16", "16"],
|
||||
]),
|
||||
"NO"
|
||||
)
|
||||
.appendField(new Blockly.FieldDropdown(this.NUMBER), "NO")
|
||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_JS_MONITOR_SCROLL_INTERVAL);
|
||||
this.appendValueInput("timein").setCheck(null);
|
||||
this.appendDummyInput().appendField(Blockly.Msg.MIXLY_mSecond);
|
||||
this.appendValueInput("timein")
|
||||
.setCheck(null);
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_mSecond);
|
||||
this.appendStatementInput("zxhs")
|
||||
.setCheck(null)
|
||||
.appendField(Blockly.Msg.CONTROLS_REPEAT_INPUT_DO);
|
||||
@@ -860,7 +845,26 @@ export const simple_timer = {
|
||||
this.setTooltip();
|
||||
this.setHelpUrl("");
|
||||
},
|
||||
NUMBER: [
|
||||
["1", "1"],
|
||||
["2", "2"],
|
||||
["3", "3"],
|
||||
["4", "4"],
|
||||
["5", "5"],
|
||||
["6", "6"],
|
||||
["7", "7"],
|
||||
["8", "8"],
|
||||
["9", "9"],
|
||||
["10", "10"],
|
||||
["11", "11"],
|
||||
["12", "12"],
|
||||
["13", "13"],
|
||||
["14", "14"],
|
||||
["15", "15"],
|
||||
["16", "16"],
|
||||
]
|
||||
};
|
||||
|
||||
//do-while循环
|
||||
export const do_while = {
|
||||
init: function () {
|
||||
@@ -890,32 +894,31 @@ export const super_delay_function1 = {
|
||||
init: function () {
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.super_delay_function)
|
||||
.appendField(
|
||||
new Blockly.FieldDropdown([
|
||||
["1", "1"],
|
||||
["2", "2"],
|
||||
["3", "3"],
|
||||
["4", "4"],
|
||||
["5", "5"],
|
||||
["6", "6"],
|
||||
["7", "7"],
|
||||
["8", "8"],
|
||||
["9", "9"],
|
||||
["10", "10"],
|
||||
["11", "11"],
|
||||
["12", "12"],
|
||||
["13", "13"],
|
||||
["14", "14"],
|
||||
["15", "15"],
|
||||
["16", "16"],
|
||||
]),
|
||||
"number"
|
||||
);
|
||||
this.appendStatementInput("delay_function").setCheck(null);
|
||||
.appendField(new Blockly.FieldDropdown(this.NUMBER), "number");
|
||||
this.appendStatementInput("delay_function")
|
||||
.setCheck(null);
|
||||
this.setColour(120);
|
||||
this.setTooltip(Blockly.Msg.super_delay_function_help);
|
||||
this.setHelpUrl("");
|
||||
},
|
||||
NUMBER: [
|
||||
["1", "1"],
|
||||
["2", "2"],
|
||||
["3", "3"],
|
||||
["4", "4"],
|
||||
["5", "5"],
|
||||
["6", "6"],
|
||||
["7", "7"],
|
||||
["8", "8"],
|
||||
["9", "9"],
|
||||
["10", "10"],
|
||||
["11", "11"],
|
||||
["12", "12"],
|
||||
["13", "13"],
|
||||
["14", "14"],
|
||||
["15", "15"],
|
||||
["16", "16"],
|
||||
]
|
||||
};
|
||||
|
||||
//执行超级延时函数
|
||||
@@ -923,27 +926,7 @@ export const execute_super_delay_function1 = {
|
||||
init: function () {
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.execute_super_delay_function)
|
||||
.appendField(
|
||||
new Blockly.FieldDropdown([
|
||||
["1", "1"],
|
||||
["2", "2"],
|
||||
["3", "3"],
|
||||
["4", "4"],
|
||||
["5", "5"],
|
||||
["6", "6"],
|
||||
["7", "7"],
|
||||
["8", "8"],
|
||||
["9", "9"],
|
||||
["10", "10"],
|
||||
["11", "11"],
|
||||
["12", "12"],
|
||||
["13", "13"],
|
||||
["14", "14"],
|
||||
["15", "15"],
|
||||
["16", "16"],
|
||||
]),
|
||||
"number"
|
||||
);
|
||||
.appendField(new Blockly.FieldDropdown(this.NUMBER), "number");
|
||||
this.appendValueInput("time_interval")
|
||||
.setCheck(null)
|
||||
.appendField(Blockly.Msg.time_interval);
|
||||
@@ -957,4 +940,22 @@ export const execute_super_delay_function1 = {
|
||||
this.setTooltip(Blockly.Msg.execute_super_delay_function_help);
|
||||
this.setHelpUrl("");
|
||||
},
|
||||
};
|
||||
NUMBER: [
|
||||
["1", "1"],
|
||||
["2", "2"],
|
||||
["3", "3"],
|
||||
["4", "4"],
|
||||
["5", "5"],
|
||||
["6", "6"],
|
||||
["7", "7"],
|
||||
["8", "8"],
|
||||
["9", "9"],
|
||||
["10", "10"],
|
||||
["11", "11"],
|
||||
["12", "12"],
|
||||
["13", "13"],
|
||||
["14", "14"],
|
||||
["15", "15"],
|
||||
["16", "16"],
|
||||
]
|
||||
};
|
||||
File diff suppressed because one or more lines are too long
@@ -7,7 +7,10 @@ export const ethernet_init_begin = {
|
||||
this.setColour(ETHERNET_HUE);
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_ETHERNET_BEGIN)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_ETHERNET, 'Ethernet'], [Blockly.Msg.MIXLY_ETHERNET2, 'Ethernet2']]), "Ethernet");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_ETHERNET, 'Ethernet'],
|
||||
[Blockly.Msg.MIXLY_ETHERNET2, 'Ethernet2']
|
||||
]), "Ethernet");
|
||||
this.appendValueInput('MAC')
|
||||
.setCheck(Array)
|
||||
.setAlign(Blockly.inputs.Align.RIGHT)
|
||||
@@ -35,7 +38,7 @@ export const ethernet_mac_address = {
|
||||
this.setOutput(true, Array);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_ETHERNET_MACADDRESS);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const ethernet_init_local_ip = {
|
||||
init: function () {
|
||||
@@ -167,8 +170,7 @@ export const ethernet_client_get_request = {
|
||||
}
|
||||
return new Blockly.FieldImage(file, 12, 12, '"');
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
export const NTP_server = {
|
||||
init: function () {
|
||||
@@ -190,16 +192,7 @@ export const NTP_server = {
|
||||
this.setHelpUrl();
|
||||
}
|
||||
};
|
||||
//传感器-实时时钟块_时间变量
|
||||
var NTP_TIME_TYPE = [
|
||||
[Blockly.Msg.MIXLY_YEAR, "NTP.getDateYear()"],
|
||||
[Blockly.Msg.MIXLY_MONTH, "NTP.getDateMonth()"],
|
||||
[Blockly.Msg.MIXLY_DAY, "NTP.getDateDay()"],
|
||||
[Blockly.Msg.MIXLY_HOUR, "NTP.getTimeHour24()"],
|
||||
[Blockly.Msg.MIXLY_MINUTE, "NTP.getTimeMinute()"],
|
||||
[Blockly.Msg.MIXLY_SECOND, "NTP.getTimeSecond()"],
|
||||
[Blockly.Msg.MIXLY_WEEK, "NTP.getDateWeekday()"]
|
||||
];
|
||||
|
||||
//传感器-实时时钟块_获取时间
|
||||
export const NTP_server_get_time = {
|
||||
init: function () {
|
||||
@@ -209,10 +202,19 @@ export const NTP_server_get_time = {
|
||||
.appendField(Blockly.Msg.NTP_server_get_time);
|
||||
this.appendDummyInput("")
|
||||
.setAlign(Blockly.inputs.Align.RIGHT)
|
||||
.appendField(new Blockly.FieldDropdown(NTP_TIME_TYPE), "TIME_TYPE");
|
||||
.appendField(new Blockly.FieldDropdown(this.NTP_TIME_TYPE), "TIME_TYPE");
|
||||
this.setInputsInline(true);
|
||||
this.setOutput(true, Number);
|
||||
}
|
||||
},
|
||||
NTP_TIME_TYPE: [
|
||||
[Blockly.Msg.MIXLY_YEAR, "NTP.getDateYear()"],
|
||||
[Blockly.Msg.MIXLY_MONTH, "NTP.getDateMonth()"],
|
||||
[Blockly.Msg.MIXLY_DAY, "NTP.getDateDay()"],
|
||||
[Blockly.Msg.MIXLY_HOUR, "NTP.getTimeHour24()"],
|
||||
[Blockly.Msg.MIXLY_MINUTE, "NTP.getTimeMinute()"],
|
||||
[Blockly.Msg.MIXLY_SECOND, "NTP.getTimeSecond()"],
|
||||
[Blockly.Msg.MIXLY_WEEK, "NTP.getDateWeekday()"]
|
||||
]
|
||||
};
|
||||
|
||||
export const MQTT_server = {
|
||||
@@ -315,7 +317,8 @@ export const MQTT_connect = {
|
||||
this.setTooltip();
|
||||
}
|
||||
};
|
||||
var Topic_validator = function (newValue) {
|
||||
|
||||
const Topic_validator = function (newValue) {
|
||||
return newValue.replace(/\//g, '');
|
||||
};
|
||||
|
||||
@@ -352,6 +355,7 @@ export const MQTT_subscribe_value = {
|
||||
this.setOutput(true, String);
|
||||
}
|
||||
};
|
||||
|
||||
export const MQTT_add_subscribe_topic = {
|
||||
/**
|
||||
* Mutator bolck for else-if condition.
|
||||
@@ -487,7 +491,6 @@ export const MQTT_subscribe = {
|
||||
clauseBlock = clauseBlock.nextConnection &&
|
||||
clauseBlock.nextConnection.targetBlock();
|
||||
}
|
||||
|
||||
this.updateShape_();
|
||||
// Reconnect any child blocks.
|
||||
this.reconnectChildBlocks_(statementConnections);
|
||||
@@ -612,7 +615,10 @@ export const WIFI_smartConfig = {
|
||||
this.setColour(ETHERNET_HUE);
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.blynk_smartconfig)
|
||||
.appendField(new Blockly.FieldDropdown([["SmartConfig", 'SmartConfig'], ["AP", 'AP']]), "MODE");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
["SmartConfig", 'SmartConfig'],
|
||||
["AP", 'AP']
|
||||
]), "MODE");
|
||||
this.setInputsInline(true);
|
||||
this.setPreviousStatement(true, null);//可上下连接
|
||||
this.setNextStatement(true, null);
|
||||
@@ -695,7 +701,10 @@ export const WIFI_incomingPacket = {
|
||||
init: function () {
|
||||
this.appendDummyInput()
|
||||
.appendField(new Blockly.FieldImage(require('../media/blynk/wifi_udp.png'), 25, 25, "*"))
|
||||
.appendField(Blockly.Msg.CONTROLS_IF_MSG_IF + " WIFI UDP " + Blockly.Msg.MIXLY_STM32_SPI_DATA_RECEIVED + "?")
|
||||
.appendField(
|
||||
Blockly.Msg.CONTROLS_IF_MSG_IF + " WIFI UDP "
|
||||
+ Blockly.Msg.MIXLY_STM32_SPI_DATA_RECEIVED + "?"
|
||||
)
|
||||
this.appendValueInput("input_data")
|
||||
.setCheck(null)
|
||||
.appendField(Blockly.Msg.PROCEDURES_CALL_BEFORE_PARAMS);
|
||||
|
||||
@@ -175,7 +175,8 @@ export const factory_declare = {
|
||||
this.setPreviousStatement(true);
|
||||
this.setNextStatement(true);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const factory_declare2 = {
|
||||
init: function () {
|
||||
this.setColour(FACTORY_HUE);
|
||||
@@ -185,6 +186,7 @@ export const factory_declare2 = {
|
||||
this.setNextStatement(true);
|
||||
}
|
||||
};
|
||||
|
||||
export const factory_define = {
|
||||
init: function () {
|
||||
this.setColour(FACTORY_HUE);
|
||||
@@ -195,7 +197,8 @@ export const factory_define = {
|
||||
this.setPreviousStatement(true);
|
||||
this.setNextStatement(true);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const factory_static_method_noreturn = {
|
||||
init: function () {
|
||||
this.setColour(FACTORY_HUE);
|
||||
@@ -216,7 +219,7 @@ export const factory_static_method_noreturn = {
|
||||
compose: factory_function_noreturn.compose,
|
||||
saveConnections: factory_function_noreturn.saveConnections,
|
||||
updateShape_: factory_function_noreturn.updateShape_
|
||||
}
|
||||
};
|
||||
|
||||
export const factory_static_method_return = {
|
||||
init: function () {
|
||||
@@ -237,7 +240,7 @@ export const factory_static_method_return = {
|
||||
compose: factory_function_noreturn.compose,
|
||||
saveConnections: factory_function_noreturn.saveConnections,
|
||||
updateShape_: factory_function_noreturn.updateShape_
|
||||
}
|
||||
};
|
||||
|
||||
export const factory_callMethod_noreturn = {
|
||||
init: function () {
|
||||
@@ -318,4 +321,4 @@ export const factory_block_return_with_textarea = {
|
||||
.appendField(new Blockly.FieldMultilineInput('Hello\nMixly'), 'VALUE');
|
||||
this.setOutput(true);
|
||||
}
|
||||
};
|
||||
};
|
||||
@@ -7,7 +7,10 @@ export const inout_highlow = {
|
||||
init: function () {
|
||||
this.setColour(BASE_HUE);
|
||||
this.appendDummyInput("")
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_HIGH, "HIGH"], [Blockly.Msg.MIXLY_LOW, "LOW"]]), 'BOOL')
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_HIGH, "HIGH"],
|
||||
[Blockly.Msg.MIXLY_LOW, "LOW"]
|
||||
]), 'BOOL')
|
||||
this.setOutput(true, Boolean);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_INOUT_HIGHLOW);
|
||||
}
|
||||
@@ -21,7 +24,11 @@ export const inout_pinMode = {
|
||||
.setCheck(Number);
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_STAT)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_PINMODEIN, "INPUT"], [Blockly.Msg.MIXLY_PINMODEOUT, "OUTPUT"], [Blockly.Msg.MIXLY_PINMODEPULLUP, "INPUT_PULLUP"]]), "MODE")
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_PINMODEIN, "INPUT"],
|
||||
[Blockly.Msg.MIXLY_PINMODEOUT, "OUTPUT"],
|
||||
[Blockly.Msg.MIXLY_PINMODEPULLUP, "INPUT_PULLUP"]
|
||||
]), "MODE")
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setInputsInline(true);
|
||||
@@ -29,7 +36,6 @@ export const inout_pinMode = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export const inout_digital_write2 = {
|
||||
init: function () {
|
||||
this.setColour(BASE_HUE);
|
||||
@@ -108,7 +114,10 @@ export const inout_buildin_led = {
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_BUILDIN_LED)
|
||||
.appendField(Blockly.Msg.MIXLY_STAT)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_ON, "HIGH"], [Blockly.Msg.MIXLY_OFF, "LOW"]]), "STAT");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_ON, "HIGH"],
|
||||
[Blockly.Msg.MIXLY_OFF, "LOW"]
|
||||
]), "STAT");
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setTooltip('light or off the build-in LED');
|
||||
@@ -122,7 +131,13 @@ export const OneButton_interrupt = {
|
||||
.appendField(Blockly.Msg.ONEBUTTON + " " + Blockly.Msg.MIXLY_PIN)
|
||||
.setCheck(Number);
|
||||
this.appendDummyInput("")
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_CLICK, "attachClick"], [Blockly.Msg.MIXLY_DOUBLE_CLICK, "attachDoubleClick"], [Blockly.Msg.MIXLY_LONG_PRESS_START, "attachLongPressStart"], [Blockly.Msg.MIXLY_DURING_LONG_PRESS, "attachDuringLongPress"], [Blockly.Msg.MIXLY_LONG_PRESS_END, "attachLongPressStop"]]), "mode");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_CLICK, "attachClick"],
|
||||
[Blockly.Msg.MIXLY_DOUBLE_CLICK, "attachDoubleClick"],
|
||||
[Blockly.Msg.MIXLY_LONG_PRESS_START, "attachLongPressStart"],
|
||||
[Blockly.Msg.MIXLY_DURING_LONG_PRESS, "attachDuringLongPress"],
|
||||
[Blockly.Msg.MIXLY_LONG_PRESS_END, "attachLongPressStop"]
|
||||
]), "mode");
|
||||
this.appendValueInput("STAT")
|
||||
.appendField(Blockly.Msg.MIXLY_ELECLEVEL);
|
||||
this.appendStatementInput('DO')
|
||||
@@ -141,7 +156,11 @@ export const controls_attachInterrupt = {
|
||||
.setCheck(Number);
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_MODE)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_RISING, "RISING"], [Blockly.Msg.MIXLY_FALLING, "FALLING"], [Blockly.Msg.MIXLY_CHANGE, "CHANGE"]]), "mode");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_RISING, "RISING"],
|
||||
[Blockly.Msg.MIXLY_FALLING, "FALLING"],
|
||||
[Blockly.Msg.MIXLY_CHANGE, "CHANGE"]
|
||||
]), "mode");
|
||||
this.appendStatementInput('DO')
|
||||
.appendField(Blockly.Msg.MIXLY_DO);
|
||||
this.setPreviousStatement(true);
|
||||
@@ -173,7 +192,11 @@ export const controls_attachPinInterrupt = {
|
||||
.setCheck(Number);
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_MODE)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_RISING, "RISING"], [Blockly.Msg.MIXLY_FALLING, "FALLING"], [Blockly.Msg.MIXLY_CHANGE, "CHANGE"]]), "mode");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_RISING, "RISING"],
|
||||
[Blockly.Msg.MIXLY_FALLING, "FALLING"],
|
||||
[Blockly.Msg.MIXLY_CHANGE, "CHANGE"]
|
||||
]), "mode");
|
||||
this.appendStatementInput('DO')
|
||||
.appendField(Blockly.Msg.MIXLY_DO);
|
||||
this.setPreviousStatement(true);
|
||||
@@ -202,7 +225,10 @@ export const inout_pulseIn = {
|
||||
.setCheck(Number);
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_PULSEIN_STAT)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_HIGH, "HIGH"], [Blockly.Msg.MIXLY_LOW, "LOW"]]), "STAT");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_HIGH, "HIGH"],
|
||||
[Blockly.Msg.MIXLY_LOW, "LOW"]
|
||||
]), "STAT");
|
||||
this.setOutput(true, Number);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_INOUT_pulseIn);
|
||||
this.setHelpUrl("https://mixly.readthedocs.io/zh_CN/latest/arduino/02.Input-Output.html#id33");
|
||||
@@ -217,7 +243,10 @@ export const inout_pulseIn2 = {
|
||||
.setCheck(Number);
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_PULSEIN_STAT)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_HIGH, "HIGH"], [Blockly.Msg.MIXLY_LOW, "LOW"]]), "STAT");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_HIGH, "HIGH"],
|
||||
[Blockly.Msg.MIXLY_LOW, "LOW"]
|
||||
]), "STAT");
|
||||
this.appendValueInput("TIMEOUT", Number)
|
||||
.appendField(Blockly.Msg.MIXLY_PULSEIN_TIMEOUT)
|
||||
.setCheck(Number);
|
||||
@@ -241,7 +270,10 @@ export const inout_shiftout = {
|
||||
.setCheck(Number);
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_BITORDER)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_MSBFIRST, "MSBFIRST"], [Blockly.Msg.MIXLY_LSBFIRST, "LSBFIRST"]]), "ORDER");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_MSBFIRST, "MSBFIRST"],
|
||||
[Blockly.Msg.MIXLY_LSBFIRST, "LSBFIRST"]
|
||||
]), "ORDER");
|
||||
this.appendValueInput("DATA", Number)
|
||||
.appendField(Blockly.Msg.MIXLY_DATA)
|
||||
.setCheck(Number);
|
||||
@@ -253,7 +285,6 @@ export const inout_shiftout = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export const ESP32touchButton = {
|
||||
init: function () {
|
||||
this.setColour(BASE_HUE);
|
||||
@@ -262,7 +293,13 @@ export const ESP32touchButton = {
|
||||
.setCheck(Number);
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_MODE)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_CLICK, "attachClick"], [Blockly.Msg.MIXLY_DOUBLE_CLICK, "attachDoubleClick"], [Blockly.Msg.MIXLY_LONG_PRESS_START, "attachLongPressStart"], [Blockly.Msg.MIXLY_DURING_LONG_PRESS, "attachDuringLongPress"], [Blockly.Msg.MIXLY_LONG_PRESS_END, "attachLongPressStop"]]), "mode");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_CLICK, "attachClick"],
|
||||
[Blockly.Msg.MIXLY_DOUBLE_CLICK, "attachDoubleClick"],
|
||||
[Blockly.Msg.MIXLY_LONG_PRESS_START, "attachLongPressStart"],
|
||||
[Blockly.Msg.MIXLY_DURING_LONG_PRESS, "attachDuringLongPress"],
|
||||
[Blockly.Msg.MIXLY_LONG_PRESS_END, "attachLongPressStop"]
|
||||
]), "mode");
|
||||
this.appendStatementInput('DO')
|
||||
.appendField(Blockly.Msg.MIXLY_DO);
|
||||
this.setTooltip();
|
||||
@@ -301,45 +338,62 @@ export const inout_cancel_soft_analog_write = {
|
||||
}
|
||||
};
|
||||
|
||||
//ADS1015模拟数字转换模块-获取数据
|
||||
var ADS1015_setGain_type = [
|
||||
["±6.144V 3mv/bit", "GAIN_TWOTHIRDS"],
|
||||
["±4.096V 2mv/bit", "GAIN_ONE"],
|
||||
["±2.048V 1mv/bit", "GAIN_TWO"],
|
||||
["±1.024V 0.5mv/bit", "GAIN_FOUR"],
|
||||
["±0.512V 0.25mv/bit", "GAIN_EIGHT"],
|
||||
["±0.256V 0.125mv/bit", "GAIN_SIXTEEN"],
|
||||
];
|
||||
|
||||
//ADS1015模拟数字转换模块-增益设置
|
||||
export const ADS1015_setGain = {
|
||||
init: function () {
|
||||
this.setColour(BASE_HUE);
|
||||
this.appendDummyInput("").appendField(Blockly.Msg.MIXLY_SETTING).appendField(Blockly.Msg.ADS1015_setGain);
|
||||
this.appendDummyInput("").setAlign(Blockly.inputs.Align.RIGHT).appendField(new Blockly.FieldDropdown(ADS1015_setGain_type), "ADS1015_setGain");
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_SETTING)
|
||||
.appendField(Blockly.Msg.ADS1015_setGain);
|
||||
this.appendDummyInput("")
|
||||
.setAlign(Blockly.inputs.Align.RIGHT)
|
||||
.appendField(new Blockly.FieldDropdown(this.GAIN_TYPE), "ADS1015_setGain");
|
||||
this.setInputsInline(true);
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setTooltip();
|
||||
}
|
||||
},
|
||||
GAIN_TYPE: [
|
||||
["±6.144V 3mv/bit", "GAIN_TWOTHIRDS"],
|
||||
["±4.096V 2mv/bit", "GAIN_ONE"],
|
||||
["±2.048V 1mv/bit", "GAIN_TWO"],
|
||||
["±1.024V 0.5mv/bit", "GAIN_FOUR"],
|
||||
["±0.512V 0.25mv/bit", "GAIN_EIGHT"],
|
||||
["±0.256V 0.125mv/bit", "GAIN_SIXTEEN"],
|
||||
]
|
||||
};
|
||||
|
||||
//ADS1015模拟数字转换模块 数值获取
|
||||
export const ADS1015_Get_Value = {
|
||||
init: function () {
|
||||
this.setColour(BASE_HUE);
|
||||
this.appendDummyInput("").appendField("ADS1015" + Blockly.Msg.ADS1015_Get_Value);
|
||||
this.appendDummyInput("").appendField(new Blockly.FieldDropdown([["AIN0", "ads.readADC_SingleEnded(0)"], ["AIN1", "ads.readADC_SingleEnded(1)"], ["AIN2", "ads.readADC_SingleEnded(2)"], ["AIN3", "ads.readADC_SingleEnded(3)"]]), "ADS1015_AIN");
|
||||
this.appendDummyInput("")
|
||||
.appendField("ADS1015" + Blockly.Msg.ADS1015_Get_Value);
|
||||
this.appendDummyInput("")
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
["AIN0", "ads.readADC_SingleEnded(0)"],
|
||||
["AIN1", "ads.readADC_SingleEnded(1)"],
|
||||
["AIN2", "ads.readADC_SingleEnded(2)"],
|
||||
["AIN3", "ads.readADC_SingleEnded(3)"]
|
||||
]), "ADS1015_AIN");
|
||||
this.setInputsInline(true);
|
||||
this.setOutput(true);
|
||||
}
|
||||
};
|
||||
|
||||
//PCF8591T模拟数字转换模块 数值获取
|
||||
export const PCF8591T = {
|
||||
init: function () {
|
||||
this.setColour(BASE_HUE);
|
||||
this.appendDummyInput("").appendField("PCF8591T" + Blockly.Msg.ADS1015_Get_Value);
|
||||
this.appendDummyInput("").appendField(new Blockly.FieldDropdown([["AIN0", "pcf8591.analogRead(AIN0)"], ["AIN1", "pcf8591.analogRead(AIN1)"], ["AIN2", "pcf8591.analogRead(AIN2)"], ["AIN3", "pcf8591.analogRead(AIN3)"]]), "PCF8591T_AIN");
|
||||
this.appendDummyInput("")
|
||||
.appendField("PCF8591T" + Blockly.Msg.ADS1015_Get_Value);
|
||||
this.appendDummyInput("")
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
["AIN0", "pcf8591.analogRead(AIN0)"],
|
||||
["AIN1", "pcf8591.analogRead(AIN1)"],
|
||||
["AIN2", "pcf8591.analogRead(AIN2)"],
|
||||
["AIN3", "pcf8591.analogRead(AIN3)"]
|
||||
]), "PCF8591T_AIN");
|
||||
this.setInputsInline(true);
|
||||
this.setOutput(true);
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ export const lists_create_with_text = {
|
||||
}
|
||||
return new Blockly.FieldImage(file, 12, 12, '"');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const lists_create_with2 = {
|
||||
/**
|
||||
@@ -577,6 +577,7 @@ export const lists_array2_setup = {
|
||||
this.setHelpUrl("");
|
||||
}
|
||||
};
|
||||
|
||||
export const lists_array2_setup_get_data = {
|
||||
/**
|
||||
* Block for creating a list with any number of elements of any type.
|
||||
@@ -720,10 +721,14 @@ export const loop_array = {
|
||||
init: function () {
|
||||
this.appendValueInput("name")
|
||||
.setCheck(null)
|
||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_PY_CONTORL_GET_TYPE).appendField(new Blockly.FieldDropdown(DATATYPES), "TYPE")
|
||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_PY_CONTORL_GET_TYPE)
|
||||
.appendField(new Blockly.FieldDropdown(DATATYPES), "TYPE")
|
||||
.appendField(Blockly.Msg.MIXLY_LIST_NAME);
|
||||
this.appendDummyInput()
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.LEFT_CYCLE, "0"], [Blockly.Msg.RIGHT_CYCLE, "1"]]), "mode");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.LEFT_CYCLE, "0"],
|
||||
[Blockly.Msg.RIGHT_CYCLE, "1"]
|
||||
]), "mode");
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setColour(LISTS_HUE);
|
||||
@@ -739,7 +744,10 @@ export const lists_array2_get_length = {
|
||||
.appendField(Blockly.Msg.MIXLY_ARRAY2)
|
||||
.appendField(new Blockly.FieldTextInput("mylist"), "list_name")
|
||||
.appendField(" " + Blockly.Msg.MIXLY_GET)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.array2_rows, "row"], [Blockly.Msg.array2_cols, "col"]]), "type");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.array2_rows, "row"],
|
||||
[Blockly.Msg.array2_cols, "col"]
|
||||
]), "type");
|
||||
this.setInputsInline(true);
|
||||
this.setOutput(true, null);
|
||||
this.setColour(LISTS_HUE);
|
||||
|
||||
@@ -133,7 +133,6 @@ export const logic_null = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export const logic_true_or_false = {
|
||||
init: function () {
|
||||
this.setColour(LOGIC_HUE);
|
||||
@@ -146,4 +145,4 @@ export const logic_true_or_false = {
|
||||
this.setInputsInline(true);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_LOGIT_TRUEORFALSE);
|
||||
}
|
||||
};
|
||||
};
|
||||
@@ -29,14 +29,6 @@ export const math_arithmetic = {
|
||||
* @this Blockly.Block
|
||||
*/
|
||||
init: function () {
|
||||
var OPERATORS = [
|
||||
[Blockly.Msg.MATH_ADDITION_SYMBOL, 'ADD'],
|
||||
[Blockly.Msg.MATH_SUBTRACTION_SYMBOL, 'MINUS'],
|
||||
[Blockly.Msg.MATH_MULTIPLICATION_SYMBOL, 'MULTIPLY'],
|
||||
[Blockly.Msg.MATH_DIVISION_SYMBOL, 'DIVIDE'],
|
||||
[Blockly.Msg.MATH_QUYU_SYMBOL, 'QUYU'],
|
||||
[Blockly.Msg.MATH_POWER_SYMBOL, 'POWER']
|
||||
];
|
||||
//this.setHelpUrl(Blockly.Msg.MATH_ARITHMETIC_HELPURL);
|
||||
this.setColour(MATH_HUE);
|
||||
this.setOutput(true, Number);
|
||||
@@ -45,7 +37,7 @@ export const math_arithmetic = {
|
||||
this.setHelpUrl("https://mixly.readthedocs.io/zh_CN/latest/arduino/04.Mathematics.html#id4");
|
||||
this.appendValueInput('B')
|
||||
.setCheck(null)
|
||||
.appendField(new Blockly.FieldDropdown(OPERATORS), 'OP');
|
||||
.appendField(new Blockly.FieldDropdown(this.OPERATORS), 'OP');
|
||||
this.setInputsInline(true);
|
||||
// Assign 'this' to a variable for use in the tooltip closure below.
|
||||
var thisBlock = this;
|
||||
@@ -61,29 +53,37 @@ export const math_arithmetic = {
|
||||
};
|
||||
return TOOLTIPS[mode];
|
||||
});
|
||||
}
|
||||
},
|
||||
OPERATORS: [
|
||||
[Blockly.Msg.MATH_ADDITION_SYMBOL, 'ADD'],
|
||||
[Blockly.Msg.MATH_SUBTRACTION_SYMBOL, 'MINUS'],
|
||||
[Blockly.Msg.MATH_MULTIPLICATION_SYMBOL, 'MULTIPLY'],
|
||||
[Blockly.Msg.MATH_DIVISION_SYMBOL, 'DIVIDE'],
|
||||
[Blockly.Msg.MATH_QUYU_SYMBOL, 'QUYU'],
|
||||
[Blockly.Msg.MATH_POWER_SYMBOL, 'POWER']
|
||||
]
|
||||
};
|
||||
|
||||
export const math_bit = {
|
||||
init: function () {
|
||||
var OPERATORS = [
|
||||
['&', '&'],
|
||||
['|', '|'],
|
||||
['xor', '^'],
|
||||
['>>', '>>'],
|
||||
['<<', '<<']
|
||||
];
|
||||
this.setColour(MATH_HUE);
|
||||
this.setOutput(true, Number);
|
||||
this.appendValueInput('A')
|
||||
.setCheck(Number);
|
||||
this.appendValueInput('B')
|
||||
.setCheck(Number)
|
||||
.appendField(new Blockly.FieldDropdown(OPERATORS), 'OP');
|
||||
.appendField(new Blockly.FieldDropdown(this.OPERATORS), 'OP');
|
||||
this.setInputsInline(true);
|
||||
this.setTooltip("");
|
||||
this.setHelpUrl("https://mixly.readthedocs.io/zh_CN/latest/arduino/04.Mathematics.html#id8");
|
||||
}
|
||||
},
|
||||
OPERATORS: [
|
||||
['&', '&'],
|
||||
['|', '|'],
|
||||
['xor', '^'],
|
||||
['>>', '>>'],
|
||||
['<<', '<<']
|
||||
]
|
||||
};
|
||||
|
||||
export const math_trig = {
|
||||
@@ -92,27 +92,12 @@ export const math_trig = {
|
||||
* @this Blockly.Block
|
||||
*/
|
||||
init: function () {
|
||||
var OPERATORS = [
|
||||
['sin', 'SIN'],
|
||||
['cos', 'COS'],
|
||||
['tan', 'TAN'],
|
||||
['asin', 'ASIN'],
|
||||
['acos', 'ACOS'],
|
||||
['atan', 'ATAN'],
|
||||
['ln', 'LN'],
|
||||
['log10', 'LOG10'],
|
||||
['e^', 'EXP'],
|
||||
['10^', 'POW10'],
|
||||
['++', '++'],
|
||||
['--', '--'],
|
||||
['~', '~'],
|
||||
];
|
||||
//this.setHelpUrl(Blockly.Msg.MATH_TRIG_HELPURL);
|
||||
this.setColour(MATH_HUE);
|
||||
this.setOutput(true, Number);
|
||||
this.appendValueInput('NUM')
|
||||
.setCheck(Number)
|
||||
.appendField(new Blockly.FieldDropdown(OPERATORS), 'OP');
|
||||
.appendField(new Blockly.FieldDropdown(this.OPERATORS), 'OP');
|
||||
// Assign 'this' to a variable for use in the tooltip closure below.
|
||||
var thisBlock = this;
|
||||
this.setHelpUrl("https://mixly.readthedocs.io/zh_CN/latest/arduino/04.Mathematics.html#id17");
|
||||
@@ -128,24 +113,31 @@ export const math_trig = {
|
||||
};
|
||||
return TOOLTIPS[mode];
|
||||
});
|
||||
}
|
||||
},
|
||||
OPERATORS: [
|
||||
['sin', 'SIN'],
|
||||
['cos', 'COS'],
|
||||
['tan', 'TAN'],
|
||||
['asin', 'ASIN'],
|
||||
['acos', 'ACOS'],
|
||||
['atan', 'ATAN'],
|
||||
['ln', 'LN'],
|
||||
['log10', 'LOG10'],
|
||||
['e^', 'EXP'],
|
||||
['10^', 'POW10'],
|
||||
['++', '++'],
|
||||
['--', '--'],
|
||||
['~', '~'],
|
||||
]
|
||||
};
|
||||
|
||||
//取整等
|
||||
export const math_to_int = {
|
||||
init: function () {
|
||||
var OPERATORS = [
|
||||
[Blockly.Msg.LANG_MATH_TO_ROUND, 'round'],
|
||||
[Blockly.Msg.LANG_MATH_TO_CEIL, 'ceil'],
|
||||
[Blockly.Msg.LANG_MATH_TO_FLOOR, 'floor'],
|
||||
[Blockly.Msg.MATH_ABS, 'abs'],
|
||||
[Blockly.Msg.MATH_SQ, 'sq'],
|
||||
[Blockly.Msg.MATH_SQRT, 'sqrt']
|
||||
];
|
||||
this.setColour(MATH_HUE);
|
||||
this.appendValueInput('A')
|
||||
.setCheck(Number)
|
||||
.appendField(new Blockly.FieldDropdown(OPERATORS), 'OP');
|
||||
.appendField(new Blockly.FieldDropdown(this.OPERATORS), 'OP');
|
||||
this.setOutput(true, Number);
|
||||
this.setHelpUrl("https://mixly.readthedocs.io/zh_CN/latest/arduino/04.Mathematics.html#id18");
|
||||
var thisBlock = this;
|
||||
@@ -162,37 +154,47 @@ export const math_to_int = {
|
||||
};
|
||||
return TOOLTIPS[mode];
|
||||
});
|
||||
}
|
||||
},
|
||||
OPERATORS: [
|
||||
[Blockly.Msg.LANG_MATH_TO_ROUND, 'round'],
|
||||
[Blockly.Msg.LANG_MATH_TO_CEIL, 'ceil'],
|
||||
[Blockly.Msg.LANG_MATH_TO_FLOOR, 'floor'],
|
||||
[Blockly.Msg.MATH_ABS, 'abs'],
|
||||
[Blockly.Msg.MATH_SQ, 'sq'],
|
||||
[Blockly.Msg.MATH_SQRT, 'sqrt']
|
||||
]
|
||||
};
|
||||
|
||||
//变量定义
|
||||
export const arduino_variate_type = {
|
||||
init: function () {
|
||||
var DATATYPES = [
|
||||
[Blockly.Msg.LANG_MATH_INT, 'int'],
|
||||
[Blockly.Msg.LANG_MATH_UNSIGNED_INT, 'unsigned int'],
|
||||
[Blockly.Msg.LANG_MATH_WORD, 'word'],
|
||||
[Blockly.Msg.LANG_MATH_LONG, 'long'],
|
||||
[Blockly.Msg.LANG_MATH_UNSIGNED_LONG, 'unsigned long'],
|
||||
[Blockly.Msg.LANG_MATH_FLOAT, 'float'],
|
||||
[Blockly.Msg.LANG_MATH_DOUBLE, 'double'],
|
||||
[Blockly.Msg.LANG_MATH_BOOLEAN, 'boolean'],
|
||||
[Blockly.Msg.LANG_MATH_BYTE, 'byte'],
|
||||
[Blockly.Msg.LANG_MATH_CHAR, 'char'],
|
||||
[Blockly.Msg.LANG_MATH_UNSIGNED_CHAR, 'unsigned char'],
|
||||
[Blockly.Msg.LANG_MATH_STRING, 'String'],
|
||||
["uint8_t", "uint8_t"],
|
||||
["uint16_t", "uint16_t"],
|
||||
["uint32_t", "uint32_t"],
|
||||
["uint64_t", "uint64_t"]
|
||||
];
|
||||
this.appendDummyInput()
|
||||
.appendField(new Blockly.FieldDropdown(DATATYPES), "variate_type");
|
||||
.appendField(new Blockly.FieldDropdown(this.DATATYPES), "variate_type");
|
||||
this.setOutput(true, null);
|
||||
this.setColour(MATH_HUE);
|
||||
this.setTooltip("");
|
||||
this.setHelpUrl("");
|
||||
}
|
||||
},
|
||||
DATATYPES: [
|
||||
[Blockly.Msg.LANG_MATH_INT, 'int'],
|
||||
[Blockly.Msg.LANG_MATH_UNSIGNED_INT, 'unsigned int'],
|
||||
[Blockly.Msg.LANG_MATH_WORD, 'word'],
|
||||
[Blockly.Msg.LANG_MATH_LONG, 'long'],
|
||||
[Blockly.Msg.LANG_MATH_UNSIGNED_LONG, 'unsigned long'],
|
||||
[Blockly.Msg.LANG_MATH_FLOAT, 'float'],
|
||||
[Blockly.Msg.LANG_MATH_DOUBLE, 'double'],
|
||||
[Blockly.Msg.LANG_MATH_BOOLEAN, 'boolean'],
|
||||
[Blockly.Msg.LANG_MATH_BYTE, 'byte'],
|
||||
[Blockly.Msg.LANG_MATH_CHAR, 'char'],
|
||||
[Blockly.Msg.LANG_MATH_UNSIGNED_CHAR, 'unsigned char'],
|
||||
[Blockly.Msg.LANG_MATH_STRING, 'String'],
|
||||
["uint8_t", "uint8_t"],
|
||||
["uint16_t", "uint16_t"],
|
||||
["uint32_t", "uint32_t"],
|
||||
["uint64_t", "uint64_t"]
|
||||
]
|
||||
};
|
||||
|
||||
//获取某个变量在内存中所占用的字节数
|
||||
export const math_SizeOf = {
|
||||
init: function () {
|
||||
@@ -206,18 +208,15 @@ export const math_SizeOf = {
|
||||
this.setHelpUrl("");
|
||||
}
|
||||
};
|
||||
|
||||
//最大最小值
|
||||
export const math_max_min = {
|
||||
init: function () {
|
||||
var OPERATORS = [
|
||||
[Blockly.Msg.MIXLY_MAX, 'max'],
|
||||
[Blockly.Msg.MIXLY_MIN, 'min'],
|
||||
];
|
||||
this.setColour(MATH_HUE);
|
||||
this.appendValueInput('A')
|
||||
.setCheck(Number)
|
||||
.setAlign(Blockly.inputs.Align.RIGHT)
|
||||
.appendField(new Blockly.FieldDropdown(OPERATORS), 'OP')
|
||||
.appendField(new Blockly.FieldDropdown(this.OPERATORS), 'OP')
|
||||
.appendField('(');
|
||||
this.appendValueInput('B')
|
||||
.setCheck(Number)
|
||||
@@ -238,7 +237,11 @@ export const math_max_min = {
|
||||
};
|
||||
return TOOLTIPS[mode];
|
||||
});
|
||||
}
|
||||
},
|
||||
OPERATORS: [
|
||||
[Blockly.Msg.MIXLY_MAX, 'max'],
|
||||
[Blockly.Msg.MIXLY_MIN, 'min'],
|
||||
]
|
||||
};
|
||||
|
||||
export const math_random_seed = {
|
||||
@@ -305,7 +308,10 @@ export const base_map = {
|
||||
this.setColour(MATH_HUE);
|
||||
this.appendValueInput("NUM", Number)
|
||||
.appendField(Blockly.Msg.MIXLY_MAP)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.LANG_MATH_INT, "map_int"], [Blockly.Msg.LANG_MATH_FLOAT, "map_float"]]), "maptype")
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.LANG_MATH_INT, "map_int"],
|
||||
[Blockly.Msg.LANG_MATH_FLOAT, "map_float"]
|
||||
]), "maptype")
|
||||
.setCheck(Number);
|
||||
this.appendValueInput("fromLow", Number)
|
||||
.appendField(Blockly.Msg.MIXLY_MAP_FROM)
|
||||
@@ -335,7 +341,12 @@ export const variables_operation = {
|
||||
.setCheck(null);
|
||||
this.appendValueInput("data")
|
||||
.setCheck(null)
|
||||
.appendField(new Blockly.FieldDropdown([["+=", "+"], ["-=", "-"], ["*=", "*"], ["/=", "/"]]), "type");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
["+=", "+"],
|
||||
["-=", "-"],
|
||||
["*=", "*"],
|
||||
["/=", "/"]
|
||||
]), "type");
|
||||
this.appendDummyInput();
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
@@ -349,7 +360,10 @@ export const math_auto_add_or_minus = {
|
||||
this.appendValueInput("math_auto_add_minus_output")
|
||||
.setCheck(null);
|
||||
this.appendDummyInput()
|
||||
.appendField(new Blockly.FieldDropdown([["++", "++"], ["--", "--"]]), "math_auto_add_minus_type");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
["++", "++"],
|
||||
["--", "--"]
|
||||
]), "math_auto_add_minus_type");
|
||||
this.setInputsInline(true);
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
|
||||
@@ -38,6 +38,7 @@ export const pins_interrupt = {
|
||||
this.setOutput(true, Number);
|
||||
}
|
||||
};
|
||||
|
||||
export const pins_MOSI = {
|
||||
init: function () {
|
||||
this.setColour(PINS_HUE);
|
||||
@@ -46,6 +47,7 @@ export const pins_MOSI = {
|
||||
this.setOutput(true, Number);
|
||||
}
|
||||
};
|
||||
|
||||
export const pins_MISO = {
|
||||
init: function () {
|
||||
this.setColour(PINS_HUE);
|
||||
@@ -54,6 +56,7 @@ export const pins_MISO = {
|
||||
this.setOutput(true, Number);
|
||||
}
|
||||
};
|
||||
|
||||
export const pins_SCK = {
|
||||
init: function () {
|
||||
this.setColour(PINS_HUE);
|
||||
@@ -62,6 +65,7 @@ export const pins_SCK = {
|
||||
this.setOutput(true, Number);
|
||||
}
|
||||
};
|
||||
|
||||
export const pins_SCL = {
|
||||
init: function () {
|
||||
this.setColour(PINS_HUE);
|
||||
@@ -70,6 +74,7 @@ export const pins_SCL = {
|
||||
this.setOutput(true, Number);
|
||||
}
|
||||
};
|
||||
|
||||
export const pins_SDA = {
|
||||
init: function () {
|
||||
this.setColour(PINS_HUE);
|
||||
|
||||
@@ -4,10 +4,9 @@ const SCOOP_HUE = 120;
|
||||
|
||||
export const SCoopTask = {
|
||||
init: function () {
|
||||
var _tasknum = [["1", "1"], ["2", "2"], ["3", "3"], ["4", "4"], ["5", "5"], ["6", "6"], ["7", "7"], ["8", "8"]];
|
||||
this.appendDummyInput()
|
||||
.appendField("Scoop Task")
|
||||
.appendField(new Blockly.FieldDropdown(_tasknum), "_tasknum");
|
||||
.appendField(new Blockly.FieldDropdown(this.NUMBER), "_tasknum");
|
||||
this.appendStatementInput("setup")
|
||||
.appendField(Blockly.Msg.MIXLY_SETUP)
|
||||
.setCheck(null);
|
||||
@@ -17,7 +16,17 @@ export const SCoopTask = {
|
||||
this.setColour(SCOOP_HUE);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_SCOOP);
|
||||
this.setHelpUrl("https://mixly.readthedocs.io/zh_CN/latest/arduino/03.Control.html#scoop-task");
|
||||
}
|
||||
},
|
||||
NUMBER: [
|
||||
["1", "1"],
|
||||
["2", "2"],
|
||||
["3", "3"],
|
||||
["4", "4"],
|
||||
["5", "5"],
|
||||
["6", "6"],
|
||||
["7", "7"],
|
||||
["8", "8"]
|
||||
]
|
||||
};
|
||||
|
||||
export const SCoop_yield = {
|
||||
@@ -31,6 +40,7 @@ export const SCoop_yield = {
|
||||
this.setHelpUrl("https://mixly.readthedocs.io/zh_CN/latest/arduino/03.Control.html#scoop-task");
|
||||
}
|
||||
};
|
||||
|
||||
export const SCoop_sleep = {
|
||||
init: function () {
|
||||
this.setColour(SCOOP_HUE);
|
||||
|
||||
@@ -139,16 +139,19 @@ export const LM35 = {
|
||||
//DS18B20温度传感器
|
||||
export const ds18b20 = {
|
||||
init: function () {
|
||||
var UNIT = [[Blockly.Msg.MIXLY_DS18B20_C, '0'], [Blockly.Msg.MIXLY_DS18B20_F, '1']];
|
||||
this.setColour(SENSOR_HUE);
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_DS18B20)
|
||||
.appendField(new Blockly.FieldDropdown(Profile.default.digital), "PIN")
|
||||
.appendField(Blockly.Msg.MIXLY_GETTEMPERATUE)
|
||||
.appendField(new Blockly.FieldDropdown(UNIT), "UNIT");
|
||||
.appendField(new Blockly.FieldDropdown(this.UNIT), "UNIT");
|
||||
this.setOutput(true, Number);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_DS18);
|
||||
}
|
||||
},
|
||||
UNIT: [
|
||||
[Blockly.Msg.MIXLY_DS18B20_C, '0'],
|
||||
[Blockly.Msg.MIXLY_DS18B20_F, '1']
|
||||
]
|
||||
};
|
||||
|
||||
//初始化MLX90614红外测温传感器
|
||||
@@ -170,21 +173,22 @@ export const mlx90614_init = {
|
||||
//MLX90614获取数据
|
||||
export const mlx90614_get_data = {
|
||||
init: function () {
|
||||
var type = [
|
||||
[Blockly.Msg.MLX90614_TARGET_OBJECT_TEMP + "(℃)", "readObjectTempC"],
|
||||
[Blockly.Msg.MLX90614_TARGET_OBJECT_TEMP + "(℉)", "readObjectTempF"],
|
||||
[Blockly.Msg.MLX90614_AMBIENT_TEMP + "(℃)", "readAmbientTempC"],
|
||||
[Blockly.Msg.MLX90614_AMBIENT_TEMP + "(℉)", "readAmbientTempF"]];
|
||||
this.appendDummyInput()
|
||||
.appendField("MLX90614" + Blockly.Msg.MLX90614_TYPE)
|
||||
.appendField(Blockly.Msg.MIXLY_GET)
|
||||
.appendField(new Blockly.FieldDropdown(type), "mlx90614_data");
|
||||
.appendField(new Blockly.FieldDropdown(this.DATA_TYPE), "mlx90614_data");
|
||||
this.setInputsInline(true);
|
||||
this.setOutput(true, null);
|
||||
this.setColour(40);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_MLX90614_GET_DATA);
|
||||
this.setHelpUrl("");
|
||||
}
|
||||
},
|
||||
DATA_TYPE: [
|
||||
[Blockly.Msg.MLX90614_TARGET_OBJECT_TEMP + "(℃)", "readObjectTempC"],
|
||||
[Blockly.Msg.MLX90614_TARGET_OBJECT_TEMP + "(℉)", "readObjectTempF"],
|
||||
[Blockly.Msg.MLX90614_AMBIENT_TEMP + "(℃)", "readAmbientTempC"],
|
||||
[Blockly.Msg.MLX90614_AMBIENT_TEMP + "(℉)", "readAmbientTempF"]
|
||||
]
|
||||
};
|
||||
|
||||
//DF称重模块
|
||||
@@ -232,16 +236,17 @@ export const DS1302_init = {
|
||||
this.setInputsInline(true);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_DS1302_INIT);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var RTCTypeList = [['DS1307', 'RtcDS1307'], ['DS3231', 'RtcDS3231']];
|
||||
//DS1307 RTC
|
||||
export const DS1307_init = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_HUE);
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_RTCINIT);
|
||||
this.appendDummyInput("").setAlign(Blockly.inputs.Align.RIGHT).appendField(new Blockly.FieldDropdown(RTCTypeList), 'RTCType');
|
||||
this.appendDummyInput("")
|
||||
.setAlign(Blockly.inputs.Align.RIGHT)
|
||||
.appendField(new Blockly.FieldDropdown(this.RTC_TYPE), 'RTCType');
|
||||
this.appendDummyInput("")
|
||||
.setAlign(Blockly.inputs.Align.RIGHT)
|
||||
.appendField(Blockly.Msg.MIXLY_PIN);
|
||||
@@ -256,21 +261,10 @@ export const DS1307_init = {
|
||||
this.setNextStatement(true, null);
|
||||
this.setInputsInline(true);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_DS1307_INIT);
|
||||
}
|
||||
},
|
||||
RTC_TYPE: [['DS1307', 'RtcDS1307'], ['DS3231', 'RtcDS3231']]
|
||||
};
|
||||
|
||||
//传感器-实时时钟块_时间变量
|
||||
var RTC_TIME_TYPE = [
|
||||
[Blockly.Msg.MIXLY_YEAR, "Year"],
|
||||
[Blockly.Msg.MIXLY_MONTH, "Month"],
|
||||
[Blockly.Msg.MIXLY_DAY, "Day"],
|
||||
[Blockly.Msg.MIXLY_HOUR, "Hour"],
|
||||
[Blockly.Msg.MIXLY_MINUTE, "Minute"],
|
||||
[Blockly.Msg.MIXLY_SECOND, "Second"],
|
||||
[Blockly.Msg.MIXLY_WEEK, "DayOfWeek"],
|
||||
|
||||
];
|
||||
|
||||
//传感器-实时时钟块_获取时间
|
||||
export const RTC_get_time = {
|
||||
init: function () {
|
||||
@@ -283,11 +277,20 @@ export const RTC_get_time = {
|
||||
//.appendField(new Blockly.FieldTextInput('myRTC'), 'RTCName');
|
||||
this.appendDummyInput("")
|
||||
.setAlign(Blockly.inputs.Align.RIGHT)
|
||||
.appendField(new Blockly.FieldDropdown(RTC_TIME_TYPE), "TIME_TYPE");
|
||||
.appendField(new Blockly.FieldDropdown(this.RTC_TIME_TYPE), "TIME_TYPE");
|
||||
this.setInputsInline(true);
|
||||
this.setOutput(true, Number);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_RTC_GETTIME.replace('%1', this.getFieldValue("TIME_TYPE")));
|
||||
}
|
||||
},
|
||||
RTC_TIME_TYPE: [
|
||||
[Blockly.Msg.MIXLY_YEAR, "Year"],
|
||||
[Blockly.Msg.MIXLY_MONTH, "Month"],
|
||||
[Blockly.Msg.MIXLY_DAY, "Day"],
|
||||
[Blockly.Msg.MIXLY_HOUR, "Hour"],
|
||||
[Blockly.Msg.MIXLY_MINUTE, "Minute"],
|
||||
[Blockly.Msg.MIXLY_SECOND, "Second"],
|
||||
[Blockly.Msg.MIXLY_WEEK, "DayOfWeek"]
|
||||
]
|
||||
};
|
||||
|
||||
// //传感器-实时时钟块_设置时间
|
||||
@@ -356,7 +359,10 @@ export const get_system_date_time = {
|
||||
init: function () {
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_GET + " " + Blockly.Msg.MIXLY_SYSTEM)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_GPS_DATE, "DATE"], [Blockly.Msg.MIXLY_GPS_TIME, "TIME"]]), "type");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_GPS_DATE, "DATE"],
|
||||
[Blockly.Msg.MIXLY_GPS_TIME, "TIME"]
|
||||
]), "type");
|
||||
this.setInputsInline(false);
|
||||
this.setOutput(true, null);
|
||||
this.setColour(40);
|
||||
@@ -373,18 +379,12 @@ export const RTC_set_date = {
|
||||
.setAlign(Blockly.inputs.Align.RIGHT)
|
||||
.appendField(Blockly.Msg.MIXLY_RTCSETDATE);
|
||||
// .appendField(new Blockly.FieldTextInput('myRTC'), 'RTCName');
|
||||
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_RTC_SETDATE);
|
||||
}
|
||||
};
|
||||
|
||||
var SHT20_TYPE = [
|
||||
[Blockly.Msg.MIXLY_TEMPERATURE, "sht20.readTemperature()"],
|
||||
[Blockly.Msg.MIXLY_Humidity, "sht20.readHumidity()"],
|
||||
];
|
||||
|
||||
export const SHT20 = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_HUE);
|
||||
@@ -392,22 +392,17 @@ export const SHT20 = {
|
||||
.appendField("SHT20" + Blockly.Msg.MIXLY_DHT11_T_H);
|
||||
this.appendDummyInput("")
|
||||
.setAlign(Blockly.inputs.Align.RIGHT)
|
||||
.appendField(new Blockly.FieldDropdown(SHT20_TYPE), "SHT20_TYPE");
|
||||
.appendField(new Blockly.FieldDropdown(this.SHT20_TYPE), "SHT20_TYPE");
|
||||
this.setInputsInline(true);
|
||||
this.setOutput(true);
|
||||
this.setTooltip();
|
||||
}
|
||||
},
|
||||
SHT20_TYPE: [
|
||||
[Blockly.Msg.MIXLY_TEMPERATURE, "sht20.readTemperature()"],
|
||||
[Blockly.Msg.MIXLY_Humidity, "sht20.readHumidity()"],
|
||||
]
|
||||
};
|
||||
|
||||
var ADXL345_GETAB = [
|
||||
[Blockly.Msg.MixGo_MPU9250_AX, "accel.getAccelerationX()"],
|
||||
[Blockly.Msg.MixGo_MPU9250_AY, "accel.getAccelerationY()"],
|
||||
[Blockly.Msg.MixGo_MPU9250_AZ, "accel.getAccelerationZ()"],
|
||||
[Blockly.Msg.MixGo_MPU9250_AX + "(g)", "accel.getAccelerationX()/256.0"],
|
||||
[Blockly.Msg.MixGo_MPU9250_AY + "(g)", "accel.getAccelerationY()/256.0"],
|
||||
[Blockly.Msg.MixGo_MPU9250_AZ + "(g)", "accel.getAccelerationZ()/256.0"],
|
||||
];
|
||||
|
||||
//传感器-重力感应块-获取数据
|
||||
export const ADXL345 = {
|
||||
init: function () {
|
||||
@@ -416,11 +411,19 @@ export const ADXL345 = {
|
||||
.appendField(Blockly.Msg.MIXLY_ADXL345);
|
||||
this.appendDummyInput("")
|
||||
.setAlign(Blockly.inputs.Align.RIGHT)
|
||||
.appendField(new Blockly.FieldDropdown(ADXL345_GETAB), "ADXL345_PIN");
|
||||
.appendField(new Blockly.FieldDropdown(this.ADXL345_GETAB), "ADXL345_PIN");
|
||||
this.setInputsInline(true);
|
||||
this.setOutput(true);
|
||||
this.setTooltip();
|
||||
}
|
||||
},
|
||||
ADXL345_GETAB: [
|
||||
[Blockly.Msg.MixGo_MPU9250_AX, "accel.getAccelerationX()"],
|
||||
[Blockly.Msg.MixGo_MPU9250_AY, "accel.getAccelerationY()"],
|
||||
[Blockly.Msg.MixGo_MPU9250_AZ, "accel.getAccelerationZ()"],
|
||||
[Blockly.Msg.MixGo_MPU9250_AX + "(g)", "accel.getAccelerationX()/256.0"],
|
||||
[Blockly.Msg.MixGo_MPU9250_AY + "(g)", "accel.getAccelerationY()/256.0"],
|
||||
[Blockly.Msg.MixGo_MPU9250_AZ + "(g)", "accel.getAccelerationZ()/256.0"],
|
||||
]
|
||||
};
|
||||
|
||||
var LIS3DHTR_GETDATA = [
|
||||
@@ -454,7 +457,11 @@ export const ADXL345_setOffset = {
|
||||
this.appendValueInput("OFFSET")
|
||||
.setCheck(Number)
|
||||
.setAlign(Blockly.inputs.Align.RIGHT)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_DISPLAY_MATRIX_X, "setOffsetX"], [Blockly.Msg.MIXLY_DISPLAY_MATRIX_Y, "setOffsetY"], [Blockly.Msg.MIXLY_Z_AXIS, "setOffsetZ"]]), "MIXEPI_ADXL345_OFFSET");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_DISPLAY_MATRIX_X, "setOffsetX"],
|
||||
[Blockly.Msg.MIXLY_DISPLAY_MATRIX_Y, "setOffsetY"],
|
||||
[Blockly.Msg.MIXLY_Z_AXIS, "setOffsetZ"]
|
||||
]), "MIXEPI_ADXL345_OFFSET");
|
||||
this.setInputsInline(true);
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
@@ -495,7 +502,7 @@ export const MPU6050_update = {
|
||||
}
|
||||
};
|
||||
|
||||
var Encoder_NO = [
|
||||
const Encoder_NO = [
|
||||
[Blockly.Msg.MIXLY_ENCODER + 1, "1"],
|
||||
[Blockly.Msg.MIXLY_ENCODER + 2, "2"],
|
||||
[Blockly.Msg.MIXLY_ENCODER + 3, "3"],
|
||||
@@ -709,20 +716,6 @@ export const sensor_encoder_handle = {
|
||||
}
|
||||
};
|
||||
|
||||
const BMX280_VALUE_TYPE = {
|
||||
bme: [
|
||||
[Blockly.Msg.blynk_IOT_IR_TEMP, "readTemperature()"],
|
||||
[Blockly.Msg.MIXLY_Humidity, "readHumidity()"],
|
||||
[Blockly.Msg.MIXLY_Altitude, "readPressure()"],
|
||||
[Blockly.Msg.MIXLY_HEIGHT, "readAltitude(SEALEVELPRESSURE_HPA)"]
|
||||
],
|
||||
bmp: [
|
||||
[Blockly.Msg.blynk_IOT_IR_TEMP, "readTemperature()"],
|
||||
[Blockly.Msg.MIXLY_Altitude, "readPressure()"],
|
||||
[Blockly.Msg.MIXLY_HEIGHT, "readAltitude(SEALEVELPRESSURE_HPA)"]
|
||||
]
|
||||
};
|
||||
|
||||
//BME280读取
|
||||
export const BME280_READ = {
|
||||
init: function () {
|
||||
@@ -734,11 +727,26 @@ export const BME280_READ = {
|
||||
.appendField(Blockly.Msg.MIXLY_LCD_ADDRESS);
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_GET)
|
||||
.appendField(new Blockly.FieldDependentDropdown("TYPE", BMX280_VALUE_TYPE, BMX280_VALUE_TYPE['bme']), 'BME_TYPE');
|
||||
.appendField(new Blockly.FieldDependentDropdown(
|
||||
"TYPE", this.BMX280_VALUE_TYPE, this.BMX280_VALUE_TYPE['bme']), 'BME_TYPE'
|
||||
);
|
||||
this.setOutput(true, null);
|
||||
this.setInputsInline(true);
|
||||
this.setTooltip("");
|
||||
this.setHelpUrl("");
|
||||
},
|
||||
BMX280_VALUE_TYPE: {
|
||||
bme: [
|
||||
[Blockly.Msg.blynk_IOT_IR_TEMP, "readTemperature()"],
|
||||
[Blockly.Msg.MIXLY_Humidity, "readHumidity()"],
|
||||
[Blockly.Msg.MIXLY_Altitude, "readPressure()"],
|
||||
[Blockly.Msg.MIXLY_HEIGHT, "readAltitude(SEALEVELPRESSURE_HPA)"]
|
||||
],
|
||||
bmp: [
|
||||
[Blockly.Msg.blynk_IOT_IR_TEMP, "readTemperature()"],
|
||||
[Blockly.Msg.MIXLY_Altitude, "readPressure()"],
|
||||
[Blockly.Msg.MIXLY_HEIGHT, "readAltitude(SEALEVELPRESSURE_HPA)"]
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
@@ -759,7 +767,10 @@ export const PS2_init = {
|
||||
.appendField(new Blockly.FieldDropdown(Profile.default.digital), "PS2_CLK");
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.PS2_setRumble)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_ON, "true"], [Blockly.Msg.MIXLY_OFF, "false"]]), "rumble");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_ON, "true"],
|
||||
[Blockly.Msg.MIXLY_OFF, "false"]
|
||||
]), "rumble");
|
||||
this.setInputsInline(true);
|
||||
this.setPreviousStatement(true);
|
||||
this.setNextStatement(true);
|
||||
@@ -782,71 +793,74 @@ export const PS2_update = {
|
||||
}
|
||||
};
|
||||
|
||||
var PSBUTTON = [
|
||||
[Blockly.Msg.PS2_TRIANGLE, "PSB_GREEN"],
|
||||
[Blockly.Msg.PS2_CIRCLE, "PSB_RED"],
|
||||
[Blockly.Msg.PS2_CROSS, "PSB_BLUE"],
|
||||
[Blockly.Msg.PS2_SQUARE, "PSB_PINK"],
|
||||
[Blockly.Msg.PS2_L1, "PSB_L1"],
|
||||
[Blockly.Msg.PS2_L2, "PSB_L2"],
|
||||
// ["PSB_L3","PSB_L3"],
|
||||
[Blockly.Msg.PS2_R1, "PSB_R1"],
|
||||
[Blockly.Msg.PS2_R2, "PSB_R2"],
|
||||
// ["PSB_R3","PSB_R3"],
|
||||
[Blockly.Msg.PS2_UP, "PSB_PAD_UP"],
|
||||
[Blockly.Msg.PS2_RIGHT, "PSB_PAD_RIGHT"],
|
||||
[Blockly.Msg.PS2_DOWN, "PSB_PAD_DOWN"],
|
||||
[Blockly.Msg.PS2_LEFT, "PSB_PAD_LEFT"],
|
||||
[Blockly.Msg.PS2_SELECT, "PSB_SELECT"],
|
||||
[Blockly.Msg.PS2_START, "PSB_START"]
|
||||
];
|
||||
|
||||
//
|
||||
export const PS2_Button = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_HUE);
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.PS2_BUTTON)
|
||||
.appendField(new Blockly.FieldDropdown(PSBUTTON), "psbt")
|
||||
.appendField(new Blockly.FieldDropdown(this.PSBUTTON), "psbt")
|
||||
.appendField(Blockly.Msg.MIXLY_PULSEIN_STAT)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_BUTTON_HOLD, "Button"], [Blockly.Msg.MIXLY_BUTTON_PRESSED, "ButtonPressed"], [Blockly.Msg.MIXLY_BUTTON_RELEASED, "ButtonReleased"], [Blockly.Msg.MIXLY_CHANGE, "NewButtonState"]]), "btstate");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_BUTTON_HOLD, "Button"],
|
||||
[Blockly.Msg.MIXLY_BUTTON_PRESSED, "ButtonPressed"],
|
||||
[Blockly.Msg.MIXLY_BUTTON_RELEASED, "ButtonReleased"],
|
||||
[Blockly.Msg.MIXLY_CHANGE, "NewButtonState"]
|
||||
]), "btstate");
|
||||
this.setOutput(true, Boolean);
|
||||
this.setTooltip('');
|
||||
}
|
||||
},
|
||||
PSBUTTON: [
|
||||
[Blockly.Msg.PS2_TRIANGLE, "PSB_GREEN"],
|
||||
[Blockly.Msg.PS2_CIRCLE, "PSB_RED"],
|
||||
[Blockly.Msg.PS2_CROSS, "PSB_BLUE"],
|
||||
[Blockly.Msg.PS2_SQUARE, "PSB_PINK"],
|
||||
[Blockly.Msg.PS2_L1, "PSB_L1"],
|
||||
[Blockly.Msg.PS2_L2, "PSB_L2"],
|
||||
// ["PSB_L3","PSB_L3"],
|
||||
[Blockly.Msg.PS2_R1, "PSB_R1"],
|
||||
[Blockly.Msg.PS2_R2, "PSB_R2"],
|
||||
// ["PSB_R3","PSB_R3"],
|
||||
[Blockly.Msg.PS2_UP, "PSB_PAD_UP"],
|
||||
[Blockly.Msg.PS2_RIGHT, "PSB_PAD_RIGHT"],
|
||||
[Blockly.Msg.PS2_DOWN, "PSB_PAD_DOWN"],
|
||||
[Blockly.Msg.PS2_LEFT, "PSB_PAD_LEFT"],
|
||||
[Blockly.Msg.PS2_SELECT, "PSB_SELECT"],
|
||||
[Blockly.Msg.PS2_START, "PSB_START"]
|
||||
]
|
||||
};
|
||||
|
||||
export const PS2_stk = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_HUE);
|
||||
var PSSTK = [
|
||||
[Blockly.Msg.PS2_RX, "PSS_RX"],
|
||||
[Blockly.Msg.PS2_RY, "PSS_RY"],
|
||||
[Blockly.Msg.PS2_LX, "PSS_LX"],
|
||||
[Blockly.Msg.PS2_LY, "PSS_LY"],
|
||||
];
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.PS2_stick)
|
||||
.appendField(new Blockly.FieldDropdown(PSSTK), "psstk");
|
||||
.appendField(new Blockly.FieldDropdown(this.PSSTK), "psstk");
|
||||
this.setOutput(true, Number);
|
||||
this.setTooltip('');
|
||||
}
|
||||
},
|
||||
PSSTK: [
|
||||
[Blockly.Msg.PS2_RX, "PSS_RX"],
|
||||
[Blockly.Msg.PS2_RY, "PSS_RY"],
|
||||
[Blockly.Msg.PS2_LX, "PSS_LX"],
|
||||
[Blockly.Msg.PS2_LY, "PSS_LY"],
|
||||
]
|
||||
};
|
||||
|
||||
var DF_TCS34725_COLOR = [
|
||||
[Blockly.Msg.COLOUR_RGB_RED, "tcs34725.getRedToGamma()"],
|
||||
[Blockly.Msg.COLOUR_RGB_GREEN, "tcs34725.getGreenToGamma()"],
|
||||
[Blockly.Msg.COLOUR_RGB_BLUE, "tcs34725.getBlueToGamma()"],
|
||||
];
|
||||
|
||||
export const TCS34725_Get_RGB = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_HUE);
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.TCS34725_Get_RGB)
|
||||
.appendField(new Blockly.FieldDropdown(DF_TCS34725_COLOR), "DF_TCS34725_COLOR");
|
||||
.appendField(new Blockly.FieldDropdown(this.DF_TCS34725_COLOR), "DF_TCS34725_COLOR");
|
||||
this.setInputsInline(true);
|
||||
this.setOutput(true);
|
||||
}
|
||||
},
|
||||
DF_TCS34725_COLOR: [
|
||||
[Blockly.Msg.COLOUR_RGB_RED, "tcs34725.getRedToGamma()"],
|
||||
[Blockly.Msg.COLOUR_RGB_GREEN, "tcs34725.getGreenToGamma()"],
|
||||
[Blockly.Msg.COLOUR_RGB_BLUE, "tcs34725.getBlueToGamma()"],
|
||||
]
|
||||
};
|
||||
|
||||
//初始化TCS230颜色传感器
|
||||
@@ -1050,18 +1064,6 @@ export const arduino_keypad_event = {
|
||||
}
|
||||
};
|
||||
|
||||
var MixGo_MPU9250_GETAB = [
|
||||
[Blockly.Msg.MixGo_MPU9250_AX, "a"],
|
||||
[Blockly.Msg.MixGo_MPU9250_AY, "b"],
|
||||
[Blockly.Msg.MixGo_MPU9250_AZ, "c"],
|
||||
[Blockly.Msg.MixGo_MPU9250_GX, "d"],
|
||||
[Blockly.Msg.MixGo_MPU9250_GY, "e"],
|
||||
[Blockly.Msg.MixGo_MPU9250_GZ, "f"],
|
||||
[Blockly.Msg.MixGo_MPU9250_MX, "g"],
|
||||
[Blockly.Msg.MixGo_MPU9250_MY, "h"],
|
||||
[Blockly.Msg.MixGo_MPU9250_MZ, "i"]
|
||||
];
|
||||
|
||||
//传感器_重力感应块_获取9轴数据
|
||||
export const mixgo_MPU9250 = {
|
||||
init: function () {
|
||||
@@ -1070,12 +1072,23 @@ export const mixgo_MPU9250 = {
|
||||
.appendField("MPU9250" + Blockly.Msg.MixGo_MPU9250);
|
||||
this.appendDummyInput("")
|
||||
.setAlign(Blockly.inputs.Align.RIGHT)
|
||||
.appendField(new Blockly.FieldDropdown(MixGo_MPU9250_GETAB), "MixGo_MPU9250_GETAB");
|
||||
.appendField(new Blockly.FieldDropdown(this.MixGo_MPU9250_GETAB), "MixGo_MPU9250_GETAB");
|
||||
this.setInputsInline(true);
|
||||
this.setOutput(true);
|
||||
this.setTooltip("");
|
||||
this.setHelpUrl('');
|
||||
}
|
||||
},
|
||||
MixGo_MPU9250_GETAB: [
|
||||
[Blockly.Msg.MixGo_MPU9250_AX, "a"],
|
||||
[Blockly.Msg.MixGo_MPU9250_AY, "b"],
|
||||
[Blockly.Msg.MixGo_MPU9250_AZ, "c"],
|
||||
[Blockly.Msg.MixGo_MPU9250_GX, "d"],
|
||||
[Blockly.Msg.MixGo_MPU9250_GY, "e"],
|
||||
[Blockly.Msg.MixGo_MPU9250_GZ, "f"],
|
||||
[Blockly.Msg.MixGo_MPU9250_MX, "g"],
|
||||
[Blockly.Msg.MixGo_MPU9250_MY, "h"],
|
||||
[Blockly.Msg.MixGo_MPU9250_MZ, "i"]
|
||||
]
|
||||
};
|
||||
|
||||
//NTC电阻
|
||||
@@ -1120,4 +1133,4 @@ export const AHT20_21 = {
|
||||
this.setOutput(true);
|
||||
this.setTooltip();
|
||||
}
|
||||
};
|
||||
};
|
||||
@@ -35,7 +35,10 @@ export const serial_print = {
|
||||
this.appendValueInput("CONTENT", String)
|
||||
.appendField(new Blockly.FieldDropdown(Profile.default.serial_select), "serial_select")
|
||||
.appendField(Blockly.Msg.MIXLY_SERIAL_PRINT)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_PRINT_INLINE, "print"], [Blockly.Msg.TEXT_PRINT_Huanhang_TOOLTIP, "println"]]), "new_line");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_PRINT_INLINE, "print"],
|
||||
[Blockly.Msg.TEXT_PRINT_Huanhang_TOOLTIP, "println"]
|
||||
]), "new_line");
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setTooltip(Blockly.Msg.TEXT_PRINT_TOOLTIP);
|
||||
@@ -48,24 +51,34 @@ export const serial_println = {
|
||||
this.appendValueInput("CONTENT", String)
|
||||
.appendField(new Blockly.FieldDropdown(Profile.default.serial_select), "serial_select")
|
||||
.appendField(Blockly.Msg.MIXLY_SERIAL_PRINT)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.TEXT_PRINT_Huanhang_TOOLTIP, "println"], [Blockly.Msg.MIXLY_PRINT_INLINE, "print"]]), "new_line");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.TEXT_PRINT_Huanhang_TOOLTIP, "println"],
|
||||
[Blockly.Msg.MIXLY_PRINT_INLINE, "print"]
|
||||
]), "new_line");
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setTooltip(Blockly.Msg.TEXT_PRINT_TOOLTIP);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export const serial_print_num = {
|
||||
init: function () {
|
||||
this.setColour(SERIAL_HUE);
|
||||
this.appendDummyInput()
|
||||
.appendField(new Blockly.FieldDropdown(Profile.default.serial_select), "serial_select")
|
||||
.appendField(Blockly.Msg.MIXLY_SERIAL_PRINT)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_PRINT_INLINE, "print"], [Blockly.Msg.TEXT_PRINT_Huanhang_TOOLTIP, "println"]]), "new_line")
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_PRINT_INLINE, "print"],
|
||||
[Blockly.Msg.TEXT_PRINT_Huanhang_TOOLTIP, "println"]
|
||||
]), "new_line")
|
||||
.appendField(Blockly.Msg.MIXLY_NUMBER);
|
||||
this.appendValueInput("CONTENT", Number)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MATH_HEX, "HEX"], [Blockly.Msg.MATH_BIN, "BIN"], [Blockly.Msg.MATH_OCT, "OCT"], [Blockly.Msg.MATH_DEC, "DEC"]]), "STAT")
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MATH_HEX, "HEX"],
|
||||
[Blockly.Msg.MATH_BIN, "BIN"],
|
||||
[Blockly.Msg.MATH_OCT, "OCT"],
|
||||
[Blockly.Msg.MATH_DEC, "DEC"]
|
||||
]), "STAT")
|
||||
.setCheck(Number);
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
@@ -117,7 +130,12 @@ export const serial_parseInt_Float = {
|
||||
this.appendDummyInput()
|
||||
.appendField(new Blockly.FieldDropdown(Profile.default.serial_select), "serial_select")
|
||||
//.appendField(Blockly.Msg.MIXLY_SERIAL_READ)
|
||||
.appendField(new Blockly.FieldDropdown([["read", "read"], ["peek", "peek"], ["parseInt", "parseInt"], ["parseFloat", "parseFloat"]]), "STAT");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
["read", "read"],
|
||||
["peek", "peek"],
|
||||
["parseInt", "parseInt"],
|
||||
["parseFloat", "parseFloat"]
|
||||
]), "STAT");
|
||||
this.setOutput(true, Number);
|
||||
var thisBlock = this;
|
||||
this.setTooltip(function () {
|
||||
@@ -142,6 +160,7 @@ export const serial_flush = {
|
||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_SERIAL_FLUSH);
|
||||
}
|
||||
};
|
||||
|
||||
export const serial_softserial = {
|
||||
init: function () {
|
||||
this.setColour(SERIAL_HUE);
|
||||
|
||||
@@ -94,25 +94,24 @@ export const sd_card_root_files = {
|
||||
}
|
||||
};
|
||||
|
||||
var volume_TYPE = [
|
||||
[Blockly.Msg.MIXLY_SD_clusterCount, 'volume.clusterCount()'],
|
||||
[Blockly.Msg.MIXLY_SD_blocksPerCluster, 'volume.blocksPerCluster()'],
|
||||
[Blockly.Msg.MIXLY_SD_TOTAL_blocks, 'volume.blocksPerCluster() * volume.clusterCount()'],
|
||||
["FAT" + Blockly.Msg.MIXLY_TYPE, 'volume.fatType()'],
|
||||
[Blockly.Msg.MIXLY_volume + "(KB)", 'volume.blocksPerCluster()*volume.clusterCount()/2'],
|
||||
[Blockly.Msg.MIXLY_volume + "(MB)", 'volume.blocksPerCluster()*volume.clusterCount()/2/1024'],
|
||||
[Blockly.Msg.MIXLY_volume + "(GB)", 'volume.blocksPerCluster()*volume.clusterCount()/2/1024/1024.0'],
|
||||
];
|
||||
|
||||
export const sd_volume = {
|
||||
init: function () {
|
||||
this.setColour(STORAGE_HUE);
|
||||
this.appendDummyInput()
|
||||
.appendField("SD")
|
||||
.appendField(new Blockly.FieldDropdown(volume_TYPE), 'volume_TYPE');
|
||||
.appendField(new Blockly.FieldDropdown(this.VOLUME_TYPE), 'volume_TYPE');
|
||||
this.setOutput(true, Number);
|
||||
this.setTooltip();
|
||||
}
|
||||
},
|
||||
VOLUME_TYPE: [
|
||||
[Blockly.Msg.MIXLY_SD_clusterCount, 'volume.clusterCount()'],
|
||||
[Blockly.Msg.MIXLY_SD_blocksPerCluster, 'volume.blocksPerCluster()'],
|
||||
[Blockly.Msg.MIXLY_SD_TOTAL_blocks, 'volume.blocksPerCluster() * volume.clusterCount()'],
|
||||
["FAT" + Blockly.Msg.MIXLY_TYPE, 'volume.fatType()'],
|
||||
[Blockly.Msg.MIXLY_volume + "(KB)", 'volume.blocksPerCluster()*volume.clusterCount()/2'],
|
||||
[Blockly.Msg.MIXLY_volume + "(MB)", 'volume.blocksPerCluster()*volume.clusterCount()/2/1024'],
|
||||
[Blockly.Msg.MIXLY_volume + "(GB)", 'volume.blocksPerCluster()*volume.clusterCount()/2/1024/1024.0'],
|
||||
]
|
||||
};
|
||||
|
||||
export const sd_exist = {
|
||||
@@ -230,7 +229,6 @@ export const store_eeprom_put = {
|
||||
this.appendValueInput("ADDRESS")
|
||||
.setCheck(null)
|
||||
.appendField(Blockly.Msg.MIXLY_ESP32_WRITE)
|
||||
//.appendField(new Blockly.FieldDropdown([[Blockly.Msg.LANG_MATH_INT,"int"],[Blockly.Msg.LANG_MATH_LONG,"long"],[Blockly.Msg.LANG_MATH_FLOAT,"float"],[Blockly.Msg.LANG_MATH_BYTE,"byte"],["字节数组","byte_array"],["字符数组","char_array"]]), "type")
|
||||
.appendField("EEPROM")
|
||||
.appendField(Blockly.Msg.MQTT_SERVER_ADD);
|
||||
this.appendValueInput("DATA")
|
||||
@@ -249,7 +247,6 @@ export const store_eeprom_get = {
|
||||
this.appendValueInput("ADDRESS")
|
||||
.setCheck(null)
|
||||
.appendField(Blockly.Msg.MIXLY_SERIAL_READ)
|
||||
//.appendField(new Blockly.FieldDropdown([[Blockly.Msg.LANG_MATH_INT,"int"],[Blockly.Msg.LANG_MATH_LONG,"long"],[Blockly.Msg.LANG_MATH_FLOAT,"float"],[Blockly.Msg.LANG_MATH_BYTE,"byte"],["字节数组","byte_array"],["字符数组","char_array"]]), "type")
|
||||
.appendField("EEPROM")
|
||||
.appendField(Blockly.Msg.MQTT_SERVER_ADD);
|
||||
this.appendValueInput("DATA")
|
||||
@@ -262,11 +259,6 @@ export const store_eeprom_get = {
|
||||
}
|
||||
};
|
||||
|
||||
//ESP32简化SPIFFS
|
||||
var OPEN_MODE1 = [
|
||||
[Blockly.Msg.TEXT_WRITE_TEXT, '1'],
|
||||
[Blockly.Msg.TEXT_APPEND_APPENDTEXT, '2']]
|
||||
|
||||
export const simple_spiffs_read = {
|
||||
init: function () {
|
||||
this.appendValueInput("FileName")
|
||||
@@ -293,11 +285,15 @@ export const simple_spiffs_store_spiffs_write = {
|
||||
.appendField(Blockly.Msg.MIXLY_SD_NEWLINE);
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_MODE)
|
||||
.appendField(new Blockly.FieldDropdown(OPEN_MODE1), 'MODE');
|
||||
.appendField(new Blockly.FieldDropdown(this.OPEN_MODE), 'MODE');
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_STORE_SDWRITE);
|
||||
}
|
||||
},
|
||||
OPEN_MODE: [
|
||||
[Blockly.Msg.TEXT_WRITE_TEXT, '1'],
|
||||
[Blockly.Msg.TEXT_APPEND_APPENDTEXT, '2']
|
||||
]
|
||||
};
|
||||
|
||||
export const simple_spiffs_DelFile = {
|
||||
|
||||
@@ -33,7 +33,7 @@ export const text = {
|
||||
}
|
||||
};
|
||||
|
||||
Blockly.FieldTextInput.char_validator = function (text) {
|
||||
const charValidator = function (text) {
|
||||
if (text.length > 1) {
|
||||
if (text.charAt(0) === "\\") {
|
||||
var charAtOne = text.charAt(1);
|
||||
@@ -59,7 +59,7 @@ export const text_char = {
|
||||
this.setColour(TEXTS_HUE);
|
||||
this.appendDummyInput()
|
||||
.appendField(this.newQuote_(true))
|
||||
.appendField(new Blockly.FieldTextInput('', Blockly.FieldTextInput.char_validator), 'TEXT')
|
||||
.appendField(new Blockly.FieldTextInput('', charValidator), 'TEXT')
|
||||
.appendField(this.newQuote_(false));
|
||||
this.setOutput(true, Number);
|
||||
this.setTooltip(Blockly.Msg.TEXT_CHAR_TOOLTIP);
|
||||
@@ -75,7 +75,6 @@ export const text_char = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export const text_join = {
|
||||
init: function () {
|
||||
this.setColour(TEXTS_HUE);
|
||||
@@ -90,7 +89,6 @@ export const text_join = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export const text_to_number = {
|
||||
init: function () {
|
||||
var TO_INT_FLOAT = [
|
||||
@@ -131,7 +129,7 @@ export const char_to_ascii = {
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_TOASCII)
|
||||
.appendField("'")
|
||||
.appendField(new Blockly.FieldTextInput('', Blockly.FieldTextInput.char_validator), 'TEXT')
|
||||
.appendField(new Blockly.FieldTextInput('', charValidator), 'TEXT')
|
||||
.appendField("'");
|
||||
this.setOutput(true, Number);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_TEXT_TOASCII);
|
||||
@@ -176,7 +174,7 @@ export const text_length = {
|
||||
this.setOutput(true, Number);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_TEXT_LENGTH);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const text_char_at = {
|
||||
init: function () {
|
||||
@@ -195,20 +193,15 @@ export const text_char_at = {
|
||||
return Blockly.Msg.MIXLY_TOOLTIP_TEXT_FIND_CHAR_AT.replace('%1', Blockly.Arduino.valueToCode(self, 'VAR', Blockly.Arduino.ORDER_ATOMIC));
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const text_equals_starts_ends = {
|
||||
init: function () {
|
||||
var TEXT_DOWHAT = [
|
||||
[Blockly.Msg.MIXLY_EQUALS, 'equals'],
|
||||
[Blockly.Msg.MIXLY_STARTSWITH, 'startsWith'],
|
||||
[Blockly.Msg.MIXLY_ENDSWITH, 'endsWith']
|
||||
];
|
||||
this.setColour(TEXTS_HUE);
|
||||
this.appendValueInput("STR1")
|
||||
.setCheck([String, Number]);
|
||||
this.appendValueInput("STR2")
|
||||
.appendField(new Blockly.FieldDropdown(TEXT_DOWHAT), 'DOWHAT')
|
||||
.appendField(new Blockly.FieldDropdown(this.TEXT_DOWHAT), 'DOWHAT')
|
||||
.setCheck([String, Number]);
|
||||
this.setOutput(true, [Boolean, Number]);
|
||||
this.setInputsInline(true);
|
||||
@@ -222,8 +215,13 @@ export const text_equals_starts_ends = {
|
||||
};
|
||||
return Blockly.Msg.MIXLY_TOOLTIP_TEXT_EQUALS_STARTS_ENDS.replace('%1', TOOLTIPS[op]).replace('%2', Blockly.Arduino.valueToCode(self, 'STR2', Blockly.Arduino.ORDER_ATOMIC));
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
TEXT_DOWHAT: [
|
||||
[Blockly.Msg.MIXLY_EQUALS, 'equals'],
|
||||
[Blockly.Msg.MIXLY_STARTSWITH, 'startsWith'],
|
||||
[Blockly.Msg.MIXLY_ENDSWITH, 'endsWith']
|
||||
]
|
||||
};
|
||||
|
||||
export const text_compareTo = {
|
||||
init: function () {
|
||||
@@ -237,7 +235,8 @@ export const text_compareTo = {
|
||||
this.setInputsInline(true);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_COMPARETO_HELP);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//小数获取有效位
|
||||
export const decimal_places = {
|
||||
init: function () {
|
||||
@@ -255,6 +254,7 @@ export const decimal_places = {
|
||||
this.setHelpUrl("");
|
||||
}
|
||||
};
|
||||
|
||||
//截取字符串
|
||||
export const substring = {
|
||||
init: function () {
|
||||
@@ -274,6 +274,7 @@ export const substring = {
|
||||
this.setHelpUrl("");
|
||||
}
|
||||
};
|
||||
|
||||
//字符串转化为大小写
|
||||
export const letter_conversion = {
|
||||
init: function () {
|
||||
@@ -282,7 +283,10 @@ export const letter_conversion = {
|
||||
.appendField(Blockly.Msg.STRING_VARIABLE);
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.LETTERS_ARE_CONVERTED_TO)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.CAPITAL, ".toUpperCase()"], [Blockly.Msg.LOWER_CASE, ".toLowerCase()"]]), "type");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.CAPITAL, ".toUpperCase()"],
|
||||
[Blockly.Msg.LOWER_CASE, ".toLowerCase()"]
|
||||
]), "type");
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setColour(TEXTS_HUE);
|
||||
@@ -338,7 +342,10 @@ export const first_and_last = {
|
||||
.setCheck(null)
|
||||
.appendField(Blockly.Msg.AS_A_STRING);
|
||||
this.appendDummyInput()
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.STARTSWITH, ".startsWith"], [Blockly.Msg.ENDSWITH, ".endsWith"]]), "type");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.STARTSWITH, ".startsWith"],
|
||||
[Blockly.Msg.ENDSWITH, ".endsWith"]
|
||||
]), "type");
|
||||
this.setOutput(true, null);
|
||||
this.setColour(TEXTS_HUE);
|
||||
this.setTooltip(Blockly.Msg.FIRST_AND_LAST_HELP);
|
||||
@@ -352,7 +359,15 @@ export const type_conversion = {
|
||||
this.appendValueInput("variable")
|
||||
.setCheck(null)
|
||||
.appendField(Blockly.Msg.DATA_TYPE_CONVERSION)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.LANG_MATH_STRING, "String"], [Blockly.Msg.LANG_MATH_CHAR, "char"], [Blockly.Msg.LANG_MATH_BYTE, "byte"], [Blockly.Msg.LANG_MATH_INT, "int"], [Blockly.Msg.LANG_MATH_LONG, "long"], [Blockly.Msg.LANG_MATH_FLOAT, "float"], [Blockly.Msg.LANG_MATH_WORD, "word"]]), "type");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.LANG_MATH_STRING, "String"],
|
||||
[Blockly.Msg.LANG_MATH_CHAR, "char"],
|
||||
[Blockly.Msg.LANG_MATH_BYTE, "byte"],
|
||||
[Blockly.Msg.LANG_MATH_INT, "int"],
|
||||
[Blockly.Msg.LANG_MATH_LONG, "long"],
|
||||
[Blockly.Msg.LANG_MATH_FLOAT, "float"],
|
||||
[Blockly.Msg.LANG_MATH_WORD, "word"]
|
||||
]), "type");
|
||||
this.setOutput(true, null);
|
||||
this.setColour(TEXTS_HUE);
|
||||
this.setTooltip(Blockly.Msg.TYPE_CONVERSION_HELP);
|
||||
@@ -559,7 +574,13 @@ export const String_to_Long_Integer = {
|
||||
this.appendValueInput("data")
|
||||
.setCheck(null)
|
||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_TYPE_STRING + Blockly.Msg.A_TO_B + Blockly.Msg.LANG_MATH_LONG)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MATH_HEX, "16"], [Blockly.Msg.MATH_DEC, "10"], [Blockly.Msg.MATH_OCT, "8"], [Blockly.Msg.MATH_BIN, "2"], [Blockly.Msg.blynk_IOT_AUTO, "0"]]), "type");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MATH_HEX, "16"],
|
||||
[Blockly.Msg.MATH_DEC, "10"],
|
||||
[Blockly.Msg.MATH_OCT, "8"],
|
||||
[Blockly.Msg.MATH_BIN, "2"],
|
||||
[Blockly.Msg.blynk_IOT_AUTO, "0"]
|
||||
]), "type");
|
||||
this.setOutput(true, null);
|
||||
this.setColour(TEXTS_HUE);
|
||||
this.setTooltip("");
|
||||
|
||||
@@ -27,7 +27,6 @@ export const folding_block = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//IIC地址查找
|
||||
export const IICSCAN = {
|
||||
init: function () {
|
||||
|
||||
@@ -3297,16 +3297,6 @@
|
||||
</value>
|
||||
</block>
|
||||
<block type="blynk_table_cleardata">
|
||||
<value name="xnyj">
|
||||
<shadow type="math_number">
|
||||
<field name="NUM">V0</field>
|
||||
</shadow>
|
||||
<value name="xnyj">
|
||||
<shadow type="math_number">
|
||||
<field name="NUM">V0</field>
|
||||
</shadow>
|
||||
</value>
|
||||
</value>
|
||||
<value name="id">
|
||||
<shadow type="math_number">
|
||||
<field name="NUM">0</field>
|
||||
|
||||
@@ -97,7 +97,6 @@ export const motor_id = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export const HR8833_Motor_Setup = {
|
||||
init: function () {
|
||||
this.setColour(ACTUATOR_HUE);
|
||||
|
||||
@@ -14,6 +14,7 @@ export const serialBT_Init = {
|
||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_SERIAL_BEGIN);
|
||||
}
|
||||
};
|
||||
|
||||
export const serialBT_available = {
|
||||
init: function () {
|
||||
this.setColour(COMMUNICATE_HUE);
|
||||
@@ -34,6 +35,7 @@ export const serialBT_read = {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
export const serialBT_write = {
|
||||
init: function () {
|
||||
this.setColour(COMMUNICATE_HUE);
|
||||
@@ -43,5 +45,4 @@ export const serialBT_write = {
|
||||
this.setNextStatement(true, null);
|
||||
this.setTooltip(Blockly.Msg.TEXT_WRITE_TOOLTIP);
|
||||
}
|
||||
};
|
||||
|
||||
};
|
||||
@@ -7,14 +7,22 @@ export const controls_hw_timer = {
|
||||
this.setColour(LOOPS_HUE);
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_ESP32_HW_TIMER)
|
||||
.appendField(new Blockly.FieldDropdown([["0", "0"], ["1", "1"], ["2", "2"], ["3", "3"]]), "TIMER_NUM");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
["0", "0"],
|
||||
["1", "1"],
|
||||
["2", "2"],
|
||||
["3", "3"]
|
||||
]), "TIMER_NUM");
|
||||
this.appendValueInput('TIME')
|
||||
.setCheck(Number)
|
||||
.appendField(Blockly.Msg.MIXLY_MSTIMER2_EVERY);
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_MILLIS)
|
||||
.appendField(Blockly.Msg.MIXLY_MODE)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_PYTHON_ONE_SHOT, "false"], [Blockly.Msg.MIXLY_PYTHON_PERIODIC, "true"]]), "mode");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_PYTHON_ONE_SHOT, "false"],
|
||||
[Blockly.Msg.MIXLY_PYTHON_PERIODIC, "true"]
|
||||
]), "mode");
|
||||
this.appendStatementInput('DO')
|
||||
.appendField(Blockly.Msg.MIXLY_MSTIMER2_DO);
|
||||
this.setPreviousStatement(false);
|
||||
@@ -28,9 +36,21 @@ export const controls_runnig_core = {
|
||||
this.appendDummyInput()
|
||||
.appendField("ESP32")
|
||||
.appendField("Task")
|
||||
.appendField(new Blockly.FieldDropdown([["1", "1"], ["2", "2"], ["3", "3"], ["4", "4"], ["5", "5"], ["6", "6"], ["7", "7"], ["8", "8"]]), "task")
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
["1", "1"],
|
||||
["2", "2"],
|
||||
["3", "3"],
|
||||
["4", "4"],
|
||||
["5", "5"],
|
||||
["6", "6"],
|
||||
["7", "7"],
|
||||
["8", "8"]
|
||||
]), "task")
|
||||
.appendField("Core")
|
||||
.appendField(new Blockly.FieldDropdown([["0", "0"], ["1", "1"]]), "core");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
["0", "0"],
|
||||
["1", "1"]
|
||||
]), "core");
|
||||
this.appendValueInput("length")
|
||||
.setCheck(null)
|
||||
.setAlign(Blockly.inputs.Align.RIGHT)
|
||||
@@ -61,12 +81,18 @@ export const control_core_delay = {
|
||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_SCOOP_SLEEP);
|
||||
}
|
||||
};
|
||||
|
||||
export const controls_hw_timer_start = {
|
||||
init: function () {
|
||||
this.setColour(LOOPS_HUE);
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_ESP32_HW_TIMER)
|
||||
.appendField(new Blockly.FieldDropdown([["0", "0"], ["1", "1"], ["2", "2"], ["3", "3"]]), "TIMER_NUM")
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
["0", "0"],
|
||||
["1", "1"],
|
||||
["2", "2"],
|
||||
["3", "3"]
|
||||
]), "TIMER_NUM")
|
||||
.appendField(Blockly.Msg.MIXLY_MSTIMER2_START);
|
||||
this.setPreviousStatement(true);
|
||||
this.setNextStatement(true);
|
||||
@@ -79,7 +105,12 @@ export const controls_hw_timer_stop = {
|
||||
this.setColour(LOOPS_HUE);
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_ESP32_HW_TIMER)
|
||||
.appendField(new Blockly.FieldDropdown([["0", "0"], ["1", "1"], ["2", "2"], ["3", "3"]]), "TIMER_NUM")
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
["0", "0"],
|
||||
["1", "1"],
|
||||
["2", "2"],
|
||||
["3", "3"]
|
||||
]), "TIMER_NUM")
|
||||
.appendField(Blockly.Msg.MIXLY_STOP);
|
||||
this.setPreviousStatement(true);
|
||||
this.setNextStatement(true);
|
||||
|
||||
@@ -44,7 +44,11 @@ export const esp32_wifi_connection_event = {
|
||||
init: function () {
|
||||
this.appendDummyInput()
|
||||
.appendField("WiFi连接事件")
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_ESP32_WIFI_CONNECTION_EVENT1, "1"], [Blockly.Msg.MIXLY_ESP32_WIFI_CONNECTION_EVENT2, "2"], [Blockly.Msg.MIXLY_ESP32_WIFI_CONNECTION_EVENT3, "3"]]), "type");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_ESP32_WIFI_CONNECTION_EVENT1, "1"],
|
||||
[Blockly.Msg.MIXLY_ESP32_WIFI_CONNECTION_EVENT2, "2"],
|
||||
[Blockly.Msg.MIXLY_ESP32_WIFI_CONNECTION_EVENT3, "3"]
|
||||
]), "type");
|
||||
this.appendStatementInput("event")
|
||||
.setCheck(null);
|
||||
this.setColour(ETHERNET_HUE);
|
||||
|
||||
@@ -73,22 +73,6 @@ export const touchAttachInterrupt = {
|
||||
}
|
||||
};
|
||||
|
||||
var HANDBIT_MSA300_GETAB = [
|
||||
[Blockly.Msg.MixGo_MPU9250_AX, "msa.getX()"],
|
||||
[Blockly.Msg.MixGo_MPU9250_AY, "msa.getY()"],
|
||||
[Blockly.Msg.MixGo_MPU9250_AZ, "msa.getZ()"],
|
||||
];
|
||||
|
||||
var HANDBIT_MSA300_ACTION = [
|
||||
[Blockly.Msg.HANDBIT_FORWARD, "msa.getX()>1500&&msa.getX()<2000&&msa.getZ()>-1000&&msa.getZ()<0"],
|
||||
[Blockly.Msg.HANDBIT_BACKWARD, "msa.getX()>1500&&msa.getX()<2000&&msa.getZ()>0&&msa.getZ()<1500"],
|
||||
[Blockly.Msg.HANDBIT_LEFT, "msa.getY()<1000&&msa.getY()>0"],
|
||||
[Blockly.Msg.HANDBIT_RIGHT, "msa.getY()<0&&msa.getY()>-1000"],
|
||||
[Blockly.Msg.HANDBIT_UP, "msa.getX()>-400&&msa.getX()<400&&msa.getY()>-400&&msa.getY()<400&&msa.getZ()>-1800&&msa.getZ()<-1400"],
|
||||
[Blockly.Msg.HANDBIT_DOWN, "msa.getX()>-400&&msa.getX()<400&&msa.getY()>-400&&msa.getY()<400&&msa.getZ()>2000&&msa.getZ()<2400"],
|
||||
|
||||
];
|
||||
|
||||
//传感器_重力感应
|
||||
export const handbit_MSA300 = {
|
||||
init: function () {
|
||||
@@ -97,12 +81,17 @@ export const handbit_MSA300 = {
|
||||
.appendField(Blockly.Msg.MixGo_MPU9250);
|
||||
this.appendDummyInput("")
|
||||
.setAlign(Blockly.inputs.Align.RIGHT)
|
||||
.appendField(new Blockly.FieldDropdown(HANDBIT_MSA300_GETAB), "HANDBIT_MSA300_GETAB");
|
||||
.appendField(new Blockly.FieldDropdown(this.HANDBIT_MSA300_GETAB), "HANDBIT_MSA300_GETAB");
|
||||
this.setInputsInline(true);
|
||||
this.setOutput(true);
|
||||
this.setTooltip("");
|
||||
this.setHelpUrl('');
|
||||
}
|
||||
},
|
||||
HANDBIT_MSA300_GETAB: [
|
||||
[Blockly.Msg.MixGo_MPU9250_AX, "msa.getX()"],
|
||||
[Blockly.Msg.MixGo_MPU9250_AY, "msa.getY()"],
|
||||
[Blockly.Msg.MixGo_MPU9250_AZ, "msa.getZ()"],
|
||||
]
|
||||
};
|
||||
|
||||
export const handbit_MSA300_action = {
|
||||
@@ -112,12 +101,20 @@ export const handbit_MSA300_action = {
|
||||
.appendField(Blockly.Msg.Handbit);
|
||||
this.appendDummyInput("")
|
||||
.setAlign(Blockly.inputs.Align.RIGHT)
|
||||
.appendField(new Blockly.FieldDropdown(HANDBIT_MSA300_ACTION), "HANDBIT_MSA300_ACTION");
|
||||
.appendField(new Blockly.FieldDropdown(this.HANDBIT_MSA300_ACTION), "HANDBIT_MSA300_ACTION");
|
||||
this.setInputsInline(true);
|
||||
this.setOutput(true);
|
||||
this.setTooltip("");
|
||||
this.setHelpUrl('');
|
||||
}
|
||||
},
|
||||
HANDBIT_MSA300_ACTION: [
|
||||
[Blockly.Msg.HANDBIT_FORWARD, "msa.getX()>1500&&msa.getX()<2000&&msa.getZ()>-1000&&msa.getZ()<0"],
|
||||
[Blockly.Msg.HANDBIT_BACKWARD, "msa.getX()>1500&&msa.getX()<2000&&msa.getZ()>0&&msa.getZ()<1500"],
|
||||
[Blockly.Msg.HANDBIT_LEFT, "msa.getY()<1000&&msa.getY()>0"],
|
||||
[Blockly.Msg.HANDBIT_RIGHT, "msa.getY()<0&&msa.getY()>-1000"],
|
||||
[Blockly.Msg.HANDBIT_UP, "msa.getX()>-400&&msa.getX()<400&&msa.getY()>-400&&msa.getY()<400&&msa.getZ()>-1800&&msa.getZ()<-1400"],
|
||||
[Blockly.Msg.HANDBIT_DOWN, "msa.getX()>-400&&msa.getX()<400&&msa.getY()>-400&&msa.getY()<400&&msa.getZ()>2000&&msa.getZ()<2400"],
|
||||
]
|
||||
};
|
||||
|
||||
export const handbit_rgb_rainbow1 = {
|
||||
@@ -135,18 +132,13 @@ export const handbit_rgb_rainbow1 = {
|
||||
}
|
||||
};
|
||||
|
||||
var DISPLAY_RAINBOW_TYPE = [
|
||||
[Blockly.Msg.MIXLY_RGB_DISPLAY_RAINBOW_TYPE_1, "normal"],
|
||||
[Blockly.Msg.MIXLY_RGB_DISPLAY_RAINBOW_TYPE_2, "change"]
|
||||
];
|
||||
|
||||
export const handbit_rgb_rainbow3 = {
|
||||
init: function () {
|
||||
this.setColour(ACTUATOR_HUE);
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_RGB);
|
||||
this.appendDummyInput("")
|
||||
.appendField(new Blockly.FieldDropdown(DISPLAY_RAINBOW_TYPE), "TYPE");
|
||||
.appendField(new Blockly.FieldDropdown(this.DISPLAY_RAINBOW_TYPE), "TYPE");
|
||||
this.appendValueInput("rainbow_color")
|
||||
.setCheck(Number)
|
||||
.setAlign(Blockly.inputs.Align.RIGHT)
|
||||
@@ -154,7 +146,11 @@ export const handbit_rgb_rainbow3 = {
|
||||
this.setInputsInline(true);
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
}
|
||||
},
|
||||
DISPLAY_RAINBOW_TYPE: [
|
||||
[Blockly.Msg.MIXLY_RGB_DISPLAY_RAINBOW_TYPE_1, "normal"],
|
||||
[Blockly.Msg.MIXLY_RGB_DISPLAY_RAINBOW_TYPE_2, "change"]
|
||||
]
|
||||
};
|
||||
|
||||
export const handbit_rgb = {
|
||||
|
||||
@@ -2,7 +2,7 @@ import * as Blockly from 'blockly/core';
|
||||
import { Profile } from 'mixly';
|
||||
import { inout_analog_write } from '@mixly/arduino-avr/blocks/inout';
|
||||
|
||||
const BASE_HUE = 20//'#ae3838';//40;
|
||||
const BASE_HUE = 20;
|
||||
|
||||
export const ledcSetup = {
|
||||
init: function () {
|
||||
@@ -40,6 +40,7 @@ export const ledcAttachPin = {
|
||||
this.setTooltip();
|
||||
}
|
||||
};
|
||||
|
||||
export const ledcDetachPin = {
|
||||
init: function () {
|
||||
this.setColour(BASE_HUE);
|
||||
@@ -52,6 +53,7 @@ export const ledcDetachPin = {
|
||||
this.setTooltip();
|
||||
}
|
||||
};
|
||||
|
||||
export const ledcWrite = inout_analog_write;
|
||||
|
||||
export const inout_touchRead = {
|
||||
@@ -85,6 +87,7 @@ export const touchAttachInterrupt = {
|
||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_INOUT_ATTACHINTERRUPT);
|
||||
}
|
||||
};
|
||||
|
||||
export const inout_esp32_dac = {
|
||||
init: function () {
|
||||
this.appendValueInput("value")
|
||||
@@ -110,7 +113,24 @@ export const esp32_led_pwm = {
|
||||
.appendField(Blockly.Msg.MIXLY_FREQUENCY)
|
||||
.appendField(new Blockly.FieldTextInput("5000"), "freq")
|
||||
.appendField(Blockly.Msg.MIXLY_CHANNEL)
|
||||
.appendField(new Blockly.FieldDropdown([["0", "0"], ["1", "1"], ["2", "2"], ["3", "3"], ["4", "4"], ["5", "5"], ["6", "6"], ["7", "7"], ["8", "8"], ["9", "9"], ["10", "10"], ["11", "11"], ["12", "12"], ["13", "13"], ["14", "14"], ["15", "15"]]), "ledChannel")
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
["0", "0"],
|
||||
["1", "1"],
|
||||
["2", "2"],
|
||||
["3", "3"],
|
||||
["4", "4"],
|
||||
["5", "5"],
|
||||
["6", "6"],
|
||||
["7", "7"],
|
||||
["8", "8"],
|
||||
["9", "9"],
|
||||
["10", "10"],
|
||||
["11", "11"],
|
||||
["12", "12"],
|
||||
["13", "13"],
|
||||
["14", "14"],
|
||||
["15", "15"]
|
||||
]), "ledChannel")
|
||||
.appendField(Blockly.Msg.MIXLY_ANALOGWRITE_PIN);
|
||||
this.appendValueInput("val")
|
||||
.setCheck(null)
|
||||
|
||||
@@ -5,26 +5,24 @@ const DISPLAY_HUE = 180;
|
||||
const SENSOR_HUE = 40;
|
||||
const ACTUATOR_HUE = 100;
|
||||
|
||||
var MIXEPI_ADXL345_ACTION = [
|
||||
[Blockly.Msg.HANDBIT_FORWARD, "accel.getAcceleration().x>-4.7&&accel.getAcceleration().x<0&&accel.getAcceleration().y<1&&accel.getAcceleration().y>-1&&accel.getAcceleration().z<-8&&accel.getAcceleration().z>-9.8"],
|
||||
[Blockly.Msg.HANDBIT_BACKWARD, "accel.getAcceleration().x>0&&accel.getAcceleration().x<4.7&&accel.getAcceleration().y<1&&accel.getAcceleration().y>-1&&accel.getAcceleration().z<-8&&accel.getAcceleration().z>-9.8"],
|
||||
[Blockly.Msg.HANDBIT_LEFT, "accel.getAcceleration().y>0&&accel.getAcceleration().y<5.5&&accel.getAcceleration().z<-7.5&&accel.getAcceleration().z>-9.8"],
|
||||
[Blockly.Msg.HANDBIT_RIGHT, "accel.getAcceleration().y<0&&accel.getAcceleration().y>-4.7&&accel.getAcceleration().z<-7.5&&accel.getAcceleration().z>-9.8"],
|
||||
[Blockly.Msg.HANDBIT_UP, "accel.getAcceleration().z>-9.8&&accel.getAcceleration().z<-8"],
|
||||
[Blockly.Msg.HANDBIT_DOWN, "accel.getAcceleration().z>8&&accel.getAcceleration().z<9.8"]
|
||||
];
|
||||
|
||||
|
||||
|
||||
var BRIGHTNESS_SELECT = [["0", "0"], ["1", "1"], ["2", "2"], ["3", "3"], ["4", "4"], ["5", "5"], ["6", "6"], ["7", "7"], ["8", "8"]];
|
||||
|
||||
export const brightness_select = {
|
||||
init: function () {
|
||||
this.setColour(DISPLAY_HUE);
|
||||
this.appendDummyInput("")
|
||||
.appendField(new Blockly.FieldDropdown(BRIGHTNESS_SELECT), 'STAT');
|
||||
.appendField(new Blockly.FieldDropdown(this.BRIGHTNESS_SELECT), 'STAT');
|
||||
this.setOutput(true, Number);
|
||||
}
|
||||
},
|
||||
BRIGHTNESS_SELECT: [
|
||||
["0", "0"],
|
||||
["1", "1"],
|
||||
["2", "2"],
|
||||
["3", "3"],
|
||||
["4", "4"],
|
||||
["5", "5"],
|
||||
["6", "6"],
|
||||
["7", "7"],
|
||||
["8", "8"]
|
||||
]
|
||||
};
|
||||
|
||||
export const mixePi_button_is_pressed = {
|
||||
@@ -79,7 +77,6 @@ export const mixepi_inout_touchRead = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export const mixepi_ADXL345_action = {
|
||||
init: function () {
|
||||
this.setColour(SENSOR_HUE);
|
||||
@@ -87,12 +84,20 @@ export const mixepi_ADXL345_action = {
|
||||
.appendField("MIXEPI");
|
||||
this.appendDummyInput("")
|
||||
.setAlign(Blockly.inputs.Align.RIGHT)
|
||||
.appendField(new Blockly.FieldDropdown(MIXEPI_ADXL345_ACTION), "MIXEPI_ADXL345_ACTION");
|
||||
.appendField(new Blockly.FieldDropdown(this.MIXEPI_ADXL345_ACTION), "MIXEPI_ADXL345_ACTION");
|
||||
this.setInputsInline(true);
|
||||
this.setOutput(true);
|
||||
this.setTooltip("");
|
||||
this.setHelpUrl('');
|
||||
}
|
||||
},
|
||||
MIXEPI_ADXL345_ACTION: [
|
||||
[Blockly.Msg.HANDBIT_FORWARD, "accel.getAcceleration().x>-4.7&&accel.getAcceleration().x<0&&accel.getAcceleration().y<1&&accel.getAcceleration().y>-1&&accel.getAcceleration().z<-8&&accel.getAcceleration().z>-9.8"],
|
||||
[Blockly.Msg.HANDBIT_BACKWARD, "accel.getAcceleration().x>0&&accel.getAcceleration().x<4.7&&accel.getAcceleration().y<1&&accel.getAcceleration().y>-1&&accel.getAcceleration().z<-8&&accel.getAcceleration().z>-9.8"],
|
||||
[Blockly.Msg.HANDBIT_LEFT, "accel.getAcceleration().y>0&&accel.getAcceleration().y<5.5&&accel.getAcceleration().z<-7.5&&accel.getAcceleration().z>-9.8"],
|
||||
[Blockly.Msg.HANDBIT_RIGHT, "accel.getAcceleration().y<0&&accel.getAcceleration().y>-4.7&&accel.getAcceleration().z<-7.5&&accel.getAcceleration().z>-9.8"],
|
||||
[Blockly.Msg.HANDBIT_UP, "accel.getAcceleration().z>-9.8&&accel.getAcceleration().z<-8"],
|
||||
[Blockly.Msg.HANDBIT_DOWN, "accel.getAcceleration().z>8&&accel.getAcceleration().z<9.8"]
|
||||
]
|
||||
};
|
||||
|
||||
export const mixepi_rgb_rainbow1 = {
|
||||
@@ -110,18 +115,13 @@ export const mixepi_rgb_rainbow1 = {
|
||||
}
|
||||
};
|
||||
|
||||
var DISPLAY_RAINBOW_TYPE = [
|
||||
[Blockly.Msg.MIXLY_RGB_DISPLAY_RAINBOW_TYPE_1, "normal"],
|
||||
[Blockly.Msg.MIXLY_RGB_DISPLAY_RAINBOW_TYPE_2, "change"]
|
||||
];
|
||||
|
||||
export const mixepi_rgb_rainbow3 = {
|
||||
init: function () {
|
||||
this.setColour(ACTUATOR_HUE);
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_RGB);
|
||||
this.appendDummyInput("")
|
||||
.appendField(new Blockly.FieldDropdown(DISPLAY_RAINBOW_TYPE), "TYPE");
|
||||
.appendField(new Blockly.FieldDropdown(this.DISPLAY_RAINBOW_TYPE), "TYPE");
|
||||
this.appendValueInput("rainbow_color")
|
||||
.setCheck(Number)
|
||||
.setAlign(Blockly.inputs.Align.RIGHT)
|
||||
@@ -129,7 +129,11 @@ export const mixepi_rgb_rainbow3 = {
|
||||
this.setInputsInline(true);
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
}
|
||||
},
|
||||
DISPLAY_RAINBOW_TYPE: [
|
||||
[Blockly.Msg.MIXLY_RGB_DISPLAY_RAINBOW_TYPE_1, "normal"],
|
||||
[Blockly.Msg.MIXLY_RGB_DISPLAY_RAINBOW_TYPE_2, "change"]
|
||||
]
|
||||
};
|
||||
|
||||
export const RGB_color_seclet = {
|
||||
@@ -225,5 +229,4 @@ export const mixepi_rgb_Brightness = {
|
||||
this.setNextStatement(true, null);
|
||||
this.setTooltip('');
|
||||
}
|
||||
};
|
||||
|
||||
};
|
||||
@@ -23,11 +23,6 @@ export const HT16K33_TEXT = {
|
||||
//执行器_点阵屏显示_画点显示
|
||||
export const HT16K33_POS = {
|
||||
init: function () {
|
||||
//执行器_点阵屏显示_画点变量
|
||||
var MixGo_DrawPixel_NUM = [
|
||||
[Blockly.Msg.MIXLY_4DIGITDISPLAY_ON, "LED_ON"],
|
||||
[Blockly.Msg.MIXLY_4DIGITDISPLAY_OFF, "LED_OFF"]
|
||||
];
|
||||
this.setColour(DISPLAY_HUE);
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_MICROBIT_monitor);
|
||||
@@ -42,12 +37,16 @@ export const HT16K33_POS = {
|
||||
this.appendDummyInput("")
|
||||
.setAlign(Blockly.inputs.Align.RIGHT)
|
||||
.appendField(Blockly.Msg.MIXLY_DISPLAY_MATRIX_SHOWPOINT)
|
||||
.appendField(new Blockly.FieldDropdown(MixGo_DrawPixel_NUM), "DrawPixel_TYPE");
|
||||
.appendField(new Blockly.FieldDropdown(this.DRAW_TYPE), "DrawPixel_TYPE");
|
||||
this.setInputsInline(true);
|
||||
this.setPreviousStatement(true);
|
||||
this.setNextStatement(true);
|
||||
this.setTooltip("");
|
||||
}
|
||||
},
|
||||
DRAW_TYPE: [
|
||||
[Blockly.Msg.MIXLY_4DIGITDISPLAY_ON, "LED_ON"],
|
||||
[Blockly.Msg.MIXLY_4DIGITDISPLAY_OFF, "LED_OFF"]
|
||||
]
|
||||
};
|
||||
|
||||
//执行器_点阵屏显示_显示图案
|
||||
@@ -211,7 +210,6 @@ export const HT16K33_LedArray = {
|
||||
.appendField(new Blockly.FieldCheckbox("FALSE"), "a116");
|
||||
this.setOutput(true, Number);
|
||||
this.setTooltip();
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
@@ -328,7 +326,6 @@ export const mixgo_button_is_pressed = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export const sensor_mixgo_light = {
|
||||
init: function () {
|
||||
this.setColour(Blockly.Msg['SENSOR_HUE']);
|
||||
@@ -370,7 +367,10 @@ export const sensor_mixgo_pin_near = {
|
||||
init: function () {
|
||||
this.setColour(Blockly.Msg['SENSOR_HUE']);
|
||||
this.appendDummyInput()
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.TEXT_TRIM_LEFT, "34"], [Blockly.Msg.TEXT_TRIM_RIGHT, "36"]]), "direction")
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.TEXT_TRIM_LEFT, "34"],
|
||||
[Blockly.Msg.TEXT_TRIM_RIGHT, "36"]
|
||||
]), "direction")
|
||||
.appendField(Blockly.Msg.MIXLY_ESP32_NEAR);
|
||||
this.setOutput(true, Boolean);
|
||||
this.setInputsInline(true);
|
||||
@@ -387,13 +387,17 @@ export const sensor_mixgo_pin_near = {
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export const mixGo_led = {
|
||||
init: function () {
|
||||
this.setColour(ACTUATOR_HUE);
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_SETTING)
|
||||
.appendField(Blockly.Msg.MIXLY_BUILDIN_LED)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_LEFT, "0"], [Blockly.Msg.MIXLY_RIGHT, "5"]]), 'STAT');
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_LEFT, "0"],
|
||||
[Blockly.Msg.MIXLY_RIGHT, "5"]
|
||||
]), 'STAT');
|
||||
this.appendValueInput('bright')
|
||||
.appendField(Blockly.Msg.MIXLY_PULSEIN_STAT)
|
||||
this.setPreviousStatement(true, null);
|
||||
@@ -409,7 +413,10 @@ export const mixGo_led_brightness = {
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_SETTING)
|
||||
.appendField(Blockly.Msg.MIXLY_BUILDIN_LED)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_LEFT, "0"], [Blockly.Msg.MIXLY_RIGHT, "5"]]), 'STAT');
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_LEFT, "0"],
|
||||
[Blockly.Msg.MIXLY_RIGHT, "5"]
|
||||
]), 'STAT');
|
||||
this.appendValueInput('bright')
|
||||
.appendField(Blockly.Msg.MIXLY_PULSEIN_STAT)
|
||||
this.setPreviousStatement(true, null);
|
||||
@@ -434,18 +441,13 @@ export const MixGo_rgb_rainbow1 = {
|
||||
}
|
||||
};
|
||||
|
||||
var DISPLAY_RAINBOW_TYPE = [
|
||||
[Blockly.Msg.MIXLY_RGB_DISPLAY_RAINBOW_TYPE_1, "normal"],
|
||||
[Blockly.Msg.MIXLY_RGB_DISPLAY_RAINBOW_TYPE_2, "change"]
|
||||
];
|
||||
|
||||
export const MixGo_rgb_rainbow3 = {
|
||||
init: function () {
|
||||
this.setColour(ACTUATOR_HUE);
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_RGB);
|
||||
this.appendDummyInput("")
|
||||
.appendField(new Blockly.FieldDropdown(DISPLAY_RAINBOW_TYPE), "TYPE");
|
||||
.appendField(new Blockly.FieldDropdown(this.DISPLAY_RAINBOW_TYPE), "TYPE");
|
||||
this.appendValueInput("rainbow_color")
|
||||
.setCheck(Number)
|
||||
.setAlign(Blockly.inputs.Align.RIGHT)
|
||||
@@ -453,7 +455,11 @@ export const MixGo_rgb_rainbow3 = {
|
||||
this.setInputsInline(true);
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
}
|
||||
},
|
||||
DISPLAY_RAINBOW_TYPE: [
|
||||
[Blockly.Msg.MIXLY_RGB_DISPLAY_RAINBOW_TYPE_1, "normal"],
|
||||
[Blockly.Msg.MIXLY_RGB_DISPLAY_RAINBOW_TYPE_2, "change"]
|
||||
]
|
||||
};
|
||||
|
||||
export const MixGo_rgb = {
|
||||
@@ -512,6 +518,7 @@ export const MixGo_rgb_Brightness = {
|
||||
this.setTooltip('');
|
||||
}
|
||||
};
|
||||
|
||||
export const MixGo_rgb_show = {
|
||||
init: function () {
|
||||
this.setColour(ACTUATOR_HUE);
|
||||
|
||||
@@ -2,7 +2,6 @@ import * as Blockly from 'blockly/core';
|
||||
|
||||
const PINOUT_HUE = '#555555';
|
||||
|
||||
|
||||
export const esp32_pin = {
|
||||
init: function () {
|
||||
this.appendDummyInput()
|
||||
|
||||
@@ -20,6 +20,7 @@ export const pins_button = {
|
||||
this.setOutput(true, Number);
|
||||
}
|
||||
};
|
||||
|
||||
export const pins_sda = {
|
||||
init: function () {
|
||||
this.setColour(PINS_HUE);
|
||||
@@ -100,6 +101,7 @@ export const pins_axis = {
|
||||
this.setOutput(true, Number);
|
||||
}
|
||||
};
|
||||
|
||||
export const pins_brightness = {
|
||||
init: function () {
|
||||
this.setColour(PINS_HUE);
|
||||
@@ -172,7 +174,6 @@ export const brightness = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export const CHANNEL = {
|
||||
init: function () {
|
||||
this.setColour(PINS_HUE);
|
||||
|
||||
@@ -81,6 +81,7 @@ export const MPU9250_update = {
|
||||
this.setInputsInline(true);
|
||||
}
|
||||
};
|
||||
|
||||
export const Pocket_rgb = {
|
||||
init: function () {
|
||||
this.setColour(ACTUATOR_HUE);
|
||||
@@ -128,6 +129,7 @@ export const Pocket_rgb_Brightness = {
|
||||
this.setTooltip('');
|
||||
}
|
||||
};
|
||||
|
||||
export const Pocket_rgb_show = {
|
||||
init: function () {
|
||||
this.setColour(ACTUATOR_HUE);
|
||||
@@ -137,6 +139,7 @@ export const Pocket_rgb_show = {
|
||||
this.setNextStatement(true, null);
|
||||
}
|
||||
};
|
||||
|
||||
export const pocket_RGB_color_HSV = {
|
||||
init: function () {
|
||||
this.setColour(ACTUATOR_HUE);
|
||||
|
||||
@@ -36,7 +36,13 @@ export const OneButton = {
|
||||
.appendField(new Blockly.FieldDropdown(Profile.default.button), 'PIN');
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.MIXLY_BUTTON)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_CLICK, "attachClick"], [Blockly.Msg.MIXLY_DOUBLE_CLICK, "attachDoubleClick"], [Blockly.Msg.MIXLY_LONG_PRESS_START, "attachLongPressStart"], [Blockly.Msg.MIXLY_DURING_LONG_PRESS, "attachDuringLongPress"], [Blockly.Msg.MIXLY_LONG_PRESS_END, "attachLongPressStop"]]), "mode");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_CLICK, "attachClick"],
|
||||
[Blockly.Msg.MIXLY_DOUBLE_CLICK, "attachDoubleClick"],
|
||||
[Blockly.Msg.MIXLY_LONG_PRESS_START, "attachLongPressStart"],
|
||||
[Blockly.Msg.MIXLY_DURING_LONG_PRESS, "attachDuringLongPress"],
|
||||
[Blockly.Msg.MIXLY_LONG_PRESS_END, "attachLongPressStop"]
|
||||
]), "mode");
|
||||
this.appendStatementInput('DO')
|
||||
.appendField(Blockly.Msg.MIXLY_DO);
|
||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_INOUT_ATTACHINTERRUPT);
|
||||
@@ -47,16 +53,16 @@ export const OneButton = {
|
||||
|
||||
export const ESP_TCS34725_Get_RGB = {
|
||||
init: function () {
|
||||
const TCS34725_COLOR = [
|
||||
[Blockly.Msg.COLOUR_RGB_RED, "r"],
|
||||
[Blockly.Msg.COLOUR_RGB_GREEN, "g"],
|
||||
[Blockly.Msg.COLOUR_RGB_BLUE, "b"],
|
||||
];
|
||||
this.setColour(SENSOR_HUE);
|
||||
this.appendDummyInput("")
|
||||
.appendField(Blockly.Msg.TCS34725_Get_RGB)
|
||||
.appendField(new Blockly.FieldDropdown(TCS34725_COLOR), "TCS34725_COLOR");
|
||||
.appendField(new Blockly.FieldDropdown(this.TCS34725_COLOR), "TCS34725_COLOR");
|
||||
this.setInputsInline(true);
|
||||
this.setOutput(true);
|
||||
}
|
||||
},
|
||||
TCS34725_COLOR: [
|
||||
[Blockly.Msg.COLOUR_RGB_RED, "r"],
|
||||
[Blockly.Msg.COLOUR_RGB_GREEN, "g"],
|
||||
[Blockly.Msg.COLOUR_RGB_BLUE, "b"],
|
||||
]
|
||||
};
|
||||
@@ -60,7 +60,10 @@ export const serial_print = {
|
||||
this.appendValueInput("CONTENT", String)
|
||||
.appendField(new Blockly.FieldDropdown(Profile.default.serial_HardwareSelect), "serial_select")
|
||||
.appendField(Blockly.Msg.MIXLY_SERIAL_PRINT)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_PRINT_INLINE, "print"], [Blockly.Msg.TEXT_PRINT_Huanhang_TOOLTIP, "println"]]), "new_line");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_PRINT_INLINE, "print"],
|
||||
[Blockly.Msg.TEXT_PRINT_Huanhang_TOOLTIP, "println"]
|
||||
]), "new_line");
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setTooltip(Blockly.Msg.TEXT_PRINT_TOOLTIP);
|
||||
@@ -73,24 +76,34 @@ export const serial_println = {
|
||||
this.appendValueInput("CONTENT", String)
|
||||
.appendField(new Blockly.FieldDropdown(Profile.default.serial_HardwareSelect), "serial_select")
|
||||
.appendField(Blockly.Msg.MIXLY_SERIAL_PRINT)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.TEXT_PRINT_Huanhang_TOOLTIP, "println"], [Blockly.Msg.MIXLY_PRINT_INLINE, "print"]]), "new_line");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.TEXT_PRINT_Huanhang_TOOLTIP, "println"],
|
||||
[Blockly.Msg.MIXLY_PRINT_INLINE, "print"]
|
||||
]), "new_line");
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setTooltip(Blockly.Msg.TEXT_PRINT_TOOLTIP);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export const serial_print_num = {
|
||||
init: function () {
|
||||
this.setColour(SERIAL_HUE);
|
||||
this.appendDummyInput()
|
||||
.appendField(new Blockly.FieldDropdown(Profile.default.serial_HardwareSelect), "serial_select")
|
||||
.appendField(Blockly.Msg.MIXLY_SERIAL_PRINT)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_PRINT_INLINE, "print"], [Blockly.Msg.TEXT_PRINT_Huanhang_TOOLTIP, "println"]]), "new_line")
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MIXLY_PRINT_INLINE, "print"],
|
||||
[Blockly.Msg.TEXT_PRINT_Huanhang_TOOLTIP, "println"]
|
||||
]), "new_line")
|
||||
.appendField(Blockly.Msg.MIXLY_NUMBER);
|
||||
this.appendValueInput("CONTENT", Number)
|
||||
.appendField(new Blockly.FieldDropdown([[Blockly.Msg.MATH_HEX, "HEX"], [Blockly.Msg.MATH_BIN, "BIN"], [Blockly.Msg.MATH_OCT, "OCT"], [Blockly.Msg.MATH_DEC, "DEC"]]), "STAT")
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
[Blockly.Msg.MATH_HEX, "HEX"],
|
||||
[Blockly.Msg.MATH_BIN, "BIN"],
|
||||
[Blockly.Msg.MATH_OCT, "OCT"],
|
||||
[Blockly.Msg.MATH_DEC, "DEC"]
|
||||
]), "STAT")
|
||||
.setCheck(Number);
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
@@ -142,7 +155,12 @@ export const serial_parseInt_Float = {
|
||||
this.appendDummyInput()
|
||||
.appendField(new Blockly.FieldDropdown(Profile.default.serial_HardwareSelect), "serial_select")
|
||||
//.appendField(Blockly.Msg.MIXLY_SERIAL_READ)
|
||||
.appendField(new Blockly.FieldDropdown([["read", "read"], ["peek", "peek"], ["parseInt", "parseInt"], ["parseFloat", "parseFloat"]]), "STAT");
|
||||
.appendField(new Blockly.FieldDropdown([
|
||||
["read", "read"],
|
||||
["peek", "peek"],
|
||||
["parseInt", "parseInt"],
|
||||
["parseFloat", "parseFloat"]
|
||||
]), "STAT");
|
||||
this.setOutput(true, Number);
|
||||
var thisBlock = this;
|
||||
this.setTooltip(function () {
|
||||
@@ -167,6 +185,7 @@ export const serial_flush = {
|
||||
this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_SERIAL_FLUSH);
|
||||
}
|
||||
};
|
||||
|
||||
export const serial_softserial = {
|
||||
init: function () {
|
||||
this.setColour(SERIAL_HUE);
|
||||
|
||||
@@ -14,10 +14,6 @@ export const initialize_spiffs = {
|
||||
this.setHelpUrl("");
|
||||
}
|
||||
};
|
||||
var OPEN_MODE = [
|
||||
[Blockly.Msg.MIXLY_READONLY, 'FILE_READ'],
|
||||
[Blockly.Msg.TEXT_WRITE_TEXT, 'FILE_WRITE'],
|
||||
[Blockly.Msg.TEXT_APPEND_APPENDTEXT, 'FILE_APPEND']]
|
||||
|
||||
//打开文件并向其中写入数据
|
||||
export const spiffs_open_file = {
|
||||
@@ -33,14 +29,19 @@ export const spiffs_open_file = {
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_MODE);
|
||||
this.appendDummyInput()
|
||||
.appendField(new Blockly.FieldDropdown(OPEN_MODE), 'MODE');
|
||||
.appendField(new Blockly.FieldDropdown(this.OPEN_MODE), 'MODE');
|
||||
this.setInputsInline(true);
|
||||
this.setPreviousStatement(true, null);
|
||||
this.setNextStatement(true, null);
|
||||
this.setColour(STORAGE_HUE);
|
||||
this.setTooltip("");
|
||||
this.setHelpUrl("");
|
||||
}
|
||||
},
|
||||
OPEN_MODE: [
|
||||
[Blockly.Msg.MIXLY_READONLY, 'FILE_READ'],
|
||||
[Blockly.Msg.TEXT_WRITE_TEXT, 'FILE_WRITE'],
|
||||
[Blockly.Msg.TEXT_APPEND_APPENDTEXT, 'FILE_APPEND']
|
||||
]
|
||||
};
|
||||
|
||||
//打开文件并向其中写入数据
|
||||
@@ -58,6 +59,7 @@ export const spiffs_close_file = {
|
||||
this.setHelpUrl("");
|
||||
}
|
||||
};
|
||||
|
||||
//将数据追加到文件
|
||||
export const spiffs_write_data = {
|
||||
init: function () {
|
||||
@@ -77,6 +79,7 @@ export const spiffs_write_data = {
|
||||
this.setHelpUrl("");
|
||||
}
|
||||
};
|
||||
|
||||
//文件可读
|
||||
export const spiffs_read_available = {
|
||||
init: function () {
|
||||
|
||||
@@ -726,21 +726,13 @@
|
||||
<category id="catSensor" colour="40">
|
||||
<block type="chaoshengbo2">
|
||||
</block>
|
||||
<block type="DHT">
|
||||
<value name="PIN">
|
||||
<shadow type="pins_digital"></shadow>
|
||||
</value>
|
||||
</block>
|
||||
<block type="DHT"></block>
|
||||
<block type="LM35">
|
||||
<value name="PIN">
|
||||
<shadow type="pins_analog"></shadow>
|
||||
</value>
|
||||
</block>
|
||||
<block type="ds18b20">
|
||||
<value name="PIN">
|
||||
<shadow type="pins_digital"></shadow>
|
||||
</value>
|
||||
</block>
|
||||
<block type="ds18b20"></block>
|
||||
<block type="BME280_READ">
|
||||
<value name="address">
|
||||
<shadow type="math_number">
|
||||
@@ -784,27 +776,27 @@
|
||||
</value>
|
||||
<value name="tcs230_s1">
|
||||
<shadow type="pins_digital">
|
||||
<field name="PIN">3</field>
|
||||
<field name="PIN">4</field>
|
||||
</shadow>
|
||||
</value>
|
||||
<value name="tcs230_s2">
|
||||
<shadow type="pins_digital">
|
||||
<field name="PIN">4</field>
|
||||
<field name="PIN">5</field>
|
||||
</shadow>
|
||||
</value>
|
||||
<value name="tcs230_s3">
|
||||
<shadow type="pins_digital">
|
||||
<field name="PIN">5</field>
|
||||
<field name="PIN">12</field>
|
||||
</shadow>
|
||||
</value>
|
||||
<value name="tcs230_led">
|
||||
<shadow type="pins_digital">
|
||||
<field name="PIN">6</field>
|
||||
<field name="PIN">13</field>
|
||||
</shadow>
|
||||
</value>
|
||||
<value name="tcs230_out">
|
||||
<shadow type="pins_digital">
|
||||
<field name="PIN">7</field>
|
||||
<field name="PIN">14</field>
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
@@ -1019,9 +1011,7 @@
|
||||
<block type="keypad_type_data"></block>
|
||||
</value>
|
||||
</block>
|
||||
<block type="get_keypad_num">
|
||||
<value name="keypad_name"></value>
|
||||
</block>
|
||||
<block type="get_keypad_num"></block>
|
||||
<block type="gps_init">
|
||||
<value name="RX">
|
||||
<shadow type="pins_digital"></shadow>
|
||||
@@ -1105,7 +1095,7 @@
|
||||
</value>
|
||||
<value name="PIN_EN">
|
||||
<shadow type="pins_pwm">
|
||||
<field name="PIN">6</field>
|
||||
<field name="PIN">12</field>
|
||||
</shadow>
|
||||
</value>
|
||||
<value name="speed">
|
||||
@@ -1166,20 +1156,16 @@
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
<block type="servo_read_degrees">
|
||||
<value name="PIN">
|
||||
<shadow type="pins_digital"></shadow>
|
||||
</value>
|
||||
</block>
|
||||
<block type="servo_read_degrees"></block>
|
||||
<block type="group_stepper_setup">
|
||||
<value name="PIN1">
|
||||
<shadow type="pins_digital">
|
||||
<field name="PIN">1</field>
|
||||
<field name="PIN">2</field>
|
||||
</shadow>
|
||||
</value>
|
||||
<value name="PIN2">
|
||||
<shadow type="pins_digital">
|
||||
<field name="PIN">2</field>
|
||||
<field name="PIN">4</field>
|
||||
</shadow>
|
||||
</value>
|
||||
<value name="steps">
|
||||
@@ -1196,22 +1182,22 @@
|
||||
<block type="group_stepper_setup2">
|
||||
<value name="PIN1">
|
||||
<shadow type="pins_digital">
|
||||
<field name="PIN">1</field>
|
||||
<field name="PIN">2</field>
|
||||
</shadow>
|
||||
</value>
|
||||
<value name="PIN2">
|
||||
<shadow type="pins_digital">
|
||||
<field name="PIN">2</field>
|
||||
<field name="PIN">4</field>
|
||||
</shadow>
|
||||
</value>
|
||||
<value name="PIN3">
|
||||
<shadow type="pins_digital">
|
||||
<field name="PIN">3</field>
|
||||
<field name="PIN">5</field>
|
||||
</shadow>
|
||||
</value>
|
||||
<value name="PIN4">
|
||||
<shadow type="pins_digital">
|
||||
<field name="PIN">4</field>
|
||||
<field name="PIN">12</field>
|
||||
</shadow>
|
||||
</value>
|
||||
<value name="steps">
|
||||
@@ -1328,14 +1314,14 @@
|
||||
<block type="M9101X_S_MP3_CONTROL">
|
||||
<value name="PIN">
|
||||
<shadow type="pins_digital">
|
||||
<field name="PIN">8</field>
|
||||
<field name="PIN"></field>
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
<block type="M9101X_S_MP3_VOL_CONTROL">
|
||||
<value name="PIN">
|
||||
<shadow type="pins_digital">
|
||||
<field name="PIN">8</field>
|
||||
<field name="PIN"></field>
|
||||
</shadow>
|
||||
</value>
|
||||
<value name="NUM">
|
||||
@@ -1347,7 +1333,7 @@
|
||||
<block type="M9101X_S_MP3_PLAY_NUM">
|
||||
<value name="PIN">
|
||||
<shadow type="pins_digital">
|
||||
<field name="PIN">8</field>
|
||||
<field name="PIN"></field>
|
||||
</shadow>
|
||||
</value>
|
||||
<value name="NUM">
|
||||
@@ -1370,12 +1356,12 @@
|
||||
<field name="serial_select">mySerial</field>
|
||||
<value name="RX">
|
||||
<shadow type="pins_digital">
|
||||
<field name="PIN">10</field>
|
||||
<field name="PIN"></field>
|
||||
</shadow>
|
||||
</value>
|
||||
<value name="TX">
|
||||
<shadow type="pins_digital">
|
||||
<field name="PIN">11</field>
|
||||
<field name="PIN"></field>
|
||||
</shadow>
|
||||
</value>
|
||||
<next>
|
||||
@@ -1516,11 +1502,6 @@
|
||||
<field name="NUM">4</field>
|
||||
</shadow>
|
||||
</value>
|
||||
<value name="Brightness">
|
||||
<shadow type="math_number">
|
||||
<field name="NUM">20</field>
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
<block type="display_rgb_Brightness">
|
||||
<value name="Brightness">
|
||||
@@ -1589,11 +1570,6 @@
|
||||
<field name="NUM">20</field>
|
||||
</shadow>
|
||||
</value>
|
||||
<value name="Brightness">
|
||||
<shadow type="math_number">
|
||||
<field name="NUM">20</field>
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
<block type="display_rgb_rainbow3">
|
||||
<value name="rainbow_color">
|
||||
@@ -1633,11 +1609,6 @@
|
||||
<field name="TEXT">2345</field>
|
||||
</shadow>
|
||||
</value>
|
||||
<value name="Speed">
|
||||
<shadow type="math_number">
|
||||
<field name="NUM">300</field>
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
<block type="display_TM1637_displayTime">
|
||||
<value name="hour">
|
||||
@@ -1650,10 +1621,6 @@
|
||||
<field name="NUM">30</field>
|
||||
</shadow>
|
||||
</value>
|
||||
<value name="STAT">
|
||||
<shadow type="inout_highlow">
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
</category>
|
||||
<category id="catLCD" colour="180">
|
||||
@@ -1706,7 +1673,7 @@
|
||||
<field name="number">0</field>
|
||||
<value name="row">
|
||||
<shadow type="math_number">
|
||||
<field name=" NUM">1</field>
|
||||
<field name="NUM">1</field>
|
||||
</shadow>
|
||||
</value>
|
||||
<value name="column">
|
||||
@@ -1743,9 +1710,6 @@
|
||||
<block type="u8g2_spi_init">
|
||||
<field name="U8G2_TYPE_SPI">SSD1306_128X64_NONAME</field>
|
||||
<field name="ROTATION">U8G2_R0</field>
|
||||
<field name="CS">10</field>
|
||||
<field name="DC">9</field>
|
||||
<field name="RST">8</field>
|
||||
<next>
|
||||
<block type="oled_page">
|
||||
<statement name="DO">
|
||||
@@ -1766,7 +1730,6 @@
|
||||
<shadow type="pins_MOSI">
|
||||
</shadow>
|
||||
</value>
|
||||
<field name="DC">10</field>
|
||||
<next>
|
||||
<block type="oled_page">
|
||||
<statement name="DO">
|
||||
@@ -1778,17 +1741,13 @@
|
||||
</next>
|
||||
</block>
|
||||
<sep gap="50"></sep>
|
||||
<block type="oled_set_EN_Font">
|
||||
</block>
|
||||
<block type="oled_set_CN_Font">
|
||||
</block>
|
||||
<block type="oled_set_ZH_TW_Font">
|
||||
</block>
|
||||
<block type="oled_set_EN_Font"></block>
|
||||
<block type="oled_set_CN_Font"></block>
|
||||
<block type="oled_set_ZH_TW_Font"></block>
|
||||
<block type="procedures_defnoreturn">
|
||||
<field name="NAME">page1</field>
|
||||
<statement name="STACK">
|
||||
<block type="oled_set_EN_Font">
|
||||
<field name="TYPE">timR08_tr</field>
|
||||
<next>
|
||||
<block type="oled_print">
|
||||
<value name="POS_X">
|
||||
@@ -1823,13 +1782,8 @@
|
||||
<field name="modulus_direction">2</field>
|
||||
<field name="hz_sharp">STHeiti</field>
|
||||
<field name="hz_line_height">16</field>
|
||||
<field name="hz_up_down">hz_up</field>
|
||||
<field name="hz_up_down_data">0</field>
|
||||
<field name="hz_left_right">hz_left</field>
|
||||
<field name="hz_left_right_data">0</field>
|
||||
<field name="bitmap_width">48</field>
|
||||
<field name="bitmap_height">16</field>
|
||||
<field name="show_hz">TRUE</field>
|
||||
<field name="input_data">米思齐</field>
|
||||
</block>
|
||||
</value>
|
||||
@@ -1880,7 +1834,6 @@
|
||||
<field name="NUM">0</field>
|
||||
</shadow>
|
||||
</value>
|
||||
<field name="Icon_size"></field>
|
||||
</block>
|
||||
<block type="oled_icons">
|
||||
<value name="POS_X">
|
||||
@@ -1893,7 +1846,6 @@
|
||||
<field name="NUM">20</field>
|
||||
</shadow>
|
||||
</value>
|
||||
<field name="Icon_size"></field>
|
||||
</block>
|
||||
<block type="oled_drawPixel">
|
||||
<value name="POS_X">
|
||||
@@ -2094,11 +2046,6 @@
|
||||
</value>
|
||||
</block>
|
||||
<block type="HT16K33_Init">
|
||||
<value name="PIN1">
|
||||
<shadow type="pins_digital">
|
||||
<field name="PIN">SDA</field>
|
||||
</shadow>
|
||||
</value>
|
||||
<value name="PIN2">
|
||||
<shadow type="pins_digital">
|
||||
<field name="PIN">SCL</field>
|
||||
@@ -2221,9 +2168,6 @@
|
||||
<value name="PIN">
|
||||
<shadow type="pins_digital"></shadow>
|
||||
</value>
|
||||
<value name="data">
|
||||
<shadow type="math_number"></shadow>
|
||||
</value>
|
||||
<value name="bits">
|
||||
<shadow type="math_number">
|
||||
<field name="NUM">32</field>
|
||||
@@ -2688,7 +2632,6 @@
|
||||
<mutation>
|
||||
<arg name="vpin_value" vartype="int"></arg>
|
||||
</mutation>
|
||||
<field name="Vpin">V0</field>
|
||||
<value name="TIME">
|
||||
<shadow type="math_number">
|
||||
<field name="NUM">1000</field>
|
||||
@@ -3271,11 +3214,6 @@
|
||||
<field name="NUM">120</field>
|
||||
</shadow>
|
||||
</value>
|
||||
<value name="Topic">
|
||||
<shadow type="text">
|
||||
<field name="TEXT">Topic_0</field>
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
<block type="MQTT_subscribe">
|
||||
<statement name="DO0">
|
||||
|
||||
Reference in New Issue
Block a user