Skip to content

Commit 02b75a8

Browse files
authored
Merge pull request InfiniTimeOrg#71 from minacode/low-battery
Add support for low battery warning
2 parents 535ed3c + 81c0608 commit 02b75a8

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

sim/components/battery/BatteryController.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ namespace Pinetime {
2121
return voltage;
2222
}
2323

24+
bool BatteryIsLow() const {
25+
return percentRemaining <= lowBatteryThreshold;
26+
}
27+
2428
bool IsCharging() const {
2529
// isCharging will go up and down when fully charged
2630
// isFull makes sure this returns false while fully charged.
@@ -49,6 +53,8 @@ namespace Pinetime {
4953
//void SaadcEventHandler(nrfx_saadc_evt_t const* p_event);
5054
//static void AdcCallbackStatic(nrfx_saadc_evt_t const* event);
5155

56+
static constexpr uint8_t lowBatteryThreshold {20};
57+
5258
bool isReading = false;
5359

5460
Pinetime::System::SystemTask* systemTask = nullptr;

0 commit comments

Comments
 (0)