mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 06:28:27 -04:00
AP_BoardConfig: added board detection for FMUv6
support Holybro-6X and CUAV-6X for now, using IMU signatures
This commit is contained in:
parent
b09f7d1344
commit
a6159604e5
@ -96,6 +96,8 @@ public:
|
|||||||
VRX_BOARD_CORE10 = 36,
|
VRX_BOARD_CORE10 = 36,
|
||||||
VRX_BOARD_BRAIN54 = 38,
|
VRX_BOARD_BRAIN54 = 38,
|
||||||
PX4_BOARD_FMUV6 = 39,
|
PX4_BOARD_FMUV6 = 39,
|
||||||
|
FMUV6_BOARD_HOLYBRO_6X = 40,
|
||||||
|
FMUV6_BOARD_CUAV_6X = 41,
|
||||||
PX4_BOARD_OLDDRIVERS = 100,
|
PX4_BOARD_OLDDRIVERS = 100,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -249,6 +251,7 @@ private:
|
|||||||
bool spi_check_register_inv2(const char *devname, uint8_t regnum, uint8_t value, uint8_t read_flag = 0x80);
|
bool spi_check_register_inv2(const char *devname, uint8_t regnum, uint8_t value, uint8_t read_flag = 0x80);
|
||||||
void validate_board_type(void);
|
void validate_board_type(void);
|
||||||
void board_autodetect(void);
|
void board_autodetect(void);
|
||||||
|
void detect_fmuv6_variant(void);
|
||||||
bool check_ms5611(const char* devname);
|
bool check_ms5611(const char* devname);
|
||||||
|
|
||||||
#endif // AP_FEATURE_BOARD_DETECT
|
#endif // AP_FEATURE_BOARD_DETECT
|
||||||
|
@ -134,6 +134,8 @@ void AP_BoardConfig::board_setup_drivers(void)
|
|||||||
case PX4_BOARD_PIXHAWK_PRO:
|
case PX4_BOARD_PIXHAWK_PRO:
|
||||||
case PX4_BOARD_PCNC1:
|
case PX4_BOARD_PCNC1:
|
||||||
case PX4_BOARD_MINDPXV2:
|
case PX4_BOARD_MINDPXV2:
|
||||||
|
case FMUV6_BOARD_HOLYBRO_6X:
|
||||||
|
case FMUV6_BOARD_CUAV_6X:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
config_error("Unknown board type");
|
config_error("Unknown board type");
|
||||||
@ -400,8 +402,7 @@ void AP_BoardConfig::board_autodetect(void)
|
|||||||
state.board_type.set_and_notify(PX4_BOARD_FMUV5);
|
state.board_type.set_and_notify(PX4_BOARD_FMUV5);
|
||||||
hal.console->printf("Detected FMUv5\n");
|
hal.console->printf("Detected FMUv5\n");
|
||||||
#elif defined(HAL_CHIBIOS_ARCH_FMUV6)
|
#elif defined(HAL_CHIBIOS_ARCH_FMUV6)
|
||||||
state.board_type.set_and_notify(PX4_BOARD_FMUV5);
|
detect_fmuv6_variant();
|
||||||
hal.console->printf("Detected FMUv6\n");
|
|
||||||
#elif defined(CONFIG_ARCH_BOARD_VRBRAIN_V51) || defined(HAL_CHIBIOS_ARCH_BRAINV51)
|
#elif defined(CONFIG_ARCH_BOARD_VRBRAIN_V51) || defined(HAL_CHIBIOS_ARCH_BRAINV51)
|
||||||
state.board_type.set_and_notify(VRX_BOARD_BRAIN51);
|
state.board_type.set_and_notify(VRX_BOARD_BRAIN51);
|
||||||
hal.console->printf("Detected VR Brain 5.1\n");
|
hal.console->printf("Detected VR Brain 5.1\n");
|
||||||
@ -522,6 +523,7 @@ void AP_BoardConfig::board_setup()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAL_CHIBIOS_ARCH_FMUV6
|
#ifdef HAL_CHIBIOS_ARCH_FMUV6
|
||||||
|
|
||||||
#define BMI088REG_CHIPID 0x00
|
#define BMI088REG_CHIPID 0x00
|
||||||
@ -537,12 +539,12 @@ void AP_BoardConfig::detect_fmuv6_variant()
|
|||||||
spi_check_register("icm42688", INV3REG_WHOAMI, INV3_WHOAMI_ICM42688) &&
|
spi_check_register("icm42688", INV3REG_WHOAMI, INV3_WHOAMI_ICM42688) &&
|
||||||
spi_check_register("icm42670", INV3REG_WHOAMI, INV3_WHOAMI_ICM42670))) {
|
spi_check_register("icm42670", INV3REG_WHOAMI, INV3_WHOAMI_ICM42670))) {
|
||||||
state.board_type.set_and_notify(FMUV6_BOARD_HOLYBRO_6X);
|
state.board_type.set_and_notify(FMUV6_BOARD_HOLYBRO_6X);
|
||||||
DEV_PRINTF("Detected Holybro 6X\n");
|
hal.console->printf("Detected Holybro 6X\n");
|
||||||
} else if ((spi_check_register_inv2("icm20649_2", INV2REG_WHOAMI, INV2_WHOAMI_ICM20649) &&
|
} else if ((spi_check_register_inv2("icm20649_2", INV2REG_WHOAMI, INV2_WHOAMI_ICM20649) &&
|
||||||
spi_check_register("icm42688", INV3REG_WHOAMI, INV3_WHOAMI_ICM42688) &&
|
spi_check_register("icm42688", INV3REG_WHOAMI, INV3_WHOAMI_ICM42688) &&
|
||||||
spi_check_register("bmi088_g", BMI088REG_CHIPID, CHIPID_BMI088_G))) {
|
spi_check_register("bmi088_g", BMI088REG_CHIPID, CHIPID_BMI088_G))) {
|
||||||
state.board_type.set_and_notify(FMUV6_BOARD_CUAV_6X);
|
state.board_type.set_and_notify(FMUV6_BOARD_CUAV_6X);
|
||||||
DEV_PRINTF("Detected CUAV 6X\n");
|
hal.console->printf("Detected CUAV 6X\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user