Skip to content

Commit

Permalink
Merge branch 'bugfix/fix_esp32_esp32c3_some_bugs_v4.3' into 'release/…
Browse files Browse the repository at this point in the history
…v4.3'

Fixed BLE lld_per_adv.c line 401 assert on ESP32C3 (backport v4.3)

See merge request espressif/esp-idf!20759
  • Loading branch information
jack0c committed Oct 26, 2022
2 parents 69ae164 + 2dfdea8 commit a2086ca
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 52 deletions.
36 changes: 18 additions & 18 deletions components/bt/controller/esp32c3/Kconfig.in
Expand Up @@ -138,8 +138,6 @@ choice BT_CTRL_DFT_TX_POWER_LEVEL
help
Specify default Tx power level

config BT_CTRL_DFT_TX_POWER_LEVEL_N27
bool "-27dBm"
config BT_CTRL_DFT_TX_POWER_LEVEL_N24
bool "-24dBm"
config BT_CTRL_DFT_TX_POWER_LEVEL_N21
Expand Down Expand Up @@ -170,26 +168,28 @@ choice BT_CTRL_DFT_TX_POWER_LEVEL
bool "+15dBm"
config BT_CTRL_DFT_TX_POWER_LEVEL_P18
bool "+18dBm"
config BT_CTRL_DFT_TX_POWER_LEVEL_P21
bool "+21dBm"
endchoice

config BT_CTRL_DFT_TX_POWER_LEVEL_EFF
int
default 0 if BT_CTRL_DFT_TX_POWER_LEVEL_N27
default 1 if BT_CTRL_DFT_TX_POWER_LEVEL_N24
default 2 if BT_CTRL_DFT_TX_POWER_LEVEL_N21
default 3 if BT_CTRL_DFT_TX_POWER_LEVEL_N18
default 4 if BT_CTRL_DFT_TX_POWER_LEVEL_N15
default 5 if BT_CTRL_DFT_TX_POWER_LEVEL_N12
default 6 if BT_CTRL_DFT_TX_POWER_LEVEL_N9
default 7 if BT_CTRL_DFT_TX_POWER_LEVEL_N6
default 8 if BT_CTRL_DFT_TX_POWER_LEVEL_N3
default 9 if BT_CTRL_DFT_TX_POWER_LEVEL_N0
default 10 if BT_CTRL_DFT_TX_POWER_LEVEL_P3
default 11 if BT_CTRL_DFT_TX_POWER_LEVEL_P6
default 12 if BT_CTRL_DFT_TX_POWER_LEVEL_P9
default 13 if BT_CTRL_DFT_TX_POWER_LEVEL_P12
default 14 if BT_CTRL_DFT_TX_POWER_LEVEL_P15
default 15 if BT_CTRL_DFT_TX_POWER_LEVEL_P18
default 0 if BT_CTRL_DFT_TX_POWER_LEVEL_N24
default 1 if BT_CTRL_DFT_TX_POWER_LEVEL_N21
default 2 if BT_CTRL_DFT_TX_POWER_LEVEL_N18
default 3 if BT_CTRL_DFT_TX_POWER_LEVEL_N15
default 4 if BT_CTRL_DFT_TX_POWER_LEVEL_N12
default 5 if BT_CTRL_DFT_TX_POWER_LEVEL_N9
default 6 if BT_CTRL_DFT_TX_POWER_LEVEL_N6
default 7 if BT_CTRL_DFT_TX_POWER_LEVEL_N3
default 8 if BT_CTRL_DFT_TX_POWER_LEVEL_N0
default 9 if BT_CTRL_DFT_TX_POWER_LEVEL_P3
default 10 if BT_CTRL_DFT_TX_POWER_LEVEL_P6
default 11 if BT_CTRL_DFT_TX_POWER_LEVEL_P9
default 12 if BT_CTRL_DFT_TX_POWER_LEVEL_P12
default 13 if BT_CTRL_DFT_TX_POWER_LEVEL_P15
default 14 if BT_CTRL_DFT_TX_POWER_LEVEL_P18
default 15 if BT_CTRL_DFT_TX_POWER_LEVEL_P21
default 0

config BT_CTRL_BLE_ADV_REPORT_FLOW_CTRL_SUPP
Expand Down
2 changes: 1 addition & 1 deletion components/bt/controller/lib_esp32
2 changes: 1 addition & 1 deletion components/bt/controller/lib_esp32c3_family
2 changes: 1 addition & 1 deletion components/bt/host/bluedroid/Kconfig.in
Expand Up @@ -1023,7 +1023,7 @@ config BT_SMP_ENABLE

config BT_BLE_ACT_SCAN_REP_ADV_SCAN
bool "Report adv data and scan response individually when BLE active scan"
depends on BT_BLUEDROID_ENABLED && (BTDM_CTRL_MODE_BTDM || BTDM_CTRL_MODE_BLE_ONLY)
depends on BT_BLUEDROID_ENABLED && BT_BLE_ENABLED
default n
help
Originally, when doing BLE active scan, Bluedroid will not report adv to application layer
Expand Down
29 changes: 14 additions & 15 deletions components/bt/host/bluedroid/stack/btm/btm_ble_gap.c
Expand Up @@ -3673,21 +3673,20 @@ static void btm_ble_process_adv_pkt_cont(BD_ADDR bda, UINT8 addr_type, UINT8 evt
0x04 Scan Response (SCAN_RSP)
0x05-0xFF Reserved for future use
*/
//if scan duplicate is enabled, the adv packet without scan response is allowed to report to higher layer
if(p_le_inq_cb->scan_duplicate_filter == BTM_BLE_SCAN_DUPLICATE_ENABLE) {
/*
Bluedroid will put the advertising packet and scan response into a packet and send it to the higher layer.
If two advertising packets are not with the same address, or can't be combined into a packet, then the first advertising
packet will be discarded. So we added the following judgment:
1. For different addresses, send the last advertising packet to higher layer
2. For same address and same advertising type (not scan response), send the last advertising packet to higher layer
3. For same address and scan response, do nothing
*/
int same_addr = memcmp(bda, p_le_inq_cb->adv_addr, BD_ADDR_LEN);
if (same_addr != 0 || (same_addr == 0 && evt_type != BTM_BLE_SCAN_RSP_EVT)) {
btm_ble_process_last_adv_pkt();
}
}
// The adv packet without scan response is allowed to report to higher layer
/*
Bluedroid will put the advertising packet and scan response into a packet and send it to the higher layer.
If two advertising packets are not with the same address, or can't be combined into a packet, then the first advertising
packet will be discarded. So we added the following judgment:
1. For different addresses, send the last advertising packet to higher layer
2. For same address and same advertising type (not scan response), send the last advertising packet to higher layer
3. For same address and scan response, do nothing
*/
int same_addr = memcmp(bda, p_le_inq_cb->adv_addr, BD_ADDR_LEN);
if (same_addr != 0 || (same_addr == 0 && evt_type != BTM_BLE_SCAN_RSP_EVT)) {
btm_ble_process_last_adv_pkt();
}


p_i = btm_inq_db_find (bda);

Expand Down
32 changes: 16 additions & 16 deletions components/bt/include/esp32c3/include/esp_bt.h
Expand Up @@ -290,22 +290,22 @@ typedef enum {
* @brief Bluetooth TX power level(index), it's just a index corresponding to power(dbm).
*/
typedef enum {
ESP_PWR_LVL_N27 = 0, /*!< Corresponding to -27dbm */
ESP_PWR_LVL_N24 = 1, /*!< Corresponding to -24dbm */
ESP_PWR_LVL_N21 = 2, /*!< Corresponding to -21dbm */
ESP_PWR_LVL_N18 = 3, /*!< Corresponding to -18dbm */
ESP_PWR_LVL_N15 = 4, /*!< Corresponding to -15dbm */
ESP_PWR_LVL_N12 = 5, /*!< Corresponding to -12dbm */
ESP_PWR_LVL_N9 = 6, /*!< Corresponding to -9dbm */
ESP_PWR_LVL_N6 = 7, /*!< Corresponding to -6dbm */
ESP_PWR_LVL_N3 = 8, /*!< Corresponding to -3dbm */
ESP_PWR_LVL_N0 = 9, /*!< Corresponding to 0dbm */
ESP_PWR_LVL_P3 = 10, /*!< Corresponding to +3dbm */
ESP_PWR_LVL_P6 = 11, /*!< Corresponding to +6dbm */
ESP_PWR_LVL_P9 = 12, /*!< Corresponding to +9dbm */
ESP_PWR_LVL_P12 = 13, /*!< Corresponding to +12dbm */
ESP_PWR_LVL_P15 = 14, /*!< Corresponding to +15dbm */
ESP_PWR_LVL_P18 = 15, /*!< Corresponding to +18dbm */
ESP_PWR_LVL_N24 = 0, /*!< Corresponding to -24dbm */
ESP_PWR_LVL_N21 = 1, /*!< Corresponding to -21dbm */
ESP_PWR_LVL_N18 = 2, /*!< Corresponding to -18dbm */
ESP_PWR_LVL_N15 = 3, /*!< Corresponding to -15dbm */
ESP_PWR_LVL_N12 = 4, /*!< Corresponding to -12dbm */
ESP_PWR_LVL_N9 = 5, /*!< Corresponding to -9dbm */
ESP_PWR_LVL_N6 = 6, /*!< Corresponding to -6dbm */
ESP_PWR_LVL_N3 = 7, /*!< Corresponding to -3dbm */
ESP_PWR_LVL_N0 = 8, /*!< Corresponding to 0dbm */
ESP_PWR_LVL_P3 = 9, /*!< Corresponding to +3dbm */
ESP_PWR_LVL_P6 = 10, /*!< Corresponding to +6dbm */
ESP_PWR_LVL_P9 = 11, /*!< Corresponding to +9dbm */
ESP_PWR_LVL_P12 = 12, /*!< Corresponding to +12dbm */
ESP_PWR_LVL_P15 = 13, /*!< Corresponding to +15dbm */
ESP_PWR_LVL_P18 = 14, /*!< Corresponding to +18dbm */
ESP_PWR_LVL_P21 = 15, /*!< Corresponding to +21dbm */
ESP_PWR_LVL_INVALID = 0xFF, /*!< Indicates an invalid value */
} esp_power_level_t;

Expand Down

0 comments on commit a2086ca

Please sign in to comment.