mirror of
https://gitee.com/xiaohuolufeihua/bizhang_-obav.git
synced 2026-05-22 01:12:31 +00:00
Iridiumsbd driver: Publish log message when TX buffer is deleted
This commit is contained in:
@@ -47,6 +47,7 @@
|
|||||||
#include <systemlib/err.h>
|
#include <systemlib/err.h>
|
||||||
#include <systemlib/systemlib.h>
|
#include <systemlib/systemlib.h>
|
||||||
#include <systemlib/param/param.h>
|
#include <systemlib/param/param.h>
|
||||||
|
#include <systemlib/mavlink_log.h>
|
||||||
|
|
||||||
#include "drivers/drv_iridiumsbd.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 (*buffer == MAVLINK_PACKAGE_START) {
|
||||||
if (SATCOM_TX_BUF_LEN - tx_buf_write_idx - SATCOM_MIN_TX_BUF_SPACE - (*(buffer + 1) + 8) < 0) {
|
if (SATCOM_TX_BUF_LEN - tx_buf_write_idx - SATCOM_MIN_TX_BUF_SPACE - (*(buffer + 1) + 8) < 0) {
|
||||||
tx_buf_write_idx = 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
|
// 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) {
|
if (SATCOM_TX_BUF_LEN - tx_buf_write_idx - SATCOM_MIN_TX_BUF_SPACE < 0) {
|
||||||
tx_buf_write_idx = 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);
|
VERBOSE_INFO("WRITE: LEN %d, TX WRITTEN: %d", buflen, tx_buf_write_idx);
|
||||||
|
|||||||
@@ -304,4 +304,6 @@ private:
|
|||||||
|
|
||||||
pthread_mutex_t tx_buf_mutex = pthread_mutex_t();
|
pthread_mutex_t tx_buf_mutex = pthread_mutex_t();
|
||||||
bool verbose = false;
|
bool verbose = false;
|
||||||
|
|
||||||
|
orb_advert_t _mavlink_log_pub{nullptr};
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user