-
-
Notifications
You must be signed in to change notification settings - Fork 917
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
Show magADC values without re-scaling in Sensors Tab #3593
Conversation
SonarCloud Quality Gate failed. 0 Bugs No Coverage information Catch issues before they fail your Quality Gate with our IDE extension SonarLint |
This comment has been minimized.
This comment has been minimized.
AUTOMERGE: (FAIL)
|
The code is ok, but I think is better to "normalize" the data in the firmware part if possible. In this way the MSP command will always return Gauss. |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs within a week. |
Pull request closed automatically as inactive. |
SonarCloud Quality Gate failed. 0 Bugs No Coverage information Catch issues before they fail your Quality Gate with our IDE extension SonarLint |
Hi @McGiverGim - yes, there is benefit in using un-scaled values, because they are the values that are used to calculate the 'cal' values. So if, for instance, the min and max values on a given axis, when added and divided by two, are wrong by say -30, the cal value needs to be reduced by 30. |
I am re-opening because this should be merged. |
Do you want to test this code? Here you have an automated build: |
Please post screenshots for those of us unable to test Mag |
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.
- approving -- code visually reviewed only; i cannot test Mag
show true magADC values
Changes:
- Ga
from the title of the Mag data, since the value is no longer Gauss.Fixes:
Notes:
Using un-scaled magADC values greatly simplifies the calculation of the Mag Cal value to be used for a given axis.
If the user points a given axis directly into (parallel to) the field, it will return its most positive, or Maximum, value when the values of the other two axes are zero.
The Minimum value can be found by rotating the quad 180 degrees until it points directly away from (anti-parallel to) the field, and seeking out the most negative value, which again will be when the other two axes read zero.
The Cal value to use for that axis is the simple average of the two values, ie
((Max + Min)/2)
. For instance, if the Max value was 1800 and the Min was -1400, the cal value for the axis would be((1800 - 1400)/2)
, or 200.Once that calibration value is applied, a check can be made that the Max and Min values are numerically equal, by repeating the above test. In the above example, after applying a Cal value for the axis of 200, a re-check should show the Max of 1600
(1800 - 200)
and the Min of -1600(-1400 - 200)
.As a simple check of an existing calibration, the Cal factor is correct when
Max = -Min
for each axis.