From 509c28424e854a2d59b156da6f76ea43aaf6c8b8 Mon Sep 17 00:00:00 2001 From: "taemin.yeom" Date: Mon, 23 Aug 2021 10:57:09 +0900 Subject: Fix axis direction of sensors Change-Id: I773223931314cbbdf3fec4a27b0ec6b1ce14cb8a Signed-off-by: taemin.yeom --- src/accelerometer/accel_device.cpp | 6 +++--- src/gyroscope/gyro_device.cpp | 6 +++--- src/magnetometer/magnet_device.cpp | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/accelerometer/accel_device.cpp b/src/accelerometer/accel_device.cpp index 0c5145c..f812906 100644 --- a/src/accelerometer/accel_device.cpp +++ b/src/accelerometer/accel_device.cpp @@ -211,11 +211,11 @@ bool accel_device::update_value_i2c(void) peripheral_i2c_read_register_word(m_i2c_handle, OUT_Y_L_XL, (uint16_t*) &temp[1]); peripheral_i2c_read_register_word(m_i2c_handle, OUT_Z_L_XL, (uint16_t*) &temp[2]); - if ((temp[0] == m_x) && (temp[1] == m_y) && (temp[2] == m_z)) + if ((temp[0] == m_y) && (temp[1] == m_x) && (temp[2] == m_z)) return false; - m_x = temp[0]; - m_y = temp[1]; + m_x = temp[1]; + m_y = temp[0]; m_z = temp[2]; m_fired_time = util::get_timestamp(); diff --git a/src/gyroscope/gyro_device.cpp b/src/gyroscope/gyro_device.cpp index 6715398..a3a58d1 100644 --- a/src/gyroscope/gyro_device.cpp +++ b/src/gyroscope/gyro_device.cpp @@ -205,11 +205,11 @@ bool gyro_device::update_value_i2c(void) peripheral_i2c_read_register_word(m_i2c_handle, OUT_Y_L_G, (uint16_t*) &temp[1]); peripheral_i2c_read_register_word(m_i2c_handle, OUT_Z_L_G, (uint16_t*) &temp[2]); - if ((temp[0] == m_x) && (temp[1] == m_y) && (temp[2] == m_z)) + if ((temp[0] == m_y) && (temp[1] == m_x) && (temp[2] == m_z)) return false; - m_x = temp[0]; - m_y = temp[1]; + m_x = temp[1]; + m_y = temp[0]; m_z = temp[2]; m_fired_time = util::get_timestamp(); diff --git a/src/magnetometer/magnet_device.cpp b/src/magnetometer/magnet_device.cpp index 8ce97f6..af92d1f 100644 --- a/src/magnetometer/magnet_device.cpp +++ b/src/magnetometer/magnet_device.cpp @@ -244,11 +244,11 @@ bool magnet_device::update_value_i2c(void) peripheral_i2c_read_register_word(m_i2c_handle, OUT_Y_L_M, (uint16_t*) &temp[1]); peripheral_i2c_read_register_word(m_i2c_handle, OUT_Z_L_M, (uint16_t*) &temp[2]); - if ((temp[0] == m_x) && (temp[1] == m_y) && (temp[2] == m_z)) + if ((temp[0] == -m_y) && (temp[1] == m_x) && (temp[2] == m_z)) return false; - m_x = temp[0]; - m_y = temp[1]; + m_x = temp[1]; + m_y = -temp[0]; m_z = temp[2]; m_fired_time = util::get_timestamp(); -- cgit v1.2.3