kizniche / Mycodo

An environmental monitoring and regulation system
http://kylegabriel.com/projects/
GNU General Public License v3.0
2.99k stars 499 forks source link

ADS1115 channels 2,3,4 #911

Closed pduke closed 3 years ago

pduke commented 3 years ago

Describe the problem/bug

Attempting to read values from ADS1115 channels 2, 3, and 4. Channel 1 value is returned for all 4 channels. I discovered it works with ads1x15 version but not circuitpython version of input.

I found channel 0 was hard coded in the measure function. Changed it to the local variable "channel" and it works fine now.

Both files in .../inputs need the fix - ads1015_circuitpython.py ads1115_circuitpython.py

Go down to line 154 - chan = self.analog_in(self.adc, self.ads.P0) change to use the channel variable rather than P0 chan = self.analog_in(self.adc, channel)

Versions:

kizniche commented 3 years ago

Thanks for the bug report. I'll incorporate this fix for the next release.