freetronics / BaroSensor

Arduino Library for the BARO barometric pressure module
GNU General Public License v3.0
5 stars 5 forks source link

Type error causing problems below 20DegC #2

Open murray1978 opened 9 years ago

murray1978 commented 9 years ago

Hay think I found it, line 107, BaroSensor.cpp int64_t dt = d2 - c5 * (1L<<8);

should read

int32_t dt = d2 - c5 * (1L<<8);

Doing this solved my Less than 20DegC issue.

projectgus commented 9 years ago

Hi Murray,

Thanks for reporting this. I've made the change you suggested, which is in line with the storage size preferred in the datasheet.

The reason I up-sized some of these variables was to avoid potential integer overflow later on. However on reflect it doesn't make a lot of sense for this one to be 64 bits wide instead of 32.

I can't actually explain why this would have caused the problem though, but I'm glad it seems to have solved it.