From 2c1fa7376a0f90fc5843bca38a207cdb619a16b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niccol=C3=B2=20Izzo?= Date: Fri, 11 Dec 2020 14:11:21 +0100 Subject: [PATCH] Improve battery drawing function --- openrtx/src/graphics/graphics_bw.c | 4 ++-- openrtx/src/graphics/graphics_rgb565.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/openrtx/src/graphics/graphics_bw.c b/openrtx/src/graphics/graphics_bw.c index 507e614c..8b9ad60d 100644 --- a/openrtx/src/graphics/graphics_bw.c +++ b/openrtx/src/graphics/graphics_bw.c @@ -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); } diff --git a/openrtx/src/graphics/graphics_rgb565.c b/openrtx/src/graphics/graphics_rgb565.c index e3906472..775b0869 100644 --- a/openrtx/src/graphics/graphics_rgb565.c +++ b/openrtx/src/graphics/graphics_rgb565.c @@ -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); }