Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.

Commit 6fd1004

Browse files
author
iwahdan88
committed
[PYFW-324] Updated Char max length to correspond to MTU #close
1 parent d5787f4 commit 6fd1004

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

esp32/mods/modbt.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@
5858
******************************************************************************/
5959
#define BT_SCAN_QUEUE_SIZE_MAX (16)
6060
#define BT_GATTS_QUEUE_SIZE_MAX (2)
61-
#define BT_CHAR_VALUE_SIZE_MAX (20)
61+
#define BT_MTU_SIZE_MAX (200)
62+
#define BT_CHAR_VALUE_SIZE_MAX (BT_MTU_SIZE_MAX - 3)
6263

6364
#define MOD_BT_CLIENT_APP_ID (0)
6465
#define MOD_BT_SERVER_APP_ID (1)
@@ -297,7 +298,7 @@ void bt_resume(bool reconnect)
297298
esp_ble_gattc_app_register(MOD_BT_CLIENT_APP_ID);
298299
esp_ble_gatts_app_register(MOD_BT_SERVER_APP_ID);
299300

300-
esp_ble_gatt_set_local_mtu(200);
301+
esp_ble_gatt_set_local_mtu(BT_MTU_SIZE_MAX);
301302

302303
bt_connection_obj_t *connection_obj = NULL;
303304

@@ -563,6 +564,7 @@ static void gattc_events_handler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc
563564
bt_obj.busy = false;
564565
// intentional fall through
565566
case ESP_GATTC_CLOSE_EVT:
567+
case ESP_GATTC_DISCONNECT_EVT:
566568
close_connection(p_data->close.conn_id);
567569
bt_obj.busy = false;
568570
break;
@@ -797,7 +799,7 @@ static mp_obj_t bt_init_helper(bt_obj_t *self, const mp_arg_val_t *args) {
797799
esp_ble_gattc_app_register(MOD_BT_CLIENT_APP_ID);
798800
esp_ble_gatts_app_register(MOD_BT_SERVER_APP_ID);
799801

800-
esp_ble_gatt_set_local_mtu(500);
802+
esp_ble_gatt_set_local_mtu(BT_MTU_SIZE_MAX);
801803

802804
self->init = true;
803805
}

0 commit comments

Comments
 (0)