replaced brighter ContDownBar ticks by differently colored
This commit is contained in:
parent
72cc70bf68
commit
f6f97e5273
@ -7,6 +7,7 @@
|
||||
#define _ false
|
||||
|
||||
#define ____ 0
|
||||
#define HALF 127
|
||||
#define FULL 255
|
||||
|
||||
#define countof(x) (sizeof(x) / sizeof(x[0]))
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -27,6 +27,8 @@ extern const Color YELLOW;
|
||||
|
||||
extern const Color MAGENTA;
|
||||
|
||||
extern const Color VIOLET;
|
||||
|
||||
extern const Color TURQUOISE;
|
||||
|
||||
#endif
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user