Navio2
Navio2 copied to clipboard
Unreachable code for python barometer library
ms5611.py has unreachable code in the second order temperature compensation. Error does not exist in the related c++ file because it does not use else if statements.
if (self.TEMP >= 2000):
T2 = 0
OFF2 = 0
SENS2 = 0
elif (self.TEMP < 2000):
T2 = dT * dT / 2**31
OFF2 = 5 * ((self.TEMP - 2000) ** 2) / 2
SENS2 = OFF2 / 2
elif (self.TEMP < -1500):
OFF2 = OFF2 + 7 * ((self.TEMP + 1500) ** 2)
SENS2 = SENS2 + 11 * (self.TEMP + 1500) ** 2 / 2
Reviewing the chip documentation, switching the first if-elif clause to if-else and the last elif to if will match the datasheet.
I'm still figuring out this github stuff and pull requests seem to still be out of my league, so this is the patch file I got out of my local git commands.
0001-Python-Navio-MS5611-Correction-for-second-order-temp.patch