Exposed Bluetooth advertising interval as config.json property

This commit is contained in:
Martin Woolley 2017-08-16 12:05:32 +01:00
parent 7f70e588df
commit 002272e048
2 changed files with 8 additions and 2 deletions

View file

@ -113,6 +113,9 @@
#define MICROBIT_BLE_OPEN YOTTA_CFG_MICROBIT_DAL_BLUETOOTH_OPEN
#endif
#ifdef YOTTA_CFG_MICROBIT_DAL_BLUETOOTH_ADVERTISING_INTERVAL
#define MICROBIT_BLE_ADVERTISING_INTERVAL YOTTA_CFG_MICROBIT_DAL_BLUETOOTH_ADVERTISING_INTERVAL
#endif
//we check if the user has requested open mode, otherwise we will double def!
#if (YOTTA_CFG_MICROBIT_DAL_BLUETOOTH_OPEN == 0)

View file

@ -414,8 +414,11 @@ void MicroBitBLEManager::init(ManagedString deviceName, ManagedString serialNumb
ble->accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LOCAL_NAME, (uint8_t *)BLEName.toCharArray(), BLEName.length());
ble->setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED);
ble->setAdvertisingInterval(200);
uint16_t adv_interval = 200;
#ifdef MICROBIT_BLE_ADVERTISING_INTERVAL
adv_interval = MICROBIT_BLE_ADVERTISING_INTERVAL;
#endif
ble->setAdvertisingInterval(adv_interval);
#if (MICROBIT_BLE_ADVERTISING_TIMEOUT > 0)
ble->gap().setAdvertisingTimeout(MICROBIT_BLE_ADVERTISING_TIMEOUT);
#endif