Add delete/nullptr check to begin (dtor not called)

This commit is contained in:
Tyeth Gundry 2025-08-22 12:58:59 +01:00
parent 39a15fd584
commit 6de22b6d25

View file

@ -65,6 +65,10 @@ class WipperSnapper_I2C_Driver_MLX90632D : public WipperSnapper_I2C_Driver {
*/
/*******************************************************************************/
bool begin() {
if (_mlx90632) {
delete _mlx90632;
_mlx90632 = nullptr;
}
_mlx90632 = new Adafruit_MLX90632();
// attempt to initialize MLX90632
if (!_mlx90632->begin(_sensorAddress, _i2c)) return false;