From de1a64457e893e1d39e5a1463ad062971c7a940f Mon Sep 17 00:00:00 2001 From: h2zero Date: Tue, 24 Nov 2026 18:21:43 -0600 Subject: [PATCH] [BREAKING/Bugfix] Arduino 4.x compilation due to config. --- .github/workflows/build.yml | 26 ++++++++----------- src/NimBLEDevice.cpp | 3 +++ .../esp_port/port/include/esp_nimble_cfg.h | 16 +++++------- src/nimconfig.h | 9 ++++--- 4 files changed, 26 insertions(+), 28 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d99f5b9cc..af1ca0490 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -75,14 +75,13 @@ jobs: [env] platform = espressif32 framework = arduino + build_flags = '-DMYNEWT_VAL_BLE_EXT_ADV=1' [env:esp32c3] board = esp32-c3-devkitm-1 - build_flags = '-DCONFIG_BT_NIMBLE_EXT_ADV=1' [env:esp32s3] board = esp32-s3-devkitc-1 - build_flags = '-DCONFIG_BT_NIMBLE_EXT_ADV=1' EOF cp ${{ matrix.example }}/* example/src/ platformio run -d example @@ -160,22 +159,19 @@ jobs: [env] platform = https://github.com/pioarduino/platform-espressif32/releases/download/stable/platform-espressif32.zip framework = arduino + build_flags = '-DMYNEWT_VAL_BLE_EXT_ADV=1' [env:esp32c3] board = esp32-c3-devkitm-1 - build_flags = '-DCONFIG_BT_NIMBLE_EXT_ADV=1' [env:esp32s3] board = esp32-s3-devkitc-1 - build_flags = '-DCONFIG_BT_NIMBLE_EXT_ADV=1' [env:esp32c6] board = esp32-c6-devkitc-1 - build_flags = '-DCONFIG_BT_NIMBLE_EXT_ADV=1' [env:esp32h2] board = esp32-h2-devkitm-1 - build_flags = '-DCONFIG_BT_NIMBLE_EXT_ADV=1' EOF cp ${{ matrix.example }}/* example/src/ platformio run -d example @@ -194,11 +190,11 @@ jobs: - esp32s3 - esp32c6 - esp32h2 - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v5 - name: Build arduino-esp32 - uses: arduino/compile-sketches@v1.1.0 + uses: arduino/compile-sketches@v1.1.4 with: cli-version: latest platforms: | @@ -220,14 +216,14 @@ jobs: - esp32s3 - esp32c6 - esp32h2 - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v5 - name: Set config for BT5 run: | - sed -i '0,/#include \"nimconfig_rename.h\"/a #define CONFIG_BT_NIMBLE_EXT_ADV 1' ./src/nimconfig.h + sed -i '0,/#include \"nimconfig_rename.h\"/a #define MYNEWT_VAL_BLE_EXT_ADV 1' ./src/nimconfig.h - name: Build BT5 arduino-esp32 - uses: arduino/compile-sketches@v1.1.0 + uses: arduino/compile-sketches@v1.1.4 with: cli-version: latest platforms: | @@ -249,11 +245,11 @@ jobs: - Generic_nRF52832 - Generic_nRF52833 - Generic_nRF52840 - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v5 - name: Build n-able Arduino - uses: arduino/compile-sketches@v1.1.0 + uses: arduino/compile-sketches@v1.1.4 with: cli-version: latest platforms: | @@ -272,14 +268,14 @@ jobs: - "examples/Bluetooth_5/NimBLE_extended_server" variant: - Generic_nRF52840 - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v5 - name: Set config for BT5 run: | echo "-DCONFIG_BT_NIMBLE_EXT_ADV=1" > ${{ matrix.example }}/build_opt.h - name: Build BT5 n-able Arduino - uses: arduino/compile-sketches@v1.1.0 + uses: arduino/compile-sketches@v1.1.4 with: cli-version: latest platforms: | diff --git a/src/NimBLEDevice.cpp b/src/NimBLEDevice.cpp index 2bb0b2a0e..636bc0ac2 100644 --- a/src/NimBLEDevice.cpp +++ b/src/NimBLEDevice.cpp @@ -54,6 +54,9 @@ # if defined(ESP_PLATFORM) && defined(CONFIG_ENABLE_ARDUINO_DEPENDS) # include "esp32-hal-bt.h" +bool bleInUse(void) { + return true; +} # if __has_include("esp32-hal-bt-mem.h") # include "esp32-hal-bt-mem.h" # endif diff --git a/src/nimble/esp_port/port/include/esp_nimble_cfg.h b/src/nimble/esp_port/port/include/esp_nimble_cfg.h index e7ba1c9eb..37e177961 100644 --- a/src/nimble/esp_port/port/include/esp_nimble_cfg.h +++ b/src/nimble/esp_port/port/include/esp_nimble_cfg.h @@ -87,10 +87,8 @@ #endif #endif -#ifndef CONFIG_BT_NIMBLE_EXT_ADV +#ifndef MYNEWT_VAL_BLE_EXT_ADV #define MYNEWT_VAL_BLE_EXT_ADV (0) -#else -#define MYNEWT_VAL_BLE_EXT_ADV (CONFIG_BT_NIMBLE_EXT_ADV) #endif #ifndef CONFIG_BT_NIMBLE_EXT_ADV_MAX_SIZE @@ -174,7 +172,7 @@ #ifndef CONFIG_BT_NIMBLE_ENABLE_PERIODIC_ADV #define MYNEWT_VAL_BLE_PERIODIC_ADV (0) #else -#define MYNEWT_VAL_BLE_PERIODIC_ADV (CONFIG_BT_NIMBLE_ENABLE_PERIODIC_ADV) +#define MYNEWT_VAL_BLE_PERIODIC_ADV (0) #endif #ifndef CONFIG_NIMBLE_MAX_CONNECTIONS @@ -392,25 +390,25 @@ /* Value copied from BLE_PERIODIC_ADV */ #ifndef MYNEWT_VAL_BLE_LL_CFG_FEAT_LL_PERIODIC_ADV -#define MYNEWT_VAL_BLE_LL_CFG_FEAT_LL_PERIODIC_ADV (CONFIG_BT_NIMBLE_ENABLE_PERIODIC_ADV) +#define MYNEWT_VAL_BLE_LL_CFG_FEAT_LL_PERIODIC_ADV (0) #endif /* Value copied from BLE_MAX_PERIODIC_SYNCS */ #ifndef MYNEWT_VAL_BLE_LL_CFG_FEAT_LL_PERIODIC_ADV_SYNC_CNT -#define MYNEWT_VAL_BLE_LL_CFG_FEAT_LL_PERIODIC_ADV_SYNC_CNT (MYNEWT_VAL_BLE_MAX_PERIODIC_SYNCS) +#define MYNEWT_VAL_BLE_LL_CFG_FEAT_LL_PERIODIC_ADV_SYNC_CNT (0) #endif -#define MYNEWT_VAL_BLE_LL_CFG_FEAT_LL_PERIODIC_ADV_SYNC_LIST_CNT (MYNEWT_VAL_BLE_MAX_PERIODIC_SYNCS) +#define MYNEWT_VAL_BLE_LL_CFG_FEAT_LL_PERIODIC_ADV_SYNC_LIST_CNT (0) #ifndef CONFIG_BT_NIMBLE_PERIODIC_ADV_SYNC_TRANSFER #define MYNEWT_VAL_BLE_PERIODIC_ADV_SYNC_TRANSFER (0) #else -#define MYNEWT_VAL_BLE_PERIODIC_ADV_SYNC_TRANSFER (CONFIG_BT_NIMBLE_PERIODIC_ADV_SYNC_TRANSFER) +#define MYNEWT_VAL_BLE_PERIODIC_ADV_SYNC_TRANSFER (0) #endif /* Value copied from BLE_PERIODIC_ADV_SYNC_TRANSFER */ -#define MYNEWT_VAL_BLE_LL_CFG_FEAT_LL_PERIODIC_ADV_SYNC_TRANSFER (CONFIG_BT_NIMBLE_PERIODIC_ADV_SYNC_TRANSFER) +#define MYNEWT_VAL_BLE_LL_CFG_FEAT_LL_PERIODIC_ADV_SYNC_TRANSFER (0) #ifndef MYNEWT_VAL_BLE_LL_CFG_FEAT_LL_PRIVACY diff --git a/src/nimconfig.h b/src/nimconfig.h index 55548d0a2..43bd6c5e0 100644 --- a/src/nimconfig.h +++ b/src/nimconfig.h @@ -2,6 +2,11 @@ #ifdef ESP_PLATFORM #include "sdkconfig.h" +#undef CONFIG_BT_NIMBLE_EXT_ADV +#ifdef MYNEWT_VAL_BLE_EXT_ADV +#define CONFIG_BT_NIMBLE_EXT_ADV MYNEWT_VAL_BLE_EXT_ADV +#endif +#undef CONFIG_BT_NIMBLE_TRANSPORT_EVT_SIZE // fix warning on arduino core 4.x #else #include "ext_nimble_config.h" /* Clear redefinition warnings */ @@ -381,10 +386,6 @@ defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32S3) #endif // ESP_PLATFORM -#if CONFIG_BT_NIMBLE_ENABLE_PERIODIC_ADV && !CONFIG_BT_NIMBLE_EXT_ADV -# error Extended advertising must be enabled to use periodic advertising. -#endif - /* Must have max instances and data length set if extended advertising is enabled */ #if CONFIG_BT_NIMBLE_EXT_ADV # if !defined(CONFIG_BT_NIMBLE_MAX_EXT_ADV_INSTANCES)