mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-26 03:53:33 +08:00
IridiumSBD: Only write to modem if new data arrived
This commit is contained in:
@@ -332,7 +332,7 @@ void IridiumSBD::standby_loop(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// write the MO buffer when the message stacking time expires
|
// write the MO buffer when the message stacking time expires
|
||||||
if ((tx_buf_write_idx > 0) && ((hrt_absolute_time() - last_write_time) > (uint64_t)param_stacking_time_ms * 1000)) {
|
if (tx_buf_write_pending && ((hrt_absolute_time() - last_write_time) > (uint64_t)param_stacking_time_ms * 1000)) {
|
||||||
write_tx_buf();
|
write_tx_buf();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -614,6 +614,7 @@ ssize_t IridiumSBD::write(struct file *filp, const char *buffer, size_t buflen)
|
|||||||
|
|
||||||
tx_buf_write_idx += buflen;
|
tx_buf_write_idx += buflen;
|
||||||
last_write_time = hrt_absolute_time();
|
last_write_time = hrt_absolute_time();
|
||||||
|
tx_buf_write_pending = true;
|
||||||
|
|
||||||
pthread_mutex_unlock(&tx_buf_mutex);
|
pthread_mutex_unlock(&tx_buf_mutex);
|
||||||
|
|
||||||
@@ -695,6 +696,8 @@ void IridiumSBD::write_tx_buf()
|
|||||||
|
|
||||||
VERBOSE_INFO("WRITE SBD: DATA WRITTEN TO MODEM");
|
VERBOSE_INFO("WRITE SBD: DATA WRITTEN TO MODEM");
|
||||||
|
|
||||||
|
tx_buf_write_pending = false;
|
||||||
|
|
||||||
pthread_mutex_unlock(&tx_buf_mutex);
|
pthread_mutex_unlock(&tx_buf_mutex);
|
||||||
|
|
||||||
tx_session_pending = true;
|
tx_session_pending = true;
|
||||||
|
|||||||
@@ -289,6 +289,7 @@ private:
|
|||||||
uint8_t tx_buf[SATCOM_TX_BUF_LEN] = {0};
|
uint8_t tx_buf[SATCOM_TX_BUF_LEN] = {0};
|
||||||
int tx_buf_write_idx = 0;
|
int tx_buf_write_idx = 0;
|
||||||
|
|
||||||
|
bool tx_buf_write_pending = false;
|
||||||
bool ring_pending = false;
|
bool ring_pending = false;
|
||||||
bool rx_session_pending = false;
|
bool rx_session_pending = false;
|
||||||
bool rx_read_pending = false;
|
bool rx_read_pending = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user