Merge pull request #312 from smartyw/master

Reduce default advertising interval and make property of config.json
This commit is contained in:
Joe Finney 2017-09-11 11:28:32 +01:00 committed by GitHub
commit e0f8b005fe
3 changed files with 9 additions and 2 deletions

View file

@ -251,6 +251,11 @@ extern uint32_t __etext;
#define MICROBIT_BLE_ADVERTISING_TIMEOUT 0
#endif
// Define the default BLE advertising interval in ms
#ifndef MICROBIT_BLE_ADVERTISING_INTERVAL
#define MICROBIT_BLE_ADVERTISING_INTERVAL 50
#endif
// Defines default power level of the BLE radio transmitter.
// Valid values are in the range 0..7 inclusive, with 0 being the lowest power and 7 the highest power.
// Based on trials undertaken by the BBC, the radio is normally set to its lowest power level

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,7 @@ 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);
ble->setAdvertisingInterval(MICROBIT_BLE_ADVERTISING_INTERVAL);
#if (MICROBIT_BLE_ADVERTISING_TIMEOUT > 0)
ble->gap().setAdvertisingTimeout(MICROBIT_BLE_ADVERTISING_TIMEOUT);
#endif