Iridiumsbd driver: Publish log message when TX buffer is deleted

This commit is contained in:
acfloria 2018-03-09 13:12:57 +01:00 committed by Beat Küng
parent 47567c5c24
commit 44937c3a99
2 changed files with 5 additions and 2 deletions

View File

@ -47,6 +47,7 @@
#include <systemlib/err.h>
#include <systemlib/systemlib.h>
#include <systemlib/param/param.h>
#include <systemlib/mavlink_log.h>
#include "drivers/drv_iridiumsbd.h"
@ -590,7 +591,7 @@ ssize_t IridiumSBD::write(struct file *filp, const char *buffer, size_t buflen)
if (*buffer == MAVLINK_PACKAGE_START) {
if (SATCOM_TX_BUF_LEN - tx_buf_write_idx - SATCOM_MIN_TX_BUF_SPACE - (*(buffer + 1) + 8) < 0) {
tx_buf_write_idx = 0;
PX4_INFO("Deleting full TX buffer before writing new message");
mavlink_log_critical(&_mavlink_log_pub, "Deleting full TX buffer before writing new message");
}
}
}
@ -598,7 +599,7 @@ ssize_t IridiumSBD::write(struct file *filp, const char *buffer, size_t buflen)
// check and reset the remaining buffer space for any non mavlink messages
if (SATCOM_TX_BUF_LEN - tx_buf_write_idx - SATCOM_MIN_TX_BUF_SPACE < 0) {
tx_buf_write_idx = 0;
PX4_INFO("Deleting full TX buffer");
mavlink_log_critical(&_mavlink_log_pub, "Deleting full TX buffer");
}
VERBOSE_INFO("WRITE: LEN %d, TX WRITTEN: %d", buflen, tx_buf_write_idx);

View File

@ -304,4 +304,6 @@ private:
pthread_mutex_t tx_buf_mutex = pthread_mutex_t();
bool verbose = false;
orb_advert_t _mavlink_log_pub{nullptr};
};