mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-01 04:20:33 +00:00
don't send DAEMON_EVENT_HCI_PACKET_SENT for eHCILL commmands
This commit is contained in:
parent
c602bc0df3
commit
8f837ea3d3
@ -133,6 +133,7 @@ static void (*packet_handler)(uint8_t packet_type, uint8_t *packet, uint16_t si
|
|||||||
|
|
||||||
// H4: tx state
|
// H4: tx state
|
||||||
static TX_STATE tx_state;
|
static TX_STATE tx_state;
|
||||||
|
static int tx_send_packet_sent;
|
||||||
static uint8_t * tx_data;
|
static uint8_t * tx_data;
|
||||||
static uint16_t tx_len;
|
static uint16_t tx_len;
|
||||||
static uint8_t tx_packet_type;
|
static uint8_t tx_packet_type;
|
||||||
@ -319,6 +320,9 @@ static void h4_block_sent(void){
|
|||||||
hal_uart_dma_send_block(tx_data, tx_len);
|
hal_uart_dma_send_block(tx_data, tx_len);
|
||||||
break;
|
break;
|
||||||
case TX_W4_PACKET_SENT:
|
case TX_W4_PACKET_SENT:
|
||||||
|
// non-ehcill packet sent, confirm
|
||||||
|
tx_send_packet_sent = 1;
|
||||||
|
|
||||||
// send pending ehcill command if neccessary
|
// send pending ehcill command if neccessary
|
||||||
switch (ehcill_command_to_send){
|
switch (ehcill_command_to_send){
|
||||||
case EHCILL_GO_TO_SLEEP_ACK:
|
case EHCILL_GO_TO_SLEEP_ACK:
|
||||||
@ -368,13 +372,17 @@ static void dump(uint8_t *data, uint16_t len){
|
|||||||
static int h4_process(struct data_source *ds) {
|
static int h4_process(struct data_source *ds) {
|
||||||
|
|
||||||
// notify about packet sent
|
// notify about packet sent
|
||||||
if (tx_state == TX_DONE){
|
if (tx_send_packet_sent){
|
||||||
// reset state
|
tx_send_packet_sent = 0;
|
||||||
tx_state = TX_IDLE;
|
|
||||||
uint8_t event[] = { DAEMON_EVENT_HCI_PACKET_SENT, 0 };
|
uint8_t event[] = { DAEMON_EVENT_HCI_PACKET_SENT, 0 };
|
||||||
packet_handler(HCI_EVENT_PACKET, &event[0], sizeof(event));
|
packet_handler(HCI_EVENT_PACKET, &event[0], sizeof(event));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// reset tx state
|
||||||
|
if (tx_state == TX_DONE){
|
||||||
|
tx_state = TX_IDLE;
|
||||||
|
}
|
||||||
|
|
||||||
if (h4_state != H4_PACKET_RECEIVED) return 0;
|
if (h4_state != H4_PACKET_RECEIVED) return 0;
|
||||||
|
|
||||||
// log packet
|
// log packet
|
||||||
@ -410,7 +418,7 @@ static void ehcill_schedule_ecill_command(uint8_t command){
|
|||||||
// new: setup timer;
|
// new: setup timer;
|
||||||
// new: break
|
// new: break
|
||||||
case TX_DONE:
|
case TX_DONE:
|
||||||
|
|
||||||
|
|
||||||
// gpio_clear(GPIOB, GPIO_DEBUG_1);
|
// gpio_clear(GPIOB, GPIO_DEBUG_1);
|
||||||
tx_state = TX_W4_EHCILL_SENT;
|
tx_state = TX_W4_EHCILL_SENT;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user