Browse Source

Release lock if sensor has not valid ID

fastled
Xose Pérez 7 years ago
parent
commit
4c90a1b320
2 changed files with 2 additions and 0 deletions
  1. +1
    -0
      code/espurna/sensors/BMX280Sensor.h
  2. +1
    -0
      code/espurna/sensors/SI7021Sensor.h

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

@ -149,6 +149,7 @@ class BMX280Sensor : public BaseSensor {
_chip = bme->begin(); _chip = bme->begin();
if ((_chip != BMX280_CHIP_BME280) && (_chip != BMX280_CHIP_BMP280)) { if ((_chip != BMX280_CHIP_BME280) && (_chip != BMX280_CHIP_BMP280)) {
_chip = 0; _chip = 0;
i2cReleaseLock(_address);
_error = SENSOR_ERROR_UNKNOWN_ID; _error = SENSOR_ERROR_UNKNOWN_ID;
} }


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

@ -75,6 +75,7 @@ class SI7021Sensor : public BaseSensor {
#endif #endif
if ((_chip != SI7021_CHIP_SI7021) & (_chip != SI7021_CHIP_HTU21D)) { if ((_chip != SI7021_CHIP_SI7021) & (_chip != SI7021_CHIP_HTU21D)) {
i2cReleaseLock(_address);
_error = SENSOR_ERROR_UNKNOWN_ID; _error = SENSOR_ERROR_UNKNOWN_ID;
} else { } else {
_count = 2; _count = 2;


Loading…
Cancel
Save