Browse Source

Limit humidity between 0 and 100, show humidity correction only if there is a humidity magnitude

rfm69
Xose Pérez 6 years ago
parent
commit
ea240f7498
5 changed files with 3178 additions and 3178 deletions
  1. BIN
      code/espurna/data/index.html.gz
  2. +4
    -1
      code/espurna/sensor.ino
  3. +3173
    -3172
      code/espurna/static/index.html.gz.h
  4. +0
    -4
      code/espurna/ws.ino
  5. +1
    -1
      code/html/index.html

BIN
code/espurna/data/index.html.gz View File


+ 4
- 1
code/espurna/sensor.ino View File

@ -72,7 +72,7 @@ double _magnitudeProcess(unsigned char type, double value) {
} }
if (type == MAGNITUDE_HUMIDITY) { if (type == MAGNITUDE_HUMIDITY) {
value = value + _sensor_humidity_correction;
value = constrain(value + _sensor_humidity_correction, 0, 100);
} }
if (type == MAGNITUDE_ENERGY || if (type == MAGNITUDE_ENERGY ||
@ -97,6 +97,7 @@ void _sensorWebSocketSendData(JsonObject& root) {
char buffer[10]; char buffer[10];
bool hasTemperature = false; bool hasTemperature = false;
bool hasHumidity = false;
JsonArray& list = root.createNestedArray("magnitudes"); JsonArray& list = root.createNestedArray("magnitudes");
for (unsigned char i=0; i<_magnitudes.size(); i++) { for (unsigned char i=0; i<_magnitudes.size(); i++) {
@ -114,10 +115,12 @@ void _sensorWebSocketSendData(JsonObject& root) {
element["error"] = magnitude.sensor->error(); element["error"] = magnitude.sensor->error();
if (magnitude.type == MAGNITUDE_TEMPERATURE) hasTemperature = true; if (magnitude.type == MAGNITUDE_TEMPERATURE) hasTemperature = true;
if (magnitude.type == MAGNITUDE_HUMIDITY) hasHumidity = true;
} }
if (hasTemperature) root["temperatureVisible"] = 1; if (hasTemperature) root["temperatureVisible"] = 1;
if (hasHumidity) root["humidityVisible"] = 1;
} }


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


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

@ -272,10 +272,6 @@ void _wsOnStart(JsonObject& root) {
root["btnDelay"] = getSetting("btnDelay", BUTTON_DBLCLICK_DELAY).toInt(); root["btnDelay"] = getSetting("btnDelay", BUTTON_DBLCLICK_DELAY).toInt();
root["webPort"] = getSetting("webPort", WEB_PORT).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; root["wsAuth"] = getSetting("wsAuth", WS_AUTHENTICATION).toInt() == 1;


+ 1
- 1
code/html/index.html View File

@ -1020,7 +1020,7 @@
</div> </div>
</div> </div>
<div class="pure-g module module-temperature">
<div class="pure-g module module-humidity">
<label class="pure-u-1 pure-u-lg-1-4">Humidity correction</label> <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" /> <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-2"></div>


Loading…
Cancel
Save