aboutsummaryrefslogtreecommitdiff
path: root/apps/drivers/hmc5883/hmc5883.cpp
diff options
context:
space:
mode:
authorLorenz Meier <lm@inf.ethz.ch>2012-08-26 13:51:18 +0200
committerLorenz Meier <lm@inf.ethz.ch>2012-08-26 13:51:18 +0200
commit6026595d83b5ce5048ad77b7e0aa78ecd83e46af (patch)
tree8f1255d8d296fbef67ee993d914364b963f4ad73 /apps/drivers/hmc5883/hmc5883.cpp
parent60311a37786a8731b10dba4d4f5ab3a56108788d (diff)
downloadpx4-firmware-6026595d83b5ce5048ad77b7e0aa78ecd83e46af.tar.gz
px4-firmware-6026595d83b5ce5048ad77b7e0aa78ecd83e46af.tar.bz2
px4-firmware-6026595d83b5ce5048ad77b7e0aa78ecd83e46af.zip
Fixed axis assignment and raw value outputs. Scaling and offsets to be done
Diffstat (limited to 'apps/drivers/hmc5883/hmc5883.cpp')
-rw-r--r--apps/drivers/hmc5883/hmc5883.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/apps/drivers/hmc5883/hmc5883.cpp b/apps/drivers/hmc5883/hmc5883.cpp
index d1025bcc6..cd198b6e6 100644
--- a/apps/drivers/hmc5883/hmc5883.cpp
+++ b/apps/drivers/hmc5883/hmc5883.cpp
@@ -658,9 +658,18 @@ HMC5883::collect()
(abs(report.z) > 2048))
goto out;
+ /* raw outputs */
+ /* to align the sensor axes with the board, x and y need to be flipped */
+ _reports[_next_report].x_raw = report.y;
+ _reports[_next_report].y_raw = report.x;
+ /* z remains z */
+ _reports[_next_report].z_raw = report.z;
+
/* scale values for output */
- _reports[_next_report].x = report.x * _scale.x_scale + _scale.x_offset;
- _reports[_next_report].y = report.y * _scale.y_scale + _scale.y_offset;
+ /* to align the sensor axes with the board, x and y need to be flipped */
+ _reports[_next_report].x = report.y * _scale.x_scale + _scale.x_offset;
+ _reports[_next_report].y = report.x * _scale.y_scale + _scale.y_offset;
+ /* z remains z */
_reports[_next_report].z = report.z * _scale.z_scale + _scale.z_offset;
/* publish it */