Optical Flow Sensor (3901-L0X) not giving correct readings

My issue is that my OF sensor (3901-L0X) paired with Matek F405-SE on ArduCopter v4.1.5 is not giving me correct readings for flowX and flowY when looking in the log files. It either gives random spikes or just a flat line.

I followed the instructions for the parameters that needed to be changed on the manufacturer site.


In this screenshot the red line is the OF.flowX and green is OF.bodyX. This was giving proper readings like the screenshots on the docs (Optical Flow Sensor Testing and Setup — Copter documentation) until I changed the parameters for first flight and changed the EK3_SRC1_VELXY to 5, which is the optical flow. After reseting the parameters and reapplying the parameters from the manufacturer, I still have the same issue.

Here’s the log file:
1 12-31-1979 7-00-00 PM.bin (592 KB)

Sometimes it randomly works after restarting, but I can’t find any consistent way. When ti does work the opt_qua varies around 20-50 depending on the surface it’s over but when it doesn’t, it stays around 0-1.