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

Commit

Permalink
Merge pull request #28 from iwahdan88/master
Browse files Browse the repository at this point in the history
Updated Char max length to correspond to MTU
  • Loading branch information
Islam Wahdan authored Apr 15, 2019
2 parents d5787f4 + 6fd1004 commit 43f34ca
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions esp32/mods/modbt.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@
******************************************************************************/
#define BT_SCAN_QUEUE_SIZE_MAX (16)
#define BT_GATTS_QUEUE_SIZE_MAX (2)
#define BT_CHAR_VALUE_SIZE_MAX (20)
#define BT_MTU_SIZE_MAX (200)
#define BT_CHAR_VALUE_SIZE_MAX (BT_MTU_SIZE_MAX - 3)

#define MOD_BT_CLIENT_APP_ID (0)
#define MOD_BT_SERVER_APP_ID (1)
Expand Down Expand Up @@ -297,7 +298,7 @@ void bt_resume(bool reconnect)
esp_ble_gattc_app_register(MOD_BT_CLIENT_APP_ID);
esp_ble_gatts_app_register(MOD_BT_SERVER_APP_ID);

esp_ble_gatt_set_local_mtu(200);
esp_ble_gatt_set_local_mtu(BT_MTU_SIZE_MAX);

bt_connection_obj_t *connection_obj = NULL;

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

esp_ble_gatt_set_local_mtu(500);
esp_ble_gatt_set_local_mtu(BT_MTU_SIZE_MAX);

self->init = true;
}
Expand Down

0 comments on commit 43f34ca

Please sign in to comment.