espurna
espurna copied to clipboard
Generic implementation of I2C ADC extenders like ADS1115, ADC121
Although there is support for I2C ADC extenders, they are implemented for energy measurement.
Would it be a good idea to just have like a generic ADS1x15 with raw outputs (like the internal ESP8266 ADC), to be used for whatever (voltage measurement, NTC, etc)?
Hi, the same issue here. I've bought an ADS1115 to use it as 4 Channel analog Input like the A0 from the ESP8266. It would be nice to get this feature. Thanks.
See also #199 and #1311
As referenced in the commit, there is now EmonADS1X115Sensor::I2CPort:
https://github.com/xoseperez/espurna/blob/44298d4077ffd146c61eea7424b394167093a5d0/code/espurna/sensor.cpp#L1871-L1872
where I2CPort::read(N)
is effectively an analogRead(N)
Only noticed the issue after the fact though. I guess it could be further modified as something virtual once again so there's a generic virtual unsigned int Class::analogRead(int channel);
, but not inheriting from the BaseSensor stuff.
edit: or, make it chain with baseanalogsensor, and simply make another class