From b2dba0864965fb69e1b78e5bd720b70ee4629750 Mon Sep 17 00:00:00 2001 From: h2zero <32826625+h2zero@users.noreply.github.com> Date: Sat, 25 Nov 2023 08:15:51 -0700 Subject: [PATCH] Fix build with IDF v5 (#139) Co-authored-by: h2zero --- src/NimBLEDevice.cpp | 4 +++- src/nimconfig.h | 12 ++++++++++++ src/nimconfig_rename.h | 8 ++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/NimBLEDevice.cpp b/src/NimBLEDevice.cpp index e19aa15..2f57a52 100644 --- a/src/NimBLEDevice.cpp +++ b/src/NimBLEDevice.cpp @@ -23,7 +23,9 @@ # include "esp_bt.h" # include "nvs_flash.h" # if defined(CONFIG_NIMBLE_CPP_IDF) -# include "esp_nimble_hci.h" +# if (ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0) || CONFIG_BT_NIMBLE_LEGACY_VHCI_ENABLE) +# include "esp_nimble_hci.h" +# endif # include "nimble/nimble_port.h" # include "nimble/nimble_port_freertos.h" # include "host/ble_hs.h" diff --git a/src/nimconfig.h b/src/nimconfig.h index 9c19031..b5e4b9b 100644 --- a/src/nimconfig.h +++ b/src/nimconfig.h @@ -25,6 +25,18 @@ #define CONFIG_BT_NIMBLE_ROLE_BROADCASTER #endif +#ifndef CONFIG_BTDM_SCAN_DUPL_TYPE_DEVICE +#define CONFIG_BTDM_SCAN_DUPL_TYPE_DEVICE 0 +#endif + +#ifndef CONFIG_BTDM_SCAN_DUPL_TYPE_DATA +#define CONFIG_BTDM_SCAN_DUPL_TYPE_DATA 1 +#endif + +#ifndef CONFIG_BTDM_SCAN_DUPL_TYPE_DATA_DEVICE +#define CONFIG_BTDM_SCAN_DUPL_TYPE_DATA_DEVICE 2 +#endif + /* Enables the use of Arduino String class for attribute values */ #if defined __has_include # if __has_include () diff --git a/src/nimconfig_rename.h b/src/nimconfig_rename.h index c45aa8b..8cdd80b 100644 --- a/src/nimconfig_rename.h +++ b/src/nimconfig_rename.h @@ -59,3 +59,11 @@ #if defined(CONFIG_NIMBLE_MAX_CONNECTIONS ) && !defined(CONFIG_BT_NIMBLE_MAX_CONNECTIONS) #define CONFIG_BT_NIMBLE_MAX_CONNECTIONS CONFIG_NIMBLE_MAX_CONNECTIONS #endif + +#if !defined(CONFIG_BTDM_SCAN_DUPL_CACHE_SIZE) && defined(CONFIG_BT_LE_SCAN_DUPL_CACHE_SIZE) +#define CONFIG_BTDM_SCAN_DUPL_CACHE_SIZE CONFIG_BT_LE_SCAN_DUPL_CACHE_SIZE +#endif + +#if !defined(CONFIG_BTDM_SCAN_DUPL_TYPE) && defined(CONFIG_BT_LE_SCAN_DUPL_TYPE) +#define CONFIG_BTDM_SCAN_DUPL_TYPE CONFIG_BT_LE_SCAN_DUPL_TYPE +#endif