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
Handle invalid baro pressure values #12815
Conversation
This comment has been minimized.
This comment has been minimized.
AUTOMERGE: (FAIL)
|
a115850
to
36392d0
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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.
NaN source shall be fixed
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Hmm ... only change to get NaN is in pressureToAltitude, by passing negative pressure. |
Should we drop the call to pressureToAltitude if pressure is negative or should we set it to 0 and let it calculate? |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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.
Tested these changes on 4.4.1 - barometer MS5611 works well. (4.5.0 does not see any of the devices at all, but this is not relevant to these changes)
Thanks a lot @haslinghuis and @ledvinap
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.
Looks good.
Now, someone should investigate why is ms5611 returning bad values shortly after initialization and make sure that negative/zero pressure is always returned in that case.
Can someone open MS5611 issue? One possible way to investigate MS5611 problem is to dump I2C traffic (Saleae). If dump is available, I can look at it. |
Well, this is interesting task, but I'm not fast in such projects. Anyway, I'll order board for Saleae and try to dump and analyze data. It won't fast. I'll be back when I'll have useful info. |
This comment has been minimized.
This comment has been minimized.
Do you want to test this code? Here you have an automated build: |
@ledvinap I've found what wrong data exactly is coming from MS5611. The way I did it is simple: first of all I found the number of wrong values - it is always 1, I simply added the counter of wrong values and put this number to
This number obviosly is not changing in time, but I'm receiving different least significant part after every reset. I made 6 resets and received the following wrong pressure values:
Five most significant octets are not changing. Only three least significant octets are changing. |
Fixes: #12744