Skip to content

Commit

Permalink
application: nrf5340_audio: Fix num_conn not set and zbus wait time
Browse files Browse the repository at this point in the history
Fix num_conn not initialized properly which could cause
the CIS gateway cannot establish connection properly.
Fix zbus publish wait time in le_audio_event_publish.

Signed-off-by: Jui-Chou Chung <jui-chou.chung@nordicsemi.no>
  • Loading branch information
rick1082 authored and nordicjm committed Aug 11, 2023
1 parent b1f3be6 commit 1899750
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ static void connected_cb(struct bt_conn *conn, uint8_t err)
{
int ret;
char addr[BT_ADDR_LE_STR_LEN];
uint8_t num_conn;
uint8_t num_conn = 0;
uint16_t conn_handle;
enum ble_hci_vs_tx_power conn_tx_pwr;
struct bt_mgmt_msg msg;
Expand Down
1 change: 1 addition & 0 deletions applications/nrf5340_audio/src/bluetooth/le_audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <zephyr/bluetooth/audio/audio.h>
#include <audio_defines.h>

#define LE_AUDIO_ZBUS_EVENT_WAIT_TIME K_MSEC(5)
#define LE_AUDIO_SDU_SIZE_OCTETS(bitrate) (bitrate / (1000000 / CONFIG_AUDIO_FRAME_DURATION_US) / 8)

#if (CONFIG_AUDIO_SAMPLE_RATE_48000_HZ)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ static void le_audio_event_publish(enum le_audio_evt_type event)

msg.event = event;

ret = zbus_chan_pub(&le_audio_chan, &msg, K_NO_WAIT);
ret = zbus_chan_pub(&le_audio_chan, &msg, LE_AUDIO_ZBUS_EVENT_WAIT_TIME);
ERR_CHK(ret);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ static void le_audio_event_publish(enum le_audio_evt_type event)

msg.event = event;

ret = zbus_chan_pub(&le_audio_chan, &msg, K_NO_WAIT);
ret = zbus_chan_pub(&le_audio_chan, &msg, LE_AUDIO_ZBUS_EVENT_WAIT_TIME);
ERR_CHK(ret);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ static void le_audio_event_publish(enum le_audio_evt_type event, struct bt_conn
msg.event = event;
msg.conn = conn;

ret = zbus_chan_pub(&le_audio_chan, &msg, K_NO_WAIT);
ret = zbus_chan_pub(&le_audio_chan, &msg, LE_AUDIO_ZBUS_EVENT_WAIT_TIME);
ERR_CHK(ret);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ static void le_audio_event_publish(enum le_audio_evt_type event, struct bt_conn
msg.event = event;
msg.conn = conn;

ret = zbus_chan_pub(&le_audio_chan, &msg, K_NO_WAIT);
ret = zbus_chan_pub(&le_audio_chan, &msg, LE_AUDIO_ZBUS_EVENT_WAIT_TIME);
ERR_CHK(ret);
}

Expand Down

0 comments on commit 1899750

Please sign in to comment.