IridiumSBD: Only write to modem if new data arrived

This commit is contained in:
acfloria 2018-03-13 09:39:26 +01:00 committed by Beat Küng
parent 44937c3a99
commit 28da1492d3
2 changed files with 5 additions and 1 deletions

View File

@ -332,7 +332,7 @@ void IridiumSBD::standby_loop(void)
}
// 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();
}
@ -614,6 +614,7 @@ ssize_t IridiumSBD::write(struct file *filp, const char *buffer, size_t buflen)
tx_buf_write_idx += buflen;
last_write_time = hrt_absolute_time();
tx_buf_write_pending = true;
pthread_mutex_unlock(&tx_buf_mutex);
@ -695,6 +696,8 @@ void IridiumSBD::write_tx_buf()
VERBOSE_INFO("WRITE SBD: DATA WRITTEN TO MODEM");
tx_buf_write_pending = false;
pthread_mutex_unlock(&tx_buf_mutex);
tx_session_pending = true;

View File

@ -289,6 +289,7 @@ private:
uint8_t tx_buf[SATCOM_TX_BUF_LEN] = {0};
int tx_buf_write_idx = 0;
bool tx_buf_write_pending = false;
bool ring_pending = false;
bool rx_session_pending = false;
bool rx_read_pending = false;