From 215e8e2466fb73121c2afe40eb3841f0e7830e4d Mon Sep 17 00:00:00 2001 From: Grant Morphett Date: Fri, 6 Feb 2015 13:18:44 +1100 Subject: [PATCH] hmc5883: Fix for Issue1858 detection of MAG on Int/Ext I2C Bus. --- src/drivers/hmc5883/hmc5883_i2c.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/drivers/hmc5883/hmc5883_i2c.cpp b/src/drivers/hmc5883/hmc5883_i2c.cpp index f86c1af6b1..b13f1fca8f 100644 --- a/src/drivers/hmc5883/hmc5883_i2c.cpp +++ b/src/drivers/hmc5883/hmc5883_i2c.cpp @@ -113,11 +113,17 @@ 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; } else { return 0; } +#else + return 1; +#endif case DEVIOCGDEVICEID: return CDev::ioctl(nullptr, operation, arg);