-
Notifications
You must be signed in to change notification settings - Fork 75
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
[Bug Report] AnalogInput calibration improvement when using only two points #221
Comments
I think you're right! Good catch! I never looked at the actual implementation of the calibration before. (some tests still fail, but it's only one contrib script (tests/contrib/test_europi_turing_machine.py) so I guess it's an issue of this test and not the code changes) |
Your fix looks good to me. Thank you very much for your time. I could have opened a PR. I don't have the time to run the tests and test with my EuroPi today but can do it in a few days if you want. But, your code is fine and I don't see any problem. |
created the PR #232 |
I took a quick look at the test failures and didn't see anything obvious. I'll look again after some other priorities. |
Hi,
I think there's a little bug in the way the voltage is computed when the calibration has been done with only two point (0 and 10).
In AnalogueInput.read_voltage() the code :
should take
INPUT_CALIBRATION_VALUES[0]
into account and becomes :This is especially important when reading low voltage. If, for example, we have :
The result, with
reading = 384
isAnd with
reading = 44634
:We can see that the 0V computation (with reading=384) is now correct and that the max voltage is not affected.
A similar issue is present in AnalogueInput.percent() :
current code :
proposed correction :
What do you think? Am I correct?
The text was updated successfully, but these errors were encountered: