Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
drivers/sensor: lps22hh: Fix the raw to kPa sample conversion
The lps22hh 24 bit raw sample is left aligned, which means that it needs to be right-shifted by 8 before applying conversion. Moreover the conversion has been simplified for clarity. Fix #35871 Signed-off-by: Armando Visconti <armando.visconti@st.com>
- Loading branch information
4e8c809
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.
Hi,
I think it's better to have :
val->val1 = press_tmp / 4096;
val->val2 = (press_tmp % 4096) * 3125 / 128;
It's necessary to have the value in hPa instead of kPa to avoid side effet for the digits after the comma. You won more precision in having the value in hPa. It's really important for example to calculate a height (precision of 10 centimeters instead of 3 meters).
I say it here but i don't know were, maybe you can add this in the next realease.
Best regards,
Pierre-Yves