commit
7524e78fc6
@ -218,12 +218,7 @@ Blockly.Blocks["sensebox_sensor_bme680_bsec"] = {
|
|||||||
|
|
||||||
Blockly.Blocks["sensebox_sensor_ultrasonic_ranger"] = {
|
Blockly.Blocks["sensebox_sensor_ultrasonic_ranger"] = {
|
||||||
init: function () {
|
init: function () {
|
||||||
var dropdownOptions = [
|
var dropdown = new FieldGridDropdown(selectedBoard().digitalPorts, function (option) {
|
||||||
[Blockly.Msg.senseBox_ultrasonic_port_A, "A"],
|
|
||||||
[Blockly.Msg.senseBox_ultrasonic_port_B, "B"],
|
|
||||||
[Blockly.Msg.senseBox_ultrasonic_port_C, "C"],
|
|
||||||
];
|
|
||||||
var dropdown = new FieldGridDropdown(dropdownOptions, function (option) {
|
|
||||||
var input = option === "A" || option === "B" || option === "C";
|
var input = option === "A" || option === "B" || option === "C";
|
||||||
this.sourceBlock_.updateShape_(input);
|
this.sourceBlock_.updateShape_(input);
|
||||||
});
|
});
|
||||||
@ -336,6 +331,7 @@ Blockly.Blocks["sensebox_button"] = {
|
|||||||
[Blockly.Msg.senseBox_button_isPressed, "isPressed"],
|
[Blockly.Msg.senseBox_button_isPressed, "isPressed"],
|
||||||
[Blockly.Msg.senseBox_button_wasPressed, "wasPressed"],
|
[Blockly.Msg.senseBox_button_wasPressed, "wasPressed"],
|
||||||
[Blockly.Msg.senseBox_button_longPress, "longPress"],
|
[Blockly.Msg.senseBox_button_longPress, "longPress"],
|
||||||
|
[Blockly.Msg.senseBox_button_switch,"toggleButton"]
|
||||||
]),
|
]),
|
||||||
"FUNCTION"
|
"FUNCTION"
|
||||||
)
|
)
|
||||||
@ -434,16 +430,11 @@ Blockly.Blocks["sensebox_gps"] = {
|
|||||||
|
|
||||||
Blockly.Blocks["sensebox_sensor_truebner_smt50"] = {
|
Blockly.Blocks["sensebox_sensor_truebner_smt50"] = {
|
||||||
init: function () {
|
init: function () {
|
||||||
var dropdownOptions = [
|
|
||||||
[Blockly.Msg.senseBox_ultrasonic_port_A, "A"],
|
|
||||||
[Blockly.Msg.senseBox_ultrasonic_port_B, "B"],
|
|
||||||
[Blockly.Msg.senseBox_ultrasonic_port_C, "C"],
|
|
||||||
];
|
|
||||||
this.setColour(getColour().sensebox);
|
this.setColour(getColour().sensebox);
|
||||||
this.appendDummyInput().appendField(Blockly.Msg.senseBox_smt50);
|
this.appendDummyInput().appendField(Blockly.Msg.senseBox_smt50);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField("Port:")
|
.appendField("Port:")
|
||||||
.appendField(new Blockly.FieldDropdown(dropdownOptions), "Port");
|
.appendField(new Blockly.FieldDropdown(selectedBoard().digitalPorts), "Port");
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.senseBox_value)
|
.appendField(Blockly.Msg.senseBox_value)
|
||||||
.appendField(
|
.appendField(
|
||||||
@ -467,16 +458,12 @@ Blockly.Blocks["sensebox_sensor_truebner_smt50"] = {
|
|||||||
|
|
||||||
Blockly.Blocks["sensebox_sensor_watertemperature"] = {
|
Blockly.Blocks["sensebox_sensor_watertemperature"] = {
|
||||||
init: function () {
|
init: function () {
|
||||||
var dropdownOptions = [
|
|
||||||
[Blockly.Msg.senseBox_ultrasonic_port_A, "A"],
|
|
||||||
[Blockly.Msg.senseBox_ultrasonic_port_B, "B"],
|
|
||||||
[Blockly.Msg.senseBox_ultrasonic_port_C, "C"],
|
|
||||||
];
|
|
||||||
this.setColour(getColour().sensebox);
|
this.setColour(getColour().sensebox);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.senseBox_watertemperature)
|
.appendField(Blockly.Msg.senseBox_watertemperature)
|
||||||
.appendField("Port:")
|
.appendField("Port:")
|
||||||
.appendField(new Blockly.FieldDropdown(dropdownOptions), "Port");
|
.appendField(new Blockly.FieldDropdown(selectedBoard().digitalPorts), "Port");
|
||||||
this.setOutput(true, Types.NUMBER.typeName);
|
this.setOutput(true, Types.NUMBER.typeName);
|
||||||
this.setTooltip(Blockly.Msg.senseBox_watertemperature_tip);
|
this.setTooltip(Blockly.Msg.senseBox_watertemperature_tip);
|
||||||
this.data = {name: "ds18b20"};
|
this.data = {name: "ds18b20"};
|
||||||
@ -506,16 +493,11 @@ Blockly.Blocks['sensebox_windspeed'] = {
|
|||||||
|
|
||||||
Blockly.Blocks["sensebox_soundsensor_dfrobot"] = {
|
Blockly.Blocks["sensebox_soundsensor_dfrobot"] = {
|
||||||
init: function () {
|
init: function () {
|
||||||
var dropdownOptions = [
|
|
||||||
[Blockly.Msg.senseBox_ultrasonic_port_A, "A"],
|
|
||||||
[Blockly.Msg.senseBox_ultrasonic_port_B, "B"],
|
|
||||||
[Blockly.Msg.senseBox_ultrasonic_port_C, "C"],
|
|
||||||
];
|
|
||||||
this.setColour(getColour().sensebox);
|
this.setColour(getColour().sensebox);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.senseBox_soundsensor_dfrobot)
|
.appendField(Blockly.Msg.senseBox_soundsensor_dfrobot)
|
||||||
.appendField("Port:")
|
.appendField("Port:")
|
||||||
.appendField(new Blockly.FieldDropdown(dropdownOptions), "Port");
|
.appendField(new Blockly.FieldDropdown(selectedBoard().digitalPorts), "Port");
|
||||||
this.setOutput(true, Types.DECIMAL.typeName);
|
this.setOutput(true, Types.DECIMAL.typeName);
|
||||||
this.setTooltip(Blockly.Msg.senseBox_soundsensor_dfrobot_tooltip);
|
this.setTooltip(Blockly.Msg.senseBox_soundsensor_dfrobot_tooltip);
|
||||||
this.setHelpUrl(Blockly.Msg.senseBox_soundsensor_dfrobot_helpurl);
|
this.setHelpUrl(Blockly.Msg.senseBox_soundsensor_dfrobot_helpurl);
|
||||||
|
@ -399,6 +399,7 @@ Blockly.Arduino.sensebox_button = function () {
|
|||||||
Blockly.Arduino.libraries_[
|
Blockly.Arduino.libraries_[
|
||||||
"library_jcButtons"
|
"library_jcButtons"
|
||||||
] = `#include <JC_Button.h> // http://librarymanager/All#JC_Button`;
|
] = `#include <JC_Button.h> // http://librarymanager/All#JC_Button`;
|
||||||
|
|
||||||
Blockly.Arduino.definitions_["define_button" + dropdown_pin + ""] =
|
Blockly.Arduino.definitions_["define_button" + dropdown_pin + ""] =
|
||||||
"Button button_" + dropdown_pin + "(" + dropdown_pin + ");";
|
"Button button_" + dropdown_pin + "(" + dropdown_pin + ");";
|
||||||
Blockly.Arduino.setupCode_["setup_button" + dropdown_pin + ""] =
|
Blockly.Arduino.setupCode_["setup_button" + dropdown_pin + ""] =
|
||||||
@ -413,6 +414,10 @@ Blockly.Arduino.sensebox_button = function () {
|
|||||||
} else if (dropown_function === "longPress") {
|
} else if (dropown_function === "longPress") {
|
||||||
var time = this.getFieldValue("time");
|
var time = this.getFieldValue("time");
|
||||||
code = "button_" + dropdown_pin + ".pressedFor(" + time + ")";
|
code = "button_" + dropdown_pin + ".pressedFor(" + time + ")";
|
||||||
|
} else if (dropown_function === "toggleButton") {
|
||||||
|
code = "button_" + dropdown_pin + ".toggleState()";
|
||||||
|
Blockly.Arduino.definitions_["define_button" + dropdown_pin + ""] =
|
||||||
|
"ToggleButton button_" + dropdown_pin + "(" + dropdown_pin + ");";
|
||||||
}
|
}
|
||||||
return [code, Blockly.Arduino.ORDER_ATOMIC];
|
return [code, Blockly.Arduino.ORDER_ATOMIC];
|
||||||
};
|
};
|
||||||
|
@ -13,6 +13,11 @@ const sensebox_mcu = {
|
|||||||
["C5", "5"],
|
["C5", "5"],
|
||||||
["C6", "6"],
|
["C6", "6"],
|
||||||
],
|
],
|
||||||
|
digitalPorts: [
|
||||||
|
["A", "A"],
|
||||||
|
["B", "B"],
|
||||||
|
["C", "C"],
|
||||||
|
],
|
||||||
digitalPinsLED: [
|
digitalPinsLED: [
|
||||||
["BUILTIN_1", "7"],
|
["BUILTIN_1", "7"],
|
||||||
["BUILTIN_2", "8"],
|
["BUILTIN_2", "8"],
|
||||||
@ -143,6 +148,9 @@ const sensebox_mini = {
|
|||||||
["IO1", "1"],
|
["IO1", "1"],
|
||||||
["IO2", "2"],
|
["IO2", "2"],
|
||||||
],
|
],
|
||||||
|
digitalPorts: [
|
||||||
|
["IO1-2", "A"],
|
||||||
|
],
|
||||||
digitalPinsLED: [
|
digitalPinsLED: [
|
||||||
["BUILTIN_1", "7"],
|
["BUILTIN_1", "7"],
|
||||||
["BUILTIN_2", "8"],
|
["BUILTIN_2", "8"],
|
||||||
@ -151,8 +159,7 @@ const sensebox_mini = {
|
|||||||
],
|
],
|
||||||
digitalPinsRGB: [
|
digitalPinsRGB: [
|
||||||
["on Board", "6"],
|
["on Board", "6"],
|
||||||
["IO1", "1"],
|
["IO1-2", "1"],
|
||||||
["IO2", "2"],
|
|
||||||
],
|
],
|
||||||
digitalPinsButton: [
|
digitalPinsButton: [
|
||||||
["on Board", "0"],
|
["on Board", "0"],
|
||||||
|
@ -13,6 +13,8 @@ const maxInstances = {
|
|||||||
sensebox_lora_initialize_otaa: 1,
|
sensebox_lora_initialize_otaa: 1,
|
||||||
sensebox_lora_initialize_abp: 1,
|
sensebox_lora_initialize_abp: 1,
|
||||||
sensebox_phyphox_init: 1,
|
sensebox_phyphox_init: 1,
|
||||||
|
sensebox_phyphox_experiment: 1,
|
||||||
|
sensebox_phyphox_experiment_send: 1,
|
||||||
sensebox_ethernet: 1,
|
sensebox_ethernet: 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user