Merge pull request #71 from minacode/low-battery

Add support for low battery warning
main
NeroBurner 2022-10-12 21:23:40 +07:00 committed by GitHub
commit 02b75a8d3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

@ -21,6 +21,10 @@ namespace Pinetime {
return voltage;
}
bool BatteryIsLow() const {
return percentRemaining <= lowBatteryThreshold;
}
bool IsCharging() const {
// isCharging will go up and down when fully charged
// isFull makes sure this returns false while fully charged.
@ -49,6 +53,8 @@ namespace Pinetime {
//void SaadcEventHandler(nrfx_saadc_evt_t const* p_event);
//static void AdcCallbackStatic(nrfx_saadc_evt_t const* event);
static constexpr uint8_t lowBatteryThreshold {20};
bool isReading = false;
Pinetime::System::SystemTask* systemTask = nullptr;