From 59f56f4a5be7e233e79715e89dddca721f427922 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Mon, 1 Jan 2018 17:30:55 +0100 Subject: [PATCH] Add support for Pixhack detection This allows to boot a Pixhack 3.0 which is the same as Pixhawk 2.0 / 2.1 --- ROMFS/px4fmu_common/init.d/rc.sensors | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/ROMFS/px4fmu_common/init.d/rc.sensors b/ROMFS/px4fmu_common/init.d/rc.sensors index 15cb898a2f..ff2d352e22 100644 --- a/ROMFS/px4fmu_common/init.d/rc.sensors +++ b/ROMFS/px4fmu_common/init.d/rc.sensors @@ -69,6 +69,9 @@ fi if ver hwcmp PX4FMU_V2 then + # V2 build hwtypecmp is always false + set BOARD_FMUV3 0 + # External I2C bus hmc5883 -C -T -X start lis3mdl -X start @@ -79,8 +82,6 @@ then # Internal SPI bus ICM-20608-G mpu6000 -T 20608 start - # V2 build hwtypecmp is always false - set BOARD_FMUV3 0 # V3 build hwtypecmp supports V2|V2M|V30 if ver hwtypecmp V30 then @@ -99,6 +100,26 @@ then fi fi + # Check if a Pixhack (which reports as V2M) is present + if ver hwtypecmp V2M + then + # Pixhawk Mini doesn't have these sensors, + # so if they are found we know its a Pixhack + + # external MPU6K is rotated 180 degrees yaw + if mpu6000 -S -R 4 start + then + set BOARD_FMUV3 20 + else + # Check for Pixhack 3.1 + # external MPU9250 is rotated 180 degrees yaw + if mpu9250 -S -R 4 start + then + set BOARD_FMUV3 21 + fi + fi + fi + if [ $BOARD_FMUV3 != 0 ] then # sensor heating is available, but we disable it for now