@@ -24,6 +24,14 @@ static Adafruit_BME280 BME280;
2424static Adafruit_BMP280 BMP280;
2525#endif
2626
27+ #if ENV_INCLUDE_SHTC3
28+ #include < Adafruit_SHTC3.h>
29+ static Adafruit_SHTC3 SHTC3;
30+ #endif
31+
32+ #if ENV_INCLUDE_LPS22HB
33+ #include < Arduino_LPS22HB.h>
34+ #endif
2735
2836#if ENV_INCLUDE_INA3221
2937#define TELEM_INA3221_ADDRESS 0x42 // INA3221 3 channel current sensor I2C address
@@ -76,28 +84,48 @@ bool EnvironmentSensorManager::begin() {
7684 }
7785 #endif
7886
87+ #if ENV_INCLUDE_SHTC3
88+ if (SHTC3.begin ()) {
89+ MESH_DEBUG_PRINTLN (" Found sensor: SHTC3" );
90+ SHTC3_initialized = true ;
91+ } else {
92+ SHTC3_initialized = false ;
93+ MESH_DEBUG_PRINTLN (" SHTC3 was not found at I2C address %02X" , 0x70 );
94+ }
95+ #endif
96+
97+ #if ENV_INCLUDE_LPS22HB
98+ if (BARO.begin ()) {
99+ MESH_DEBUG_PRINTLN (" Found sensor: LPS22HB" );
100+ LPS22HB_initialized = true ;
101+ } else {
102+ LPS22HB_initialized = false ;
103+ MESH_DEBUG_PRINTLN (" LPS22HB was not found at I2C address %02X" , 0x5C );
104+ }
105+ #endif
106+
79107 #if ENV_INCLUDE_INA3221
80108 if (INA3221.begin (TELEM_INA3221_ADDRESS, &Wire)) {
81- MESH_DEBUG_PRINTLN (" Found INA3221 at address: %02X" , TELEM_INA3221_ADDRESS);
82- MESH_DEBUG_PRINTLN (" %04X %04X" , INA3221.getDieID (), INA3221.getManufacturerID ());
109+ MESH_DEBUG_PRINTLN (" Found INA3221 at address: %02X" , TELEM_INA3221_ADDRESS);
110+ MESH_DEBUG_PRINTLN (" %04X %04X" , INA3221.getDieID (), INA3221.getManufacturerID ());
83111
84- for (int i = 0 ; i < 3 ; i++) {
85- INA3221.setShuntResistance (i, TELEM_INA3221_SHUNT_VALUE);
86- }
87- INA3221_initialized = true ;
112+ for (int i = 0 ; i < 3 ; i++) {
113+ INA3221.setShuntResistance (i, TELEM_INA3221_SHUNT_VALUE);
114+ }
115+ INA3221_initialized = true ;
88116 } else {
89- INA3221_initialized = false ;
90- MESH_DEBUG_PRINTLN (" INA3221 was not found at I2C address %02X" , TELEM_INA3221_ADDRESS);
117+ INA3221_initialized = false ;
118+ MESH_DEBUG_PRINTLN (" INA3221 was not found at I2C address %02X" , TELEM_INA3221_ADDRESS);
91119 }
92120 #endif
93121
94122 #if ENV_INCLUDE_INA219
95123 if (INA219.begin (&Wire)) {
96- MESH_DEBUG_PRINTLN (" Found INA219 at address: %02X" , TELEM_INA219_ADDRESS);
97- INA219_initialized = true ;
124+ MESH_DEBUG_PRINTLN (" Found INA219 at address: %02X" , TELEM_INA219_ADDRESS);
125+ INA219_initialized = true ;
98126 } else {
99- INA219_initialized = false ;
100- MESH_DEBUG_PRINTLN (" INA219 was not found at I2C address %02X" , TELEM_INA219_ADDRESS);
127+ INA219_initialized = false ;
128+ MESH_DEBUG_PRINTLN (" INA219 was not found at I2C address %02X" , TELEM_INA219_ADDRESS);
101129 }
102130 #endif
103131
@@ -139,6 +167,23 @@ bool EnvironmentSensorManager::querySensors(uint8_t requester_permissions, Cayen
139167 }
140168 #endif
141169
170+ #if ENV_INCLUDE_SHTC3
171+ if (SHTC3_initialized) {
172+ sensors_event_t humidity, temp;
173+ SHTC3.getEvent (&humidity, &temp);
174+
175+ telemetry.addTemperature (TELEM_CHANNEL_SELF, temp.temperature );
176+ telemetry.addRelativeHumidity (TELEM_CHANNEL_SELF, humidity.relative_humidity );
177+ }
178+ #endif
179+
180+ #if ENV_INCLUDE_LPS22HB
181+ if (LPS22HB_initialized) {
182+ telemetry.addTemperature (TELEM_CHANNEL_SELF, BARO.readTemperature ());
183+ telemetry.addBarometricPressure (TELEM_CHANNEL_SELF, BARO.readPressure ());
184+ }
185+ #endif
186+
142187 #if ENV_INCLUDE_INA3221
143188 if (INA3221_initialized) {
144189 for (int i = 0 ; i < TELEM_INA3221_NUM_CHANNELS; i++) {
@@ -157,10 +202,10 @@ bool EnvironmentSensorManager::querySensors(uint8_t requester_permissions, Cayen
157202
158203 #if ENV_INCLUDE_INA219
159204 if (INA219_initialized) {
160- telemetry.addVoltage (next_available_channel, INA219.getBusVoltage_V ());
161- telemetry.addCurrent (next_available_channel, INA219.getCurrent_mA () / 1000 );
162- telemetry.addPower (next_available_channel, INA219.getPower_mW () / 1000 );
163- next_available_channel++;
205+ telemetry.addVoltage (next_available_channel, INA219.getBusVoltage_V ());
206+ telemetry.addCurrent (next_available_channel, INA219.getCurrent_mA () / 1000 );
207+ telemetry.addPower (next_available_channel, INA219.getPower_mW () / 1000 );
208+ next_available_channel++;
164209 }
165210 #endif
166211
0 commit comments