Ensure state set correctly on exit from state transform functions
This commit is contained in:
parent
90805d61d9
commit
0fb0118ffa
16
src/main.c
16
src/main.c
|
@ -716,19 +716,20 @@ static linkstate_t do_uninit(struct net_buf const *buf) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static linkstate_t do_init(struct net_buf const *buf) {
|
static linkstate_t do_init(struct net_buf const *buf) {
|
||||||
if (packet_is_config(buf)) {
|
if (packet_is_config_response(buf)) {
|
||||||
h5_send_config_response();
|
|
||||||
return INIT;
|
|
||||||
} else if (packet_is_config_response(buf)) {
|
|
||||||
h5.tx_win = conf_rsp[2] & 0x7;
|
h5.tx_win = conf_rsp[2] & 0x7;
|
||||||
h5.tx_seq = 0;
|
h5.tx_seq = 0;
|
||||||
h5.tx_ack = 0;
|
h5.tx_ack = 0;
|
||||||
LOG_DBG("Finished H5 configuration, tx_win %u", h5.tx_win);
|
LOG_DBG("Finished H5 configuration, tx_win %u", h5.tx_win);
|
||||||
return ACTIVE;
|
return ACTIVE;
|
||||||
}
|
}
|
||||||
|
if (packet_is_config(buf)) {
|
||||||
|
h5_send_config_response();
|
||||||
|
}
|
||||||
|
return INIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
static linkstate_t do_active(struct net_buf const *buf) {
|
static linkstate_t do_active(struct net_buf *buf) {
|
||||||
if (packet_is_config(buf)) {
|
if (packet_is_config(buf)) {
|
||||||
h5_send_config_response();
|
h5_send_config_response();
|
||||||
return ACTIVE;
|
return ACTIVE;
|
||||||
|
@ -745,13 +746,12 @@ static linkstate_t do_active(struct net_buf const *buf) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Presumably something from the controller
|
// Presumably something from the controller
|
||||||
u8_t type = bt_buf_get_type(buf);
|
if (bt_buf_get_type(buf) == BT_BUF_EVT) {
|
||||||
if (type == BT_BUF_EVT) {
|
|
||||||
//LOG_HEXDUMP_DBG(buf->data, buf->len, "CTRL -> HOST");
|
|
||||||
h5_send(buf->data, HCI_EVENT_PKT, buf->len);
|
h5_send(buf->data, HCI_EVENT_PKT, buf->len);
|
||||||
} 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");
|
||||||
}
|
}
|
||||||
|
return ACTIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void main(void)
|
void main(void)
|
||||||
|
|
Loading…
Reference in New Issue