@@ -103,6 +103,11 @@ void menuAttachedDevices()
103
103
functionPointers[availableDevices - 1 ] = menuConfigure_SCD30;
104
104
Serial.printf (" %d) SCD30 CO2 Sensor\n " , availableDevices++);
105
105
}
106
+ if (qwiicAvailable.MS8607 )
107
+ {
108
+ functionPointers[availableDevices - 1 ] = menuConfigure_MS8607;
109
+ Serial.printf (" %d) MS8607 Pressure Humidity Temperature Sensor\n " , availableDevices++);
110
+ }
106
111
107
112
Serial.println (" x) Exit" );
108
113
@@ -155,6 +160,7 @@ bool detectQwiicDevices()
155
160
#define ADR_VEML6075 0x10
156
161
#define ADR_NAU7802 0x2A
157
162
#define ADR_VL53L1X 0x29
163
+ #define ADR_MS8607 0x40 // Humidity portion of the MS8607 sensor
158
164
#define ADR_UBLOX 0x42
159
165
#define ADR_TMP117 0x48 // Alternates: 0x49, 0x4A, and 0x4B
160
166
#define ADR_SGP30 0x58
@@ -167,6 +173,7 @@ bool detectQwiicDevices()
167
173
#define ADR_MCP9600_1 0x66
168
174
#define ADR_BME280_2 0x76
169
175
#define ADR_MS5637 0x76
176
+ // #define ADR_MS8607 0x76 //Pressure portion of the MS8607 sensor. We'll catch the 0x40 first
170
177
#define ADR_BME280_1 0x77
171
178
172
179
// Given an address, see if it repsonds as we would expect
@@ -230,13 +237,23 @@ bool testDevice(uint8_t i2cAddress)
230
237
qwiicAvailable.VEML6075 = true ;
231
238
break ;
232
239
case ADR_MS5637:
233
- if (pressureSensor_MS5637.begin (qwiic) == true ) // Wire port
234
- qwiicAvailable.MS5637 = true ;
235
- break ;
240
+ {
241
+ // By the time we hit this address, MS8607 should have already been started by its first address
242
+ if (qwiicAvailable.MS8607 == false )
243
+ {
244
+ if (pressureSensor_MS5637.begin (qwiic) == true ) // Wire port
245
+ qwiicAvailable.MS5637 = true ;
246
+ }
247
+ break ;
248
+ }
236
249
case ADR_SCD30:
237
250
if (co2Sensor_SCD30.begin (qwiic) == true ) // Wire port
238
251
qwiicAvailable.SCD30 = true ;
239
252
break ;
253
+ case ADR_MS8607:
254
+ if (pressureSensor_MS8607.begin (qwiic) == true ) // Wire port. Tests for both 0x40 and 0x76 I2C addresses.
255
+ qwiicAvailable.MS8607 = true ;
256
+ break ;
240
257
default :
241
258
Serial.printf (" Unknown device at address 0x%02X\n " , i2cAddress);
242
259
return false ;
@@ -1193,3 +1210,126 @@ void menuConfigure_SCD30()
1193
1210
1194
1211
qwiicOnline.SCD30 = false ; // Mark as offline so it will be started with new settings
1195
1212
}
1213
+
1214
+ void menuConfigure_MS8607 ()
1215
+ {
1216
+ while (1 )
1217
+ {
1218
+ Serial.println ();
1219
+ Serial.println (" Menu: Configure MS8607 Pressure Humidity Temperature (PHT) Sensor" );
1220
+
1221
+ Serial.print (" 1) Sensor Logging: " );
1222
+ if (settings.sensor_MS8607 .log == true ) Serial.println (" Enabled" );
1223
+ else Serial.println (" Disabled" );
1224
+
1225
+ if (settings.sensor_MS8607 .log == true )
1226
+ {
1227
+ Serial.print (" 2) Log Pressure: " );
1228
+ if (settings.sensor_MS8607 .logPressure == true ) Serial.println (" Enabled" );
1229
+ else Serial.println (" Disabled" );
1230
+
1231
+ Serial.print (" 3) Log Humidity: " );
1232
+ if (settings.sensor_MS8607 .logHumidity == true ) Serial.println (" Enabled" );
1233
+ else Serial.println (" Disabled" );
1234
+
1235
+ Serial.print (" 4) Log Temperature: " );
1236
+ if (settings.sensor_MS8607 .logTemperature == true ) Serial.println (" Enabled" );
1237
+ else Serial.println (" Disabled" );
1238
+
1239
+ Serial.print (" 5) Heater: " );
1240
+ if (settings.sensor_MS8607 .enableHeater == true ) Serial.println (" Enabled" );
1241
+ else Serial.println (" Disabled" );
1242
+
1243
+ Serial.print (" 6) Set Pressure Resolution: " );
1244
+ if (settings.sensor_MS8607 .pressureResolution == MS8607_pressure_resolution_osr_256)
1245
+ Serial.print (" 0.11" );
1246
+ else if (settings.sensor_MS8607 .pressureResolution == MS8607_pressure_resolution_osr_512)
1247
+ Serial.print (" 0.062" );
1248
+ else if (settings.sensor_MS8607 .pressureResolution == MS8607_pressure_resolution_osr_1024)
1249
+ Serial.print (" 0.039" );
1250
+ else if (settings.sensor_MS8607 .pressureResolution == MS8607_pressure_resolution_osr_2048)
1251
+ Serial.print (" 0.028" );
1252
+ else if (settings.sensor_MS8607 .pressureResolution == MS8607_pressure_resolution_osr_4096)
1253
+ Serial.print (" 0.021" );
1254
+ else if (settings.sensor_MS8607 .pressureResolution == MS8607_pressure_resolution_osr_8192)
1255
+ Serial.print (" 0.016" );
1256
+ Serial.println (" mbar" );
1257
+
1258
+ Serial.print (" 7) Set Humidity Resolution: " );
1259
+ if (settings.sensor_MS8607 .humidityResolution == MS8607_humidity_resolution_8b)
1260
+ Serial.print (" 8" );
1261
+ else if (settings.sensor_MS8607 .humidityResolution == MS8607_humidity_resolution_10b)
1262
+ Serial.print (" 10" );
1263
+ else if (settings.sensor_MS8607 .humidityResolution == MS8607_humidity_resolution_11b)
1264
+ Serial.print (" 11" );
1265
+ else if (settings.sensor_MS8607 .humidityResolution == MS8607_humidity_resolution_12b)
1266
+ Serial.print (" 12" );
1267
+ Serial.println (" bits" );
1268
+ }
1269
+ Serial.println (" x) Exit" );
1270
+
1271
+ byte incoming = getByteChoice (menuTimeout); // Timeout after x seconds
1272
+
1273
+ if (incoming == ' 1' )
1274
+ settings.sensor_MS8607 .log ^= 1 ;
1275
+ else if (settings.sensor_MS8607 .log == true )
1276
+ {
1277
+ if (incoming == ' 2' )
1278
+ settings.sensor_MS8607 .logPressure ^= 1 ;
1279
+ else if (incoming == ' 3' )
1280
+ settings.sensor_MS8607 .logHumidity ^= 1 ;
1281
+ else if (incoming == ' 4' )
1282
+ settings.sensor_MS8607 .logTemperature ^= 1 ;
1283
+ else if (incoming == ' 5' )
1284
+ settings.sensor_MS8607 .enableHeater ^= 1 ;
1285
+ else if (incoming == ' 6' )
1286
+ {
1287
+ Serial.println (" Set Pressure Resolution:" );
1288
+ Serial.println (" 1) 0.11 mbar" );
1289
+ Serial.println (" 2) 0.062 mbar" );
1290
+ Serial.println (" 3) 0.039 mbar" );
1291
+ Serial.println (" 4) 0.028 mbar" );
1292
+ Serial.println (" 5) 0.021 mbar" );
1293
+ Serial.println (" 6) 0.016 mbar" );
1294
+ int amt = getNumber (menuTimeout); // x second timeout
1295
+ if (amt >= 1 && amt <= 6 )
1296
+ settings.sensor_MS8607 .pressureResolution = (MS8607_pressure_resolution)(amt - 1 );
1297
+ else
1298
+ Serial.println (" Error: Out of range" );
1299
+ }
1300
+ else if (incoming == ' 7' )
1301
+ {
1302
+ Serial.println (" Set Humidity Resolution:" );
1303
+ Serial.println (" 1) 8 bit" );
1304
+ Serial.println (" 2) 10 bit" );
1305
+ Serial.println (" 3) 11 bit" );
1306
+ Serial.println (" 4) 12 bit" );
1307
+ int amt = getNumber (menuTimeout); // x second timeout
1308
+ if (amt >= 1 && amt <= 4 )
1309
+ {
1310
+ // Unfortunately these enums aren't sequential so we have to lookup
1311
+ if (amt == 1 ) settings.sensor_MS8607 .humidityResolution = MS8607_humidity_resolution_8b;
1312
+ if (amt == 2 ) settings.sensor_MS8607 .humidityResolution = MS8607_humidity_resolution_10b;
1313
+ if (amt == 3 ) settings.sensor_MS8607 .humidityResolution = MS8607_humidity_resolution_11b;
1314
+ if (amt == 4 ) settings.sensor_MS8607 .humidityResolution = MS8607_humidity_resolution_12b;
1315
+ }
1316
+ else
1317
+ Serial.println (" Error: Out of range" );
1318
+ }
1319
+ else if (incoming == ' x' )
1320
+ break ;
1321
+ else if (incoming == STATUS_GETBYTE_TIMEOUT)
1322
+ break ;
1323
+ else
1324
+ printUnknown (incoming);
1325
+ }
1326
+ else if (incoming == ' x' )
1327
+ break ;
1328
+ else if (incoming == STATUS_GETBYTE_TIMEOUT)
1329
+ break ;
1330
+ else
1331
+ printUnknown (incoming);
1332
+ }
1333
+
1334
+ qwiicOnline.MS8607 = false ; // Mark as offline so it will be started with new settings
1335
+ }
0 commit comments