From: Tomas Wenström Date: Fri, 6 Dec 2019 22:49:33 +0000 (+0100) Subject: Don't calculate sun colors when sun is completely up X-Git-Url: http://git.dolda2000.com/gitweb/?a=commitdiff_plain;ds=inline;h=e8b77a251487daabad64ae17c2255b4582c7e03f;p=kaka%2Fcakelight.git Don't calculate sun colors when sun is completely up --- diff --git a/src/kaka/cakelight/mode/SunriseMode.java b/src/kaka/cakelight/mode/SunriseMode.java index 896646f..b0840c9 100644 --- a/src/kaka/cakelight/mode/SunriseMode.java +++ b/src/kaka/cakelight/mode/SunriseMode.java @@ -12,6 +12,10 @@ public class SunriseMode extends AmbientMode { @Override protected void updateFrame(LedFrame frame, long time, int count) { + if (time > durationSeconds) { + frame.fillColor(Color.rgb(255, 255, 255)); + return; + } double progress = clamp(time / (durationSeconds * 1000.0)); double elevation = 2.0 - progress; double radius = progress * 2.12;