Merge branch 'bugfix/fix_ble_power_save_ci_v5.0' into 'release/v5.0'

fix(ble): fix conn error of ble power save ci test(v5.0)

See merge request espressif/esp-idf!29824
This commit is contained in:
Island 2024-03-27 10:31:17 +08:00
commit a463942e14
6 changed files with 47 additions and 4 deletions

View File

@ -28,6 +28,26 @@
#include "services/gap/ble_svc_gap.h"
#include "blecent.h"
#if CONFIG_EXAMPLE_USE_CI_ADDRESS
#ifdef CONFIG_IDF_TARGET_ESP32
#define TEST_CI_ADDRESS_CHIP_OFFSET (0)
#elif CONFIG_IDF_TARGET_ESP32C2
#define TEST_CI_ADDRESS_CHIP_OFFSET (1)
#elif CONFIG_IDF_TARGET_ESP32C3
#define TEST_CI_ADDRESS_CHIP_OFFSET (2)
#elif CONFIG_IDF_TARGET_ESP32C6
#define TEST_CI_ADDRESS_CHIP_OFFSET (3)
#elif CONFIG_IDF_TARGET_ESP32C5
#define TEST_CI_ADDRESS_CHIP_OFFSET (4)
#elif CONFIG_IDF_TARGET_ESP32H2
#define TEST_CI_ADDRESS_CHIP_OFFSET (5)
#elif CONFIG_IDF_TARGET_ESP32P4
#define TEST_CI_ADDRESS_CHIP_OFFSET (6)
#elif CONFIG_IDF_TARGET_ESP32S3
#define TEST_CI_ADDRESS_CHIP_OFFSET (7)
#endif
#endif
/*** The UUID of the service containing the subscribable characterstic ***/
static const ble_uuid_t * remote_svc_uuid =
BLE_UUID128_DECLARE(0x2d, 0x71, 0xa2, 0x59, 0xb4, 0x58, 0xc8, 0x12,
@ -474,6 +494,7 @@ ext_blecent_should_connect(const struct ble_gap_ext_disc_desc *disc)
addr_offset = (uint32_t *)&peer_addr[1];
*addr_offset = atoi(CONFIG_EXAMPLE_PEER_ADDR);
peer_addr[5] = 0xC3;
peer_addr[0] = TEST_CI_ADDRESS_CHIP_OFFSET;
#endif // !CONFIG_EXAMPLE_USE_CI_ADDRESS
if (memcmp(peer_addr, disc->addr.val, sizeof(disc->addr.val)) != 0) {
return 0;
@ -537,6 +558,7 @@ blecent_should_connect(const struct ble_gap_disc_desc *disc)
addr_offset = (uint32_t *)&peer_addr[1];
*addr_offset = atoi(CONFIG_EXAMPLE_PEER_ADDR);
peer_addr[5] = 0xC3;
peer_addr[0] = TEST_CI_ADDRESS_CHIP_OFFSET;
#endif // !CONFIG_EXAMPLE_USE_CI_ADDRESS
if (memcmp(peer_addr, disc->addr.val, sizeof(disc->addr.val)) != 0) {
return 0;

View File

@ -1,2 +1,2 @@
CONFIG_EXAMPLE_USE_CI_ADDRESS=y
CONFIG_EXAMPLE_PEER_ADDR="${CI_JOB_ID}"
CONFIG_EXAMPLE_PEER_ADDR="${CI_PIPELINE_ID}"

View File

@ -1,4 +1,4 @@
CONFIG_IDF_TARGET="esp32c2"
CONFIG_XTAL_FREQ_26=y
CONFIG_EXAMPLE_USE_CI_ADDRESS=y
CONFIG_EXAMPLE_PEER_ADDR="${CI_JOB_ID}"
CONFIG_EXAMPLE_PEER_ADDR="${CI_PIPELINE_ID}"

View File

@ -17,6 +17,26 @@
#include "services/gap/ble_svc_gap.h"
#include "bleprph.h"
#if CONFIG_EXAMPLE_USE_CI_ADDRESS
#ifdef CONFIG_IDF_TARGET_ESP32
#define TEST_CI_ADDRESS_CHIP_OFFSET (0)
#elif CONFIG_IDF_TARGET_ESP32C2
#define TEST_CI_ADDRESS_CHIP_OFFSET (1)
#elif CONFIG_IDF_TARGET_ESP32C3
#define TEST_CI_ADDRESS_CHIP_OFFSET (2)
#elif CONFIG_IDF_TARGET_ESP32C6
#define TEST_CI_ADDRESS_CHIP_OFFSET (3)
#elif CONFIG_IDF_TARGET_ESP32C5
#define TEST_CI_ADDRESS_CHIP_OFFSET (4)
#elif CONFIG_IDF_TARGET_ESP32H2
#define TEST_CI_ADDRESS_CHIP_OFFSET (5)
#elif CONFIG_IDF_TARGET_ESP32P4
#define TEST_CI_ADDRESS_CHIP_OFFSET (6)
#elif CONFIG_IDF_TARGET_ESP32S3
#define TEST_CI_ADDRESS_CHIP_OFFSET (7)
#endif
#endif
#if CONFIG_EXAMPLE_EXTENDED_ADV
static uint8_t ext_adv_pattern_1[] = {
0x02, 0x01, 0x06,
@ -468,6 +488,7 @@ bleprph_on_sync(void)
uint32_t *offset = (uint32_t *)&addr[1];
*offset = atoi(CONFIG_EXAMPLE_CI_ADDRESS_OFFSET);
addr[5] = 0xC3;
addr[0] = TEST_CI_ADDRESS_CHIP_OFFSET;
rc = ble_hs_id_set_rnd(addr);
assert(rc == 0);
}

View File

@ -2,4 +2,4 @@
# Test Config
#
CONFIG_EXAMPLE_USE_CI_ADDRESS=y
CONFIG_EXAMPLE_CI_ADDRESS_OFFSET="${CI_JOB_ID}"
CONFIG_EXAMPLE_CI_ADDRESS_OFFSET="${CI_PIPELINE_ID}"

View File

@ -4,4 +4,4 @@ CONFIG_XTAL_FREQ_26=y
# Test Config
#
CONFIG_EXAMPLE_USE_CI_ADDRESS=y
CONFIG_EXAMPLE_CI_ADDRESS_OFFSET="${CI_JOB_ID}"
CONFIG_EXAMPLE_CI_ADDRESS_OFFSET="${CI_PIPELINE_ID}"