diff --git a/Adafruit_BMP280.cpp b/Adafruit_BMP280.cpp index 0994325..6c1b6b9 100644 --- a/Adafruit_BMP280.cpp +++ b/Adafruit_BMP280.cpp @@ -32,17 +32,6 @@ Adafruit_BMP280::Adafruit_BMP280(TwoWire *theWire) { pressure_sensor = new Adafruit_BMP280_Pressure(this); } -Adafruit_BMP280::~Adafruit_BMP280(void) { - if (spi_dev) - delete spi_dev; - if (i2c_dev) - delete i2c_dev; - if (temp_sensor == nullptr) - delete temp_sensor; - if (pressure_sensor == nullptr) - delete pressure_sensor; -} - /*! * @brief BMP280 constructor using hardware SPI * @param cspin @@ -75,6 +64,17 @@ Adafruit_BMP280::Adafruit_BMP280(int8_t cspin, int8_t mosipin, int8_t misopin, pressure_sensor = new Adafruit_BMP280_Pressure(this); } +Adafruit_BMP280::~Adafruit_BMP280(void) { + if (spi_dev) + delete spi_dev; + if (i2c_dev) + delete i2c_dev; + if (temp_sensor) + delete temp_sensor; + if (pressure_sensor) + delete pressure_sensor; +} + /*! * Initialises the sensor. * @param addr