Skip to content
Commit 13dfa0ac authored by Fabio Baltieri's avatar Fabio Baltieri Committed by Carles Cufí
Browse files

sensors: shell: implement rounding for q31_t



Since the sensor shell command was converted to use qt31_t, all the
integer values started to show up as rounded up by a fractional unit
when displayed, due to the conversion always rounding down.

Fix that by using the recently introduced DIV_ROUND_CLOSEST and handling
rounding up to next integer explicitly.

Before:

channel idx=44 gauge_state_of_charge value=83.999999

after:

channel idx=44 gauge_state_of_charge value=84.000000

Signed-off-by: default avatarFabio Baltieri <fabiobaltieri@google.com>
parent 409b15c7
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment