Browse Source

Option to disable completely new sensors module

fastled
Xose Pérez 7 years ago
parent
commit
e1baf48b9b
23 changed files with 151 additions and 79 deletions
  1. +31
    -31
      code/espurna/config/sensors.h
  2. +9
    -16
      code/espurna/domoticz.ino
  3. +9
    -10
      code/espurna/espurna.ino
  4. +10
    -6
      code/espurna/sensor.ino
  5. +5
    -1
      code/espurna/sensors/AnalogSensor.h
  6. +5
    -1
      code/espurna/sensors/BMX280Sensor.h
  7. +5
    -1
      code/espurna/sensors/BaseSensor.h
  8. +5
    -1
      code/espurna/sensors/DHTSensor.h
  9. +5
    -1
      code/espurna/sensors/DallasSensor.h
  10. +5
    -1
      code/espurna/sensors/DigitalSensor.h
  11. +5
    -1
      code/espurna/sensors/ECH1560Sensor.h
  12. +4
    -0
      code/espurna/sensors/EmonADC121Sensor.h
  13. +5
    -1
      code/espurna/sensors/EmonADS1X15Sensor.h
  14. +5
    -1
      code/espurna/sensors/EmonAnalogSensor.h
  15. +4
    -0
      code/espurna/sensors/EmonSensor.h
  16. +5
    -1
      code/espurna/sensors/EventSensor.h
  17. +5
    -1
      code/espurna/sensors/HLW8012Sensor.h
  18. +4
    -0
      code/espurna/sensors/I2CSensor.h
  19. +5
    -1
      code/espurna/sensors/MHZ19Sensor.h
  20. +5
    -1
      code/espurna/sensors/PMSX003Sensor.h
  21. +5
    -1
      code/espurna/sensors/SHT3XI2CSensor.h
  22. +5
    -1
      code/espurna/sensors/SI7021Sensor.h
  23. +5
    -1
      code/espurna/sensors/V9261FSensor.h

+ 31
- 31
code/espurna/config/sensors.h View File

@ -2,6 +2,7 @@
// SENSORS - General data
// =============================================================================
#define SENSOR_SUPPORT 0 // Sensor support
#define SENSOR_DEBUG 0 // Debug sensors
#define SENSOR_READ_INTERVAL 6 // Read data from sensors every 6 seconds
@ -40,36 +41,29 @@
// Magnitudes
//--------------------------------------------------------------------------------
typedef enum magnitude_t {
MAGNITUDE_NONE = 0,
MAGNITUDE_TEMPERATURE,
MAGNITUDE_HUMIDITY,
MAGNITUDE_PRESSURE,
MAGNITUDE_CURRENT,
MAGNITUDE_VOLTAGE,
MAGNITUDE_POWER_ACTIVE,
MAGNITUDE_POWER_APPARENT,
MAGNITUDE_POWER_REACTIVE,
MAGNITUDE_ENERGY,
MAGNITUDE_ENERGY_DELTA,
MAGNITUDE_POWER_FACTOR,
MAGNITUDE_ANALOG,
MAGNITUDE_DIGITAL,
MAGNITUDE_EVENTS,
MAGNITUDE_PM1dot0,
MAGNITUDE_PM2dot5,
MAGNITUDE_PM10,
MAGNITUDE_CO2,
MAGNITUDE_MAX,
} magnitude_t;
#define MAGNITUDE_NONE 0
#define MAGNITUDE_TEMPERATURE 1
#define MAGNITUDE_HUMIDITY 2
#define MAGNITUDE_PRESSURE 3
#define MAGNITUDE_CURRENT 4
#define MAGNITUDE_VOLTAGE 5
#define MAGNITUDE_POWER_ACTIVE 6
#define MAGNITUDE_POWER_APPARENT 7
#define MAGNITUDE_POWER_REACTIVE 8
#define MAGNITUDE_ENERGY 9
#define MAGNITUDE_ENERGY_DELTA 10
#define MAGNITUDE_POWER_FACTOR 11
#define MAGNITUDE_ANALOG 12
#define MAGNITUDE_DIGITAL 13
#define MAGNITUDE_EVENTS 14
#define MAGNITUDE_PM1dot0 15
#define MAGNITUDE_PM2dot5 16
#define MAGNITUDE_PM10 17
#define MAGNITUDE_CO2 18
#define MAGNITUDE_MAX 19
#if SENSOR_SUPPORT
PROGMEM const unsigned char magnitude_decimals[] = {
0,
@ -132,6 +126,8 @@ PROGMEM const char* const magnitude_units[] = {
magnitude_ppm
};
#endif // SENSOR_SUPPORT
//--------------------------------------------------------------------------------
// Sensor ID
// These should remain over time, do not modify them, only add new ones at the end
@ -178,7 +174,7 @@ PROGMEM const char* const magnitude_units[] = {
//------------------------------------------------------------------------------
#ifndef BMX280_SUPPORT
#define BMX280_SUPPORT 1
#define BMX280_SUPPORT 0
#endif
#ifndef BMX280_ADDRESS
@ -513,6 +509,8 @@ PROGMEM const char* const magnitude_units[] = {
// Class loading
//--------------------------------------------------------------------------------
#if SENSOR_SUPPORT
#include "../sensors/BaseSensor.h"
#if ANALOG_SUPPORT
@ -585,3 +583,5 @@ PROGMEM const char* const magnitude_units[] = {
#include <SoftwareSerial.h>
#include "../sensors/V9261FSensor.h"
#endif
#endif // SENSOR_SUPPORT

+ 9
- 16
code/espurna/domoticz.ino View File

@ -91,22 +91,15 @@ void _domoticzWebSocketOnSend(JsonObject& root) {
relays.add(domoticzIdx(i));
}
JsonArray& list = root.createNestedArray("dczMagnitudes");
for (byte i=0; i<magnitudeCount(); i++) {
JsonObject& element = list.createNestedObject();
element["name"] = magnitudeName(i);
element["type"] = magnitudeType(i);
element["index"] = magnitudeIndex(i);
element["idx"] = getSetting("dczMagnitude", i, 0).toInt();
}
#if POWER_PROVIDER != POWER_PROVIDER_NONE
root["dczPowIdx"] = getSetting("dczPowIdx").toInt();
root["dczEnergyIdx"] = getSetting("dczEnergyIdx").toInt();
root["dczCurrentIdx"] = getSetting("dczCurrentIdx").toInt();
#if POWER_HAS_ACTIVE
root["dczVoltIdx"] = getSetting("dczVoltIdx").toInt();
#endif
#if SENSOR_SUPPORT
JsonArray& list = root.createNestedArray("dczMagnitudes");
for (byte i=0; i<magnitudeCount(); i++) {
JsonObject& element = list.createNestedObject();
element["name"] = magnitudeName(i);
element["type"] = magnitudeType(i);
element["index"] = magnitudeIndex(i);
element["idx"] = getSetting("dczMagnitude", i, 0).toInt();
}
#endif
}


+ 9
- 10
code/espurna/espurna.ino View File

@ -185,6 +185,9 @@ void welcome() {
#if RF_SUPPORT
DEBUG_MSG_P(PSTR(" RF"));
#endif
#if SENSOR_SUPPORT
DEBUG_MSG_P(PSTR(" SENSOR"));
#endif
#if SPIFFS_SUPPORT
DEBUG_MSG_P(PSTR(" SPIFFS"));
#endif
@ -352,9 +355,6 @@ void setup() {
#ifdef ITEAD_SONOFF_RFBRIDGE
rfbSetup();
#endif
#if POWER_PROVIDER != POWER_PROVIDER_NONE
powerSetup();
#endif
#if ALEXA_SUPPORT
alexaSetup();
#endif
@ -376,8 +376,9 @@ void setup() {
#if HOMEASSISTANT_SUPPORT
haSetup();
#endif
sensorSetup();
#if SENSOR_SUPPORT
sensorSetup();
#endif
// Prepare configuration for version 2.0
migrate();
@ -412,9 +413,6 @@ void loop() {
#ifdef ITEAD_SONOFF_RFBRIDGE
rfbLoop();
#endif
#if POWER_PROVIDER != POWER_PROVIDER_NONE
powerLoop();
#endif
#if SSDP_SUPPORT
ssdpLoop();
#endif
@ -433,8 +431,9 @@ void loop() {
#if IR_SUPPORT
irLoop();
#endif
sensorLoop();
#if SENSOR_SUPPORT
sensorLoop();
#endif
// Power saving delay
delay(_loopDelay);


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

@ -6,6 +6,8 @@ Copyright (C) 2016-2017 by Xose Pérez <xose dot perez at gmail dot com>
*/
#if SENSOR_SUPPORT
#include <vector>
#include "filters/MaxFilter.h"
#include "filters/MedianFilter.h"
@ -15,7 +17,7 @@ Copyright (C) 2016-2017 by Xose Pérez <xose dot perez at gmail dot com>
typedef struct {
BaseSensor * sensor;
unsigned char local; // Local index in its provider
magnitude_t type; // Type of measurement
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
@ -38,18 +40,18 @@ double _sensor_temperature_correction = SENSOR_TEMPERATURE_CORRECTION;
// Private
// -----------------------------------------------------------------------------
String _magnitudeTopic(magnitude_t type) {
String _magnitudeTopic(unsigned char type) {
char buffer[16] = {0};
if (type < MAGNITUDE_MAX) strncpy_P(buffer, magnitude_topics[type], sizeof(buffer));
return String(buffer);
}
unsigned char _magnitudeDecimals(magnitude_t type) {
unsigned char _magnitudeDecimals(unsigned char type) {
if (type < MAGNITUDE_MAX) return pgm_read_byte(magnitude_decimals + type);
return 0;
}
String _magnitudeUnits(magnitude_t type) {
String _magnitudeUnits(unsigned char type) {
char buffer[8] = {0};
if (type < MAGNITUDE_MAX) {
if ((type == MAGNITUDE_TEMPERATURE) && (_sensor_temperature_units == TMP_FAHRENHEIT)) {
@ -61,7 +63,7 @@ String _magnitudeUnits(magnitude_t type) {
return String(buffer);
}
double _magnitudeProcess(magnitude_t type, double value) {
double _magnitudeProcess(unsigned char type, double value) {
if (type == MAGNITUDE_TEMPERATURE) {
if (_sensor_temperature_units == TMP_FAHRENHEIT) value = value * 1.8 + 32;
value = value + _sensor_temperature_correction;
@ -457,7 +459,7 @@ void _magnitudesInit() {
for (unsigned char k=0; k<sensor->count(); k++) {
magnitude_t type = sensor->type(k);
unsigned char type = sensor->type(k);
sensor_magnitude_t new_magnitude;
new_magnitude.sensor = sensor;
@ -671,3 +673,5 @@ void sensorLoop() {
}
}
#endif // SENSOR_SUPPORT

+ 5
- 1
code/espurna/sensors/AnalogSensor.h View File

@ -3,6 +3,8 @@
// Copyright (C) 2017 by Xose Pérez <xose dot perez at gmail dot com>
// -----------------------------------------------------------------------------
#if SENSOR_SUPPORT && ANALOG_SUPPORT
#pragma once
#include "Arduino.h"
@ -36,7 +38,7 @@ class AnalogSensor : public BaseSensor {
}
// Type for slot # index
magnitude_t type(unsigned char index) {
unsigned char type(unsigned char index) {
_error = SENSOR_ERROR_OK;
if (index == 0) return MAGNITUDE_ANALOG;
_error = SENSOR_ERROR_OUT_OF_RANGE;
@ -53,3 +55,5 @@ class AnalogSensor : public BaseSensor {
};
#endif // SENSOR_SUPPORT && ANALOG_SUPPORT

+ 5
- 1
code/espurna/sensors/BMX280Sensor.h View File

@ -4,6 +4,8 @@
// Copyright (C) 2017 by Xose Pérez <xose dot perez at gmail dot com>
// -----------------------------------------------------------------------------
#if SENSOR_SUPPORT && BMX280_SUPPORT
#pragma once
#include "Arduino.h"
@ -60,7 +62,7 @@ class BMX280Sensor : public I2CSensor {
}
// Type for slot # index
magnitude_t type(unsigned char index) {
unsigned char type(unsigned char index) {
if (index < _count) {
_error = SENSOR_ERROR_OK;
unsigned char i = 0;
@ -245,3 +247,5 @@ class BMX280Sensor : public I2CSensor {
// Static inizializations
unsigned char BMX280Sensor::addresses[2] = {0x76, 0x77};
// SENSOR_SUPPORT && BMX280_SUPPORT

+ 5
- 1
code/espurna/sensors/BaseSensor.h View File

@ -3,6 +3,8 @@
// Copyright (C) 2017 by Xose Pérez <xose dot perez at gmail dot com>
// -----------------------------------------------------------------------------
#if SENSOR_SUPPORT
#pragma once
#include <Arduino.h>
@ -45,7 +47,7 @@ class BaseSensor {
virtual String description() {}
// Type for slot # index
virtual magnitude_t type(unsigned char index) {}
virtual unsigned char type(unsigned char index) {}
// Current value for slot # index
virtual double value(unsigned char index) {}
@ -82,3 +84,5 @@ class BaseSensor {
unsigned char _count = 0;
};
#endif

+ 5
- 1
code/espurna/sensors/DHTSensor.h View File

@ -3,6 +3,8 @@
// Copyright (C) 2017 by Xose Pérez <xose dot perez at gmail dot com>
// -----------------------------------------------------------------------------
#if SENSOR_SUPPORT && DHT_SUPPORT
#pragma once
#include "Arduino.h"
@ -89,7 +91,7 @@ class DHTSensor : public BaseSensor {
}
// Type for slot # index
magnitude_t type(unsigned char index) {
unsigned char type(unsigned char index) {
_error = SENSOR_ERROR_OK;
if (index == 0) return MAGNITUDE_TEMPERATURE;
if (index == 1) return MAGNITUDE_HUMIDITY;
@ -226,3 +228,5 @@ class DHTSensor : public BaseSensor {
unsigned int _humidity;
};
#endif // SENSOR_SUPPORT && DHT_SUPPORT

+ 5
- 1
code/espurna/sensors/DallasSensor.h View File

@ -4,6 +4,8 @@
// Copyright (C) 2017 by Xose Pérez <xose dot perez at gmail dot com>
// -----------------------------------------------------------------------------
#if SENSOR_SUPPORT && DALLAS_SUPPORT
#pragma once
#include "Arduino.h"
@ -187,7 +189,7 @@ class DallasSensor : public BaseSensor {
}
// Type for slot # index
magnitude_t type(unsigned char index) {
unsigned char type(unsigned char index) {
_error = SENSOR_ERROR_OK;
if (index < _count) return MAGNITUDE_TEMPERATURE;
_error = SENSOR_ERROR_OUT_OF_RANGE;
@ -301,3 +303,5 @@ class DallasSensor : public BaseSensor {
OneWire * _wire = NULL;
};
#endif // SENSOR_SUPPORT && DALLAS_SUPPORT

+ 5
- 1
code/espurna/sensors/DigitalSensor.h View File

@ -3,6 +3,8 @@
// Copyright (C) 2017 by Xose Pérez <xose dot perez at gmail dot com>
// -----------------------------------------------------------------------------
#if SENSOR_SUPPORT && DIGITAL_SUPPORT
#pragma once
#include "Arduino.h"
@ -66,7 +68,7 @@ class DigitalSensor : public BaseSensor {
}
// Type for slot # index
magnitude_t type(unsigned char index) {
unsigned char type(unsigned char index) {
_error = SENSOR_ERROR_OK;
if (index == 0) return MAGNITUDE_DIGITAL;
_error = SENSOR_ERROR_OUT_OF_RANGE;
@ -93,3 +95,5 @@ class DigitalSensor : public BaseSensor {
bool _default = false;
};
#endif // SENSOR_SUPPORT && DIGITAL_SUPPORT

+ 5
- 1
code/espurna/sensors/ECH1560Sensor.h View File

@ -3,6 +3,8 @@
// Copyright (C) 2017 by Xose Pérez <xose dot perez at gmail dot com>
// -----------------------------------------------------------------------------
#if SENSOR_SUPPORT && ECH1560_SUPPORT
#pragma once
#include "Arduino.h"
@ -81,7 +83,7 @@ class ECH1560Sensor : public BaseSensor {
}
// Type for slot # index
magnitude_t type(unsigned char index) {
unsigned char type(unsigned char index) {
_error = SENSOR_ERROR_OK;
if (index == 0) return MAGNITUDE_CURRENT;
if (index == 1) return MAGNITUDE_VOLTAGE;
@ -324,3 +326,5 @@ void ECH1560Sensor::_detach(unsigned char gpio) {
_ech1560_sensor_instance[index] = NULL;
}
}
#endif // SENSOR_SUPPORT && ECH1560_SUPPORT

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

@ -3,6 +3,8 @@
// Copyright (C) 2017 by Xose Pérez <xose dot perez at gmail dot com>
// -----------------------------------------------------------------------------
#if SENSOR_SUPPORT && EMON_ADC121_SUPPORT
#pragma once
#include "Arduino.h"
@ -139,3 +141,5 @@ class EmonADC121Sensor : public EmonAnalogSensor {
}
};
#endif // SENSOR_SUPPORT && EMON_ADC121_SUPPORT

+ 5
- 1
code/espurna/sensors/EmonADS1X15Sensor.h View File

@ -3,6 +3,8 @@
// Copyright (C) 2017 by Xose Pérez <xose dot perez at gmail dot com>
// -----------------------------------------------------------------------------
#if SENSOR_SUPPORT && EMON_ADS1X15_SUPPORT
#pragma once
#include "Arduino.h"
@ -202,7 +204,7 @@ class EmonADS1X15Sensor : public EmonSensor {
}
// Type for slot # index
magnitude_t type(unsigned char index) {
unsigned char type(unsigned char index) {
if (index < _count) {
_error = SENSOR_ERROR_OK;
unsigned char magnitude = index / _ports;
@ -392,3 +394,5 @@ class EmonADS1X15Sensor : public EmonSensor {
};
#endif // SENSOR_SUPPORT && EMON_ADS1X15_SUPPORT

+ 5
- 1
code/espurna/sensors/EmonAnalogSensor.h View File

@ -3,6 +3,8 @@
// Copyright (C) 2017 by Xose Pérez <xose dot perez at gmail dot com>
// -----------------------------------------------------------------------------
#if SENSOR_SUPPORT && EMON_ANALOG_SUPPORT
#pragma once
#include "Arduino.h"
@ -58,7 +60,7 @@ class EmonAnalogSensor : public EmonSensor {
}
// Type for slot # index
magnitude_t type(unsigned char index) {
unsigned char type(unsigned char index) {
_error = SENSOR_ERROR_OK;
unsigned char i=0;
#if EMON_REPORT_CURRENT
@ -119,3 +121,5 @@ class EmonAnalogSensor : public EmonSensor {
}
};
#endif // SENSOR_SUPPORT && EMON_ANALOG_SUPPORT

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

@ -3,6 +3,8 @@
// Copyright (C) 2017 by Xose Pérez <xose dot perez at gmail dot com>
// -----------------------------------------------------------------------------
#if SENSOR_SUPPORT
#pragma once
#include "Arduino.h"
@ -225,3 +227,5 @@ class EmonSensor : public I2CSensor {
};
#endif // SENSOR_SUPPORT

+ 5
- 1
code/espurna/sensors/EventSensor.h View File

@ -3,6 +3,8 @@
// Copyright (C) 2017 by Xose Pérez <xose dot perez at gmail dot com>
// -----------------------------------------------------------------------------
#if SENSOR_SUPPORT && EVENTS_SUPPORT
#pragma once
#include "Arduino.h"
@ -80,7 +82,7 @@ class EventSensor : public BaseSensor {
}
// Type for slot # index
magnitude_t type(unsigned char index) {
unsigned char type(unsigned char index) {
_error = SENSOR_ERROR_OK;
if (index == 0) return MAGNITUDE_EVENTS;
_error = SENSOR_ERROR_OUT_OF_RANGE;
@ -198,3 +200,5 @@ void EventSensor::_detach(unsigned char gpio) {
_event_sensor_instance[index] = NULL;
}
}
#endif // SENSOR_SUPPORT && EVENTS_SUPPORT

+ 5
- 1
code/espurna/sensors/HLW8012Sensor.h View File

@ -3,6 +3,8 @@
// Copyright (C) 2017 by Xose Pérez <xose dot perez at gmail dot com>
// -----------------------------------------------------------------------------
#if SENSOR_SUPPORT && HLW8012_SUPPORT
#pragma once
#include "Arduino.h"
@ -161,7 +163,7 @@ class HLW8012Sensor : public BaseSensor {
}
// Type for slot # index
magnitude_t type(unsigned char index) {
unsigned char type(unsigned char index) {
_error = SENSOR_ERROR_OK;
if (index == 0) return MAGNITUDE_CURRENT;
if (index == 1) return MAGNITUDE_VOLTAGE;
@ -308,3 +310,5 @@ void HLW8012Sensor::_detach(unsigned char gpio) {
_hlw8012_sensor_instance[index] = NULL;
}
}
#endif // SENSOR_SUPPORT && HLW8012_SUPPORT

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

@ -3,6 +3,8 @@
// Copyright (C) 2017 by Xose Pérez <xose dot perez at gmail dot com>
// -----------------------------------------------------------------------------
#if SENSOR_SUPPORT && I2C_SUPPORT
#pragma once
#include "BaseSensor.h"
@ -55,3 +57,5 @@ class I2CSensor : public BaseSensor {
unsigned char _address = 0;
};
#endif // SENSOR_SUPPORT && I2C_SUPPORT

+ 5
- 1
code/espurna/sensors/MHZ19Sensor.h View File

@ -6,6 +6,8 @@
// Copyright (C) 2017 by Xose Pérez <xose dot perez at gmail dot com>
// -----------------------------------------------------------------------------
#if SENSOR_SUPPORT && MHZ19_SUPPORT
#pragma once
#include "Arduino.h"
@ -88,7 +90,7 @@ class MHZ19Sensor : public BaseSensor {
}
// Type for slot # index
magnitude_t type(unsigned char index) {
unsigned char type(unsigned char index) {
_error = SENSOR_ERROR_OK;
if (index == 0) return MAGNITUDE_CO2;
_error = SENSOR_ERROR_OUT_OF_RANGE;
@ -202,3 +204,5 @@ class MHZ19Sensor : public BaseSensor {
SoftwareSerial * _serial = NULL;
};
#endif // SENSOR_SUPPORT && MHZ19_SUPPORT

+ 5
- 1
code/espurna/sensors/PMSX003Sensor.h View File

@ -4,6 +4,8 @@
// Contribution by Òscar Rovira López
// -----------------------------------------------------------------------------
#if SENSOR_SUPPORT && PMSX003_SUPPORT
#pragma once
#include "Arduino.h"
@ -96,7 +98,7 @@ class PMSX003Sensor : public BaseSensor {
}
// Type for slot # index
magnitude_t type(unsigned char index) {
unsigned char type(unsigned char index) {
if (index < _count) {
_error = SENSOR_ERROR_OK;
if (index == 0) return MAGNITUDE_PM1dot0;
@ -150,3 +152,5 @@ class PMSX003Sensor : public BaseSensor {
PMS::DATA _data;
};
#endif // SENSOR_SUPPORT && PMSX003_SUPPORT

+ 5
- 1
code/espurna/sensors/SHT3XI2CSensor.h View File

@ -3,6 +3,8 @@
// Copyright (C) 2017 by Xose Pérez <xose dot perez at gmail dot com>
// -----------------------------------------------------------------------------
#if SENSOR_SUPPORT && SHT3X_I2C_SUPPORT
#pragma once
#include "Arduino.h"
@ -50,7 +52,7 @@ class SHT3XI2CSensor : public I2CSensor {
}
// Type for slot # index
magnitude_t type(unsigned char index) {
unsigned char type(unsigned char index) {
if (index < _count) {
_error = SENSOR_ERROR_OK;
if (index == 0) return MAGNITUDE_TEMPERATURE;
@ -116,3 +118,5 @@ class SHT3XI2CSensor : public I2CSensor {
unsigned char _humidity = 0;
};
#endif // SENSOR_SUPPORT && SHT3X_I2C_SUPPORT

+ 5
- 1
code/espurna/sensors/SI7021Sensor.h View File

@ -3,6 +3,8 @@
// Copyright (C) 2017 by Xose Pérez <xose dot perez at gmail dot com>
// -----------------------------------------------------------------------------
#if SENSOR_SUPPORT && SI7021_SUPPORT
#pragma once
#include "Arduino.h"
@ -84,7 +86,7 @@ class SI7021Sensor : public I2CSensor {
}
// Type for slot # index
magnitude_t type(unsigned char index) {
unsigned char type(unsigned char index) {
if (index < _count) {
_error = SENSOR_ERROR_OK;
if (index == 0) return MAGNITUDE_TEMPERATURE;
@ -175,3 +177,5 @@ class SI7021Sensor : public I2CSensor {
unsigned char _chip;
};
#endif // SENSOR_SUPPORT && SI7021_SUPPORT

+ 5
- 1
code/espurna/sensors/V9261FSensor.h View File

@ -3,6 +3,8 @@
// Copyright (C) 2017 by Xose Pérez <xose dot perez at gmail dot com>
// -----------------------------------------------------------------------------
#if SENSOR_SUPPORT && V9261F_SUPPORT
#pragma once
#include "Arduino.h"
@ -81,7 +83,7 @@ class V9261FSensor : public BaseSensor {
}
// Type for slot # index
magnitude_t type(unsigned char index) {
unsigned char type(unsigned char index) {
_error = SENSOR_ERROR_OK;
if (index == 0) return MAGNITUDE_CURRENT;
if (index == 1) return MAGNITUDE_VOLTAGE;
@ -244,3 +246,5 @@ class V9261FSensor : public BaseSensor {
unsigned char _data[24];
};
#endif // SENSOR_SUPPORT && V9261F_SUPPORT

Loading…
Cancel
Save