Force usage of GPS altitude

Hi all,
I’m using an very precise external positioning system and want to inject the copter position as “fake”-gps over Mavlink. The approach I use is the one described in this post. However, I could get Arducopter to accept the injected lat and lon values but it does not use the altitude. Instead it seems like it still uses the barometer. I set EK2_ALT_SOURCE = 2 and also tried EK2_ALT_M_NSE = 10, but it still does not work.
Does anyone has an idea how to force the usage of GPS altitude?


Looks like you will have to dig into the code. EK2_ALT_SOURCE = 2 should have done the trick

@amilcarlucas, thanks for your answer. Not sure, but maybe I’m wrong. The result I get is shown in the image below, injecting the shown position to GPS2.

The offset in the GPS position may be normal (is it?), but I’m wondering about the altitude. I understand that alt is the altitude above sea level and relative_alt is above ground. But where is the link? And which one is used for flying?
I’m injecting the current GPS position of the drone and want to make sure that it trusts this position for flying. Thanks in advance.