mavlink: Only send event-based messages if there is space in the buffer

This commit is contained in:
Lorenz Meier
2014-07-19 23:39:02 +02:00
parent cbfbdd2788
commit cd8a0cd217
3 changed files with 84 additions and 6 deletions
+16 -1
View File
@@ -247,6 +247,13 @@ public:
*/
void count_rxbytes(unsigned n) { _bytes_rx += n; };
/**
* Get the free space in the transmit buffer
*
* @return free space in the UART TX buffer
*/
unsigned get_free_tx_buf();
/**
* Get the receive status of this MAVLink link
*/
@@ -292,7 +299,8 @@ private:
bool _ftp_on;
int _uart_fd;
int _baudrate;
int _datarate;
int _datarate; ///< data rate for normal streams (attitude, position, etc.)
int _datarate_events; ///< data rate for params, waypoints, text messages
/**
* If the queue index is not at 0, the queue sending
@@ -385,6 +393,13 @@ private:
int configure_stream(const char *stream_name, const float rate);
/**
* Adjust the stream rates based on the current rate
*
* @param multiplier if greater than 1, the transmission rate will increase, if smaller than one decrease
*/
void adjust_stream_rates(const float multiplier);
int message_buffer_init(int size);
void message_buffer_destroy();