From 8040b9b96e8f7c07aa981150c33f850096062f70 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 27 Apr 2013 19:51:06 +0200 Subject: Allowed for onboard bus to be not present --- src/drivers/hmc5883/hmc5883.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/drivers/hmc5883') diff --git a/src/drivers/hmc5883/hmc5883.cpp b/src/drivers/hmc5883/hmc5883.cpp index d71f469e9..c406a7588 100644 --- a/src/drivers/hmc5883/hmc5883.cpp +++ b/src/drivers/hmc5883/hmc5883.cpp @@ -841,6 +841,7 @@ HMC5883::collect() * 74 from all measurements centers them around zero. */ +#ifdef PX4_I2C_BUS_ONBOARD if (_bus == PX4_I2C_BUS_ONBOARD) { /* to align the sensor axes with the board, x and y need to be flipped */ _reports[_next_report].x = ((report.y * _range_scale) - _scale.x_offset) * _scale.x_scale; @@ -849,13 +850,16 @@ HMC5883::collect() /* z remains z */ _reports[_next_report].z = ((report.z * _range_scale) - _scale.z_offset) * _scale.z_scale; } else { +#endif /* XXX axis assignment of external sensor is yet unknown */ _reports[_next_report].x = ((report.y * _range_scale) - _scale.x_offset) * _scale.x_scale; /* flip axes and negate value for y */ _reports[_next_report].y = ((((report.x == -32768) ? 32767 : -report.x) * _range_scale) - _scale.y_offset) * _scale.y_scale; /* z remains z */ _reports[_next_report].z = ((report.z * _range_scale) - _scale.z_offset) * _scale.z_scale; +#ifdef PX4_I2C_BUS_ONBOARD } +#endif /* publish it */ orb_publish(ORB_ID(sensor_mag), _mag_topic, &_reports[_next_report]); -- cgit v1.2.3