Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unreachable code for python barometer library #55

Open
MilesStarr opened this issue Oct 10, 2023 · 0 comments
Open

Unreachable code for python barometer library #55

MilesStarr opened this issue Oct 10, 2023 · 0 comments

Comments

@MilesStarr
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant