From ad406b1df229e4d5634187b919eb498814131fdd Mon Sep 17 00:00:00 2001 From: TinyO Date: Mon, 28 Oct 2019 09:34:56 +0800 Subject: [PATCH] fix(imu): issue of rnage. --- src/mynteye/device/channel/channels.h | 2 ++ src/mynteye/device/motions.cc | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/mynteye/device/channel/channels.h b/src/mynteye/device/channel/channels.h index abd0a50..8a8c51a 100644 --- a/src/mynteye/device/channel/channels.h +++ b/src/mynteye/device/channel/channels.h @@ -100,6 +100,8 @@ class MYNTEYE_API Channels { inline uint64_t timestamp_compensate(uint32_t timestamp32) { return 0; } + inline void SetAcceRange(const int & value) {accel_range = value;} + inline void SetGyroRange(const int & value) {gyro_range = value;} private: bool PuControlRange( diff --git a/src/mynteye/device/motions.cc b/src/mynteye/device/motions.cc index e901694..c80f5a1 100644 --- a/src/mynteye/device/motions.cc +++ b/src/mynteye/device/motions.cc @@ -69,6 +69,8 @@ void Motions::SetMotionCallback(motion_callback_t callback) { gyro_range = channels_->GetControlValue(Option::GYROSCOPE_RANGE); if (gyro_range == -1) gyro_range = channels_->GetGyroRangeDefault(); + channels_->SetAcceRange(accel_range); + channels_->SetGyroRange(gyro_range); channels_->SetImuCallback([this](const ImuPacket2 &packet) { if (!motion_callback_ && !motion_datas_enabled_) { @@ -114,8 +116,9 @@ void Motions::SetMotionCallback(motion_callback_t callback) { // LOG(INFO)<< "afterg" << imu->gyro[1]; // LOG(INFO)<< "afterg" << imu->gyro[2]; - bool proc_assembly = ((proc_mode_ & ProcessMode::PROC_IMU_ASSEMBLY) > 0); - bool proc_temp_drift = ((proc_mode_ & ProcessMode::PROC_IMU_TEMP_DRIFT) > 0); + bool proc_assembly =((proc_mode_ & ProcessMode::PROC_IMU_ASSEMBLY) > 0); + bool proc_temp_drift = + ((proc_mode_ & ProcessMode::PROC_IMU_TEMP_DRIFT) > 0); if (proc_assembly && proc_temp_drift) { ProcImuTempDrift(imu); ProcImuAssembly(imu);