Add conditional checks to nimconfig to support command line defines.

* Support platformio config settings on command line.

* Update changelog.
This commit is contained in:
h2zero 2020-12-19 23:05:54 -07:00
parent 7ed962d963
commit 77f477f428
2 changed files with 43 additions and 4 deletions

View file

@ -8,10 +8,28 @@ All notable changes to this project will be documented in this file.
- `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.
- `NimBLEHIDDevice` class added by wakwak-koba.
- `NimBLEServerCallbacks::onDisconnect` overloaded callback added to provide a ble_gap_conn_desc parameter for the application
to obtain information about the disconnected client.
- Conditional checks in `nimconfig.h` for command line defined macros to support platformio config settings.
### Changed ### Changed
- `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
- (Arduino) Ensure controller mode is set to BLE Only.
- Advertising payload length correction, now accounts for appearance.
- 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.
## [1.0.2] - 2020-09-13 ## [1.0.2] - 2020-09-13
### Changed ### Changed

View file

@ -51,22 +51,30 @@
/** @brief Comment out if not using NimBLE Client functions \n /** @brief Comment out if not using NimBLE Client functions \n
* Reduces flash size by approx. 7kB. * Reduces flash size by approx. 7kB.
*/ */
#ifndef CONFIG_BT_NIMBLE_ROLE_CENTRAL
#define CONFIG_BT_NIMBLE_ROLE_CENTRAL #define CONFIG_BT_NIMBLE_ROLE_CENTRAL
#endif
/** @brief Comment out if not using NimBLE Scan functions \n /** @brief Comment out if not using NimBLE Scan functions \n
* Reduces flash size by approx. 26kB. * Reduces flash size by approx. 26kB.
*/ */
#ifndef CONFIG_BT_NIMBLE_ROLE_OBSERVER
#define CONFIG_BT_NIMBLE_ROLE_OBSERVER #define CONFIG_BT_NIMBLE_ROLE_OBSERVER
#endif
/** @brief Comment out if not using NimBLE Server functions \n /** @brief Comment out if not using NimBLE Server functions \n
* Reduces flash size by approx. 16kB. * Reduces flash size by approx. 16kB.
*/ */
#ifndef CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
#define CONFIG_BT_NIMBLE_ROLE_PERIPHERAL #define CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
#endif
/** @brief Comment out if not using NimBLE Advertising functions \n /** @brief Comment out if not using NimBLE Advertising functions \n
* Reduces flash size by approx. 5kB. * Reduces flash size by approx. 5kB.
*/ */
#ifndef CONFIG_BT_NIMBLE_ROLE_BROADCASTER
#define CONFIG_BT_NIMBLE_ROLE_BROADCASTER #define CONFIG_BT_NIMBLE_ROLE_BROADCASTER
#endif
/* Uncomment to see debug log messages from the NimBLE host /* Uncomment to see debug log messages from the NimBLE host
* Uses approx. 32kB of flash memory. * Uses approx. 32kB of flash memory.
@ -89,26 +97,43 @@
// #define CONFIG_NIMBLE_CPP_ENABLE_ADVERTISMENT_TYPE_TEXT // #define CONFIG_NIMBLE_CPP_ENABLE_ADVERTISMENT_TYPE_TEXT
/** @brief Sets the core NimBLE host runs on */ /** @brief Sets the core NimBLE host runs on */
#ifndef CONFIG_BT_NIMBLE_PINNED_TO_CORE
#define CONFIG_BT_NIMBLE_PINNED_TO_CORE 0 #define CONFIG_BT_NIMBLE_PINNED_TO_CORE 0
#endif
/** @brief Sets the stack size for the NimBLE host task */ /** @brief Sets the stack size for the NimBLE host task */
#ifndef CONFIG_BT_NIMBLE_TASK_STACK_SIZE
#define CONFIG_BT_NIMBLE_TASK_STACK_SIZE 4096 #define CONFIG_BT_NIMBLE_TASK_STACK_SIZE 4096
#endif
/** /**
* @brief Sets the memory pool where NimBLE will be loaded * @brief Sets the memory pool where NimBLE will be loaded
* @details By default NimBLE is loaded in internal ram.\n * @details By default NimBLE is loaded in internal ram.\n
* To use external PSRAM you must change this to `#define CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_EXTERNAL 1` * To use external PSRAM you must change this to `#define CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_EXTERNAL 1`
*/ */
#ifndef CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_EXTERNAL
#define CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_INTERNAL 1 #define CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_INTERNAL 1
#endif
/** @brief Sets the number of simultaneous connections (esp controller max is 9) */ /** @brief Sets the number of simultaneous connections (esp controller max is 9) */
#ifndef CONFIG_BT_NIMBLE_MAX_CONNECTIONS
#define CONFIG_BT_NIMBLE_MAX_CONNECTIONS 3 #define CONFIG_BT_NIMBLE_MAX_CONNECTIONS 3
#endif
/** @brief Sets the number of devices allowed to store/bond with */ /** @brief Sets the number of devices allowed to store/bond with */
#ifndef CONFIG_BT_NIMBLE_MAX_BONDS
#define CONFIG_BT_NIMBLE_MAX_BONDS 3 #define CONFIG_BT_NIMBLE_MAX_BONDS 3
#endif
/** @brief Sets the maximum number of CCCD subscriptions to store */ /** @brief Sets the maximum number of CCCD subscriptions to store */
#ifndef CONFIG_BT_NIMBLE_MAX_CCCDS
#define CONFIG_BT_NIMBLE_MAX_CCCDS 8 #define CONFIG_BT_NIMBLE_MAX_CCCDS 8
#endif
/** @brief Default device name */
#ifndef CONFIG_BT_NIMBLE_SVC_GAP_DEVICE_NAME
#define CONFIG_BT_NIMBLE_SVC_GAP_DEVICE_NAME "nimble"
#endif
/** @brief Set if CCCD's and bond data should be stored in NVS */ /** @brief Set if CCCD's and bond data should be stored in NVS */
#define CONFIG_BT_NIMBLE_NVS_PERSIST 1 #define CONFIG_BT_NIMBLE_NVS_PERSIST 1
@ -119,9 +144,6 @@
/** @brief Allow BLE secure connections */ /** @brief Allow BLE secure connections */
#define CONFIG_BT_NIMBLE_SM_SC 1 #define CONFIG_BT_NIMBLE_SM_SC 1
/** @brief Default device name */
#define CONFIG_BT_NIMBLE_SVC_GAP_DEVICE_NAME "nimble"
/** @brief Max device name length (bytes) */ /** @brief Max device name length (bytes) */
#define CONFIG_BT_NIMBLE_GAP_DEVICE_NAME_MAX_LEN 31 #define CONFIG_BT_NIMBLE_GAP_DEVICE_NAME_MAX_LEN 31
@ -154,7 +176,6 @@
*/ */
#define CONFIG_BT_NIMBLE_MSYS1_BLOCK_COUNT 12 #define CONFIG_BT_NIMBLE_MSYS1_BLOCK_COUNT 12
/** @brief Random address refresh time in seconds */ /** @brief Random address refresh time in seconds */
#define CONFIG_BT_NIMBLE_RPA_TIMEOUT 900 #define CONFIG_BT_NIMBLE_RPA_TIMEOUT 900