diff --git a/charger/charger.c b/charger/charger.c index bcba7c3a22e..f6bfe929022 100644 --- a/charger/charger.c +++ b/charger/charger.c @@ -658,6 +658,20 @@ static void android_green(void) gr_color(0xa4, 0xc6, 0x39, 255); } +static void draw_capacity(struct charger *charger) +{ + char cap_str[64]; + int x, y; + int str_len_px; + + snprintf(cap_str, sizeof(cap_str), "%d%%", charger->batt_anim->capacity); + str_len_px = gr_measure(cap_str); + x = (gr_fb_width() - str_len_px) / 2; + y = (gr_fb_height() + char_height) / 2; + android_green(); + gr_text(x, y, cap_str, 0); +} + /* returns the last y-offset of where the surface ends */ static int draw_surface_centered(struct charger *charger, gr_surface surface) { @@ -710,8 +724,10 @@ static void redraw_screen(struct charger *charger) /* try to display *something* */ if (batt_anim->capacity < 0 || batt_anim->num_frames == 0) draw_unknown(charger); - else + else { draw_battery(charger); + draw_capacity(charger); + } gr_flip(); }