Skip to content

Commit

Permalink
sensor: streamline correction settings (#2265)
Browse files Browse the repository at this point in the history
* wip

* template common operation

* more

* ui

* fix naming issues

* remove old constraints

* oops

* dummy sensor

* rearrange bmx280 magnitudes
  • Loading branch information
mcspr authored May 31, 2020
1 parent cb8443d commit d9cb35f
Show file tree
Hide file tree
Showing 27 changed files with 20,268 additions and 19,925 deletions.
31 changes: 19 additions & 12 deletions code/espurna/config/sensors.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,10 @@
#define SENSOR_POWER_CHECK_STATUS 1 // If set to 1 the reported power/current/energy will be 0 if the relay[0] is OFF
#endif

#ifndef SENSOR_TEMPERATURE_CORRECTION
#define SENSOR_TEMPERATURE_CORRECTION 0.0 // Offset correction
#endif

#ifndef TEMPERATURE_MIN_CHANGE
#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.0 // Minimum humidity change to report
#endif
Expand Down Expand Up @@ -89,6 +81,25 @@
#define SENSOR_POWER_UNITS POWER_WATTS // Power units (POWER_WATTS | POWER_KILOWATTS)
#endif

// -----------------------------------------------------------------------------
// Magnitude offset correction
// -----------------------------------------------------------------------------

#ifndef SENSOR_TEMPERATURE_CORRECTION
#define SENSOR_TEMPERATURE_CORRECTION 0.0
#endif

#ifndef SENSOR_HUMIDITY_CORRECTION
#define SENSOR_HUMIDITY_CORRECTION 0.0
#endif

#ifndef SENSOR_PRESSURE_CORRECTION
#define SENSOR_PRESSURE_CORRECTION 0.0
#endif

#ifndef SENSOR_LUX_CORRECTION
#define SENSOR_LUX_CORRECTION 0.0
#endif

// =============================================================================
// Specific data for each sensor
Expand Down Expand Up @@ -771,10 +782,6 @@
// Enable support by passing LDR_SUPPORT=1 build flag
//------------------------------------------------------------------------------

#ifndef SENSOR_LUX_CORRECTION
#define SENSOR_LUX_CORRECTION 0.0 // Offset correction
#endif

#ifndef LDR_SUPPORT
#define LDR_SUPPORT 0
#endif
Expand Down
3 changes: 3 additions & 0 deletions code/espurna/config/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,9 @@
#define SENSOR_ERROR_GPIO_USED 7 // The GPIO is already in use
#define SENSOR_ERROR_CALIBRATION 8 // Calibration error or Not calibrated
#define SENSOR_ERROR_OTHER 99 // Any other error

#define SENSOR_ERROR_MAX 9

//------------------------------------------------------------------------------
// Telnet server
//------------------------------------------------------------------------------
Expand Down
Binary file modified code/espurna/data/index.all.html.gz
Binary file not shown.
Binary file modified code/espurna/data/index.curtain.html.gz
Binary file not shown.
Binary file modified code/espurna/data/index.light.html.gz
Binary file not shown.
Binary file modified code/espurna/data/index.lightfox.html.gz
Binary file not shown.
Binary file modified code/espurna/data/index.rfbridge.html.gz
Binary file not shown.
Binary file modified code/espurna/data/index.rfm69.html.gz
Binary file not shown.
Binary file modified code/espurna/data/index.sensor.html.gz
Binary file not shown.
Binary file modified code/espurna/data/index.small.html.gz
Binary file not shown.
Binary file modified code/espurna/data/index.thermostat.html.gz
Binary file not shown.
1 change: 1 addition & 0 deletions code/espurna/relay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,7 @@ void _relayWebSocketUpdate(JsonObject& root) {
JsonArray& status = state.createNestedArray("status");
JsonArray& lock = state.createNestedArray("lock");

// Note: we use byte instead of bool to ever so slightly compress json output
for (unsigned char i=0; i<relayCount(); i++) {
status.add<uint8_t>(_relays[i].target_status);
lock.add(_relays[i].lock);
Expand Down
Loading

0 comments on commit d9cb35f

Please sign in to comment.