Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add-rainsensor #195

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions src/components/Blockly/blocks/sensebox-sensors.js
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,40 @@ Blockly.Blocks["sensebox_soundsensor_dfrobot"] = {
},
};



/**
* rainsensor hydreon rg-15
*/

Blockly.Blocks["sensebox_rainsensor_hydreon_rg15"] = {
init: function () {
var dropdownOptionsPorts = [
[Blockly.Msg.sensebox_rainsensor_hydreon_rg15_serial1, "Serial1"],
[Blockly.Msg.sensebox_rainsensor_hydreon_rg15_serial2, "Serial2"],
];
var dropdownOptionsValues = [
[Blockly.Msg.sensebox_rainsensor_hydreon_rg15_acc, "getAccumulation"],
[Blockly.Msg.sensebox_rainsensor_hydreon_rg15_totalAcc, "getTotalAccumulation"],
[Blockly.Msg.sensebox_rainsensor_hydreon_rg15_eventAcc, "getEventAccumulation"],
[Blockly.Msg.sensebox_rainsensor_hydreon_rg15_rainInt, "getRainfallIntensity"],
];
this.setColour(getColour().sensebox);
this.appendDummyInput()
.appendField(Blockly.Msg.sensebox_rainsensor_hydreon_rg15);
this.appendDummyInput()
.appendField(Blockly.Msg.sensebox_rainsensor_hydreon_rg15_port)
.appendField(new Blockly.FieldDropdown(dropdownOptionsPorts), "SERIAL");
this.appendDummyInput()
.appendField(Blockly.Msg.sensebox_rainsensor_hydreon_rg15_value)
.appendField(new Blockly.FieldDropdown(dropdownOptionsValues), "VALUE");
this.setOutput(true, Types.DECIMAL.typeName);
this.setTooltip(Blockly.Msg.sensebox_rainsensor_hydreon_rg15_tooltip);
this.setHelpUrl(Blockly.Msg.sensebox_rainsensor_hydreon_rg15_helpurl);
},
};


/**
* Infineon DPS310 Pressure Sensor
*
Expand Down
17 changes: 17 additions & 0 deletions src/components/Blockly/generator/sensebox-sensors.js
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,23 @@ float getSoundValue(){
return [code, Blockly.Arduino.ORDER_ATOMIC];
};

/**
* rainsensor hydreon rg-15
*/

Blockly.Arduino.sensebox_rainsensor_hydreon_rg15 = function () {
var port = this.getFieldValue("SERIAL");
var value = this.getFieldValue("VALUE");
Blockly.Arduino.libraries_["library_senseBoxIO"] = "#include <senseBoxIO.h>";
Blockly.Arduino.libraries_["library_rainsensor_rg15"] = "#include <hydreon.h>";
Blockly.Arduino.definitions_["def_rainsensor_rg15_" + port] = "HYDREON rainsensor_" + port + "(" + port + ");";
Blockly.Arduino.setupCode_["setup_rainsensor_rg15_" + port] = "rainsensor_" + port + ".begin();";
Blockly.Arduino.loopCodeOnce_["loop_rainsensor_rg15_" + port] = "rainsensor_" + port + ".readAllData();"

var code = "rainsensor_" + port + "." + value + "()";
return [code, Blockly.Arduino.ORDER_ATOMIC];
};

/**
* Infineon DPS310 Pressure Sensor
*
Expand Down
19 changes: 17 additions & 2 deletions src/components/Blockly/msg/de/sensebox-sensors.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,25 @@ Wenn die maximale Distanz überschritten wird, wird ein Wert von **O** ausgegebe
"Schließe den Sensor an einen der 3 **digital/analog Ports** an. Der Sensor gibt dir den Messwert in dB mit einer Nachkommastelle",
senseBox_soundsensor_dfrobot_helpurl:
"https://docs.sensebox.de/hardware/sensoren-lautstaerke/",

/*
* BME680
*/
* rainsensor hydreon rg-15
*/
sensebox_rainsensor_hydreon_rg15: "Regensensor (RG-15)",
sensebox_rainsensor_hydreon_rg15_port: "Serieller Port:",
sensebox_rainsensor_hydreon_rg15_serial1: "Serial1",
sensebox_rainsensor_hydreon_rg15_serial2: "Serial2",
sensebox_rainsensor_hydreon_rg15_value: "Messwert:",
sensebox_rainsensor_hydreon_rg15_totalAcc: "gesamter Niederschlag in mm",
sensebox_rainsensor_hydreon_rg15_rainInt: "Niederschlagsintensität in mm/h",
sensebox_rainsensor_hydreon_rg15_eventAcc: "Niederschlag pro Event in mm",
sensebox_rainsensor_hydreon_rg15_acc: "Niederschlag seit letzter Messung in mm",
sensebox_rainsensor_hydreon_rg15_tooltip: "Regensensor (RG-15) an einen der Seriellen Ports anschließen.",
sensebox_rainsensor_hydreon_rg15_helpurl: "https://rainsensors.com/products/rg-15/",

/*
* BME680
*/
senseBox_bme680: "Umweltsensor (BME680)",
senseBox_bme_iaq: "Innenraumluftqualität (IAQ)",
senseBox_bme_iaq_accuracy: "Kalibrierungswert",
Expand Down
15 changes: 15 additions & 0 deletions src/components/Blockly/msg/en/sensebox-sensors.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,21 @@ If the max distance is reached the a value of **O** will be returned`,
senseBox_soundsensor_dfrobot_helpurl:
"https://en.docs.sensebox.de/hardware/sensoren-lautstaerke/",

/*
* rainsensor hydreon rg-15
*/
sensebox_rainsensor_hydreon_rg15: "Rainsensor (RG-15)",
sensebox_rainsensor_hydreon_rg15_port: "Serial Port:",
sensebox_rainsensor_hydreon_rg15_serial1: "Serial1",
sensebox_rainsensor_hydreon_rg15_serial2: "Serial2",
sensebox_rainsensor_hydreon_rg15_value: "value:",
sensebox_rainsensor_hydreon_rg15_totalAcc: "total Accumulation in mm",
sensebox_rainsensor_hydreon_rg15_rainInt: "Rainfall Intensity in mm/h",
sensebox_rainsensor_hydreon_rg15_eventAcc: "Accumulation per Event in mm",
sensebox_rainsensor_hydreon_rg15_acc: "Accumulation since last loop in mm",
sensebox_rainsensor_hydreon_rg15_tooltip: "Connect Rainsensor (RG-15) to one of the Serial ports.",
sensebox_rainsensor_hydreon_rg15_helpurl: "https://rainsensors.com/products/rg-15/",

/*
* BME680
*/
Expand Down
1 change: 1 addition & 0 deletions src/components/Blockly/toolbox/Toolbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class Toolbox extends React.Component {
<Block type="sensebox_sensor_watertemperature" />
{/* <Block type="sensebox_windspeed" /> */}
<Block type="sensebox_soundsensor_dfrobot" />
<Block type="sensebox_rainsensor_hydreon_rg15" />
<Block type="sensebox_multiplexer_init">
<Value name="nrChannels">
<Block type="math_number">
Expand Down