Custom Flow Sensor on APM

Hi All,
I’m trying to feed data from my custom optical flow algorithm to APM so that it can use it in flow hold mode. How do you decide the EK2_FLOW_DELAY value? I’m planning to send MavLink messages so it should be a drop-in replacement to the OpenMV in the tutorial here.

Thanks,
Nitin