|
|
@@ -321,22 +321,18 @@ static unsigned int pct_text(char *b, int pct)
|
|
|
return n;
|
|
|
}
|
|
|
|
|
|
-static unsigned int batt_color(int pct, int charging, int ac)
|
|
|
+static unsigned int batt_color(int pct)
|
|
|
{
|
|
|
if (pct <= 10)
|
|
|
return 0xFF5050u;
|
|
|
- if (pct <= 20)
|
|
|
- return 0xFFD250u;
|
|
|
- if (charging || ac > 0)
|
|
|
- return 0x55FF55u;
|
|
|
- return 0x55D2FFu;
|
|
|
+ return 0x55FF55u;
|
|
|
}
|
|
|
|
|
|
/* Battery pictogram: outline, terminal and a fill proportional to the
|
|
|
* percentage. A critical charge turns the outline red as well. */
|
|
|
static void bar_icon_battery(int x, int y, int pct, unsigned int c)
|
|
|
{
|
|
|
- unsigned int frame = pct <= 10 ? c : 0xD2D2D2u;
|
|
|
+ unsigned int frame = c;
|
|
|
unsigned int fill = (unsigned int)((14 * pct + 99) / 100);
|
|
|
|
|
|
usurf_fill(&screen, x + 1, y + 2, 18, 2, frame);
|
|
|
@@ -347,7 +343,7 @@ static void bar_icon_battery(int x, int y, int pct, unsigned int c)
|
|
|
if (fill > 14)
|
|
|
fill = 14;
|
|
|
if (fill)
|
|
|
- usurf_fill(&screen, x + 3, y + 4, fill, 8, c);
|
|
|
+ usurf_fill(&screen, x + 3, y + 4, fill, 10, c);
|
|
|
}
|
|
|
|
|
|
/* AC plug pictogram: two prongs and the body, kept compact in height. */
|
|
|
@@ -384,8 +380,7 @@ static void bar_draw_tooltip(void)
|
|
|
lw = usurf_text_width(&screen, lb);
|
|
|
tx = bar_pwr_tip_x + ((int)bar_pwr_tip_w - (int)lw) / 2;
|
|
|
usurf_text(&screen, tx, bar_pwr_tip_y + 3, lb,
|
|
|
- batt_color(bar_batt_pct, bar_batt_charging, bar_ac_online),
|
|
|
- 0, 0, fbw, fbh);
|
|
|
+ batt_color(bar_batt_pct), 0, 0, fbw, fbh);
|
|
|
}
|
|
|
|
|
|
/* Publish the geometry computed by draw_bar() and redraw the tooltip. */
|
|
|
@@ -490,9 +485,7 @@ static void draw_bar(void)
|
|
|
else
|
|
|
bar_icon_battery(px, BAR_PWR_Y,
|
|
|
bar_batt_pct,
|
|
|
- batt_color(bar_batt_pct,
|
|
|
- bar_batt_charging,
|
|
|
- bar_ac_online));
|
|
|
+ batt_color(bar_batt_pct));
|
|
|
bar_pwr_x = px;
|
|
|
right = px - 8;
|
|
|
if (bar_pwr_hot && bar_batt_pct >= 0) {
|