diff --git a/8bkc-components/powerbtn_menu/component.mk b/8bkc-components/powerbtn_menu/component.mk index 10493e4..63bdffb 100644 --- a/8bkc-components/powerbtn_menu/component.mk +++ b/8bkc-components/powerbtn_menu/component.mk @@ -13,5 +13,5 @@ COMPONENTS_EXTRA_CLEAN := graphics.inc graphics.rgba powerbtn_menu.o: graphics.inc graphics.inc: $(COMPONENT_PATH)/graphics.xcf - convert $^ -background none -layers flatten -crop 80x142+0+0 graphics.rgba + convert $^ -background none -layers flatten -crop 80x150+0+0 graphics.rgba cat graphics.rgba | xxd -i > graphics.inc diff --git a/8bkc-components/powerbtn_menu/graphics.xcf b/8bkc-components/powerbtn_menu/graphics.xcf index e865e32..832084a 100644 Binary files a/8bkc-components/powerbtn_menu/graphics.xcf and b/8bkc-components/powerbtn_menu/graphics.xcf differ diff --git a/8bkc-components/powerbtn_menu/powerbtn_menu.c b/8bkc-components/powerbtn_menu/powerbtn_menu.c index f5c9d13..298ad2c 100644 --- a/8bkc-components/powerbtn_menu/powerbtn_menu.c +++ b/8bkc-components/powerbtn_menu/powerbtn_menu.c @@ -171,6 +171,20 @@ int powerbtn_menu_show(uint16_t *fb) { if (v>255) v=255; renderGfx(fb, 14, 25+16, 14, 130, (v*60)/256, 4); } + + // draw empty battery cell + renderGfx(fb, KC_SCREEN_W-16, 0, 0, 142, 16, 7); + + // fill in the battery with appropriate color + int batPct = kchal_get_bat_pct(); + if (batPct < 20) renderGfx(fb, KC_SCREEN_W-15, 1, 17, 143, (batPct*12)/100, 5); + else if (batPct < 50) renderGfx(fb, KC_SCREEN_W-15, 1, 33, 143, (batPct*12)/100, 5); + else renderGfx(fb, KC_SCREEN_W-15, 1, 49, 143, (batPct*12)/100, 5); + + // add lightning bolt icon if applicable + if (kchal_get_chg_status() > 0) { + renderGfx(fb, KC_SCREEN_W-11, 0, 64, 142, 6, 8); + } if (doRefresh) { kchal_send_fb(fb);