diff options
| author | Jean-François Milants <jf@codingfield.com> | 2021-07-11 14:55:06 (GMT) |
|---|---|---|
| committer | Jean-François Milants <jf@codingfield.com> | 2021-07-11 14:55:06 (GMT) |
| commit | e21f6a7f414d1f832e8fddfeaab3b9de05aa3459 (patch) | |
| tree | a4ebbc3a74ba7daf87aa99c0eafcb0e9e7bc6c35 /src/systemtask/SystemTask.cpp | |
| parent | 6a91b83b12ef849f68d54f490153b02f0ecf58dc (diff) | |
Notify battery level every 10 minutes when connected to a BLE host.
Refactor battery percent : only use uint8_t to store the battery % remaining.
Diffstat (limited to 'src/systemtask/SystemTask.cpp')
| -rw-r--r-- | src/systemtask/SystemTask.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp index 17e7823..eb29638 100644 --- a/src/systemtask/SystemTask.cpp +++ b/src/systemtask/SystemTask.cpp @@ -330,6 +330,11 @@ void SystemTask::Work() { } } + if (xTaskGetTickCount() - batteryNotificationTick > batteryNotificationPeriod) { + nimbleController.NotifyBatteryLevel(batteryController.PercentRemaining()); + batteryNotificationTick = xTaskGetTickCount(); + } + monitor.Process(); uint32_t systick_counter = nrf_rtc_counter_get(portNRF_RTC_REG); dateTimeController.UpdateTime(systick_counter); |
