|
|
|
@ -35,6 +35,12 @@ static Adafruit_BMP280 BMP280; |
|
|
|
static Adafruit_SHTC3 SHTC3; |
|
|
|
#endif |
|
|
|
|
|
|
|
#if ENV_INCLUDE_SHT4X |
|
|
|
#define TELEM_SHT4X_ADDRESS 0x44 //0x44 - 0x46
|
|
|
|
#include <SensirionI2cSht4x.h> |
|
|
|
static SensirionI2cSht4x SHT4X; |
|
|
|
#endif |
|
|
|
|
|
|
|
#if ENV_INCLUDE_LPS22HB |
|
|
|
#include <Arduino_LPS22HB.h> |
|
|
|
#endif |
|
|
|
@ -53,6 +59,12 @@ static Adafruit_INA3221 INA3221; |
|
|
|
static Adafruit_INA219 INA219(TELEM_INA219_ADDRESS); |
|
|
|
#endif |
|
|
|
|
|
|
|
#if ENV_INCLUDE_INA260 |
|
|
|
#define TELEM_INA260_ADDRESS 0x41 // INA260 single channel current sensor I2C address
|
|
|
|
#include <Adafruit_INA260.h> |
|
|
|
static Adafruit_INA260 INA260; |
|
|
|
#endif |
|
|
|
|
|
|
|
#if ENV_INCLUDE_MLX90614 |
|
|
|
#define TELEM_MLX90614_ADDRESS 0x5A // MLX90614 IR temperature sensor I2C address
|
|
|
|
#include <Adafruit_MLX90614.h> |
|
|
|
@ -130,6 +142,21 @@ bool EnvironmentSensorManager::begin() { |
|
|
|
} |
|
|
|
#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 (BARO.begin()) { |
|
|
|
MESH_DEBUG_PRINTLN("Found sensor: LPS22HB"); |
|
|
|
@ -165,6 +192,16 @@ bool EnvironmentSensorManager::begin() { |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
#if ENV_INCLUDE_INA260 |
|
|
|
if (INA260.begin(TELEM_INA260_ADDRESS, TELEM_WIRE)) { |
|
|
|
MESH_DEBUG_PRINTLN("Found INA260 at address: %02X", TELEM_INA260_ADDRESS); |
|
|
|
INA260_initialized = true; |
|
|
|
} else { |
|
|
|
INA260_initialized = false; |
|
|
|
MESH_DEBUG_PRINTLN("INA260 was not found at I2C address %02X", TELEM_INA219_ADDRESS); |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
#if ENV_INCLUDE_MLX90614 |
|
|
|
if (MLX90614.begin(TELEM_MLX90614_ADDRESS, TELEM_WIRE)) { |
|
|
|
MESH_DEBUG_PRINTLN("Found MLX90614 at address: %02X", TELEM_MLX90614_ADDRESS); |
|
|
|
@ -233,6 +270,18 @@ bool EnvironmentSensorManager::querySensors(uint8_t requester_permissions, Cayen |
|
|
|
} |
|
|
|
#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 (LPS22HB_initialized) { |
|
|
|
telemetry.addTemperature(TELEM_CHANNEL_SELF, BARO.readTemperature()); |
|
|
|
@ -265,6 +314,15 @@ bool EnvironmentSensorManager::querySensors(uint8_t requester_permissions, Cayen |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
#if ENV_INCLUDE_INA260 |
|
|
|
if (INA260_initialized) { |
|
|
|
telemetry.addVoltage(next_available_channel, INA260.readBusVoltage() / 1000); |
|
|
|
telemetry.addCurrent(next_available_channel, INA260.readCurrent() / 1000); |
|
|
|
telemetry.addPower(next_available_channel, INA260.readPower() / 1000); |
|
|
|
next_available_channel++; |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
#if ENV_INCLUDE_MLX90614 |
|
|
|
if (MLX90614_initialized) { |
|
|
|
telemetry.addTemperature(TELEM_CHANNEL_SELF, MLX90614.readObjectTempC()); |
|
|
|
|