4 {0xDB, 0x00, 0x00, 0xFF},
5 {0xB7, 0x00, 0x6D, 0xFF},
6 {0x6D, 0x00, 0xDB, 0xFF},
7 {0x24, 0x00, 0x00, 0x00},
8 {0x00, 0x00, 0x00, 0x24},
9 {0xFF, 0xDB, 0x00, 0x6D},
10 {0xFF, 0x6D, 0x00, 0xB7},
11 {0xFF, 0x00, 0x00, 0xDB},
15 {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDB, 0x00, 0x24},
16 {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x6D, 0x00, 0xDB},
17 {0x6D, 0x00, 0xB7, 0xFF, 0xB7, 0x00, 0x24, 0xFF},
18 {0xDB, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0xFF},
19 {0xFF, 0xB7, 0x00, 0x24, 0x00, 0xB7, 0xFF, 0xFF},
20 {0xFF, 0xFF, 0x24, 0x00, 0x24, 0xFF, 0xFF, 0xFF},
27 m_chargeState(
Ion::Battery::
Charge::SOMEWHERE_INBETWEEN),
34 if (chargeState != m_chargeState) {
35 m_chargeState = chargeState;
73 ctx->
fillRect(
KDRect(k_elementWidth+k_separatorThickness, 0, k_batteryWidth-3*k_elementWidth-2*k_separatorThickness, k_batteryHeight),
KDColorWhite);
82 ctx->
fillRect(
KDRect(k_elementWidth+k_separatorThickness, 0, (k_batteryWidth-3*k_elementWidth-2*k_separatorThickness)/2, k_batteryHeight),
KDColorWhite);
83 ctx->
fillRect(
KDRect(k_elementWidth+k_separatorThickness+(k_batteryWidth-3*k_elementWidth-2*k_separatorThickness)/2, 0, (k_batteryWidth-3*k_elementWidth-2*k_separatorThickness)/2, k_batteryHeight),
Palette::YellowLight);
86 ctx->
fillRect(
KDRect(k_elementWidth+k_separatorThickness, 0, k_batteryWidth-3*k_elementWidth-2*k_separatorThickness, k_batteryHeight),
KDColorWhite);
89 ctx->
fillRect(
KDRect(k_batteryWidth-k_elementWidth, (k_batteryHeight-k_capHeight)/2, k_elementWidth, k_capHeight),
KDColorWhite);
93 return KDSize(k_batteryWidth, k_batteryHeight);
KDColor s_flashWorkingBuffer[BatteryView::k_flashHeight *BatteryView::k_flashWidth]
static constexpr KDColor YellowDark
const uint8_t tickMask[BatteryView::k_tickHeight][BatteryView::k_tickWidth]
void markRectAsDirty(KDRect rect)
void blendRectWithMask(KDRect rect, KDColor color, const uint8_t *mask, KDColor *workingBuffer)
bool setIsCharging(bool isCharging)
bool setIsPlugged(bool isPlugged)
static constexpr int k_flashHeight
void drawRect(KDContext *ctx, KDRect rect) const override
KDColor s_tickWorkingBuffer[BatteryView::k_tickHeight *BatteryView::k_tickWidth]
KDSize minimalSizeForOptimalDisplay() const override
constexpr KDColor KDColorWhite
static constexpr KDColor LowBattery
static constexpr int k_tickHeight
static constexpr KDColor YellowLight
static constexpr int k_flashWidth
void fillRect(KDRect rect, KDColor color)
const uint8_t flashMask[BatteryView::k_flashHeight][BatteryView::k_flashWidth]
static constexpr int k_tickWidth
bool setChargeState(Ion::Battery::Charge chargeState)