Mavlink set last sent timestamp to space out initial publication

- remove QURT defines no longer required
This commit is contained in:
Daniel Agar
2018-06-09 13:38:44 +02:00
committed by Lorenz Meier
parent 98465171aa
commit a99f75dde2
16 changed files with 75 additions and 133 deletions
+13 -13
View File
@@ -49,17 +49,23 @@ class MavlinkStream
{
public:
MavlinkStream *next;
MavlinkStream *next{nullptr};
MavlinkStream(Mavlink *mavlink);
virtual ~MavlinkStream();
virtual ~MavlinkStream() = default;
// no copy, assignment, move, move assignment
MavlinkStream(const MavlinkStream &) = delete;
MavlinkStream &operator=(const MavlinkStream &) = delete;
MavlinkStream(MavlinkStream &&) = delete;
MavlinkStream &operator=(MavlinkStream &&) = delete;
/**
* Get the interval
*
* @param interval the interval in microseconds (us) between messages
*/
void set_interval(const int interval);
void set_interval(const int interval) { _interval = interval; }
/**
* Get the interval
@@ -71,7 +77,7 @@ public:
/**
* @return 0 if updated / sent, -1 if unchanged
*/
int update(const hrt_abstime t);
int update(const hrt_abstime &t);
virtual const char *get_name() const = 0;
virtual uint16_t get_id() = 0;
@@ -96,12 +102,10 @@ public:
virtual unsigned get_size_avg() { return get_size(); }
protected:
Mavlink *_mavlink;
int _interval; ///< if set to negative value = unlimited rate
Mavlink *const _mavlink;
int _interval{1000000}; ///< if set to negative value = unlimited rate
#ifndef __PX4_QURT
virtual bool send(const hrt_abstime t) = 0;
#endif
/**
* Function to collect/update data for the streams at a high rate independant of
@@ -112,11 +116,7 @@ protected:
virtual void update_data() { }
private:
hrt_abstime _last_sent;
/* do not allow top copying this class */
MavlinkStream(const MavlinkStream &);
MavlinkStream &operator=(const MavlinkStream &);
hrt_abstime _last_sent{0};
};