forked from Archive/PX4-Autopilot
hmc5883: fix MAGIOCGEXTERNAL ioctl for non fmuv1 boards
This makes the onboard check consistent with hmc5883_bus_option initialization. If the current bus is the onboard bus, return !external. It fixes the onboard mag (HMC5883) for AeroFC. Its priority is now 100, previously it was 255, so that if an external mag is attached, it will be preferred.
This commit is contained in:
parent
13df03c78a
commit
78f1d9d017
|
@ -113,17 +113,16 @@ HMC5883_I2C::ioctl(unsigned operation, unsigned &arg)
|
|||
switch (operation) {
|
||||
|
||||
case MAGIOCGEXTERNAL:
|
||||
// On PX4v1 the MAG can be on an internal I2C
|
||||
// On everything else its always external
|
||||
#ifdef CONFIG_ARCH_BOARD_PX4FMU_V1
|
||||
if (_bus == PX4_I2C_BUS_EXPANSION) {
|
||||
return 1;
|
||||
#ifdef PX4_I2C_BUS_ONBOARD
|
||||
if (_bus == PX4_I2C_BUS_ONBOARD) {
|
||||
return 0;
|
||||
|
||||
} else {
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
#else
|
||||
/* assume external for all boards that don't define PX4_I2C_BUS_ONBOARD */
|
||||
return 1;
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue