fix(imu): issue of rnage.

This commit is contained in:
TinyO 2019-10-28 09:34:56 +08:00
parent c79808e7d8
commit ad406b1df2
2 changed files with 7 additions and 2 deletions

View File

@ -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(

View File

@ -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);