Barometer height computation

Hi,

Am I correct that this is the height computation using barometer in the code?

Would you happen to know the origin of this code? I have tried searching and have encountered the Barometric Formula and Hypsometric Formula, but I am having difficulty matching it completely with the code.

Barometric Formula from https://www.omnicalculator.com/physics/air-pressure-at-altitude
image

Hypsometric Formula from https://www.mide.com/air-pressure-at-altitude-calculator
image

@iampete can help you…

@marcsay if you break down the hypsometric formula and precalc the exponent and scalars, you’ll see it actually matches the calculation in AP_Baro. baro code has both the exponential term and the lapse rate inverted as compared to the linked formula, at least that’s what made me pull my air initially…