Fix compilation errors when using latest Arduino master and IDF 3.3+

This commit is contained in:
h2zero 2020-12-24 15:05:32 -07:00
parent d29ad95dfe
commit 22d5564d04
3 changed files with 21 additions and 7 deletions

View file

@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
## [Unreleased] ## [Unreleased]
### Added ### 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 - `NimBLEClient::getCharacteristic(uint16_t handle)` Enabling the use of the characteristic handle to be used to find
the NimBLERemoteCharacteristic object. 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. - Conditional checks in `nimconfig.h` for command line defined macros to support platformio config settings.
### Changed ### 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) - `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. 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 ### 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. - 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 ## [1.0.2] - 2020-09-13

View file

@ -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. * @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 #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 #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 #endif
m_handle = ::xRingbufferCreate(length, type); m_handle = ::xRingbufferCreate(length, type);
} // Ringbuffer } // Ringbuffer

View file

@ -69,7 +69,11 @@ public:
class Ringbuffer { class Ringbuffer {
public: public:
#ifdef ESP_IDF_VERSION //Quick hack to detect if using IDF version that replaced ringbuf_type_t #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); Ringbuffer(size_t length, RingbufferType_t type = RINGBUF_TYPE_NOSPLIT);
#else
Ringbuffer(size_t length, ringbuf_type_t type = RINGBUF_TYPE_NOSPLIT);
#endif
#else #else
Ringbuffer(size_t length, ringbuf_type_t type = RINGBUF_TYPE_NOSPLIT); Ringbuffer(size_t length, ringbuf_type_t type = RINGBUF_TYPE_NOSPLIT);
#endif #endif