Merge pull request #71 from minacode/low-battery
Add support for low battery warning
This commit is contained in:
commit
02b75a8d3e
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user