Browse Source

Default slot method in BaseSensor class

fastled
Xose Pérez 7 years ago
parent
commit
956215eac5
11 changed files with 11 additions and 55 deletions
  1. +0
    -5
      code/espurna/sensors/AnalogSensor.h
  2. +0
    -5
      code/espurna/sensors/BMX280Sensor.h
  3. +3
    -3
      code/espurna/sensors/BaseSensor.h
  4. +0
    -5
      code/espurna/sensors/DHTSensor.h
  5. +0
    -5
      code/espurna/sensors/DigitalSensor.h
  6. +0
    -5
      code/espurna/sensors/EmonAnalogSensor.h
  7. +0
    -6
      code/espurna/sensors/EventSensor.h
  8. +0
    -5
      code/espurna/sensors/MHZ19Sensor.h
  9. +8
    -6
      code/espurna/sensors/PMSX003Sensor.h
  10. +0
    -5
      code/espurna/sensors/SHT3XI2CSensor.h
  11. +0
    -5
      code/espurna/sensors/SI7021Sensor.h

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

@ -35,11 +35,6 @@ class AnalogSensor : public BaseSensor {
return String("ANALOG @ GPIO0");
}
// Descriptive name of the slot # index
String slot(unsigned char index) {
return description();
}
// Type for slot # index
magnitude_t type(unsigned char index) {
_error = SENSOR_ERROR_OK;


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

@ -66,11 +66,6 @@ class BMX280Sensor : public BaseSensor {
return String(buffer);
}
// Descriptive name of the slot # index
String slot(unsigned char index) {
return description();
}
// Type for slot # index
magnitude_t type(unsigned char index) {
if (index < _count) {


+ 3
- 3
code/espurna/sensors/BaseSensor.h View File

@ -74,9 +74,6 @@ class BaseSensor {
// Descriptive name of the sensor
virtual String description() {}
// Descriptive name of the slot # index
virtual String slot(unsigned char index) {}
// Type for slot # index
virtual magnitude_t type(unsigned char index) {}
@ -92,6 +89,9 @@ class BaseSensor {
// Load the configuration manifest
static void manifest(JsonArray& root) {};
// Descriptive name of the slot # index
String slot(unsigned char index) { return description(); }
// Sensor ID
unsigned char getID() { return _sensor_id; };


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

@ -66,11 +66,6 @@ class DHTSensor : public BaseSensor {
return String(buffer);
}
// Descriptive name of the slot # index
String slot(unsigned char index) {
return description();
}
// Type for slot # index
magnitude_t type(unsigned char index) {
_error = SENSOR_ERROR_OK;


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

@ -65,11 +65,6 @@ class DigitalSensor : public BaseSensor {
return String(buffer);
}
// Descriptive name of the slot # index
String slot(unsigned char index) {
return description();
}
// Type for slot # index
magnitude_t type(unsigned char index) {
_error = SENSOR_ERROR_OK;


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

@ -58,11 +58,6 @@ class EmonAnalogSensor : public EmonSensor {
return String("EMON @ ANALOG @ GPIO0");
}
// Descriptive name of the slot # index
String slot(unsigned char index) {
return description();
}
// Type for slot # index
magnitude_t type(unsigned char index) {
_error = SENSOR_ERROR_OK;


+ 0
- 6
code/espurna/sensors/EventSensor.h View File

@ -80,12 +80,6 @@ class EventSensor : public BaseSensor {
return String(buffer);
}
// Descriptive name of the slot # index
String slot(unsigned char index) {
(void) index;
return description();
}
// Type for slot # index
magnitude_t type(unsigned char index) {
_error = SENSOR_ERROR_OK;


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

@ -81,11 +81,6 @@ class MHZ19Sensor : public BaseSensor {
return String(buffer);
}
// Descriptive name of the slot # index
String slot(unsigned char index) {
return description();
}
// Type for slot # index
magnitude_t type(unsigned char index) {
_error = SENSOR_ERROR_OK;


+ 8
- 6
code/espurna/sensors/PMSX003Sensor.h View File

@ -103,20 +103,22 @@ class PMSX003Sensor : public BaseSensor {
}
void pre() {
if(millis() - _startTime > 30000) {
_error = SENSOR_ERROR_OK;
} else {
if (millis() - _startTime < 30000) {
_error = SENSOR_ERROR_WARM_UP;
return;
}
_pms->requestRead();
}
void tick() {
_error = SENSOR_ERROR_OK;
if(_pms->read(_data)) {
_pm1dot0 = _data.PM_AE_UG_1_0;
_pm2dot5 = _data.PM_AE_UG_2_5;
_pm10 = _data.PM_AE_UG_10_0;
}
_pms->requestRead();
}
// Current value for slot # index


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

@ -63,11 +63,6 @@ class SHT3XI2CSensor : public BaseSensor {
return String(buffer);
}
// Descriptive name of the slot # index
String slot(unsigned char index) {
return description();
}
// Type for slot # index
magnitude_t type(unsigned char index) {
if (index < _count) {


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

@ -96,11 +96,6 @@ class SI7021Sensor : public BaseSensor {
return String(buffer);
}
// Descriptive name of the slot # index
String slot(unsigned char index) {
return description();
}
// Type for slot # index
magnitude_t type(unsigned char index) {
if (index < _count) {


Loading…
Cancel
Save