MAVLink stream: Do not override interval too much

This commit is contained in:
Lorenz Meier
2017-07-29 11:19:52 +02:00
parent af451ce638
commit 3f048e8a87

View File

@@ -99,7 +99,7 @@ MavlinkStream::update(const hrt_abstime t)
// Send the message if it is due or // Send the message if it is due or
// if it will overrun the next scheduled send interval // if it will overrun the next scheduled send interval
// by 40% of the interval time. This helps to avoid // by 30% of the interval time. This helps to avoid
// sending a scheduled message on average slower than // sending a scheduled message on average slower than
// scheduled. Doing this at 50% would risk sending // scheduled. Doing this at 50% would risk sending
// the message too often as the loop runtime of the app // the message too often as the loop runtime of the app
@@ -107,7 +107,7 @@ MavlinkStream::update(const hrt_abstime t)
// This method is not theoretically optimal but a suitable // This method is not theoretically optimal but a suitable
// stopgap as it hits its deadlines well (0.5 Hz, 50 Hz and 250 Hz) // stopgap as it hits its deadlines well (0.5 Hz, 50 Hz and 250 Hz)
if (interval == 0 || (dt > (interval - (_mavlink->get_main_loop_delay() / 10) * 4))) { if (interval == 0 || (dt > (interval - (_mavlink->get_main_loop_delay() / 10) * 3))) {
// interval expired, send message // interval expired, send message
bool sent = true; bool sent = true;
#ifndef __PX4_QURT #ifndef __PX4_QURT