RobTillaart / MS5611

Arduino library for MS5611 temperature and pressure sensor
MIT License
17 stars 5 forks source link

Possible calculation error on MS5611.cpp line 128 #9

Closed emielsteerneman closed 3 years ago

emielsteerneman commented 3 years ago

Hey,

For a project, I'm trying to rewrite your library (which looks great by the way) to STM32. During the rewrite, I found a possible calculation error in MS5611.cpp on line 128.

float sens2 = 1.25 * t * t * t;

Here, you take t to the third power, while the datasheet (page 9) takes t to the second power.

SENS2 = 5 * (TEMP – 2000)^2 / 4

Looking at all the math in the diagram, it might be even better to assign t = (_temperature - 2000) * (_temperature - 2000)

RobTillaart commented 3 years ago

Thanks for pointing out, I will investigate later today as this could be a (first class) bug.

RobTillaart commented 3 years ago

@emielsteerneman Good catch, new version is on its way!

RobTillaart commented 3 years ago

@emielsteerneman Fix + extra is in https://github.com/RobTillaart/MS5611/tree/develop

Can you please confirm its working as I have no hardware, (then I will merge) Thanks


I installed stm boards, selected nucleo64 and it compiled (few warnings about unused parameters in other libs)

emielsteerneman commented 3 years ago

I can't test it at the moment because I also currently don't have the hardware. But, if I find any other possible bugs, I will let you know.

RobTillaart commented 3 years ago

As code wise it is a bug I will merge the solution anyway as new branch is better. For now I close the issue, if needed reopen it for same thing, or a new one.

And yes, other bugs are welcome (sort of :)

Thanks again, Rob PS, your name is Dutch / Belgian? I'm from the Netherlands, near Eindhoven,