Commit f67f9a6 1 parent d80c8b3 commit f67f9a6 Copy full SHA for f67f9a6
File tree 2 files changed +14
-5
lines changed
2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change 10
10
i2c = PimoroniI2C (I2C_SDA_PIN , I2C_SCL_PIN , 100000 )
11
11
i2c_devices = i2c .scan ()
12
12
model = None
13
- if 56 in i2c_devices : # 56 = colour / light sensor and only present on Indoor
13
+ if I2C_ADDR_BH1745 in i2c_devices : # colour / light sensor and only present on Indoor
14
14
model = "indoor"
15
- elif 35 in i2c_devices : # 35 = ltr-599 on grow & weather
15
+ elif I2C_ADDR_LTR559 in i2c_devices : # ltr-599 on grow & weather
16
16
pump3_pin = Pin (12 , Pin .IN , Pin .PULL_UP )
17
17
model = "grow" if pump3_pin .value () == False else "weather"
18
18
pump3_pin .init (pull = None )
@@ -33,9 +33,13 @@ def get_board():
33
33
34
34
# return any additional sensors connected with Qw/ST
35
35
def get_additional_sensors ():
36
- if 98 in i2c_devices :
37
- import enviro .sensors .scd41 as scd41
38
- yield scd41
36
+ if I2C_ADDR_SCD41 in i2c_devices :
37
+ try :
38
+ import enviro .sensors .scd41 as scd41
39
+ yield scd41
40
+ except RuntimeError :
41
+ # Likely another device present on the SCD41 address
42
+ pass
39
43
40
44
# set up the activity led
41
45
# ===========================================================================
Original file line number Diff line number Diff line change 47
47
WATER_VAPOR_SPECIFIC_GAS_CONSTANT = 461.5
48
48
CRITICAL_WATER_TEMPERATURE = 647.096
49
49
CRITICAL_WATER_PRESSURE = 22064000
50
+
51
+ # I2C addresses
52
+ I2C_ADDR_BH1745 = 0x38
53
+ I2C_ADDR_LTR559 = 0x23
54
+ I2C_ADDR_SCD41 = 0x62
You can’t perform that action at this time.
0 commit comments