Browse Source

Error reset on _pre for different sensors

i18n
Xose Pérez 6 years ago
parent
commit
c0215f0a16
9 changed files with 17 additions and 1 deletions
  1. +1
    -0
      code/espurna/sensors/BMX280Sensor.h
  2. +1
    -0
      code/espurna/sensors/DHTSensor.h
  3. +5
    -0
      code/espurna/sensors/DallasSensor.h
  4. +2
    -0
      code/espurna/sensors/EmonADC121Sensor.h
  5. +1
    -0
      code/espurna/sensors/EmonADS1X15Sensor.h
  6. +2
    -0
      code/espurna/sensors/EmonAnalogSensor.h
  7. +2
    -0
      code/espurna/sensors/MHZ19Sensor.h
  8. +2
    -0
      code/espurna/sensors/SHT3XI2CSensor.h
  9. +1
    -1
      code/espurna/sensors/SI7021Sensor.h

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

@ -89,6 +89,7 @@ class BMX280Sensor : public I2CSensor {
_error = SENSOR_ERROR_UNKNOWN_ID; _error = SENSOR_ERROR_UNKNOWN_ID;
return; return;
} }
_error = SENSOR_ERROR_OK;
#if BMX280_MODE == 1 #if BMX280_MODE == 1
forceRead(); forceRead();


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

@ -80,6 +80,7 @@ class DHTSensor : public BaseSensor {
// Pre-read hook (usually to populate registers with up-to-date data) // Pre-read hook (usually to populate registers with up-to-date data)
void pre() { void pre() {
_error = SENSOR_ERROR_OK;
_read(); _read();
} }


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

@ -209,6 +209,11 @@ class DallasSensor : public BaseSensor {
return MAGNITUDE_NONE; return MAGNITUDE_NONE;
} }
// Pre-read hook (usually to populate registers with up-to-date data)
void pre() {
_error = SENSOR_ERROR_OK;
}
// Current value for slot # index // Current value for slot # index
double value(unsigned char index) { double value(unsigned char index) {


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

@ -112,6 +112,8 @@ class EmonADC121Sensor : public EmonSensor {
last = millis(); last = millis();
#endif #endif
_error = SENSOR_ERROR_OK;
} }
// Type for slot # index // Type for slot # index


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

@ -241,6 +241,7 @@ class EmonADS1X15Sensor : public EmonSensor {
#endif #endif
} }
last = millis(); last = millis();
_error = SENSOR_ERROR_OK;
} }
// Current value for slot # index // Current value for slot # index


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

@ -94,6 +94,8 @@ class EmonAnalogSensor : public EmonSensor {
last = millis(); last = millis();
#endif #endif
_error = SENSOR_ERROR_OK;
} }
// Current value for slot # index // Current value for slot # index


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

@ -197,6 +197,8 @@ class MHZ19Sensor : public BaseSensor {
_error = SENSOR_ERROR_OUT_OF_RANGE; _error = SENSOR_ERROR_OUT_OF_RANGE;
} }
} else {
_error = SENSOR_ERROR_CRC;
} }
} }


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

@ -66,6 +66,8 @@ class SHT3XI2CSensor : public I2CSensor {
// Pre-read hook (usually to populate registers with up-to-date data) // Pre-read hook (usually to populate registers with up-to-date data)
void pre() { void pre() {
_error = SENSOR_ERROR_OK;
unsigned char buffer[6]; unsigned char buffer[6];
#if I2C_USE_BRZO #if I2C_USE_BRZO


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

@ -93,9 +93,9 @@ class SI7021Sensor : public I2CSensor {
_error = SENSOR_ERROR_UNKNOWN_ID; _error = SENSOR_ERROR_UNKNOWN_ID;
if (_chip == 0) return; if (_chip == 0) return;
_error = SENSOR_ERROR_OK;
double value; double value;
_error = SENSOR_ERROR_OK;
value = _read(SI7021_CMD_TMP_NOHOLD); value = _read(SI7021_CMD_TMP_NOHOLD);
if (_error != SENSOR_ERROR_OK) return; if (_error != SENSOR_ERROR_OK) return;


Loading…
Cancel
Save