-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Frans ov ads1115 settings #15001
Frans ov ads1115 settings #15001
Conversation
Added setting of Single-Ended / Differential and voltage range of the ADS1115 sensor
The support for the ADS1115 Analog to Digital converter currently has hard-coded settings for input mode (Singel-Ended) and voltage range (6.144 mV). Using another mode or range would necessitate maintaining a specific image for each setting. This PR uses the sensor12 command to set input mode, Either Single-Ended or Differential and Voltage range. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution
I think the little change below would make it much more usefull
tasmota/xsns_12_ads1115.ino
Outdated
if (Ads1115.channels == ADS1115_SINGLE_CHANNELS) { | ||
config |= (ADS1115_REG_CONFIG_MUX_SINGLE_0 + (0x1000 * channel)); | ||
} else { | ||
config |= (ADS1115_REG_CONFIG_MUX_DIFF_0_1 + (0x1000 * channel)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So in single ended mode, as before, the driver supports channels 0..3 which are AIN0 to AIN3.
In the differential mode that you added, only 2 channels, as expected. But those 2 channels are
- 0 = AIN0-AIN1 and
- 1 = AIN0-AIN3
which makes AIN2 useless.
It would be more versatile to use:
- 0 = AIN0 - AIN1
- 3 = AIN2 - AIN3
Which can be easily achieved by using
config |= (ADS1115_REG_CONFIG_MUX_DIFF_0_1 + (0x3000 * channel));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are quite right. I'll change it this way..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, took two tries. I realy should no do a commit on a tablet.
Description:
Related issue (if applicable): fixes #
Checklist:
NOTE: The code change must pass CI tests. Your PR cannot be merged unless tests pass