smashyanand / ardupilot-mega

Automatically exported from code.google.com/p/ardupilot-mega
0 stars 0 forks source link

Altitudes above 327.67 meters do not work properly #105

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Elevate the APM above 327.67 meters above where it is initialized

What is the expected output? What do you see instead?
I expect press_alt to be updated with the correct altitude; instead, it is set 
to a negative number.

What version of the product are you using? On what operating system?
r880

Suggestion:
Although press_alt is prudently defined as a long, it is assigned via an int 
cast in read_airpressure(); this should be changed to a long cast.  Also, the 
divide-by-10 step (using the intermediate x variable) is unnecessary; just 
change the constant from 29271.267f to 2927.1267f.

Original issue reported on code.google.com by bjpcalt...@gmail.com on 16 Sep 2010 at 10:03

GoogleCodeExporter commented 9 years ago
I'll leave the /10 for now because it's more clear. Changing it will induce 
bugs later in development.
I've changed the cast to Long.

Original comment by jasonshort on 17 Sep 2010 at 7:48

GoogleCodeExporter commented 9 years ago
I thought about making this change before, but 327 meters above initialization 
is about 200 meters above our legal ceiling here in the US, so I didn't 
bother....  But it is a good change because some people will not respect the 
regulations, and some are lucky and live places without that restriction.

Original comment by dewei...@gmail.com on 18 Sep 2010 at 2:07