@@ -14,18 +14,20 @@ Average<float> avg_a(20);
14
14
// SHT21
15
15
// HTU21D
16
16
//
17
- // BMP280
17
+ // BMP280 - !reads 40k alt when offline, 0 psi, 0 temp
18
18
// BME280
19
- // CS811
19
+ // CS811 - CO2
20
20
// TSL2561
21
21
// BH1750 https://github.com/claws/BH1750
22
22
// APDS9960
23
23
// GP2Y
24
24
// PM Dust sensors https://github.com/avaldebe/PMserial
25
25
// MPU6050
26
26
// PCF8591
27
- // scd4x C02 sensor
27
+ // SCD4x CO2 sensor
28
28
// VEML6070 // UV
29
+ // SI7021
30
+ // AHTx0 - T/H
29
31
30
32
// NOT IMPLEMENTED @TODO
31
33
// HMC5883L
@@ -34,6 +36,10 @@ Average<float> avg_a(20);
34
36
// INA219
35
37
// MCP4725
36
38
// MCP3421
39
+ // SGP30 - tvoc
40
+ // SGP40 - tvoc
41
+ // SGP41 - tvoc
42
+ // ENS160 - CO2
37
43
38
44
// BUGS
39
45
// sensors do not reinit is they drop out, add heathcheck()
@@ -48,15 +54,20 @@ Average<float> avg_a(20);
48
54
// MOTION
49
55
#define MPU6050 // MPU 6050 GY521 3axis gyro/accel
50
56
#define HMC5883L // NI Honeywell HMC5883L
51
-
57
+ # define MLX90393 // 3 axis magnetometer
52
58
53
59
// TEMP/HUMIDITY/GAS
54
60
#define SI7021
61
+
55
62
#define AHTX0
56
63
64
+ // Sensiron
57
65
#define USESHT31 // SHT31 Temp/Humidity
58
66
#define USESHT21 // SHT21 / HTU21D Temp/Humidity
59
67
68
+
69
+ // BOSCH
70
+
60
71
// #define USEBMP180 // BMP180 Temp/Pressure/Altitude (replaces BMP085) https://www.adafruit.com/product/1603
61
72
/*
62
73
Vin: 3 to 5VDC
@@ -66,7 +77,6 @@ Up to 0.03hPa / 0.25m resolution
66
77
-40 to +85°C operational range, +-2°C temperature accuracy
67
78
This board/chip uses I2C 7-bit address 0x77.
68
79
*/
69
-
70
80
#define USEBMP280 // BMP280 Temp/Pressure/Altitude (upgrade for BMP085/BMP180/BMP183)
71
81
// #define USEBME280 // BME280 Humidity/Pressure/Altitude
72
82
// Pressure: 300...1100 hPa
@@ -137,7 +147,6 @@ Interface: I2C
137
147
#define MAX9814 // MAX9814 Auto GC amplifier
138
148
#define MAX4466 // MAX4466 Adj GC amplifier
139
149
140
-
141
150
// Energy
142
151
#define INA219 // INA219 current sense
143
152
@@ -147,16 +156,20 @@ Interface: I2C
147
156
// #define PCF8591 // PCF8591 io expander
148
157
149
158
159
+ // ADDRESSES
160
+
150
161
// 0x23 0x46 BH1750
151
- // 0x38 0x70
152
- // 0x39 0x72 APDS9960 / TSL2561
162
+ // 0x38 0x70 VEML6070 / AHTx0
163
+ // 0x39 0x72 APDS9960 / TSL2561 / VEML6070 / AHTx0
153
164
// 0x3C 0x78
154
165
// 0x44 0x88
155
166
// 0x48 0x90
156
167
// 0x5A 0xB4 CS811
157
168
// 0x62 0xC4 SCD4X
158
169
// 0x68 0xD0
159
170
// 0x76 0xEC
171
+ // 0x77 0xEE
172
+ // 0x0D 0x1A MLX90393
160
173
161
174
/*
162
175
#ifdef ENV_TEMPLATE
@@ -766,7 +779,7 @@ bool init_apds(){
766
779
}
767
780
768
781
void init_apds_color (){
769
- // enable color sensign mode
782
+ // enable color sensing mode
770
783
apds.enableColor (true );
771
784
}
772
785
@@ -806,11 +819,11 @@ String get_apds_gesture(){
806
819
}
807
820
808
821
void print_apds_color (){
809
- uint16_t r, g, b, c;
810
-
822
+ uint16_t r, g, b, c, cnt;
811
823
// wait for color data to be ready
812
- while (!apds.colorDataReady ()){
824
+ while (!apds.colorDataReady () && cnt < 100 ){
813
825
delay (5 );
826
+ cnt++;
814
827
}
815
828
816
829
// get the data and print the different channels
@@ -826,12 +839,15 @@ void print_apds_color(){
826
839
827
840
Logger.print (" clear: " );
828
841
Logger.println (c);
829
- Logger.println ();
842
+ Logger.println ();
830
843
}
831
844
832
845
float get_apds_color (uint8_t channel = 0 ){
833
846
// print_apds_color();
834
847
uint16_t r, g, b, c;
848
+ while (!apds.colorDataReady ()){
849
+ delay (5 );
850
+ }
835
851
if (!apds.colorDataReady ()) return 0 ;
836
852
apds.getColorData (&r, &g, &b, &c);
837
853
if (channel == 0 ) return r;
@@ -910,11 +926,13 @@ Adafruit_SHT31 sht31 = Adafruit_SHT31();
910
926
#ifdef USEBMP280
911
927
#include < Adafruit_BMP280.h>
912
928
Adafruit_BMP280 bmp; // I2C
929
+ // #define BMP280_ADDRESS (0x77) /**< The default I2C address for the sensor. */
930
+ // #define BMP280_ADDRESS_ALT (0x76)
913
931
#endif
914
932
915
933
#ifdef USEBMP280
916
934
void init_bmp280 (){
917
- if (!bmp.begin (BMP280_ADDRESS_ALT )) {
935
+ if (!bmp.begin (BMP280_ADDRESS )) {
918
936
Logger.println (F (" [ERROR] BMP280 init FAILED" ));
919
937
}
920
938
else Logger.println (F (" [ENV] BMP280 is ACTIVE" ));
@@ -1355,6 +1373,8 @@ float get_bmp180(uint8_t channel = 0){
1355
1373
1356
1374
1357
1375
#ifdef AHTX0
1376
+ // #define AHTX0_I2CADDR_DEFAULT 0x38 ///< AHT default i2c address
1377
+ // #define AHTX0_I2CADDR_ALTERNATE 0x39 ///< AHT alternate i2c address
1358
1378
#include < Adafruit_AHTX0.h>
1359
1379
Adafruit_AHTX0 aht;
1360
1380
0 commit comments