Closed paweljasinski closed 6 years ago
Thanks for the tip. I am new here, so for me it is not obvious how far is the memory consumption an issue. We could make the type of the chip a parameter of the initialization. This will increase size of the module. Mostly parameter validation and different timer values. Alternatively, a chip type could be a build time parameter - the module is compiled either 1015 or 1115. Another, perhaps exotic requirements, is use of mixed setup. 1015 and 1115 in the same project. But before this, the module should support more than one chip - I don't believe the module in current state supports conveniently more than than one device.
Looking at the chip specs, I see no way to automate the initialization - from i2c side both chips appear identical. Actually when I think more about it, I could configure "conversion ready mode" and measure how long did it take. Unfortunately, this is only if "conversion pin ready" is wired.
I manage to add support for multiple devices as well as different device type ads1015. I also believe it will work unchanged with ads1x13 and ads1x14. The changes can be seen under https://github.com/paweljasinski/nodemcu-firmware/tree/new-ads1115. I would appreciate feedback before updating documentation and doing a PR.
PR merged. Thanks a lot for your contribution Pawel, very much appreciated!
Missing feature
When using ads1015 chip, the existing ads1115 module can be used. However, not everything maps 1:1.
The single shot mode, module programs an esp timer with the values which are incorrect. The interval values are longer than necessary (e.g. 10ms is programmed where 1ms would be sufficient)
Interpretation of constant values used to program sampling frequency is different (e.g. ads1115.DR_8SPS is equivalent of ads1015.DR_128SPS)
Justification
ads1015 breakout boards are is available from adafruiit and ali
Workarounds
ads1115module can be used in continuous mode
use ads1115 module as-is with known limitations