From b35c2c2e569fe6f5c7300580996e26e7af0be8e1 Mon Sep 17 00:00:00 2001 From: Tyeth Gundry Date: Wed, 2 Jul 2025 18:23:48 +0100 Subject: [PATCH 01/10] Add OMRON D6T thermal sensor --- library.properties | 2 +- platformio.ini | 1 + src/components/i2c/WipperSnapper_I2C.cpp | 11 ++ src/components/i2c/WipperSnapper_I2C.h | 1 + .../drivers/WipperSnapper_I2C_Driver_D6T1A.h | 100 ++++++++++++++++++ 5 files changed, 114 insertions(+), 1 deletion(-) create mode 100644 src/components/i2c/drivers/WipperSnapper_I2C_Driver_D6T1A.h diff --git a/library.properties b/library.properties index 77037f3b6..0fa5aaaa4 100644 --- a/library.properties +++ b/library.properties @@ -7,4 +7,4 @@ paragraph=Arduino application for Adafruit.io WipperSnapper category=Communication url=https://github.com/adafruit/Adafruit_Wippersnapper_Arduino architectures=* -depends=SdFat - Adafruit Fork, Adafruit NeoPixel, Adafruit SPIFlash, ArduinoJson, Adafruit DotStar, Adafruit HDC302x, Adafruit INA219, Adafruit INA260 Library, Adafruit LTR329 and LTR303, Adafruit LTR390 Library, Adafruit MCP3421, Adafruit NAU7802 Library, Adafruit SleepyDog Library, Adafruit TMP117, Adafruit TinyUSB Library, Adafruit AHTX0, Adafruit BME280 Library, Adafruit BMP280 Library, Adafruit BMP3XX Library, Adafruit DPS310, Adafruit DS248x, Adafruit SCD30, Adafruit SGP30 Sensor, Adafruit SGP40 Sensor, Sensirion I2C SCD4x, Sensirion I2C SEN5X, Sensirion I2C SEN66, arduino-sht, Adafruit Si7021 Library, Adafruit MQTT Library, Adafruit MS8607, Adafruit MCP9808 Library, Adafruit MCP9600 Library, Adafruit MPL115A2, Adafruit MPRLS Library, Adafruit TSL2591 Library, Adafruit_VL53L0X, Adafruit VL53L1X, STM32duino VL53L4CD, STM32duino VL53L4CX, Adafruit_VL6180X, Adafruit PM25 AQI Sensor, Adafruit VCNL4020 Library, Adafruit VCNL4040, Adafruit VCNL4200 Library, Adafruit VEML7700 Library, Adafruit LC709203F, Adafruit LPS2X, Adafruit LPS28, Adafruit LPS35HW, Adafruit seesaw Library, Adafruit BME680 Library, Adafruit MAX1704X, Adafruit ADT7410 Library, Adafruit HTS221, Adafruit HTU21DF Library, Adafruit HTU31D Library, Adafruit PCT2075, hp_BH1750, ENS160 - Adafruit Fork, Adafruit BusIO, Adafruit Unified Sensor, Sensirion Core, Adafruit GFX Library, Adafruit LED Backpack Library, Adafruit LiquidCrystal, Adafruit SSD1306 +depends=OmronD6T - Community Fork, SdFat - Adafruit Fork, Adafruit NeoPixel, Adafruit SPIFlash, ArduinoJson, Adafruit DotStar, Adafruit HDC302x, Adafruit INA219, Adafruit INA260 Library, Adafruit LTR329 and LTR303, Adafruit LTR390 Library, Adafruit MCP3421, Adafruit NAU7802 Library, Adafruit SleepyDog Library, Adafruit TMP117, Adafruit TinyUSB Library, Adafruit AHTX0, Adafruit BME280 Library, Adafruit BMP280 Library, Adafruit BMP3XX Library, Adafruit DPS310, Adafruit DS248x, Adafruit SCD30, Adafruit SGP30 Sensor, Adafruit SGP40 Sensor, Sensirion I2C SCD4x, Sensirion I2C SEN5X, Sensirion I2C SEN66, arduino-sht, Adafruit Si7021 Library, Adafruit MQTT Library, Adafruit MS8607, Adafruit MCP9808 Library, Adafruit MCP9600 Library, Adafruit MPL115A2, Adafruit MPRLS Library, Adafruit TSL2591 Library, Adafruit_VL53L0X, Adafruit VL53L1X, STM32duino VL53L4CD, STM32duino VL53L4CX, Adafruit_VL6180X, Adafruit PM25 AQI Sensor, Adafruit VCNL4020 Library, Adafruit VCNL4040, Adafruit VCNL4200 Library, Adafruit VEML7700 Library, Adafruit LC709203F, Adafruit LPS2X, Adafruit LPS28, Adafruit LPS35HW, Adafruit seesaw Library, Adafruit BME680 Library, Adafruit MAX1704X, Adafruit ADT7410 Library, Adafruit HTS221, Adafruit HTU21DF Library, Adafruit HTU31D Library, Adafruit PCT2075, hp_BH1750, ENS160 - Adafruit Fork, Adafruit BusIO, Adafruit Unified Sensor, Sensirion Core, Adafruit GFX Library, Adafruit LED Backpack Library, Adafruit LiquidCrystal, Adafruit SSD1306 diff --git a/platformio.ini b/platformio.ini index bddb00c06..f72c20a75 100644 --- a/platformio.ini +++ b/platformio.ini @@ -85,6 +85,7 @@ lib_deps = adafruit/Adafruit LED Backpack Library adafruit/Adafruit PM25 AQI Sensor adafruit/Adafruit SSD1306 + https://github.com/tyeth/omron-devhub_d6t-arduino.git https://github.com/pstolarz/OneWireNg.git https://github.com/milesburton/Arduino-Temperature-Control-Library.git https://github.com/Sensirion/arduino-sht.git diff --git a/src/components/i2c/WipperSnapper_I2C.cpp b/src/components/i2c/WipperSnapper_I2C.cpp index 6f58f4c27..8767bc159 100644 --- a/src/components/i2c/WipperSnapper_I2C.cpp +++ b/src/components/i2c/WipperSnapper_I2C.cpp @@ -292,6 +292,17 @@ bool WipperSnapper_Component_I2C::initI2CDevice( _bme680->configureDriver(msgDeviceInitReq); drivers.push_back(_bme680); WS_DEBUG_PRINTLN("BME680 Initialized Successfully!"); + } else if (strcmp("d6t1a", msgDeviceInitReq->i2c_device_name) == 0) { + _d6t1a = new WipperSnapper_I2C_Driver_D6T1A(this->_i2c, i2cAddress); + if (!_d6t1a->begin()) { + WS_DEBUG_PRINTLN("ERROR: Failed to initialize D6T1A"); + _busStatusResponse = + wippersnapper_i2c_v1_BusResponse_BUS_RESPONSE_DEVICE_INIT_FAIL; + return false; + } + _d6t1a->configureDriver(msgDeviceInitReq); + drivers.push_back(_d6t1a); + WS_DEBUG_PRINTLN("D6T1A Initialized Successfully!"); } else if (strcmp("dps310", msgDeviceInitReq->i2c_device_name) == 0) { _dps310 = new WipperSnapper_I2C_Driver_DPS310(this->_i2c, i2cAddress); if (!_dps310->begin()) { diff --git a/src/components/i2c/WipperSnapper_I2C.h b/src/components/i2c/WipperSnapper_I2C.h index 1c17de10a..30c99d3c6 100644 --- a/src/components/i2c/WipperSnapper_I2C.h +++ b/src/components/i2c/WipperSnapper_I2C.h @@ -27,6 +27,7 @@ #include "drivers/WipperSnapper_I2C_Driver_BME680.h" #include "drivers/WipperSnapper_I2C_Driver_BMP280.h" #include "drivers/WipperSnapper_I2C_Driver_BMP3XX.h" +#include "drivers/WipperSnapper_I2C_Driver_D6T1A.h" #include "drivers/WipperSnapper_I2C_Driver_DPS310.h" #include "drivers/WipperSnapper_I2C_Driver_DS2484.h" #include "drivers/WipperSnapper_I2C_Driver_ENS160.h" diff --git a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_D6T1A.h b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_D6T1A.h new file mode 100644 index 000000000..d6b9c1723 --- /dev/null +++ b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_D6T1A.h @@ -0,0 +1,100 @@ +/*! + * @file WipperSnapper_I2C_Driver_D6T1A.h + * + * Device driver for a D6T1A thermal sensor. + * + * Adafruit invests time and resources providing this open source code, + * please support Adafruit and open-source hardware by purchasing + * products from Adafruit! + * + * Copyright (c) Tyeth Gundry 2025 for Adafruit Industries. + * + * MIT license, all text here must be included in any redistribution. + * + */ + +#ifndef WipperSnapper_I2C_Driver_D6T1A_H +#define WipperSnapper_I2C_Driver_D6T1A_H + +#include "WipperSnapper_I2C_Driver.h" +#include + +/**************************************************************************/ +/*! + @brief Class that provides a sensor driver for the D6T1A temperature + and pressure sensor. +*/ +/**************************************************************************/ +class WipperSnapper_I2C_Driver_D6T1A : public WipperSnapper_I2C_Driver { + +public: + /*******************************************************************************/ + /*! + @brief Constructor for an D6T1A sensor. + @param i2c + The I2C interface. + @param sensorAddress + 7-bit device address. + */ + /*******************************************************************************/ + WipperSnapper_I2C_Driver_D6T1A(TwoWire *i2c, uint16_t sensorAddress) + : WipperSnapper_I2C_Driver(i2c, sensorAddress) { + _i2c = i2c; + _sensorAddress = sensorAddress; + } + + /*******************************************************************************/ + /*! + @brief Destructor for an D6T1A sensor. + */ + /*******************************************************************************/ + ~WipperSnapper_I2C_Driver_D6T1A() { delete _d6t1a; } + + /*******************************************************************************/ + /*! + @brief Initializes the D6T1A sensor and begins I2C. + @returns True if initialized successfully, False otherwise. + */ + /*******************************************************************************/ + bool begin() { + _d6t1a = new OmronD6T( OmronD6T.Model.D6T_1A, _i2c); + // attempt to initialize D6T1A + if (!_d6t1a->begin(_sensorAddress)) + return false; + return true; + } + + /*******************************************************************************/ + /*! + @brief Gets the D6T1A's current temperature. + @param tempEvent + Pointer to an Adafruit_Sensor event. + @returns True if the temperature was obtained successfully, False + otherwise. + */ + /*******************************************************************************/ + bool getEventAmbientTemp(sensors_event_t *tempEvent) { + tempEvent->temperature = _d6t1a->ambientTempC(); + return true; + } + + /*******************************************************************************/ + /*! + @brief Gets the D6T1A's object temperature. + @param tempEvent + Pointer to an Adafruit_Sensor event. + @returns True if the temperature was obtained successfully, False + otherwise. + */ + /*******************************************************************************/ + bool getEventObjectTemp(sensors_event_t *tempEvent) { + tempEvent->temperature = _d6t1a->objectTempC(); + return true; + } + + +protected: + OmronD6T *_d6t1a; ///< D6T1A object +}; + +#endif // WipperSnapper_I2C_Driver_D6T1A \ No newline at end of file From 4e9d95900493b42bf57cec055a3b784e10a07be1 Mon Sep 17 00:00:00 2001 From: Tyeth Gundry Date: Wed, 2 Jul 2025 18:33:27 +0100 Subject: [PATCH 02/10] D6T: Swap to single read for both metrics --- .../drivers/WipperSnapper_I2C_Driver_D6T1A.h | 53 +++++++++++++++++-- 1 file changed, 48 insertions(+), 5 deletions(-) diff --git a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_D6T1A.h b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_D6T1A.h index d6b9c1723..385c5b01b 100644 --- a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_D6T1A.h +++ b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_D6T1A.h @@ -64,6 +64,38 @@ class WipperSnapper_I2C_Driver_D6T1A : public WipperSnapper_I2C_Driver { return true; } + + /*******************************************************************************/ + /*! + @brief Checks if sensor was read within last 1s, or is the first read. + @returns True if the sensor was recently read, False otherwise. + */ + /*******************************************************************************/ + bool HasBeenReadInLast200ms() { + return _lastRead != 0 && millis() - _lastRead < 200; + } + + /*******************************************************************************/ + /*! + @brief Reads the sensor. + @returns True if the sensor was read successfully, False otherwise. + */ + /*******************************************************************************/ + bool ReadSensorData() { + // dont read sensor more than once per 200ms + if (HasBeenReadInLast200ms()) { + return true; + } + + _d6t1a->read(); + _deviceTemp.temperature = _d6t1a->ambientTempC(); + _objectTemp.relative_humidity = _d6t1a->objectTempC(); + _lastRead = millis(); + return true; + } + + + /*******************************************************************************/ /*! @brief Gets the D6T1A's current temperature. @@ -74,8 +106,12 @@ class WipperSnapper_I2C_Driver_D6T1A : public WipperSnapper_I2C_Driver { */ /*******************************************************************************/ bool getEventAmbientTemp(sensors_event_t *tempEvent) { - tempEvent->temperature = _d6t1a->ambientTempC(); - return true; + if (ReadSensorData() && _deviceTemp != nan) { + // if the sensor was read recently, return the cached temperature + tempEvent->temperature = _deviceTemp; + return true; + } + return false; // sensor not read recently, return false } /*******************************************************************************/ @@ -88,13 +124,20 @@ class WipperSnapper_I2C_Driver_D6T1A : public WipperSnapper_I2C_Driver { */ /*******************************************************************************/ bool getEventObjectTemp(sensors_event_t *tempEvent) { - tempEvent->temperature = _d6t1a->objectTempC(); - return true; + if (ReadSensorData() && _objectTemp != nan) { + // if the sensor was read recently, return the cached temperature + tempEvent->temperature = _objectTemp; + return true; + } + return false; // sensor not read recently, return false } protected: - OmronD6T *_d6t1a; ///< D6T1A object + float _deviceTemp = nan; ///< Device temperature in Celsius + float _objectTemp = nan; ///< Object temperature in Celsius + uint32_t _lastRead = 0; ///< Last time the sensor was read in milliseconds + OmronD6T *_d6t1a = nullptr; ///< D6T1A object }; #endif // WipperSnapper_I2C_Driver_D6T1A \ No newline at end of file From cfdbfd6c7911ad99cb71af69ff6de180e619bf38 Mon Sep 17 00:00:00 2001 From: Tyeth Gundry Date: Wed, 2 Jul 2025 18:34:21 +0100 Subject: [PATCH 03/10] clang-format --- .../drivers/WipperSnapper_I2C_Driver_D6T1A.h | 31 ++++++++----------- 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_D6T1A.h b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_D6T1A.h index 385c5b01b..1f8918265 100644 --- a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_D6T1A.h +++ b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_D6T1A.h @@ -16,9 +16,10 @@ #ifndef WipperSnapper_I2C_Driver_D6T1A_H #define WipperSnapper_I2C_Driver_D6T1A_H -#include "WipperSnapper_I2C_Driver.h" #include +#include "WipperSnapper_I2C_Driver.h" + /**************************************************************************/ /*! @brief Class that provides a sensor driver for the D6T1A temperature @@ -26,8 +27,7 @@ */ /**************************************************************************/ class WipperSnapper_I2C_Driver_D6T1A : public WipperSnapper_I2C_Driver { - -public: + public: /*******************************************************************************/ /*! @brief Constructor for an D6T1A sensor. @@ -57,14 +57,12 @@ class WipperSnapper_I2C_Driver_D6T1A : public WipperSnapper_I2C_Driver { */ /*******************************************************************************/ bool begin() { - _d6t1a = new OmronD6T( OmronD6T.Model.D6T_1A, _i2c); + _d6t1a = new OmronD6T(OmronD6T.Model.D6T_1A, _i2c); // attempt to initialize D6T1A - if (!_d6t1a->begin(_sensorAddress)) - return false; + if (!_d6t1a->begin(_sensorAddress)) return false; return true; } - /*******************************************************************************/ /*! @brief Checks if sensor was read within last 1s, or is the first read. @@ -94,8 +92,6 @@ class WipperSnapper_I2C_Driver_D6T1A : public WipperSnapper_I2C_Driver { return true; } - - /*******************************************************************************/ /*! @brief Gets the D6T1A's current temperature. @@ -111,7 +107,7 @@ class WipperSnapper_I2C_Driver_D6T1A : public WipperSnapper_I2C_Driver { tempEvent->temperature = _deviceTemp; return true; } - return false; // sensor not read recently, return false + return false; // sensor not read recently, return false } /*******************************************************************************/ @@ -129,15 +125,14 @@ class WipperSnapper_I2C_Driver_D6T1A : public WipperSnapper_I2C_Driver { tempEvent->temperature = _objectTemp; return true; } - return false; // sensor not read recently, return false + return false; // sensor not read recently, return false } - -protected: - float _deviceTemp = nan; ///< Device temperature in Celsius - float _objectTemp = nan; ///< Object temperature in Celsius - uint32_t _lastRead = 0; ///< Last time the sensor was read in milliseconds - OmronD6T *_d6t1a = nullptr; ///< D6T1A object + protected: + float _deviceTemp = nan; ///< Device temperature in Celsius + float _objectTemp = nan; ///< Object temperature in Celsius + uint32_t _lastRead = 0; ///< Last time the sensor was read in milliseconds + OmronD6T *_d6t1a = nullptr; ///< D6T1A object }; -#endif // WipperSnapper_I2C_Driver_D6T1A \ No newline at end of file +#endif // WipperSnapper_I2C_Driver_D6T1A \ No newline at end of file From 172646a55a05b34ed923450beb9e44ab05e71628 Mon Sep 17 00:00:00 2001 From: Tyeth Gundry Date: Wed, 2 Jul 2025 19:28:31 +0100 Subject: [PATCH 04/10] Correct D6T model name and privates usage --- .../i2c/drivers/WipperSnapper_I2C_Driver_D6T1A.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_D6T1A.h b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_D6T1A.h index 1f8918265..0883e0725 100644 --- a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_D6T1A.h +++ b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_D6T1A.h @@ -57,7 +57,7 @@ class WipperSnapper_I2C_Driver_D6T1A : public WipperSnapper_I2C_Driver { */ /*******************************************************************************/ bool begin() { - _d6t1a = new OmronD6T(OmronD6T.Model.D6T_1A, _i2c); + _d6t1a = new OmronD6T(OmronD6T::Model.D6T_1A, _i2c); // attempt to initialize D6T1A if (!_d6t1a->begin(_sensorAddress)) return false; return true; @@ -86,8 +86,8 @@ class WipperSnapper_I2C_Driver_D6T1A : public WipperSnapper_I2C_Driver { } _d6t1a->read(); - _deviceTemp.temperature = _d6t1a->ambientTempC(); - _objectTemp.relative_humidity = _d6t1a->objectTempC(); + _deviceTemp = _d6t1a->ambientTempC(); + _objectTemp = _d6t1a->objectTempC(); _lastRead = millis(); return true; } @@ -102,7 +102,7 @@ class WipperSnapper_I2C_Driver_D6T1A : public WipperSnapper_I2C_Driver { */ /*******************************************************************************/ bool getEventAmbientTemp(sensors_event_t *tempEvent) { - if (ReadSensorData() && _deviceTemp != nan) { + if (ReadSensorData() && _deviceTemp != NAN) { // if the sensor was read recently, return the cached temperature tempEvent->temperature = _deviceTemp; return true; @@ -120,7 +120,7 @@ class WipperSnapper_I2C_Driver_D6T1A : public WipperSnapper_I2C_Driver { */ /*******************************************************************************/ bool getEventObjectTemp(sensors_event_t *tempEvent) { - if (ReadSensorData() && _objectTemp != nan) { + if (ReadSensorData() && _objectTemp != NAN) { // if the sensor was read recently, return the cached temperature tempEvent->temperature = _objectTemp; return true; @@ -129,8 +129,8 @@ class WipperSnapper_I2C_Driver_D6T1A : public WipperSnapper_I2C_Driver { } protected: - float _deviceTemp = nan; ///< Device temperature in Celsius - float _objectTemp = nan; ///< Object temperature in Celsius + float _deviceTemp = NAN; ///< Device temperature in Celsius + float _objectTemp = NAN; ///< Object temperature in Celsius uint32_t _lastRead = 0; ///< Last time the sensor was read in milliseconds OmronD6T *_d6t1a = nullptr; ///< D6T1A object }; From 275bedeec70d0b0c9362732826cfcb80738104cb Mon Sep 17 00:00:00 2001 From: Tyeth Gundry Date: Wed, 2 Jul 2025 19:43:13 +0100 Subject: [PATCH 05/10] D6T: Floats and Model name swap --- src/components/i2c/drivers/WipperSnapper_I2C_Driver_D6T1A.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_D6T1A.h b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_D6T1A.h index 0883e0725..1767e1ce6 100644 --- a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_D6T1A.h +++ b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_D6T1A.h @@ -57,7 +57,7 @@ class WipperSnapper_I2C_Driver_D6T1A : public WipperSnapper_I2C_Driver { */ /*******************************************************************************/ bool begin() { - _d6t1a = new OmronD6T(OmronD6T::Model.D6T_1A, _i2c); + _d6t1a = new OmronD6T(OmronD6T::D6T_1A, _i2c); // attempt to initialize D6T1A if (!_d6t1a->begin(_sensorAddress)) return false; return true; @@ -86,8 +86,8 @@ class WipperSnapper_I2C_Driver_D6T1A : public WipperSnapper_I2C_Driver { } _d6t1a->read(); - _deviceTemp = _d6t1a->ambientTempC(); - _objectTemp = _d6t1a->objectTempC(); + _deviceTemp = (float)_d6t1a->ambientTempC(); + _objectTemp = (float)_d6t1a->objectTempC(); _lastRead = millis(); return true; } From f7c094c7595f548f6605e41320d4d123fe36ecb0 Mon Sep 17 00:00:00 2001 From: Tyeth Gundry Date: Wed, 2 Jul 2025 20:04:12 +0100 Subject: [PATCH 06/10] D6T: specify cell/pixel for temp reading --- src/components/i2c/drivers/WipperSnapper_I2C_Driver_D6T1A.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_D6T1A.h b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_D6T1A.h index 1767e1ce6..98f29f5e7 100644 --- a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_D6T1A.h +++ b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_D6T1A.h @@ -87,7 +87,7 @@ class WipperSnapper_I2C_Driver_D6T1A : public WipperSnapper_I2C_Driver { _d6t1a->read(); _deviceTemp = (float)_d6t1a->ambientTempC(); - _objectTemp = (float)_d6t1a->objectTempC(); + _objectTemp = (float)_d6t1a->objectTempC(0, 0); _lastRead = millis(); return true; } From 44024f6d154f06daf220d6653240e3c65897291f Mon Sep 17 00:00:00 2001 From: Tyeth Gundry Date: Wed, 2 Jul 2025 20:12:15 +0100 Subject: [PATCH 07/10] Add missing private pointer for D6T-1A --- src/components/i2c/WipperSnapper_I2C.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/i2c/WipperSnapper_I2C.h b/src/components/i2c/WipperSnapper_I2C.h index 30c99d3c6..fc27fb977 100644 --- a/src/components/i2c/WipperSnapper_I2C.h +++ b/src/components/i2c/WipperSnapper_I2C.h @@ -149,6 +149,7 @@ class WipperSnapper_Component_I2C { _drivers_out; ///< List of i2c output drivers // Sensor driver objects WipperSnapper_I2C_Driver_AHTX0 *_ahtx0 = nullptr; + WipperSnapper_I2C_Driver_D6T1A *_d6t1a = nullptr; WipperSnapper_I2C_Driver_DPS310 *_dps310 = nullptr; WipperSnapper_I2C_Driver_DS2484 *_ds2484 = nullptr; WipperSnapper_I2C_Driver_ENS160 *_ens160 = nullptr; From b0471259813f35d301c7dec1919a762c003bc54b Mon Sep 17 00:00:00 2001 From: tyeth Date: Wed, 2 Jul 2025 23:43:52 +0100 Subject: [PATCH 08/10] 8MB partitions for 8MB boards --- platformio.ini | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index f72c20a75..72ad26edc 100644 --- a/platformio.ini +++ b/platformio.ini @@ -233,6 +233,7 @@ extra_scripts = pre:rename_usb_config.py extends = common:esp32 board = adafruit_feather_esp32s3_nopsram build_flags = -DARDUINO_ADAFRUIT_FEATHER_ESP32S3_NOPSRAM +board_build.partitions = tinyuf2-partitions-8MB.csv extra_scripts = pre:rename_usb_config.py ; Adafruit Feather ESP32-S3 TFT @@ -367,7 +368,7 @@ extra_scripts = pre:rename_usb_config.py extends = common:esp32 board = adafruit_qtpy_esp32s3_nopsram build_flags = -DARDUINO_ADAFRUIT_QTPY_ESP32S3_NOPSRAM -board_build.partitions = tinyuf2-partitions-4MB.csv +board_build.partitions = tinyuf2-partitions-8MB.csv extra_scripts = pre:rename_usb_config.py ; Adafruit QT Py ESP32-S3 with PSRAM From fe32ce6170fecd4bff51ed7c3c0f23bdab88f6f9 Mon Sep 17 00:00:00 2001 From: Tyeth Gundry Date: Fri, 11 Jul 2025 14:40:45 +0100 Subject: [PATCH 09/10] clang format --- .../drivers/WipperSnapper_I2C_Driver_D6T1A.h | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_D6T1A.h b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_D6T1A.h index 98f29f5e7..677a8b809 100644 --- a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_D6T1A.h +++ b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_D6T1A.h @@ -27,7 +27,7 @@ */ /**************************************************************************/ class WipperSnapper_I2C_Driver_D6T1A : public WipperSnapper_I2C_Driver { - public: +public: /*******************************************************************************/ /*! @brief Constructor for an D6T1A sensor. @@ -59,7 +59,8 @@ class WipperSnapper_I2C_Driver_D6T1A : public WipperSnapper_I2C_Driver { bool begin() { _d6t1a = new OmronD6T(OmronD6T::D6T_1A, _i2c); // attempt to initialize D6T1A - if (!_d6t1a->begin(_sensorAddress)) return false; + if (!_d6t1a->begin(_sensorAddress)) + return false; return true; } @@ -107,7 +108,7 @@ class WipperSnapper_I2C_Driver_D6T1A : public WipperSnapper_I2C_Driver { tempEvent->temperature = _deviceTemp; return true; } - return false; // sensor not read recently, return false + return false; // sensor not read recently, return false } /*******************************************************************************/ @@ -125,14 +126,14 @@ class WipperSnapper_I2C_Driver_D6T1A : public WipperSnapper_I2C_Driver { tempEvent->temperature = _objectTemp; return true; } - return false; // sensor not read recently, return false + return false; // sensor not read recently, return false } - protected: - float _deviceTemp = NAN; ///< Device temperature in Celsius - float _objectTemp = NAN; ///< Object temperature in Celsius - uint32_t _lastRead = 0; ///< Last time the sensor was read in milliseconds - OmronD6T *_d6t1a = nullptr; ///< D6T1A object +protected: + float _deviceTemp = NAN; ///< Device temperature in Celsius + float _objectTemp = NAN; ///< Object temperature in Celsius + uint32_t _lastRead = 0; ///< Last time the sensor was read in milliseconds + OmronD6T *_d6t1a = nullptr; ///< D6T1A object }; -#endif // WipperSnapper_I2C_Driver_D6T1A \ No newline at end of file +#endif // WipperSnapper_I2C_Driver_D6T1A \ No newline at end of file From 1c50e12d8901e48f75836b8d435cad02a9f30592 Mon Sep 17 00:00:00 2001 From: Tyeth Gundry Date: Fri, 11 Jul 2025 15:47:01 +0100 Subject: [PATCH 10/10] D6T-1A: Move initialisation values to constructor --- .../i2c/drivers/WipperSnapper_I2C_Driver_D6T1A.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_D6T1A.h b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_D6T1A.h index 677a8b809..23d181fbf 100644 --- a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_D6T1A.h +++ b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_D6T1A.h @@ -41,6 +41,9 @@ class WipperSnapper_I2C_Driver_D6T1A : public WipperSnapper_I2C_Driver { : WipperSnapper_I2C_Driver(i2c, sensorAddress) { _i2c = i2c; _sensorAddress = sensorAddress; + _deviceTemp = NAN; + _objectTemp = NAN; + _lastRead = 0; } /*******************************************************************************/ @@ -130,9 +133,9 @@ class WipperSnapper_I2C_Driver_D6T1A : public WipperSnapper_I2C_Driver { } protected: - float _deviceTemp = NAN; ///< Device temperature in Celsius - float _objectTemp = NAN; ///< Object temperature in Celsius - uint32_t _lastRead = 0; ///< Last time the sensor was read in milliseconds + float _deviceTemp; ///< Device temperature in Celsius + float _objectTemp; ///< Object temperature in Celsius + uint32_t _lastRead; ///< Last time the sensor was read in milliseconds OmronD6T *_d6t1a = nullptr; ///< D6T1A object };