forked from Archive/PX4-Autopilot
mavlink: MavlinkStream API updated
This commit is contained in:
parent
4722b609cc
commit
344a34bb72
|
@ -71,11 +71,12 @@ int
|
|||
MavlinkStream::update(const hrt_abstime t)
|
||||
{
|
||||
uint64_t dt = t - _last_sent;
|
||||
unsigned int interval = _interval * _mavlink->get_rate_mult();
|
||||
|
||||
if (dt > 0 && dt >= _interval) {
|
||||
if (dt > 0 && dt >= interval) {
|
||||
/* interval expired, send message */
|
||||
send(t);
|
||||
_last_sent = (t / _interval) * _interval;
|
||||
_last_sent = t;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -46,8 +46,6 @@
|
|||
class Mavlink;
|
||||
class MavlinkStream;
|
||||
|
||||
#include "mavlink_main.h"
|
||||
|
||||
class MavlinkStream
|
||||
{
|
||||
|
||||
|
@ -70,7 +68,6 @@ public:
|
|||
* @return the inveral in microseconds (us) between messages
|
||||
*/
|
||||
unsigned get_interval() { return _interval; }
|
||||
void set_channel(mavlink_channel_t channel);
|
||||
|
||||
/**
|
||||
* @return 0 if updated / sent, -1 if unchanged
|
||||
|
@ -82,6 +79,16 @@ public:
|
|||
virtual const char *get_name() const = 0;
|
||||
virtual uint8_t get_id() = 0;
|
||||
|
||||
/**
|
||||
* @return true if steam rate shouldn't be adjusted
|
||||
*/
|
||||
virtual bool const_rate() { return false; }
|
||||
|
||||
/**
|
||||
* Get maximal total messages size on update
|
||||
*/
|
||||
virtual unsigned get_size() = 0;
|
||||
|
||||
protected:
|
||||
Mavlink * _mavlink;
|
||||
unsigned int _interval;
|
||||
|
|
Loading…
Reference in New Issue