Support for Sensirion SHT4x
This commit is contained in:
@@ -35,6 +35,12 @@ static Adafruit_BMP280 BMP280;
|
|||||||
static Adafruit_SHTC3 SHTC3;
|
static Adafruit_SHTC3 SHTC3;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if ENV_INCLUDE_SHT4X
|
||||||
|
#define TELEM_SHT4X_ADDRESS 0x44 //0x44 - 0x46
|
||||||
|
#include <SensirionI2cSht4x.h>
|
||||||
|
static SensirionI2cSht4x SHT4X;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if ENV_INCLUDE_LPS22HB
|
#if ENV_INCLUDE_LPS22HB
|
||||||
#include <Arduino_LPS22HB.h>
|
#include <Arduino_LPS22HB.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -136,6 +142,21 @@ bool EnvironmentSensorManager::begin() {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if ENV_INCLUDE_SHT4X
|
||||||
|
SHT4X.begin(*TELEM_WIRE, TELEM_SHT4X_ADDRESS);
|
||||||
|
uint32_t serialNumber = 0;
|
||||||
|
int16_t sht4x_error;
|
||||||
|
sht4x_error = SHT4X.serialNumber(serialNumber);
|
||||||
|
if (sht4x_error == 0) {
|
||||||
|
MESH_DEBUG_PRINTLN("Found SHT4X at address: %02X", TELEM_SHT4X_ADDRESS);
|
||||||
|
SHT4X_initialized = true;
|
||||||
|
} else {
|
||||||
|
SHT4X_initialized = false;
|
||||||
|
MESH_DEBUG_PRINTLN("SHT4X was not found at I2C address %02X", TELEM_SHT4X_ADDRESS);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if ENV_INCLUDE_LPS22HB
|
#if ENV_INCLUDE_LPS22HB
|
||||||
if (BARO.begin()) {
|
if (BARO.begin()) {
|
||||||
MESH_DEBUG_PRINTLN("Found sensor: LPS22HB");
|
MESH_DEBUG_PRINTLN("Found sensor: LPS22HB");
|
||||||
@@ -249,6 +270,18 @@ bool EnvironmentSensorManager::querySensors(uint8_t requester_permissions, Cayen
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if ENV_INCLUDE_SHT4X
|
||||||
|
if (SHT4X_initialized) {
|
||||||
|
float sht4x_humidity, sht4x_temperature;
|
||||||
|
int16_t sht4x_error;
|
||||||
|
sht4x_error = SHT4X.measureLowestPrecision(sht4x_temperature, sht4x_humidity);
|
||||||
|
if (sht4x_error == 0) {
|
||||||
|
telemetry.addTemperature(TELEM_CHANNEL_SELF, sht4x_temperature);
|
||||||
|
telemetry.addRelativeHumidity(TELEM_CHANNEL_SELF, sht4x_humidity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if ENV_INCLUDE_LPS22HB
|
#if ENV_INCLUDE_LPS22HB
|
||||||
if (LPS22HB_initialized) {
|
if (LPS22HB_initialized) {
|
||||||
telemetry.addTemperature(TELEM_CHANNEL_SELF, BARO.readTemperature());
|
telemetry.addTemperature(TELEM_CHANNEL_SELF, BARO.readTemperature());
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ protected:
|
|||||||
bool LPS22HB_initialized = false;
|
bool LPS22HB_initialized = false;
|
||||||
bool MLX90614_initialized = false;
|
bool MLX90614_initialized = false;
|
||||||
bool VL53L0X_initialized = false;
|
bool VL53L0X_initialized = false;
|
||||||
|
bool SHT4X_initialized = false;
|
||||||
|
|
||||||
bool gps_detected = false;
|
bool gps_detected = false;
|
||||||
bool gps_active = false;
|
bool gps_active = false;
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ build_flags = ${nrf52_base.build_flags}
|
|||||||
-D ENV_INCLUDE_INA3221=1
|
-D ENV_INCLUDE_INA3221=1
|
||||||
-D ENV_INCLUDE_INA219=1
|
-D ENV_INCLUDE_INA219=1
|
||||||
-D ENV_INCLUDE_INA260=1
|
-D ENV_INCLUDE_INA260=1
|
||||||
|
-D ENV_INCLUDE_SHT4X=1
|
||||||
build_src_filter = ${nrf52_base.build_src_filter}
|
build_src_filter = ${nrf52_base.build_src_filter}
|
||||||
+<../variants/rak4631>
|
+<../variants/rak4631>
|
||||||
+<helpers/sensors>
|
+<helpers/sensors>
|
||||||
@@ -42,7 +43,8 @@ lib_deps =
|
|||||||
adafruit/Adafruit BMP280 Library @ ^2.6.8
|
adafruit/Adafruit BMP280 Library @ ^2.6.8
|
||||||
adafruit/Adafruit SHTC3 Library @ ^1.0.1
|
adafruit/Adafruit SHTC3 Library @ ^1.0.1
|
||||||
adafruit/Adafruit INA260 Library @ ^1.5.3
|
adafruit/Adafruit INA260 Library @ ^1.5.3
|
||||||
sparkfun/SparkFun u-blox GNSS Arduino Library@^2.2.27
|
sparkfun/SparkFun u-blox GNSS Arduino Library @ ^2.2.27
|
||||||
|
sensirion/Sensirion I2C SHT4x @ ^1.1.2
|
||||||
|
|
||||||
[env:RAK_4631_Repeater]
|
[env:RAK_4631_Repeater]
|
||||||
extends = rak4631
|
extends = rak4631
|
||||||
|
|||||||
Reference in New Issue
Block a user