[apps] BatteryView: when the battery is EMPTY and the device hasn't

shut down yet, avoid drawing full battery (and breaking assertion)
This commit is contained in:
Émilie Feral
2019-04-18 13:57:43 +02:00
parent 530fbfed56
commit 7b7cc0bb2f

View File

@@ -66,7 +66,7 @@ void BatteryView::drawRect(KDContext * ctx, KDRect rect) const {
ctx->fillRect(KDRect(batteryInsideX, 0, batteryInsideWidth, k_batteryHeight), Palette::YellowLight);
KDRect frame((k_batteryWidth-k_flashWidth)/2, 0, k_flashWidth, k_flashHeight);
ctx->blendRectWithMask(frame, KDColorWhite, (const uint8_t *)flashMask, s_flashWorkingBuffer);
} else if (m_chargeState == Ion::Battery::Charge::LOW) {
} else if (m_chargeState == Ion::Battery::Charge::EMPTY || m_chargeState == Ion::Battery::Charge::LOW) {
assert(!m_isPlugged);
// Low: Quite empty battery
ctx->fillRect(KDRect(batteryInsideX, 0, 2*k_elementWidth, k_batteryHeight), Palette::LowBattery);