From 239c855c187b6376d44f2f5074c26c8cc4b71dc9 Mon Sep 17 00:00:00 2001 From: kalman Date: Fri, 22 Mar 2019 19:15:09 +0800 Subject: [PATCH] feat(imu): add is_ets flag for imu --- src/mynteye/device/channel/def.h | 2 ++ src/mynteye/device/standard2/channels_adapter_s2.cc | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mynteye/device/channel/def.h b/src/mynteye/device/channel/def.h index a903854..ec8b2b9 100644 --- a/src/mynteye/device/channel/def.h +++ b/src/mynteye/device/channel/def.h @@ -72,6 +72,8 @@ struct ImuSegment { std::uint32_t frame_id; std::uint64_t timestamp; std::uint8_t flag; + // Is external time source + bool is_ets; std::int16_t temperature; std::int16_t accel[3]; std::int16_t gyro[3]; diff --git a/src/mynteye/device/standard2/channels_adapter_s2.cc b/src/mynteye/device/standard2/channels_adapter_s2.cc index 13efb89..0c0157b 100644 --- a/src/mynteye/device/standard2/channels_adapter_s2.cc +++ b/src/mynteye/device/standard2/channels_adapter_s2.cc @@ -55,7 +55,8 @@ struct ImuData { void unpack_imu_segment(const ImuData &imu, ImuSegment *seg) { seg->frame_id = imu.frame_id; seg->timestamp = imu.timestamp; - seg->flag = imu.flag; + seg->flag = imu.flag & 0b0011; + seg->is_ets = (imu.flag & 0b0100 == 0b0100); seg->temperature = imu.temperature; seg->accel[0] = (seg->flag == 1) ? imu.accel_or_gyro[0] : 0; seg->accel[1] = (seg->flag == 1) ? imu.accel_or_gyro[1] : 0;