Depth sensors with px4

I am working on a “flying” submarine glider using PX4 for altitude and heading control. To get depth control I was going to turn off the barometer in my IMU (pixhawk 4) and create a custom range finder driver that would work with a high resolution depth sensor. Does this sound like it should work? Other option would be to modify the barometer driver so it reads the depth sensor but I worry that might be harder than it sounds. Thanks in advance for any guidance!

Something like this should work i think, if you use it the same way a downward fasing laser distanse sensor is used for altitude in copter.
(i know that’s ardu, not px4, still usefull i think)

Interesting idea.