Improve battery drawing function

This commit is contained in:
Niccolò Izzo 2020-12-11 14:11:21 +01:00
parent 41ec005680
commit 2c1fa7376a
2 changed files with 5 additions and 5 deletions

View File

@ -318,7 +318,7 @@ void gfx_drawBattery(point_t start, uint16_t width, uint16_t height, float perce
gfx_setPixel(bottom_right, black);
// Draw the button
point_t button_start = {start.x + width, start.y + height / 2 - 1};
point_t button_end = {start.x + width, start.y + height / 2 + 1};
point_t button_start = {start.x + width, start.y + height / 2 - (height / 8) - 1 + (height % 2)};
point_t button_end = {start.x + width, start.y + height / 2 + (height / 8)};
gfx_drawLine(button_start, button_end, white);
}

View File

@ -305,7 +305,7 @@ void gfx_drawBattery(point_t start, uint16_t width, uint16_t height, float perce
color_t bat_color = yellow;
if (percentage < 0.3)
bat_color = red;
else if (percentage > 0.7)
else if (percentage > 0.6)
bat_color = green;
// Draw the battery outline
@ -326,7 +326,7 @@ void gfx_drawBattery(point_t start, uint16_t width, uint16_t height, float perce
gfx_setPixel(bottom_right, black);
// Draw the button
point_t button_start = {start.x + width, start.y + height / 2 - 2 + (height % 2)};
point_t button_end = {start.x + width, start.y + height / 2 + 1};
point_t button_start = {start.x + width, start.y + height / 2 - (height / 8) - 1 + (height % 2)};
point_t button_end = {start.x + width, start.y + height / 2 + (height / 8)};
gfx_drawLine(button_start, button_end, white);
}