altoslib: Fix MS5607 raw data to pressure conversion function
authorMiguel Benavidez <miguelbenavidez1145@gmail.com>
Thu, 4 May 2017 18:29:33 +0000 (11:29 -0700)
committerKeith Packard <keithp@keithp.com>
Fri, 5 May 2017 05:10:36 +0000 (22:10 -0700)
commita84bc1bd8dd19d47709614b0c2639958d09fbf7e
tree804759d6de45872052f8f626c8edc85fd7df8d8e
parent643f7508233f492a86f541b4f4fb20531b306ae0
altoslib: Fix MS5607 raw data to pressure conversion function

The MS5607 sensor provides raw 24-bit ADC outputs to the host along
with calibration constants necessary to convert those into temperature
and pressure values. The datasheet has a flow chart indicating how to
perform this computation. There are two parts of the algorithm which
adjust the result based on the ambient temperature, temperatures below
20°C get one compensation factor and temperatures below -15°C get an
additional factor.

The ground station version of this function mistakenly applied the
second compensation factor for all temperatures below +15°C. The
result was that the pressure computed on the ground when the measured
temperature was between -15°C and +15°C was incorrect, resulting in
altitudes which were several hundred meters off in some situations.

This can be seen when displaying any .eeprom (or .mpd) data
files for flights with temperatures in that range. The datafiles
themselves are not corrupted, only the display operation.

This is not seen for telemetry data, where the pressure and associated
altitude is computed in the airframe using the correct algorithm.

Thanks much to Miguel and the rest of the Vanguard School TARC team
for identifying the problem and providing this fix.

Signed-off-by: Keith Packard <keithp@keithp.com>
altoslib/AltosMs5607.java