Skip to content

drivers: lps25hb driver returning wrong fractional part of a pressure #46615

@karold2412

Description

@karold2412

During my work with lps25hb pressure sensor I have faced problem that fractional part of the measurement is completely wrong. During debug I figured out that we are probably overflowing int32_t range during computations in this function:
lps25hb_problem
Since this sensor is returning 24 bit wide result - when we multiply it million times - it will clearly overflow.

So my local solution for now is:
suggested_change
To give compiler the idea that we need 64 bit value in order to proceed with calculations. As far as I have tested it - it works like a charm.

What do you guys think? Is it a good solution? Should I create a pull request for that?

Metadata

Metadata

Assignees

Labels

EnhancementChanges/Updates/Additions to existing featuresarea: SensorsSensors

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions