Commit graph

16 commits

Author SHA1 Message Date
James A. Jerkins 4820b2ffe8 Revert "Linear decrease of advert rate to conserve battery"
This reverts commit c32ba844e0.
2021-09-05 15:52:01 -05:00
James A. Jerkins c32ba844e0 Linear decrease of advert rate to conserve battery
Start advertising aggressively when powered on then
slow down linearly over 75 seconds. This will conserve
battery by not advertising rapidly the whole time we
are seeking a connection. The slowest rate is
approximately once every 4.5 seconds to balance
responsiveness and battery life.

We use a fixed advertising duration of 5 seconds and start
with a 62.5 ms advertising interval. Every 5 seconds
(the advertising duration) we step up to a larger
advertising interval (slower advertising). We continue
to increase the advertising interval linearly for
75 seconds from the start of advertising. At 75 seconds
we have an advertising interval of 4.44 seconds which we
keep until connected. A reboot will restart the sequence.

When we receive a disconnect event we restart the sequence
with fast advertising and then slow down as described above.
Note that we are not using the BLE high duty cycle setting to
change the advertising rate. The rate is managed by repeatedly
setting the minimum and maximum intervals.

The linear rate of decrease and the slowest interval size
were determined experimentally by the author. The 5.3 Core
spec suggests that you not advertise slower than once
every 1.2 seconds to preserve responsiveness but we
ignored that suggestion.
2021-09-04 15:57:07 -05:00
James A. Jerkins 3e1fe687b8 Fix styles issues - no change to functionality 2021-09-01 22:50:56 -05:00
James A. Jerkins d69a8e84fa Fix race condition, connect->disconnect->discovery 2021-09-01 22:48:01 -05:00
James A. Jerkins 00a3f84ea7 Completely reset connection state on fail 2021-08-30 23:17:16 -05:00
James A. Jerkins be31f417db WIP Refactor ble advertising
Refactor ble advertising based on ble standards and conventions.
Changes are based on the bleprph example code, bluetooth docs, and nimble docs.
2021-08-29 15:50:04 -05:00
Jean-François Milants e21f6a7f41 Notify battery level every 10 minutes when connected to a BLE host.
Refactor battery percent : only use uint8_t to store the battery % remaining.
2021-07-11 16:55:06 +02:00
Jean-François Milants 7f9cc51b05 Initialize SystemTask, DisplayApp and HeartRateTask as global static variable instead of variables on the heap. We don't need them on the heap as we know their size at build time, it'll reduce memory fragmentation and it'll make memory analysis easier. 2021-06-06 15:56:03 +02:00
Avamander 40d45d923b Reformatted all the files according to clang-format style 2021-04-24 11:39:53 +03:00
petter 169b861af1 fix build warnings in HR implementation 2021-01-25 14:53:44 +01:00
Jean-François Milants 522a1eb0be Merge branch piggz/nav into develop:
- fix conflict
 - add a icon for the navigation app.
2021-01-20 21:34:09 +01:00
Jean-François Milants 68674cec53 Add heart rate BLE service. 2021-01-17 16:34:14 +01:00
okaestne 1516573df4
Include cleanup: components 2020-11-16 01:35:45 +01:00
JF 29f8074fcb Refactoring of BLE service discovery : it is now implemented into the classes of the services. 2020-10-29 16:06:01 +01:00
JF f90f2254f5 Reset BLE services on disconnect, do not start advertising if a connection is already established. 2020-10-28 18:23:09 +01:00
Avamander 6c86d1d9d7 Fixed all the includes that were broken due to the renames 2020-10-02 22:16:48 +03:00
Renamed from src/components/Ble/NimbleController.cpp (Browse further)