Fix reference to sensor slot method

This commit is contained in:
Xose Pérez
2018-01-08 10:41:21 +01:00
parent ccc5843e7b
commit c38911beae
11 changed files with 51 additions and 1 deletions

View File

@@ -37,6 +37,11 @@ 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
unsigned char type(unsigned char index) {
_error = SENSOR_ERROR_OK;

View File

@@ -62,7 +62,7 @@ class BaseSensor {
static void manifest(JsonArray& root) {};
// Descriptive name of the slot # index
String slot(unsigned char index) { return description(); }
virtual String slot(unsigned char index) {};
// Sensor ID
unsigned char getID() { return _sensor_id; };

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -23,6 +23,11 @@ class I2CSensor : public BaseSensor {
return _address;
}
// Descriptive name of the slot # index
String slot(unsigned char index) {
return description();
};
protected:
// Specific for I2C sensors

View File

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

View File

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

View File

@@ -77,6 +77,11 @@ class V9261FSensor : public BaseSensor {
return String(buffer);
}
// Descriptive name of the slot # index
String slot(unsigned char index) {
return description();
};
// Loop-like method, call it in your main loop
void tick() {
_read();