Questions about indoor "Loiter" and "AltHold" using Arkflow OpticalFlow sensor

I am currently using an arkflow optical flow sensor on an indoor drone I am working on and I have a few questions about some altitude hold functionality. Mainly when I fly over objects while in alt hold or loiter, my altitude increases. I am assuming that is because of the range finder on the ark flow.

i have EK3_SRC1_POSZ = 1 telling it to use Baro
and EK3_SRC1_VELZ = 0

EK3_SRC_OPTIONS = 0
EK3_SRC1_POSXY = 3
EK3_SRC1_VELXY = 5

preferably i would like to fuse the lidar and baro so i can get the accuracy of the lidar while holding position, but check it with the barometer so that when i fly through a window it doesn’t see the window frame and shoot up and then when there is a drop after the window is drops down… or fly over a couch and it hits the ceiling.

and suggestions would be appreciated,.

You can set the parameters, but I don’t recommend doing so because after setting the parameters, the height of the drone will drop rapidly when you hit the joystick in fixed height mode, which has been bothering me, and my attempts to modify the code have not solved it

set SURFTRAK_MODE = 0

i will try that. i was also having issues with alt hold not holding altitude very well it would fluctuate a few feet up and down constantly making it hard to fly indoors. for a temporary fix i set EK3_SRC1_POSZ to range finder and indoor alt hold is perfect…
but i know that probably isn’t the right answer.