mirror of
https://github.com/SemvdH/OBD2-car-display.git
synced 2025-12-15 20:21:03 +00:00
Show first bars of data
This commit is contained in:
@@ -11,6 +11,17 @@ void bar_draw_horizontal(int start_x, int start_y, int width, int height, int va
|
||||
display->fillRect(start_x, start_y, start_x + bar_width, start_y + height);
|
||||
}
|
||||
|
||||
void bar_draw_horizontal(int start_x, int start_y, int width, int height, int value, int max_value, byte r, byte g, byte b, char fill_outline, UTFT *display)
|
||||
{
|
||||
display->setColor(r,g,b);
|
||||
int bar_width = (int)((float)value / (float)max_value * width);
|
||||
if (fill_outline)
|
||||
{
|
||||
display->drawRect(start_x, start_y, start_x + width, start_y + height);
|
||||
}
|
||||
display->fillRect(start_x, start_y, start_x + bar_width, start_y + height);
|
||||
}
|
||||
|
||||
void bar_draw_vertical(int start_x, int start_y, int width, int height, int value, int max_value, uint color, char fill_outline, UTFT *display)
|
||||
{
|
||||
display->setColor(color);
|
||||
@@ -22,6 +33,17 @@ void bar_draw_vertical(int start_x, int start_y, int width, int height, int valu
|
||||
display->fillRect(start_x, (start_y + height) - bar_height, start_x + width, start_y + height);
|
||||
}
|
||||
|
||||
void bar_draw_vertical(int start_x, int start_y, int width, int height, int value, int max_value, byte r, byte g, byte b, char fill_outline, UTFT *display)
|
||||
{
|
||||
display->setColor(r,g,b);
|
||||
int bar_height = (int)((float)value / (float)max_value * height);
|
||||
if (fill_outline)
|
||||
{
|
||||
display->drawRect(start_x, start_y, start_x + width, start_y + height);
|
||||
}
|
||||
display->fillRect(start_x, (start_y + height) - bar_height, start_x + width, start_y + height);
|
||||
}
|
||||
|
||||
void bar_clear_part_horizontal(int start_x, int start_y, int width, int height, int value_from, int max_value, char clear_color, char clear_outline, UTFT *display)
|
||||
{
|
||||
display->setColor(clear_color);
|
||||
|
||||
Reference in New Issue
Block a user