Skip to content

Unreachable code for python barometer library #55

@MilesStarr

Description

@MilesStarr

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions