Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions library/enviroplus/gas.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,19 @@ def __repr__(self):


def setup():
global adc, _is_setup
global adc, adc_type, _is_setup
if _is_setup:
return
_is_setup = True

adc = ads1015.ADS1015(i2c_addr=0x49)
adc_type = adc.detect_chip_type()
adc.set_mode('single')
adc.set_programmable_gain(MICS6814_GAIN)
adc.set_sample_rate(1600)
if adc_type == 'ADS1115':
adc.set_sample_rate(128)
else:
adc.set_sample_rate(1600)

GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
Expand Down
2 changes: 1 addition & 1 deletion library/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ install_requires =
pms5003
ltr559
st7735
ads1015
ads1015 >= 0.0.7
fonts
font-roboto
astral
Expand Down