14. Advertising Interval
Our implementation advertises at 687.5ms intervals. In some applications, we may want to advertise using shorter intervals, or we may want to use longer intervals. It is very easy to modify this as we will demonstrate in the following.
In user_config.h, change the advertising interval in the
user_adv_conf
struct from:static const struct advertise_configuration user_adv_conf = { .addr_src = APP_CFG_ADDR_SRC(USER_CFG_ADDRESS_MODE), /// Minimum interval for advertising - .intv_min = MS_TO_BLESLOTS(687.5), // 687.5ms + .intv_min = MS_TO_BLESLOTS(100), // 100ms /// Maximum interval for advertising - .intv_max = MS_TO_BLESLOTS(687.5), // 687.5ms + .intv_max = MS_TO_BLESLOTS(100), // 100ms
Build the project and load it onto target
Use the SmartSnippets Power Profiler to verify the that the interval has changed.
Figure 26 The advertising interval has been changed to 100ms
Increasing the advertising interval
Increasing the advertising interval reduces the average current consumption i.e. can make your battery last longer. However decreasing the advertising interval often allows a central to find your device more quickly i.e. can make the user exerpience better. Apple has published some guidelines that should be noted when selecting an advertising interval for a device that will need to communication with an iOS based device: https://developer.apple.com/library/archive/qa/qa1931/_index.html