summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/components/ble/NimbleController.cpp5
-rw-r--r--src/components/ble/NimbleController.h1
2 files changed, 6 insertions, 0 deletions
diff --git a/src/components/ble/NimbleController.cpp b/src/components/ble/NimbleController.cpp
index 8e0fe756..bebca2d3 100644
--- a/src/components/ble/NimbleController.cpp
+++ b/src/components/ble/NimbleController.cpp
@@ -122,6 +122,8 @@ void NimbleController::StartAdvertising() {
adv_params.conn_mode = BLE_GAP_CONN_MODE_UND;
adv_params.disc_mode = BLE_GAP_DISC_MODE_GEN;
+ adv_params.itvl_min = advInterval;
+ adv_params.itvl_max = advInterval + 100;
fields.flags = BLE_HS_ADV_F_DISC_GEN | BLE_HS_ADV_F_BREDR_UNSUP;
fields.uuids128 = &dfuServiceUuid;
@@ -148,6 +150,8 @@ int NimbleController::OnGAPEvent(ble_gap_event* event) {
case BLE_GAP_EVENT_ADV_COMPLETE:
NRF_LOG_INFO("Advertising event : BLE_GAP_EVENT_ADV_COMPLETE");
NRF_LOG_INFO("reason=%d; status=%d", event->adv_complete.reason, event->connect.status);
+ if (advInterval < 7100)
+ advInterval += 500;
StartAdvertising();
break;
@@ -181,6 +185,7 @@ int NimbleController::OnGAPEvent(ble_gap_event* event) {
alertNotificationClient.Reset();
connectionHandle = BLE_HS_CONN_HANDLE_NONE;
bleController.Disconnect();
+ advInterval = 100;
StartAdvertising();
break;
diff --git a/src/components/ble/NimbleController.h b/src/components/ble/NimbleController.h
index 078d6158..79761108 100644
--- a/src/components/ble/NimbleController.h
+++ b/src/components/ble/NimbleController.h
@@ -94,6 +94,7 @@ namespace Pinetime {
uint8_t addrType; // 1 = Random, 0 = PUBLIC
uint16_t connectionHandle = BLE_HS_CONN_HANDLE_NONE;
+ uint16_t advInterval = 100; // multiplied by 0.625ms, must be in 32..16384
ble_uuid128_t dfuServiceUuid {
.u {.type = BLE_UUID_TYPE_128},