Przeglądaj źródła

Merge branch 'feature/add_config_to_set_duplicate_scan_list_refresh_time' into 'master'

Add config to set duplicate scan list refresh period on ESP32-S3 and ESP32-C3

Closes BT-3073 and BT-3023

See merge request espressif/esp-idf!21586
Zhi Wei Jian 3 lat temu
rodzic
commit
67cfef0acd

+ 16 - 0
components/bt/controller/esp32c3/Kconfig.in

@@ -280,6 +280,22 @@ config BT_CTRL_SCAN_DUPL_CACHE_SIZE
         Maximum number of devices which can be recorded in scan duplicate filter.
         Maximum number of devices which can be recorded in scan duplicate filter.
         When the maximum amount of device in the filter is reached, the cache will be refreshed.
         When the maximum amount of device in the filter is reached, the cache will be refreshed.
 
 
+config BT_CTRL_DUPL_SCAN_CACHE_REFRESH_PERIOD
+    int "Duplicate scan list refresh period"
+    depends on BT_CTRL_BLE_SCAN_DUPL
+    range 0 1000
+    default 0
+    help
+        If the period value is non-zero, the controller will periodically clear the device information
+        stored in the scan duuplicate filter. If it is 0, the scan duuplicate filter will not be cleared
+        until the scanning is disabled. Duplicate advertisements for this period should not be sent to the
+        Host in advertising report events.
+        There are two scenarios where the ADV packet will be repeatedly reported:
+        1. The duplicate scan cache is full, the controller will delete the oldest device information and
+        add new device information.
+        2. When the refresh period is up, the controller will clear all device information and start filtering
+        again.
+
 config BT_CTRL_BLE_MESH_SCAN_DUPL_EN
 config BT_CTRL_BLE_MESH_SCAN_DUPL_EN
     bool "Special duplicate scan mechanism for BLE Mesh scan"
     bool "Special duplicate scan mechanism for BLE Mesh scan"
     depends on BT_CTRL_BLE_SCAN_DUPL
     depends on BT_CTRL_BLE_SCAN_DUPL

+ 16 - 0
components/bt/controller/esp32s3/Kconfig.in

@@ -297,6 +297,22 @@ config BT_CTRL_SCAN_DUPL_CACHE_SIZE
         Maximum number of devices which can be recorded in scan duplicate filter.
         Maximum number of devices which can be recorded in scan duplicate filter.
         When the maximum amount of device in the filter is reached, the cache will be refreshed.
         When the maximum amount of device in the filter is reached, the cache will be refreshed.
 
 
+config BT_CTRL_DUPL_SCAN_CACHE_REFRESH_PERIOD
+    int "Duplicate scan list refresh period"
+    depends on BT_CTRL_BLE_SCAN_DUPL
+    range 0 1000
+    default 0
+    help
+        If the period value is non-zero, the controller will periodically clear the device information
+        stored in the scan duuplicate filter. If it is 0, the scan duuplicate filter will not be cleared
+        until the scanning is disabled. Duplicate advertisements for this period should not be sent to the
+        Host in advertising report events.
+        There are two scenarios where the ADV packet will be repeatedly reported:
+        1. The duplicate scan cache is full, the controller will delete the oldest device information and
+        add new device information.
+        2. When the refresh period is up, the controller will clear all device information and start filtering
+        again.
+
 config BT_CTRL_BLE_MESH_SCAN_DUPL_EN
 config BT_CTRL_BLE_MESH_SCAN_DUPL_EN
     bool "Special duplicate scan mechanism for BLE Mesh scan"
     bool "Special duplicate scan mechanism for BLE Mesh scan"
     depends on BT_CTRL_BLE_SCAN_DUPL
     depends on BT_CTRL_BLE_SCAN_DUPL

+ 1 - 1
components/bt/controller/lib_esp32c3_family

@@ -1 +1 @@
-Subproject commit 84ebcda82aa5886d2a0b939dec1dbc62aa1c11c7
+Subproject commit bba9af9259e0999ef246426d31a793fe0a3ff4db

+ 9 - 1
components/bt/include/esp32c3/include/esp_bt.h

@@ -19,7 +19,7 @@ extern "C" {
 #endif
 #endif
 
 
 #define ESP_BT_CTRL_CONFIG_MAGIC_VAL    0x5A5AA5A5
 #define ESP_BT_CTRL_CONFIG_MAGIC_VAL    0x5A5AA5A5
-#define ESP_BT_CTRL_CONFIG_VERSION      0x02209230
+#define ESP_BT_CTRL_CONFIG_VERSION      0x02212090
 
 
 #define ESP_BT_HCI_TL_MAGIC_VALUE   0xfadebead
 #define ESP_BT_HCI_TL_MAGIC_VALUE   0xfadebead
 #define ESP_BT_HCI_TL_VERSION       0x00010000
 #define ESP_BT_HCI_TL_VERSION       0x00010000
@@ -130,6 +130,12 @@ typedef void (* esp_bt_hci_tl_callback_t) (void *arg, uint8_t status);
     #define MESH_DUPLICATE_SCAN_CACHE_SIZE          0
     #define MESH_DUPLICATE_SCAN_CACHE_SIZE          0
 #endif
 #endif
 
 
+#ifndef CONFIG_BT_CTRL_DUPL_SCAN_CACHE_REFRESH_PERIOD
+#define DUPL_SCAN_CACHE_REFRESH_PERIOD 0
+#else
+#define DUPL_SCAN_CACHE_REFRESH_PERIOD CONFIG_BT_CTRL_DUPL_SCAN_CACHE_REFRESH_PERIOD
+#endif
+
 #ifdef CONFIG_BT_CTRL_AGC_RECORRECT_EN
 #ifdef CONFIG_BT_CTRL_AGC_RECORRECT_EN
 #define BT_CTRL_AGC_RECORRECT_EN  CONFIG_BT_CTRL_AGC_RECORRECT_EN
 #define BT_CTRL_AGC_RECORRECT_EN  CONFIG_BT_CTRL_AGC_RECORRECT_EN
 #else
 #else
@@ -189,6 +195,7 @@ typedef void (* esp_bt_hci_tl_callback_t) (void *arg, uint8_t status);
     .hw_recorrect_en = AGC_RECORRECT_EN,                                   \
     .hw_recorrect_en = AGC_RECORRECT_EN,                                   \
     .cca_thresh = CONFIG_BT_CTRL_HW_CCA_VAL,                               \
     .cca_thresh = CONFIG_BT_CTRL_HW_CCA_VAL,                               \
     .scan_backoff_upperlimitmax = BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX,      \
     .scan_backoff_upperlimitmax = BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX,      \
+    .dup_list_refresh_period = DUPL_SCAN_CACHE_REFRESH_PERIOD,             \
 }
 }
 
 
 #else
 #else
@@ -257,6 +264,7 @@ typedef struct {
     uint8_t hw_recorrect_en;
     uint8_t hw_recorrect_en;
     uint8_t cca_thresh;                     /*!< cca threshold*/
     uint8_t cca_thresh;                     /*!< cca threshold*/
     uint16_t scan_backoff_upperlimitmax;    /*!< scan backoff upperlimitmax value */
     uint16_t scan_backoff_upperlimitmax;    /*!< scan backoff upperlimitmax value */
+    uint16_t dup_list_refresh_period;       /*!< duplicate scan list refresh time */
 } esp_bt_controller_config_t;
 } esp_bt_controller_config_t;
 
 
 /**
 /**

+ 9 - 1
components/bt/include/esp32s3/include/esp_bt.h

@@ -19,7 +19,7 @@ extern "C" {
 #endif
 #endif
 
 
 #define ESP_BT_CTRL_CONFIG_MAGIC_VAL    0x5A5AA5A5
 #define ESP_BT_CTRL_CONFIG_MAGIC_VAL    0x5A5AA5A5
-#define ESP_BT_CTRL_CONFIG_VERSION      0x02209230
+#define ESP_BT_CTRL_CONFIG_VERSION      0x02212090
 
 
 #define ESP_BT_HCI_TL_MAGIC_VALUE   0xfadebead
 #define ESP_BT_HCI_TL_MAGIC_VALUE   0xfadebead
 #define ESP_BT_HCI_TL_VERSION       0x00010000
 #define ESP_BT_HCI_TL_VERSION       0x00010000
@@ -130,6 +130,12 @@ typedef void (* esp_bt_hci_tl_callback_t) (void *arg, uint8_t status);
     #define MESH_DUPLICATE_SCAN_CACHE_SIZE          0
     #define MESH_DUPLICATE_SCAN_CACHE_SIZE          0
 #endif
 #endif
 
 
+#ifndef CONFIG_BT_CTRL_DUPL_SCAN_CACHE_REFRESH_PERIOD
+#define DUPL_SCAN_CACHE_REFRESH_PERIOD 0
+#else
+#define DUPL_SCAN_CACHE_REFRESH_PERIOD CONFIG_BT_CTRL_DUPL_SCAN_CACHE_REFRESH_PERIOD
+#endif
+
 #ifdef CONFIG_BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX
 #ifdef CONFIG_BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX
 #define BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX CONFIG_BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX
 #define BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX CONFIG_BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX
 #else
 #else
@@ -188,6 +194,7 @@ typedef void (* esp_bt_hci_tl_callback_t) (void *arg, uint8_t status);
     .hw_recorrect_en = AGC_RECORRECT_EN,                                   \
     .hw_recorrect_en = AGC_RECORRECT_EN,                                   \
     .cca_thresh = CONFIG_BT_CTRL_HW_CCA_VAL,                               \
     .cca_thresh = CONFIG_BT_CTRL_HW_CCA_VAL,                               \
     .scan_backoff_upperlimitmax = BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX,      \
     .scan_backoff_upperlimitmax = BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX,      \
+    .dup_list_refresh_period = DUPL_SCAN_CACHE_REFRESH_PERIOD,             \
 }
 }
 
 
 #else
 #else
@@ -256,6 +263,7 @@ typedef struct {
     uint8_t hw_recorrect_en;
     uint8_t hw_recorrect_en;
     uint8_t cca_thresh;                     /*!< cca threshold*/
     uint8_t cca_thresh;                     /*!< cca threshold*/
     uint16_t scan_backoff_upperlimitmax;    /*!< scan backoff upperlimitmax value */
     uint16_t scan_backoff_upperlimitmax;    /*!< scan backoff upperlimitmax value */
+    uint16_t dup_list_refresh_period;       /*!< duplicate scan list refresh time */
 } esp_bt_controller_config_t;
 } esp_bt_controller_config_t;
 
 
 /**
 /**