From 47d7465476b312f556be0be9c9d4c79aa1f539a7 Mon Sep 17 00:00:00 2001 From: Karl Schwabe Date: Mon, 11 Sep 2017 18:01:04 +0200 Subject: [PATCH] Bugfix: corrects orientation of magnetometer raw values The magnetomer raw values were not being rotated in the same direction as the scaled values. This meant that if the rotation was set to ROTATION_NONE, the raw values and scaled values were off by 180 degrees. --- src/drivers/hmc5883/hmc5883.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/drivers/hmc5883/hmc5883.cpp b/src/drivers/hmc5883/hmc5883.cpp index ed8fd42d9b..153a9bcc5f 100644 --- a/src/drivers/hmc5883/hmc5883.cpp +++ b/src/drivers/hmc5883/hmc5883.cpp @@ -987,8 +987,8 @@ HMC5883::collect() * to align the sensor axes with the board, x and y need to be flipped * and y needs to be negated */ - new_report.x_raw = report.y; - new_report.y_raw = -report.x; + new_report.x_raw = -report.y; + new_report.y_raw = report.x; /* z remains z */ new_report.z_raw = report.z;