From 35be9e57d1f8cd94355e18f62f70c1bab9d6fd7f Mon Sep 17 00:00:00 2001 From: tyeth Date: Mon, 13 Feb 2023 16:28:32 +0000 Subject: [PATCH] Add SHT20 using si7021 driver --- src/components/i2c/WipperSnapper_I2C.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/i2c/WipperSnapper_I2C.cpp b/src/components/i2c/WipperSnapper_I2C.cpp index 316132fc6..4aa40649c 100644 --- a/src/components/i2c/WipperSnapper_I2C.cpp +++ b/src/components/i2c/WipperSnapper_I2C.cpp @@ -270,17 +270,18 @@ bool WipperSnapper_Component_I2C::initI2CDevice( _scd30->configureDriver(msgDeviceInitReq); drivers.push_back(_scd30); WS_DEBUG_PRINTLN("SCD30 Initialized Successfully!"); - } else if (strcmp("si7021", msgDeviceInitReq->i2c_device_name) == 0) { + } else if ((strcmp("sht20", msgDeviceInitReq->i2c_device_name) == 0) || + (strcmp("si7021", msgDeviceInitReq->i2c_device_name) == 0)) { _si7021 = new WipperSnapper_I2C_Driver_SI7021(this->_i2c, i2cAddress); if (!_si7021->begin()) { - WS_DEBUG_PRINTLN("ERROR: Failed to initialize SI7021!"); + WS_DEBUG_PRINTLN("ERROR: Failed to initialize SI7021/SHT20!"); _busStatusResponse = wippersnapper_i2c_v1_BusResponse_BUS_RESPONSE_DEVICE_INIT_FAIL; return false; } _si7021->configureDriver(msgDeviceInitReq); drivers.push_back(_si7021); - WS_DEBUG_PRINTLN("SI7021 Initialized Successfully!"); + WS_DEBUG_PRINTLN("SI7021/SHT20 Initialized Successfully!"); } else if (strcmp("mcp9808", msgDeviceInitReq->i2c_device_name) == 0) { _mcp9808 = new WipperSnapper_I2C_Driver_MCP9808(this->_i2c, i2cAddress); if (!_mcp9808->begin()) {