serialqueue: Limit message transmission to available receive buffer size

If the mcu is using a traditional serial port, then only send a new
message block if there is space available in the mcu receive buffer.
This should make it significantly less likely that high load on the
mcu will result in retransmits.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor
2018-05-28 09:42:59 -04:00
parent 0728c1a8be
commit d798fae20b
4 changed files with 32 additions and 5 deletions

View File

@@ -14,10 +14,13 @@
#include "sched.h" // sched_wake_tasks
#include "serial_irq.h" // serial_enable_tx_irq
static uint8_t receive_buf[192], receive_pos;
#define RX_BUFFER_SIZE 192
static uint8_t receive_buf[RX_BUFFER_SIZE], receive_pos;
static uint8_t transmit_buf[96], transmit_pos, transmit_max;
DECL_CONSTANT(SERIAL_BAUD, CONFIG_SERIAL_BAUD);
DECL_CONSTANT(RECEIVE_WINDOW, RX_BUFFER_SIZE);
// Rx interrupt - store read data
void