From 77a3af48cb29119efd3e9f869da4c4bf2c4e419f Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Thu, 15 Aug 2019 19:32:20 +0200
Subject: [PATCH] change(ble): Increase MTU to 241 bytes

By default the MTU is set to 23 bytes, use 241 bytes instead to make the
UART and file transfer service more efficient. The MTU also contains
some BLE headers and is not only the usable data.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 epicardium/ble/ble_main.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/epicardium/ble/ble_main.c b/epicardium/ble/ble_main.c
index 9eed9296..a20b197d 100644
--- a/epicardium/ble/ble_main.c
+++ b/epicardium/ble/ble_main.c
@@ -120,6 +120,15 @@ static const smpCfg_t bleSmpCfg =
   DM_AUTH_MITM_FLAG,                      /*! Device authentication requirements */
 };
 
+/* Configuration structure */
+static const attCfg_t bleAttCfg =
+{
+  15,                                  /* ATT server service discovery connection idle timeout in seconds */
+  241,                                 /* desired ATT MTU */
+  ATT_MAX_TRANS_TIMEOUT,               /* transaction timeout in seconds */
+  1                                    /* number of queued prepare writes supported by server */
+};
+
 /**************************************************************************************************
   Advertising Data
 **************************************************************************************************/
@@ -454,6 +463,7 @@ static void BleHandlerInit(void)
 
   /* Set stack configuration pointers */
   pSmpCfg = (smpCfg_t *) &bleSmpCfg;
+  pAttCfg = (attCfg_t *) &bleAttCfg;
 
   /* initialize battery service server */
   BasInit(bleHandlerId, (basCfg_t *) &bleBasCfg);
-- 
GitLab