Browse Source

Added snsDelta support

v2
Xose Pérez 6 years ago
parent
commit
56127b879f
3 changed files with 10 additions and 16 deletions
  1. +2
    -12
      code/espurna/config/hardware.h
  2. +2
    -0
      code/espurna/hardware.ino
  3. +6
    -4
      code/espurna/sensor.ino

+ 2
- 12
code/espurna/config/hardware.h View File

@ -223,7 +223,8 @@ enum boards {
#elif \
defined(GENERIC_ESP01S_DHT11_V10) || \
defined(GENERIC_ESP01S_DS18B20_V10) || \
defined(ITEAD_SONOFF_TH)
defined(ITEAD_SONOFF_TH) || \
defined(MANCAVEMADE_ESPLIVE)
#define ESPURNA_IMAGE ESPURNA_SENSOR
@ -287,17 +288,6 @@ enum boards {
// -----------------------------------------------------------------------------
#elif defined(MANCAVEMADE_ESPLIVE)
#define ESPURNA_IMAGE ESPURNA_SENSOR
// DS18B20
#define DALLAS_PIN 2
#define DALLAS_UPDATE_INTERVAL 5000
#define TEMPERATURE_MIN_CHANGE 1.0
// -----------------------------------------------------------------------------
#elif defined(PILOTAK_ESP_DIN_V1)
#define ESPURNA_IMAGE ESPURNA_SENSOR


+ 2
- 0
code/espurna/hardware.ino View File

@ -832,6 +832,8 @@ void _hardwareLoad() {
setSetting("dsEnabled", 1);
setSetting("dsGPIO", 0, 2);
setSetting("snsDelta", MAGNITUDE_TEMPERATURE, 1.0); // Temperature min change to report
#elif defined(INTERMITTECH_QUINLED)
// QuinLED


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

@ -24,9 +24,9 @@ typedef struct {
unsigned char local; // Local index in its provider
unsigned char type; // Type of measurement
unsigned char global; // Global index in its type
double current; // Current (last) value, unfiltered
double filtered; // Filtered (averaged) value
double reported; // Last reported value
double current; // Lat raw value (unfiltered)
double filtered; // Last filtered value (averaged)
double reported; // Last reported value (averaged)
double min_change; // Minimum value change to report
} sensor_magnitude_t;
@ -849,7 +849,9 @@ void _sensorConfigure() {
// Update filter sizes
for (unsigned char i=0; i<_magnitudes.size(); i++) {
_magnitudes[i].filter->resize(_sensor_report_every);
sensor_magnitude_t magnitude = _magnitudes[i];
_magnitude.filter->resize(_sensor_report_every);
_magnitude.min_change = getSetting("tmpDelta", magnitude.type, 0).toFloat();
}
// Save settings


Loading…
Cancel
Save