1
0
Fork 0

Merge pull request #71 from minacode/low-battery

Add support for low battery warning
This commit is contained in:
NeroBurner 2022-10-12 21:23:40 +02:00 committed by GitHub
commit 02b75a8d3e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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