Merge branch 'remove-senseboxmcu-lib' into block/add-ethernet-bee

This commit is contained in:
Mario Pesch
2022-01-31 15:33:12 +01:00
committed by GitHub
39 changed files with 9857 additions and 9854 deletions
+27 -53
View File
@@ -24,16 +24,6 @@ Blockly.Blocks["sensebox_osem_connection"] = {
this.setColour(getColour().sensebox);
this.appendDummyInput()
.appendField(Blockly.Msg.senseBox_osem_connection)
.appendField(
new Blockly.FieldDropdown([
[Blockly.Msg.senseBox_osem_host, '"ingress.opensensemap.org"'],
[
Blockly.Msg.senseBox_osem_host_workshop,
'"ingress.workshop.opensensemap.org"',
],
]),
"host"
)
.appendField("SSL")
.appendField(new Blockly.FieldCheckbox(ssl), "SSL");
this.appendDummyInput()
@@ -70,6 +60,11 @@ Blockly.Blocks["sensebox_osem_connection"] = {
.setCheck(null);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.getField("type").setValidator(
function (val) {
this.updateShape_(val === "Mobile");
}.bind(this)
);
},
onchange: function (e) {
var legal = false;
@@ -105,49 +100,28 @@ Blockly.Blocks["sensebox_osem_connection"] = {
}
}
},
mutationToDom: function () {
var container = document.createElement("mutation");
var input = this.getFieldValue("type");
this.updateShape_(input);
container.setAttribute("type", input);
return container;
},
domToMutation: function (xmlElement) {
var connections = xmlElement.getAttribute("connections");
this.updateShape_(connections);
},
/**
* Modify this block to have the correct number of pins available.
* @param {boolean}
* @private
* @this Blockly.Block
*/
updateShape_: function () {
var extraFieldExist = this.getFieldValue("gps");
var input = this.getFieldValue("type");
if (input === "Mobile" && extraFieldExist === null) {
this.appendValueInput("lat", "Number").appendField(
Blockly.Msg.senseBox_gps_lat,
"gps"
);
this.appendValueInput("lng", "Number").appendField(
Blockly.Msg.senseBox_gps_lng
);
this.appendValueInput("altitude", "Number").appendField(
Blockly.Msg.senseBox_gps_alt
);
this.appendValueInput("timeStamp", "Number").appendField(
Blockly.Msg.senseBox_gps_timeStamp
);
}
if (input === "Stationary" && extraFieldExist !== null) {
this.removeInput("lat");
this.removeInput("lng");
this.removeInput("altitude");
this.removeInput("timeStamp");
updateShape_(isMobile) {
if (isMobile) {
if (this.getInput("lat") == null) {
this.appendValueInput("lat", "Number").appendField(
Blockly.Msg.senseBox_gps_lat,
"gps"
);
this.appendValueInput("lng", "Number").appendField(
Blockly.Msg.senseBox_gps_lng
);
this.appendValueInput("altitude", "Number").appendField(
Blockly.Msg.senseBox_gps_alt
);
this.appendValueInput("timeStamp", "Number").appendField(
Blockly.Msg.senseBox_gps_timeStamp
);
}
} else {
this.removeInput("lat", true);
this.removeInput("lng", true);
this.removeInput("altitude", true);
this.removeInput("timeStamp", true);
}
},
LOOP_TYPES: ["sensebox_interval_timer"],