Notify battery level every 10 minutes when connected to a BLE host.
Refactor battery percent : only use uint8_t to store the battery % remaining.
This commit is contained in:
@@ -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);
|
||||
|
@@ -135,6 +135,8 @@ namespace Pinetime {
|
||||
void GoToRunning();
|
||||
void UpdateMotion();
|
||||
bool stepCounterMustBeReset = false;
|
||||
static constexpr TickType_t batteryNotificationPeriod = 1000 * 60 * 10; // 1 tick ~= 1ms. 1ms * 60 * 10 = 10 minutes
|
||||
TickType_t batteryNotificationTick = 0;
|
||||
|
||||
#if configUSE_TRACE_FACILITY == 1
|
||||
SystemMonitor<FreeRtosMonitor> monitor;
|
||||
|
Reference in New Issue
Block a user