From a1daee269deee25fbb6236cb599a8fb5919c02b7 Mon Sep 17 00:00:00 2001 From: William Date: Fri, 24 Jan 2025 06:34:22 +0000 Subject: [PATCH] Fixed a bug when setting the size of the `send`'s `TX_MTU` (#256) * Set the TX_MTU to the L2CAP_MTU rather than the PAYLOAD_LEN. --- examples/apps/src/ble_l2cap_central.rs | 4 ++-- examples/apps/src/ble_l2cap_peripheral.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/apps/src/ble_l2cap_central.rs b/examples/apps/src/ble_l2cap_central.rs index 03919bd8..44858a68 100644 --- a/examples/apps/src/ble_l2cap_central.rs +++ b/examples/apps/src/ble_l2cap_central.rs @@ -26,7 +26,7 @@ where } = stack.build(); // NOTE: Modify this to match the address of the peripheral you want to connect to. - // Currently it matches the address used by the peripheral examples + // Currently, it matches the address used by the peripheral examples let target: Address = Address::random([0xff, 0x8f, 0x1a, 0x05, 0xe4, 0xff]); let config = ConnectConfig { @@ -49,7 +49,7 @@ where info!("New l2cap channel created, sending some data!"); for i in 0..10 { let tx = [i; PAYLOAD_LEN]; - ch1.send::<_, PAYLOAD_LEN>(&stack, &tx).await.unwrap(); + ch1.send::<_, L2CAP_MTU>(&stack, &tx).await.unwrap(); } info!("Sent data, waiting for them to be sent back"); let mut rx = [0; PAYLOAD_LEN]; diff --git a/examples/apps/src/ble_l2cap_peripheral.rs b/examples/apps/src/ble_l2cap_peripheral.rs index f4c0de7d..da173196 100644 --- a/examples/apps/src/ble_l2cap_peripheral.rs +++ b/examples/apps/src/ble_l2cap_peripheral.rs @@ -70,7 +70,7 @@ where Timer::after(Duration::from_secs(1)).await; for i in 0..10 { let tx = [i; PAYLOAD_LEN]; - ch1.send::<_, PAYLOAD_LEN>(&stack, &tx).await.unwrap(); + ch1.send::<_, L2CAP_MTU>(&stack, &tx).await.unwrap(); } info!("L2CAP data echoed");