From e70804c9d0c5dbb816271a49b4575805ff78e32d Mon Sep 17 00:00:00 2001 From: devbharat Date: Mon, 18 Apr 2016 17:14:25 +0200 Subject: [PATCH] Removed debug comments --- src/modules/mavlink/mavlink_receiver.cpp | 4 ++-- src/modules/mavlink/mavlink_receiver.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/modules/mavlink/mavlink_receiver.cpp b/src/modules/mavlink/mavlink_receiver.cpp index c0cb7029c7..db788fabda 100644 --- a/src/modules/mavlink/mavlink_receiver.cpp +++ b/src/modules/mavlink/mavlink_receiver.cpp @@ -1345,7 +1345,7 @@ MavlinkReceiver::handle_message_timesync(mavlink_message_t *msg) } else if (tsync.tc1 > 0) { - int64_t offset_ns = (tsync.ts1 + now_ns - tsync.tc1*2)/2 ; + int64_t offset_ns = (int64_t)(tsync.ts1 + now_ns - tsync.tc1*2)/2 ; int64_t dt = _time_offset - offset_ns; if (dt > 10000000LL || dt < -10000000LL) { // 10 millisecond skew @@ -1995,7 +1995,7 @@ uint64_t MavlinkReceiver::sync_stamp(uint64_t usec) } -void MavlinkReceiver::smooth_time_offset(uint64_t offset_ns) +void MavlinkReceiver::smooth_time_offset(int64_t offset_ns) { /* alpha = 0.6 fixed for now. The closer alpha is to 1.0, * the faster the moving average updates in response to diff --git a/src/modules/mavlink/mavlink_receiver.h b/src/modules/mavlink/mavlink_receiver.h index 0e99568176..b077bc4151 100644 --- a/src/modules/mavlink/mavlink_receiver.h +++ b/src/modules/mavlink/mavlink_receiver.h @@ -152,7 +152,7 @@ private: /** * Exponential moving average filter to smooth time offset */ - void smooth_time_offset(uint64_t offset_ns); + void smooth_time_offset(int64_t offset_ns); /** * Decode a switch position from a bitfield @@ -216,7 +216,7 @@ private: struct vehicle_attitude_setpoint_s _att_sp; struct vehicle_rates_setpoint_s _rates_sp; double _time_offset_avg_alpha; - uint64_t _time_offset; + int64_t _time_offset; int _orb_class_instance; static constexpr unsigned MOM_SWITCH_COUNT = 8;