Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 8bkc-components/powerbtn_menu/component.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Binary file modified 8bkc-components/powerbtn_menu/graphics.xcf
Binary file not shown.
14 changes: 14 additions & 0 deletions 8bkc-components/powerbtn_menu/powerbtn_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down