add restart to osem block

This commit is contained in:
Mario Pesch
2022-02-16 20:01:22 +01:00
parent 321cba25ba
commit 772797bb6b
5 changed files with 56 additions and 34 deletions
@@ -33,6 +33,7 @@ Blockly.Arduino.sensebox_osem_connection = function (Block) {
var blocks = this.getDescendants();
var type = this.getFieldValue("type");
var ssl = this.getFieldValue("SSL");
var restart = this.getFieldValue("RESTART");
var port = 0;
var count = 0;
if (blocks !== undefined) {
@@ -186,6 +187,12 @@ ${
}
delay(1000);
}
${
restart === "TRUE"
? "if (connected == false) {\n delay(5000);\n noInterrupts();\n NVIC_SystemReset();\n while (1)\n ;\n }"
: ""
}
}`;
var code = "";
@@ -271,12 +278,20 @@ ${
client.stop();
break;
}
delay(1000);
}
num_measurements = 0;
break;
}
}
${
restart === "TRUE"
? "if (connected == false) {\n delay(5000);\n noInterrupts();\n NVIC_SystemReset();\n while (1)\n ;\n }"
: ""
}
}`;
code = "";
code += branch;
@@ -35,6 +35,7 @@ Blockly.Arduino.sensebox_sensor_uv_light = function () {
}
if (dropdown_name === "Illuminance") {
Blockly.Arduino.libraries_["library_ltr329"] = `#include <LTR329.h>`;
Blockly.Arduino.libraries_["library_wire"] = "#include <Wire.h>";
Blockly.Arduino.codeFunctions_["read_reg"] = `
int read_reg(byte address, uint8_t reg)
{