1
0
Fork 0

Adds experiment to keep high-traffic environments from blocking command response by events

This commit is contained in:
Shawn Nock 2019-07-27 14:19:14 -05:00
parent fa622ba910
commit 36138b56fb
1 changed files with 8 additions and 3 deletions

View File

@ -533,7 +533,7 @@ static void unproc_thread(void) {
//LOG_HEXDUMP_DBG((uint8_t*)&hdr, sizeof(hdr), "Header"); //LOG_HEXDUMP_DBG((uint8_t*)&hdr, sizeof(hdr), "Header");
if (hdr.is_reliable) { if (hdr.is_reliable) {
LOG_DBG("Header: seq %d, ack %d, rel: %s, crc16: %s", hdr.seq, hdr.ack, LOG_DBG("Header: seq %d, ack %d, rel: %s, has_crc16: %s", hdr.seq, hdr.ack,
hdr.is_reliable ? "true" : "false", hdr.is_reliable ? "true" : "false",
hdr.crc_after_payload ? "true" : "false"); hdr.crc_after_payload ? "true" : "false");
} }
@ -637,7 +637,7 @@ static void tx_thread(void)
k_sleep(250); k_sleep(250);
break; break;
case ACTIVE: case ACTIVE:
while ((buf = net_buf_get(&h5.controller_queue, K_MSEC(100)))) { while ((buf = net_buf_get(&h5.controller_queue, K_FOREVER))) {
bt_send(buf); bt_send(buf);
} }
//LOG_DBG("controller_queue empty"); //LOG_DBG("controller_queue empty");
@ -886,6 +886,7 @@ static linkstate_t do_active(struct net_buf *buf) {
// Presumably something from the controller // Presumably something from the controller
if (bt_buf_get_type(buf) == BT_BUF_EVT) { if (bt_buf_get_type(buf) == BT_BUF_EVT) {
h5_send(buf->data, HCI_EVENT_PKT, buf->len); h5_send(buf->data, HCI_EVENT_PKT, buf->len);
k_yield();
} else { } else {
LOG_HEXDUMP_ERR(buf->data, buf->len, "Unexpected buffer in host_queue"); LOG_HEXDUMP_ERR(buf->data, buf->len, "Unexpected buffer in host_queue");
} }
@ -898,7 +899,11 @@ void state_change(int old, int new) {
return; return;
} }
h5.link_state = new; h5.link_state = new;
k_wakeup(&tx_thread_data); if (old != ACTIVE) {
k_wakeup(&tx_thread_data);
} else {
k_fifo_cancel_wait(&h5.controller_queue);
}
} }
void main(void) void main(void)