File tree Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change 1010i2c = PimoroniI2C (I2C_SDA_PIN , I2C_SCL_PIN , 100000 )
1111i2c_devices = i2c .scan ()
1212model = 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
1414 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
1616 pump3_pin = Pin (12 , Pin .IN , Pin .PULL_UP )
1717 model = "grow" if pump3_pin .value () == False else "weather"
1818 pump3_pin .init (pull = None )
@@ -33,9 +33,13 @@ def get_board():
3333
3434# return any additional sensors connected with Qw/ST
3535def 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
3943
4044# set up the activity led
4145# ===========================================================================
Original file line number Diff line number Diff line change 4747WATER_VAPOR_SPECIFIC_GAS_CONSTANT = 461.5
4848CRITICAL_WATER_TEMPERATURE = 647.096
4949CRITICAL_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