diff --git a/src/modules/mavlink/mavlink_stream.cpp b/src/modules/mavlink/mavlink_stream.cpp index 45f716d40d..4073d2c482 100644 --- a/src/modules/mavlink/mavlink_stream.cpp +++ b/src/modules/mavlink/mavlink_stream.cpp @@ -118,11 +118,12 @@ MavlinkStream::update(const hrt_abstime t) sent = send(t); #endif - // If the interval is non-zero do not use the actual time but - // increment at a fixed rate, so that processing delays do not - // distort the average rate + // If the interval is non-zero and dt is smaller than 1.5 times the interval + // do not use the actual time but increment at a fixed rate, so that processing delays do not + // distort the average rate. The check of the maximum interval is done to ensure that after a long time + // not sending anything multiple messages in a short time are sent. if (sent) { - _last_sent = (interval > 0) ? _last_sent + interval : t; + _last_sent = ((interval > 0) && ((int64_t)(1.5 * interval) > dt)) ? _last_sent + interval : t; return 0; } else {