OK here are the steps to enable PMW3901 on MindPX/Mindracer, pretty simple actually.
Assume you have cloned PX4 master source code into your local.
Locate file "boards/airmind/mindpx-v2/src/board_config.h", use any text editor to find the line:
#define PX4_SPI_BUS_BARO PX4_SPI_BUS_SENSORS
and add the below line right under it:
#define PX4_SPI_BUS_EXTERNAL PX4_SPI_BUS_EXT
then find the line:
#define PX4_SPIDEV_EXT0 PX4_MK_SPI_SEL(PX4_SPI_BUS_EXT, 1)
and add this line right under it:
#define PX4_SPIDEV_EXTERNAL PX4_SPIDEV_EXT0
Locate file "boards/airmind/mindpx-v2/default.cmake", find the line:
comment out this line by add '#' at the beginning of it:
then find the line before:
enable this line by remove the '#' at the beginning:
Compile and upload the new firmware:
make airmind_mindpx-v2_default upload
Connect pmw3901 and connect the mindracer to QGC.
Enable EKF2_AID_MASK, and SENS_EN_PMW3901 parameter in QGC and reboot.
If everything are executed correctly, You should be able to see optical flow in MAVLink inspector now.