Don't measure and notify percentage on charging event.
This commit is contained in:
parent
a9f7153fdf
commit
1777b9dee8
3 changed files with 11 additions and 5 deletions
|
|
@ -13,7 +13,7 @@ Battery::Battery() {
|
|||
nrf_gpio_cfg_input(PinMap::Charging, static_cast<nrf_gpio_pin_pull_t> GPIO_PIN_CNF_PULL_Disabled);
|
||||
}
|
||||
|
||||
void Battery::Update() {
|
||||
void Battery::ReadPowerState() {
|
||||
isCharging = !nrf_gpio_pin_read(PinMap::Charging);
|
||||
isPowerPresent = !nrf_gpio_pin_read(PinMap::PowerPresent);
|
||||
|
||||
|
|
@ -22,6 +22,10 @@ void Battery::Update() {
|
|||
} else if (!isPowerPresent) {
|
||||
isFull = false;
|
||||
}
|
||||
}
|
||||
|
||||
void Battery::MeasureVoltage() {
|
||||
ReadPowerState();
|
||||
|
||||
if (isReading) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,8 @@ namespace Pinetime {
|
|||
public:
|
||||
Battery();
|
||||
|
||||
void Update();
|
||||
void ReadPowerState();
|
||||
void MeasureVoltage();
|
||||
void Register(System::SystemTask* systemTask);
|
||||
|
||||
uint8_t PercentRemaining() const {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue