From 6a34742cb74d58318534de7c0f010085622c0d00 Mon Sep 17 00:00:00 2001 From: Chen Jian Hua Date: Wed, 18 Sep 2024 17:34:34 +0800 Subject: [PATCH] fix(bt/controller): Change the max TX power to +20dBm on ESP32-C3 and ESP32-S3 (cherry picked from commit fe43c8f1b5c9dd0761211ca09c980a1cacf35f8c) Co-authored-by: chenjianhua --- components/bt/controller/esp32c3/Kconfig.in | 6 ++--- .../common/include/common/bt_target.h | 4 ++-- .../bt/include/esp32c3/include/esp_bt.h | 23 ++++++++++--------- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/components/bt/controller/esp32c3/Kconfig.in b/components/bt/controller/esp32c3/Kconfig.in index 059e71dab81..5178ef86021 100644 --- a/components/bt/controller/esp32c3/Kconfig.in +++ b/components/bt/controller/esp32c3/Kconfig.in @@ -200,8 +200,8 @@ 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" + config BT_CTRL_DFT_TX_POWER_LEVEL_P20 + bool "+20dBm" endchoice config BT_CTRL_DFT_TX_POWER_LEVEL_EFF @@ -221,7 +221,7 @@ config BT_CTRL_DFT_TX_POWER_LEVEL_EFF 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 15 if BT_CTRL_DFT_TX_POWER_LEVEL_P20 default 0 config BT_CTRL_BLE_ADV_REPORT_FLOW_CTRL_SUPP diff --git a/components/bt/host/bluedroid/common/include/common/bt_target.h b/components/bt/host/bluedroid/common/include/common/bt_target.h index a18c7aadb15..9f848960abb 100644 --- a/components/bt/host/bluedroid/common/include/common/bt_target.h +++ b/components/bt/host/bluedroid/common/include/common/bt_target.h @@ -1287,7 +1287,7 @@ #ifdef CONFIG_IDF_TARGET_ESP32 #define BTM_BLE_ADV_TX_POWER {-12, -9, -6, -3, 0, 3, 6, 9} #else -#define BTM_BLE_ADV_TX_POWER {-24, -21, -18, -15, -12, -9, -6, -3, 0, 3, 6, 9, 12, 15, 18, 21} +#define BTM_BLE_ADV_TX_POWER {-24, -21, -18, -15, -12, -9, -6, -3, 0, 3, 6, 9, 12, 15, 18, 20} #endif #endif @@ -1295,7 +1295,7 @@ #ifdef CONFIG_IDF_TARGET_ESP32 #define BTM_TX_POWER {-12, -9, -6, -3, 0, 3, 6, 9} #else -#define BTM_TX_POWER {-24, -21, -18, -15, -12, -9, -6, -3, 0, 3, 6, 9, 12, 15, 18, 21} +#define BTM_TX_POWER {-24, -21, -18, -15, -12, -9, -6, -3, 0, 3, 6, 9, 12, 15, 18, 20} #endif #endif diff --git a/components/bt/include/esp32c3/include/esp_bt.h b/components/bt/include/esp32c3/include/esp_bt.h index 7221e720a33..d8ff356f9d9 100644 --- a/components/bt/include/esp32c3/include/esp_bt.h +++ b/components/bt/include/esp32c3/include/esp_bt.h @@ -376,17 +376,18 @@ typedef enum { 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_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_P20 = 15, /*!< Corresponding to +20dbm */ + ESP_PWR_LVL_P21 = 15, /*!< Corresponding to +20dbm, this enum variable has been deprecated */ ESP_PWR_LVL_INVALID = 0xFF, /*!< Indicates an invalid value */ } esp_power_level_t;