From f6f97e5273c7db085702df3d1955613f94eb374f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Ha=C3=9Fel?= Date: Sun, 31 Dec 2023 16:32:10 +0100 Subject: [PATCH] replaced brighter ContDownBar ticks by differently colored --- src/BASICS.h | 1 + src/display/Color.cpp | 2 ++ src/display/Color.h | 2 ++ src/mode/CountDown/CountDown.h | 16 +++++++++++----- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/BASICS.h b/src/BASICS.h index 878d93b..0596c64 100644 --- a/src/BASICS.h +++ b/src/BASICS.h @@ -7,6 +7,7 @@ #define _ false #define ____ 0 +#define HALF 127 #define FULL 255 #define countof(x) (sizeof(x) / sizeof(x[0])) diff --git a/src/display/Color.cpp b/src/display/Color.cpp index 9ccf021..6176f7d 100644 --- a/src/display/Color.cpp +++ b/src/display/Color.cpp @@ -14,6 +14,8 @@ const Color YELLOW = {FULL, FULL, ____}; const Color MAGENTA = {FULL, ____, FULL}; +const Color VIOLET = {HALF, ____, FULL}; + const Color TURQUOISE = {____, FULL, FULL}; Color gray(uint8_t brightness) { diff --git a/src/display/Color.h b/src/display/Color.h index 2faeafc..a44b4f8 100644 --- a/src/display/Color.h +++ b/src/display/Color.h @@ -27,6 +27,8 @@ extern const Color YELLOW; extern const Color MAGENTA; +extern const Color VIOLET; + extern const Color TURQUOISE; #endif diff --git a/src/mode/CountDown/CountDown.h b/src/mode/CountDown/CountDown.h index fde17dd..c2e3621 100644 --- a/src/mode/CountDown/CountDown.h +++ b/src/mode/CountDown/CountDown.h @@ -114,12 +114,12 @@ private: } void drawCountdownBars(Display &display, uint8_t hours, uint8_t minutes, uint8_t seconds) { - drawBar(display, 0, 0, 24, 1, 0, 24, hours, RED, 6); - drawBar(display, 0, 2, 30, 2, 0, 60, minutes, BLUE, 5); - drawBar(display, 0, 5, 30, 2, 0, 60, seconds, GREEN, 10); + drawBar(display, 0, 0, 24, 1, 0, 24, hours, RED, MAGENTA, 0); + drawBar(display, 0, 2, 30, 2, 0, 60, minutes, BLUE, VIOLET, 5); + drawBar(display, 0, 5, 30, 2, 0, 60, seconds, GREEN, TURQUOISE, 10); } - void drawBar(Display &display, uint8_t _x, uint8_t _y, uint8_t _w, uint8_t _h, uint8_t min, uint8_t max, uint8_t value, const Color &color, uint8_t ticks) { + void drawBar(Display &display, uint8_t _x, uint8_t _y, uint8_t _w, uint8_t _h, uint8_t min, uint8_t max, uint8_t value, const Color &color, const Color &tickColor, uint8_t ticks) { auto totalOnCount = (uint8_t) round(((double) value - min) / (max - min) * _w * _h); uint8_t doneOnCount = 0; for (uint8_t y = 0; y < _h; y++) { @@ -128,7 +128,13 @@ private: return; } doneOnCount++; - display.set(_x + x, _y + y, (doneOnCount % ticks) == 0 ? color : factor(color, 0.5)); + Color c = color; + if (ticks != 0) { + if (doneOnCount % ticks == 0) { + c = tickColor; + } + } + display.set(_x + x, _y + y, c); } } }