Skip to content

Commit 906014b

Browse files
Damian-Nordicrlubos
authored andcommitted
samples: bluetooth: throughput: allow reducing MTU
According to the documentation of throughput sample, it is possible to change the default MTU, but the code hard-coded the GATT data length, so an attempt to use a reduced MTU ended up with a buffer allocation failure. Signed-off-by: Damian Krolik <[email protected]>
1 parent 599995c commit 906014b

File tree

1 file changed

+3
-3
lines changed
  • samples/bluetooth/throughput/src

1 file changed

+3
-3
lines changed

samples/bluetooth/throughput/src/main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ int test_run(const struct shell *shell,
547547
uint32_t data = 0;
548548

549549
/* a dummy data buffer */
550-
static char dummy[495];
550+
static char dummy[CONFIG_BT_L2CAP_TX_MTU - 3];
551551

552552
if (!default_conn) {
553553
shell_error(shell, "Device is disconnected %s",
@@ -585,12 +585,12 @@ int test_run(const struct shell *shell,
585585
stamp = k_uptime_get_32();
586586

587587
while (true) {
588-
err = bt_throughput_write(&throughput, dummy, 495);
588+
err = bt_throughput_write(&throughput, dummy, sizeof(dummy));
589589
if (err) {
590590
shell_error(shell, "GATT write failed (err %d)", err);
591591
break;
592592
}
593-
data += 495;
593+
data += sizeof(dummy);
594594
if (k_uptime_get_32() - stamp > CONFIG_BT_THROUGHPUT_DURATION) {
595595
break;
596596
}

0 commit comments

Comments
 (0)