1

Adjusted brightness table, simplify display drawing algo.

This commit is contained in:
eleksir
2019-08-17 11:20:26 +03:00
parent bd1f945ad3
commit ee1dc7bbea

View File

@@ -248,15 +248,15 @@ void loop()
} else if ((ambLight < 350) and (ambLight >= 310)) {
Display.setBrightness(-3);
} else if ((ambLight < 300) and (ambLight >= 260)) {
Display.setBrightness(-5);
Display.setBrightness(-6);
} else if ((ambLight < 250) and (ambLight >= 210)) {
Display.setBrightness(-7);
Display.setBrightness(-10);
} else if ((ambLight < 200) and (ambLight >= 160)) {
Display.setBrightness(-9);
Display.setBrightness(-14);
} else if ((ambLight < 150) and (ambLight >= 110)) {
Display.setBrightness(-12);
Display.setBrightness(-18);
} else if (ambLight < 100) {
Display.setBrightness(-15);
Display.setBrightness(-22);
}
}
@@ -265,27 +265,14 @@ void loop()
void updateTimeStr(uint8_t h, uint8_t m)
{
char str[4];
float d;
// make blinking dot
if (h > 0) {
if (dot) {
Display.setNumber((h * 100 + m), 2);
} else {
Display.setNumber((h * 100 + m));
}
} else {
/* 0 o'clock is an exception, we don't want to see "00.00", we
want see "0.00" or "0 00", so we have to use this "hack" */
if (dot) {
d = float(m) / 100;
Display.setNumber(d, 2);
} else {
sprintf(str, "%2d%02d", h, m);
Display.setChars(str);
}
if (dot) {
char str[5];
sprintf(str, "%2d.%02d", h, m);
Display.setChars(str);
} else {
char str[4];
sprintf(str, "%2d%02d", h, m);
Display.setChars(str);
}
}
/* vim: set filetype=cpp: */