From 22d5564d04d3b654cd2071944f8d059a243c01a2 Mon Sep 17 00:00:00 2001 From: h2zero Date: Thu, 24 Dec 2020 15:05:32 -0700 Subject: [PATCH] Fix compilation errors when using latest Arduino master and IDF 3.3+ --- CHANGELOG.md | 16 +++++++++++----- src/FreeRTOS.cpp | 8 ++++++-- src/FreeRTOS.h | 4 ++++ 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c63c3c..ef29e60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. ## [Unreleased] ### Added +- Conditional checks added for command line config options in `nimconfig.h` to support custom configuration in platformio. + +- `NimBLEClient::setValue` Now takes an extra bool parameter `response` to enable the use of write with response (default = false). + - `NimBLEClient::getCharacteristic(uint16_t handle)` Enabling the use of the characteristic handle to be used to find the NimBLERemoteCharacteristic object. @@ -16,19 +20,21 @@ to obtain information about the disconnected client. - Conditional checks in `nimconfig.h` for command line defined macros to support platformio config settings. ### Changed +- Advertising tx power level is now sent in the advertisement packet instead of scan response. + - `NimBLEScan` When the scan ends the scan stopped flag is now set before calling the scan complete callback (if used) this allows the starting of a new scan from the callback function. -- Advertising tx power level is now sent in the advertisement packet instead of scan response. - ### Fixed -- (Arduino) Ensure controller mode is set to BLE Only. +- `FreeRTOS` compile errors resolved in latest Ardruino core and IDF v3.3. -- Advertising payload length correction, now accounts for appearance. +- Multiple instances of `time()` called inside critical sections caused sporadic crashes, these have been moved out of critical regions. - Advertisement type now correctly set when using non-connectable (advertiser only) mode. -- Multiple instances of `time()` called inside critical sections caused sporadic crashes, these have been moved out of critical regions. +- Advertising payload length correction, now accounts for appearance. + +- (Arduino) Ensure controller mode is set to BLE Only. ## [1.0.2] - 2020-09-13 diff --git a/src/FreeRTOS.cpp b/src/FreeRTOS.cpp index ff1061c..1c398cb 100644 --- a/src/FreeRTOS.cpp +++ b/src/FreeRTOS.cpp @@ -265,9 +265,13 @@ void FreeRTOS::Semaphore::setName(std::string name) { * @param [in] type The type of buffer. One of RINGBUF_TYPE_NOSPLIT, RINGBUF_TYPE_ALLOWSPLIT, RINGBUF_TYPE_BYTEBUF. */ #ifdef ESP_IDF_VERSION //Quick hack to detect if using IDF version that replaced ringbuf_type_t -Ringbuffer::Ringbuffer(size_t length, RingbufferType_t type) { +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 0, 0) + Ringbuffer::Ringbuffer(size_t length, RingbufferType_t type) { #else -Ringbuffer::Ringbuffer(size_t length, ringbuf_type_t type) { + Ringbuffer::Ringbuffer(size_t length, ringbuf_type_t type) { +#endif +#else + Ringbuffer::Ringbuffer(size_t length, ringbuf_type_t type) { #endif m_handle = ::xRingbufferCreate(length, type); } // Ringbuffer diff --git a/src/FreeRTOS.h b/src/FreeRTOS.h index 2f3d938..fa33921 100644 --- a/src/FreeRTOS.h +++ b/src/FreeRTOS.h @@ -69,7 +69,11 @@ public: class Ringbuffer { public: #ifdef ESP_IDF_VERSION //Quick hack to detect if using IDF version that replaced ringbuf_type_t +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 0, 0) Ringbuffer(size_t length, RingbufferType_t type = RINGBUF_TYPE_NOSPLIT); +#else + Ringbuffer(size_t length, ringbuf_type_t type = RINGBUF_TYPE_NOSPLIT); +#endif #else Ringbuffer(size_t length, ringbuf_type_t type = RINGBUF_TYPE_NOSPLIT); #endif