refactor(mlx90632): use -d model distinction for medical

This commit is contained in:
tyeth 2025-08-20 14:13:45 +01:00
parent e873237b5e
commit 54ee1a632a
3 changed files with 12 additions and 9 deletions

View file

@ -537,8 +537,9 @@ bool WipperSnapper_Component_I2C::initI2CDevice(
_mcp9808->configureDriver(msgDeviceInitReq);
drivers.push_back(_mcp9808);
WS_DEBUG_PRINTLN("MCP9808 Initialized Successfully!");
} else if (strcmp("mlx90632", msgDeviceInitReq->i2c_device_name) == 0) {
_mlx90632 = new WipperSnapper_I2C_Driver_MLX90632(this->_i2c, i2cAddress);
} else if (strcmp("mlx90632d_med", msgDeviceInitReq->i2c_device_name) == 0 ||
strcmp("mlx90632d_ext", msgDeviceInitReq->i2c_device_name) == 0) {
_mlx90632 = new WipperSnapper_I2C_Driver_MLX90632D(this->_i2c, i2cAddress);
if (!_mlx90632->begin()) {
WS_DEBUG_PRINTLN("ERROR: Failed to initialize MLX90632!");
_busStatusResponse =

View file

@ -181,7 +181,7 @@ private:
WipperSnapper_I2C_Driver_LTR390 *_ltr390 = nullptr;
WipperSnapper_I2C_Driver_MCP3421 *_mcp3421 = nullptr;
WipperSnapper_I2C_Driver_MCP9808 *_mcp9808 = nullptr;
WipperSnapper_I2C_Driver_MLX90632 *_mlx90632 = nullptr;
WipperSnapper_I2C_Driver_MLX90632D *_mlx90632 = nullptr;
WipperSnapper_I2C_Driver_MPL115A2 *_mpl115a2 = nullptr;
WipperSnapper_I2C_Driver_MPRLS *_mprls = nullptr;
WipperSnapper_I2C_Driver_MS8607 *_ms8607 = nullptr;

View file

@ -1,7 +1,7 @@
/*!
* @file WipperSnapper_I2C_Driver_MLX90632.h
*
* Device driver for a Melexis MLX90632 thermal FIR sensor.
* Device driver for a Melexis MLX90632-D (medical) thermal FIR sensor.
*
* Adafruit invests time and resources providing this open source code,
* please support Adafruit and open-source hardware by purchasing
@ -22,10 +22,10 @@
/**************************************************************************/
/*!
@brief Sensor driver for the Melexis MLX90632 temperature sensor.
@brief Sensor driver for the Melexis MLX90632-D temperature sensor.
*/
/**************************************************************************/
class WipperSnapper_I2C_Driver_MLX90632 : public WipperSnapper_I2C_Driver {
class WipperSnapper_I2C_Driver_MLX90632D : public WipperSnapper_I2C_Driver {
public:
/*******************************************************************************/
/*!
@ -36,7 +36,7 @@ public:
7-bit device address.
*/
/*******************************************************************************/
WipperSnapper_I2C_Driver_MLX90632(TwoWire *i2c, uint16_t sensorAddress)
WipperSnapper_I2C_Driver_MLX90632D(TwoWire *i2c, uint16_t sensorAddress)
: WipperSnapper_I2C_Driver(i2c, sensorAddress) {
_i2c = i2c;
_sensorAddress = sensorAddress;
@ -50,7 +50,7 @@ public:
@brief Destructor for an MLX90632 sensor.
*/
/*******************************************************************************/
~WipperSnapper_I2C_Driver_MLX90632() { delete _mlx90632; }
~WipperSnapper_I2C_Driver_MLX90632D() { delete _mlx90632; }
/*******************************************************************************/
/*!
@ -70,10 +70,12 @@ public:
/*******************************************************************************/
/*!
@brief Configures the MLX90632 sensor and prints its information.
@param extendedInsteadOfMedicalRange
If true, configures the sensor for extended temperature range/acc.
@returns True if configuration fetching and setting were successful.
*/
/*******************************************************************************/
bool ConfigureAndPrintSensorInfo() {
bool ConfigureAndPrintSensorInfo(bool extendedInsteadOfMedicalRange = false) {
// Reset the device
if (!_mlx90632->reset()) {
WS_PRINTER.println(F("Device reset failed"));