Skip to content

Commit 54ee1a6

Browse files
committed
refactor(mlx90632): use -d model distinction for medical
1 parent e873237 commit 54ee1a6

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

src/components/i2c/WipperSnapper_I2C.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,8 +537,9 @@ bool WipperSnapper_Component_I2C::initI2CDevice(
537537
_mcp9808->configureDriver(msgDeviceInitReq);
538538
drivers.push_back(_mcp9808);
539539
WS_DEBUG_PRINTLN("MCP9808 Initialized Successfully!");
540-
} else if (strcmp("mlx90632", msgDeviceInitReq->i2c_device_name) == 0) {
541-
_mlx90632 = new WipperSnapper_I2C_Driver_MLX90632(this->_i2c, i2cAddress);
540+
} else if (strcmp("mlx90632d_med", msgDeviceInitReq->i2c_device_name) == 0 ||
541+
strcmp("mlx90632d_ext", msgDeviceInitReq->i2c_device_name) == 0) {
542+
_mlx90632 = new WipperSnapper_I2C_Driver_MLX90632D(this->_i2c, i2cAddress);
542543
if (!_mlx90632->begin()) {
543544
WS_DEBUG_PRINTLN("ERROR: Failed to initialize MLX90632!");
544545
_busStatusResponse =

src/components/i2c/WipperSnapper_I2C.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ class WipperSnapper_Component_I2C {
181181
WipperSnapper_I2C_Driver_LTR390 *_ltr390 = nullptr;
182182
WipperSnapper_I2C_Driver_MCP3421 *_mcp3421 = nullptr;
183183
WipperSnapper_I2C_Driver_MCP9808 *_mcp9808 = nullptr;
184-
WipperSnapper_I2C_Driver_MLX90632 *_mlx90632 = nullptr;
184+
WipperSnapper_I2C_Driver_MLX90632D *_mlx90632 = nullptr;
185185
WipperSnapper_I2C_Driver_MPL115A2 *_mpl115a2 = nullptr;
186186
WipperSnapper_I2C_Driver_MPRLS *_mprls = nullptr;
187187
WipperSnapper_I2C_Driver_MS8607 *_ms8607 = nullptr;

src/components/i2c/drivers/WipperSnapper_I2C_Driver_MLX90632.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*!
22
* @file WipperSnapper_I2C_Driver_MLX90632.h
33
*
4-
* Device driver for a Melexis MLX90632 thermal FIR sensor.
4+
* Device driver for a Melexis MLX90632-D (medical) thermal FIR sensor.
55
*
66
* Adafruit invests time and resources providing this open source code,
77
* please support Adafruit and open-source hardware by purchasing
@@ -22,10 +22,10 @@
2222

2323
/**************************************************************************/
2424
/*!
25-
@brief Sensor driver for the Melexis MLX90632 temperature sensor.
25+
@brief Sensor driver for the Melexis MLX90632-D temperature sensor.
2626
*/
2727
/**************************************************************************/
28-
class WipperSnapper_I2C_Driver_MLX90632 : public WipperSnapper_I2C_Driver {
28+
class WipperSnapper_I2C_Driver_MLX90632D : public WipperSnapper_I2C_Driver {
2929
public:
3030
/*******************************************************************************/
3131
/*!
@@ -36,7 +36,7 @@ class WipperSnapper_I2C_Driver_MLX90632 : public WipperSnapper_I2C_Driver {
3636
7-bit device address.
3737
*/
3838
/*******************************************************************************/
39-
WipperSnapper_I2C_Driver_MLX90632(TwoWire *i2c, uint16_t sensorAddress)
39+
WipperSnapper_I2C_Driver_MLX90632D(TwoWire *i2c, uint16_t sensorAddress)
4040
: WipperSnapper_I2C_Driver(i2c, sensorAddress) {
4141
_i2c = i2c;
4242
_sensorAddress = sensorAddress;
@@ -50,7 +50,7 @@ class WipperSnapper_I2C_Driver_MLX90632 : public WipperSnapper_I2C_Driver {
5050
@brief Destructor for an MLX90632 sensor.
5151
*/
5252
/*******************************************************************************/
53-
~WipperSnapper_I2C_Driver_MLX90632() { delete _mlx90632; }
53+
~WipperSnapper_I2C_Driver_MLX90632D() { delete _mlx90632; }
5454

5555
/*******************************************************************************/
5656
/*!
@@ -70,10 +70,12 @@ class WipperSnapper_I2C_Driver_MLX90632 : public WipperSnapper_I2C_Driver {
7070
/*******************************************************************************/
7171
/*!
7272
@brief Configures the MLX90632 sensor and prints its information.
73+
@param extendedInsteadOfMedicalRange
74+
If true, configures the sensor for extended temperature range/acc.
7375
@returns True if configuration fetching and setting were successful.
7476
*/
7577
/*******************************************************************************/
76-
bool ConfigureAndPrintSensorInfo() {
78+
bool ConfigureAndPrintSensorInfo(bool extendedInsteadOfMedicalRange = false) {
7779
// Reset the device
7880
if (!_mlx90632->reset()) {
7981
WS_PRINTER.println(F("Device reset failed"));

0 commit comments

Comments
 (0)