Browse Source

Merge pull request #632 from ManuelW77/master

Humidity correction
rfm69
Xose Pérez 6 years ago
committed by GitHub
parent
commit
f056fc026c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 2800 additions and 2770 deletions
  1. +4
    -0
      code/espurna/config/sensors.h
  2. +8
    -0
      code/espurna/sensor.ino
  3. +2772
    -2770
      code/espurna/static/index.html.gz.h
  4. +6
    -0
      code/espurna/ws.ino
  5. +10
    -0
      code/html/index.html

+ 4
- 0
code/espurna/config/sensors.h View File

@ -24,6 +24,10 @@
#define TEMPERATURE_MIN_CHANGE 0.0 // Minimum temperature change to report
#endif
#ifndef SENSOR_HUMIDITY_CORRECTION
#define SENSOR_HUMIDITY_CORRECTION 0.0 // Offset correction
#endif
#ifndef HUMIDITY_MIN_CHANGE
#define HUMIDITY_MIN_CHANGE 0 // Minimum humidity change to report
#endif


+ 8
- 0
code/espurna/sensor.ino View File

@ -38,6 +38,7 @@ unsigned char _sensor_power_units = SENSOR_POWER_UNITS;
unsigned char _sensor_energy_units = SENSOR_ENERGY_UNITS;
unsigned char _sensor_temperature_units = SENSOR_TEMPERATURE_UNITS;
double _sensor_temperature_correction = SENSOR_TEMPERATURE_CORRECTION;
double _sensor_humidity_correction = SENSOR_HUMIDITY_CORRECTION;
// -----------------------------------------------------------------------------
// Private
@ -69,6 +70,11 @@ double _magnitudeProcess(unsigned char type, double value) {
if (_sensor_temperature_units == TMP_FAHRENHEIT) value = value * 1.8 + 32;
value = value + _sensor_temperature_correction;
}
if (type == MAGNITUDE_HUMIDITY) {
value = value + _sensor_humidity_correction;
}
if (type == MAGNITUDE_ENERGY ||
type == MAGNITUDE_ENERGY_DELTA) {
if (_sensor_energy_units == ENERGY_KWH) value = value / 3600000;
@ -163,6 +169,7 @@ void _sensorWebSocketStart(JsonObject& root) {
root["energyUnits"] = _sensor_energy_units;
root["tmpUnits"] = _sensor_temperature_units;
root["tmpCorrection"] = _sensor_temperature_correction;
root["humCorrection"] = _sensor_humidity_correction;
root["snsRead"] = _sensor_read_interval / 1000;
root["snsReport"] = _sensor_report_every;
}
@ -602,6 +609,7 @@ void _sensorConfigure() {
_sensor_energy_units = getSetting("energyUnits", SENSOR_ENERGY_UNITS).toInt();
_sensor_temperature_units = getSetting("tmpUnits", SENSOR_TEMPERATURE_UNITS).toInt();
_sensor_temperature_correction = getSetting("tmpCorrection", SENSOR_TEMPERATURE_CORRECTION).toFloat();
_sensor_humidity_correction = getSetting("humCorrection", SENSOR_HUMIDITY_CORRECTION).toFloat();
// Update filter sizes
for (unsigned char i=0; i<_magnitudes.size(); i++) {


+ 2772
- 2770
code/espurna/static/index.html.gz.h
File diff suppressed because it is too large
View File


+ 6
- 0
code/espurna/ws.ino View File

@ -271,8 +271,14 @@ void _wsOnStart(JsonObject& root) {
root["btnDelay"] = getSetting("btnDelay", BUTTON_DBLCLICK_DELAY).toInt();
root["webPort"] = getSetting("webPort", WEB_PORT).toInt();
root["tmpUnits"] = getSetting("tmpUnits", SENSOR_TEMPERATURE_UNITS).toInt();
root["tmpCorrection"] = getSetting("tmpCorrection", SENSOR_TEMPERATURE_CORRECTION).toFloat();
root["humCorrection"] = getSetting("humCorrection", SENSOR_HUMIDITY_CORRECTION).toFloat();
root["wsAuth"] = getSetting("wsAuth", WS_AUTHENTICATION).toInt() == 1;
}
}


+ 10
- 0
code/html/index.html View File

@ -1020,6 +1020,16 @@
</div>
</div>
<div class="pure-g module module-temperature">
<label class="pure-u-1 pure-u-lg-1-4">Humidity correction</label>
<input name="humCorrection" class="pure-u-1 pure-u-lg-1-4" type="number" action="reboot" min="-100" step="0.1" max="100" tabindex="18" />
<div class="pure-u-0 pure-u-lg-1-2"></div>
<div class="pure-u-0 pure-u-lg-1-4"></div>
<div class="pure-u-1 pure-u-lg-3-4 hint">
Humidity correction value is added to the measured value which may be inaccurate due to many factors. The value can be negative.
</div>
</div>
<legend class="module module-hlw module-emon">Energy monitor</legend>
<div class="pure-g module module-emon">


Loading…
Cancel
Save