Browse Source

Destructors

fastled
Xose Pérez 7 years ago
parent
commit
d80df39629
6 changed files with 25 additions and 1 deletions
  1. +4
    -0
      code/espurna/sensors/BMX280Sensor.h
  2. +5
    -1
      code/espurna/sensors/DallasSensor.h
  3. +1
    -0
      code/espurna/sensors/HLW8012Sensor.h
  4. +6
    -0
      code/espurna/sensors/MHZ19Sensor.h
  5. +5
    -0
      code/espurna/sensors/PMSX003Sensor.h
  6. +4
    -0
      code/espurna/sensors/V9261FSensor.h

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

@ -28,6 +28,10 @@ class BMX280Sensor : public I2CSensor {
_bme = new BME280(); _bme = new BME280();
} }
~BMX280Sensor() {
delete _bme;
}
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
// Sensor API // Sensor API
// --------------------------------------------------------------------- // ---------------------------------------------------------------------


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

@ -37,6 +37,10 @@ class DallasSensor : public BaseSensor {
_sensor_id = SENSOR_DALLAS_ID; _sensor_id = SENSOR_DALLAS_ID;
} }
~DallasSensor() {
if (_wire) delete _wire;
}
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
void setGPIO(unsigned char gpio) { void setGPIO(unsigned char gpio) {
@ -279,6 +283,6 @@ class DallasSensor : public BaseSensor {
unsigned char _gpio; unsigned char _gpio;
unsigned long _interval; unsigned long _interval;
OneWire * _wire;
OneWire * _wire = NULL;
}; };

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

@ -27,6 +27,7 @@ class HLW8012Sensor : public BaseSensor {
~HLW8012Sensor() { ~HLW8012Sensor() {
_enableInterrupts(false); _enableInterrupts(false);
delete _hlw8012;
} }
void expectedCurrent(double expected) { void expectedCurrent(double expected) {


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

@ -34,6 +34,12 @@ class MHZ19Sensor : public BaseSensor {
_sensor_id = SENSOR_MHZ19_ID; _sensor_id = SENSOR_MHZ19_ID;
} }
~MHZ19Sensor() {
if (_serial) delete _serial;
}
// ---------------------------------------------------------------------
void setRX(unsigned char pin_rx) { void setRX(unsigned char pin_rx) {
if (_pin_rx == pin_rx) return; if (_pin_rx == pin_rx) return;
_pin_rx = pin_rx; _pin_rx = pin_rx;


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

@ -25,6 +25,11 @@ class PMSX003Sensor : public BaseSensor {
_sensor_id = SENSOR_PMSX003_ID; _sensor_id = SENSOR_PMSX003_ID;
} }
~PMSX003Sensor() {
if (_serial) delete _serial;
if (_pms) delete _pms;
}
void setRX(unsigned char pin_rx) { void setRX(unsigned char pin_rx) {
if (_pin_rx == pin_rx) return; if (_pin_rx == pin_rx) return;
_pin_rx = pin_rx; _pin_rx = pin_rx;


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

@ -23,6 +23,10 @@ class V9261FSensor : public BaseSensor {
_sensor_id = SENSOR_V9261F_ID; _sensor_id = SENSOR_V9261F_ID;
} }
~V9261FSensor() {
if (_serial) delete _serial;
}
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
void setRX(unsigned char pin_rx) { void setRX(unsigned char pin_rx) {


Loading…
Cancel
Save