summaryrefslogtreecommitdiff
path: root/extmod
diff options
context:
space:
mode:
Diffstat (limited to 'extmod')
-rw-r--r--extmod/modbluetooth.h2
-rw-r--r--extmod/modbluetooth_nimble.c5
2 files changed, 7 insertions, 0 deletions
diff --git a/extmod/modbluetooth.h b/extmod/modbluetooth.h
index 1b1318dec..9db3bed6c 100644
--- a/extmod/modbluetooth.h
+++ b/extmod/modbluetooth.h
@@ -48,7 +48,9 @@
#endif
// Common constants.
+#ifndef MP_BLUETOOTH_MAX_ATTR_SIZE
#define MP_BLUETOOTH_MAX_ATTR_SIZE (20)
+#endif
// Advertisement packet lengths
#define MP_BLUETOOTH_GAP_ADV_MAX_LEN (32)
diff --git a/extmod/modbluetooth_nimble.c b/extmod/modbluetooth_nimble.c
index 21d71e3c9..959360cee 100644
--- a/extmod/modbluetooth_nimble.c
+++ b/extmod/modbluetooth_nimble.c
@@ -301,6 +301,11 @@ STATIC void sync_cb(void) {
assert(rc == 0);
}
+ if (MP_BLUETOOTH_MAX_ATTR_SIZE > 20) {
+ rc = ble_att_set_preferred_mtu(MP_BLUETOOTH_MAX_ATTR_SIZE+3);
+ assert(rc == 0);
+ }
+
ble_svc_gap_device_name_set(MICROPY_PY_BLUETOOTH_DEFAULT_NAME);
ble_state = BLE_STATE_ACTIVE;