4s conn interval

This commit is contained in:
leo 2022-12-03 13:23:35 +01:00
parent fd69597093
commit cc09f5b47e
Signed by: leo
GPG Key ID: 0DD993BFB2B307DB

View File

@ -1,3 +1,5 @@
#include "host/ble_gap.h"
#include "nimble/hci_common.h"
#include "sdkconfig.h" #include "sdkconfig.h"
#ifdef CONFIG_BT_NIMBLE_ENABLED #ifdef CONFIG_BT_NIMBLE_ENABLED
@ -76,6 +78,14 @@ struct ble_gap_adv_params adv_params = {
.itvl_max = 0x4000, .itvl_max = 0x4000,
}; };
struct ble_gap_upd_params conn_params = {
.itvl_min = 3200, //Minimum value for connection interval in 1.25ms units min=6 (7.5ms) max=3200 (4s)
.itvl_max = 3200,
.latency = 0,
.supervision_timeout = 3200, //Supervision timeout in 10ms units min=10 max=3200
.min_ce_len = 0, //Minimum length of connection event in 0.625ms units
.max_ce_len = 0,
};
static struct ble_gatt_svc_def gatt_svr_svcs[] = { static struct ble_gatt_svc_def gatt_svr_svcs[] = {
[ES_SVC_IDX] = { [ES_SVC_IDX] = {
@ -218,7 +228,10 @@ static int ble_gap_event(struct ble_gap_event *event, void* arg){
ESP_LOGI(NIMBLE_LOG_TAG, "connect event"); ESP_LOGI(NIMBLE_LOG_TAG, "connect event");
if(event->connect.status) if(event->connect.status)
ble_advertise(); ble_advertise();
else {
conn_handle = event->connect.conn_handle; conn_handle = event->connect.conn_handle;
ESP_ERROR_CHECK(ble_gap_update_params(event->connect.conn_handle, &conn_params));
}
break; break;
case BLE_GAP_EVENT_DISCONNECT: case BLE_GAP_EVENT_DISCONNECT:
ESP_LOGI(NIMBLE_LOG_TAG, "disconnect event"); ESP_LOGI(NIMBLE_LOG_TAG, "disconnect event");