summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Baumann <derflob@derflob.de>2015-02-21 19:07:56 +0100
committerFlorian Baumann <derflob@derflob.de>2015-02-21 19:07:56 +0100
commit5dc0629212c179e368d1437a3cb05c7be798a493 (patch)
treef2ff35216ddbf7c5aa4eaa71dc7279d3d710839c
parent5db4465944129256042804dd23342c645199d1d9 (diff)
downloadStripClock-blue.tar.gz
StripClock-blue.tar.bz2
blue cyanblue
-rw-r--r--StripClock.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/StripClock.c b/StripClock.c
index 7b48fa0..34502e1 100644
--- a/StripClock.c
+++ b/StripClock.c
@@ -244,7 +244,7 @@ uint8_t updateStrip(void)
for (uint8_t i = 0; i < LEDS; i++) {
int16_t r, g, b = 0;
- const int16_t cur_min_r = 4 + brightness;
+ const int16_t cur_min_r = 5 + brightness;
const int16_t cur_min_g = 16 + brightness;
const int16_t cur_min_b = 1 + brightness;
const int16_t past_min_r = 2 + brightness;
@@ -263,9 +263,9 @@ uint8_t updateStrip(void)
b = cur_min_b + (past_min_b - cur_min_b) * (int16_t)dt.second / 60;
} else if (i == dt.minute) {
//next minute
- r = past_min_r + (cur_min_r - past_min_r) * (int16_t)dt.second / 60;
- g = past_min_g + (cur_min_g - past_min_g) * (int16_t)dt.second / 60;
- b = past_min_b + (cur_min_b - past_min_b) * (int16_t)dt.second / 60;
+ r = (cur_min_r - past_min_r) * (int16_t)dt.second / 60;
+ g = (cur_min_g - past_min_g) * (int16_t)dt.second / 60;
+ b = (cur_min_b - past_min_b) * (int16_t)dt.second / 60;
} else if (i % 5 == 4) {
//future hour leds
r = past_min_r;
@@ -275,19 +275,24 @@ uint8_t updateStrip(void)
r = g = b = 0;
}
+ if (r > 255) r = 0;
+ if (g > 255) g = 0;
+ if (b > 255) b = 0;
+
if (i % 15 == 14) {
- r *= 5;
- g *= 10;
- b *= 5;
+ r *= 0;
+ g *= 6;
+ b *= 12;
} else if (i % 5 == 4) {
- r *= 7;
- g *= 7;
- b *= 6;
+ r *= 0;
+ g *= 2;
+ b *= 4;
}
if (i == hour_led) {
- g += 50 + brightness * 2;
- r += 40 + brightness * 2;
+ r = 1 + brightness * 2;
+ g = 1 + brightness * 2;
+ b = 60 + brightness * 2;
}
leds[i].r = r;