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

Commit 065ccab

Browse files
author
iwahdan88
committed
Update to restore mtu seeting after bt resume from light sleep
1 parent bd4fdef commit 065ccab

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

esp32/mods/modbt.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ static esp_ble_adv_params_t bt_adv_params_sec = {
246246

247247

248248
static bool mod_bt_is_deinit;
249+
static uint16_t mod_bt_gatts_mtu_restore = 0;
249250
static bool mod_bt_is_conn_restore_available;
250251

251252
static uint8_t tx_pwr_level_to_dbm[] = {-12, -9, -6, -3, 0, 3, 6, 9};
@@ -326,7 +327,7 @@ void bt_resume(bool reconnect)
326327
esp_ble_gattc_app_register(MOD_BT_CLIENT_APP_ID);
327328
esp_ble_gatts_app_register(MOD_BT_SERVER_APP_ID);
328329

329-
esp_ble_gatt_set_local_mtu(BT_MTU_SIZE_MAX);
330+
esp_ble_gatt_set_local_mtu(mod_bt_gatts_mtu_restore);
330331

331332
bt_connection_obj_t *connection_obj = NULL;
332333

@@ -870,10 +871,12 @@ static mp_obj_t bt_init_helper(bt_obj_t *self, const mp_arg_val_t *args) {
870871
if(mtu > BT_MTU_SIZE_MAX)
871872
{
872873
esp_ble_gatt_set_local_mtu(BT_MTU_SIZE_MAX);
874+
mod_bt_gatts_mtu_restore = BT_MTU_SIZE_MAX;
873875
}
874876
else
875877
{
876878
esp_ble_gatt_set_local_mtu(mtu);
879+
mod_bt_gatts_mtu_restore = mtu;
877880
}
878881

879882
self->init = true;

0 commit comments

Comments
 (0)