Show plug icon while plugged in
This commit is contained in:
parent
b210090837
commit
980ac17388
|
@ -74,7 +74,7 @@ void Battery::SaadcEventHandler(nrfx_saadc_evt_t const* p_event) {
|
||||||
} else if (voltage < battery_min) {
|
} else if (voltage < battery_min) {
|
||||||
percentRemaining = 0;
|
percentRemaining = 0;
|
||||||
} else {
|
} else {
|
||||||
percentRemaining = std::min((voltage - battery_min) * 100 / (battery_max - battery_min), 99);
|
percentRemaining = std::min((voltage - battery_min) * 100 / (battery_max - battery_min), isCharging ? 99 : 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
nrfx_saadc_uninit();
|
nrfx_saadc_uninit();
|
||||||
|
|
|
@ -102,9 +102,9 @@ WatchFaceDigital::~WatchFaceDigital() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void WatchFaceDigital::Refresh() {
|
void WatchFaceDigital::Refresh() {
|
||||||
isCharging = batteryController.IsCharging();
|
powerPresent = batteryController.IsPowerPresent();
|
||||||
if (isCharging.IsUpdated()) {
|
if (powerPresent.IsUpdated()) {
|
||||||
lv_label_set_text(batteryPlug, BatteryIcon::GetPlugIcon(isCharging.Get()));
|
lv_label_set_text(batteryPlug, BatteryIcon::GetPlugIcon(powerPresent.Get()));
|
||||||
}
|
}
|
||||||
|
|
||||||
batteryPercentRemaining = batteryController.PercentRemaining();
|
batteryPercentRemaining = batteryController.PercentRemaining();
|
||||||
|
|
|
@ -44,7 +44,7 @@ namespace Pinetime {
|
||||||
uint8_t currentDay = 0;
|
uint8_t currentDay = 0;
|
||||||
|
|
||||||
DirtyValue<uint8_t> batteryPercentRemaining {};
|
DirtyValue<uint8_t> batteryPercentRemaining {};
|
||||||
DirtyValue<bool> isCharging {};
|
DirtyValue<bool> powerPresent {};
|
||||||
DirtyValue<bool> bleState {};
|
DirtyValue<bool> bleState {};
|
||||||
DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds>> currentDateTime {};
|
DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds>> currentDateTime {};
|
||||||
DirtyValue<bool> motionSensorOk {};
|
DirtyValue<bool> motionSensorOk {};
|
||||||
|
|
Loading…
Reference in a new issue