From: Tomas Wenström Date: Mon, 4 Sep 2017 14:16:32 +0000 (+0200) Subject: Turn off lights when exiting X-Git-Url: http://git.dolda2000.com/gitweb/?a=commitdiff_plain;h=a276d5abce63f4d7b54ae59a026730fdf7591b85;p=kaka%2Fcakelight.git Turn off lights when exiting --- diff --git a/src/kaka/cakelight/CakeLight.java b/src/kaka/cakelight/CakeLight.java index 6a00a37..69f6677 100644 --- a/src/kaka/cakelight/CakeLight.java +++ b/src/kaka/cakelight/CakeLight.java @@ -39,4 +39,9 @@ public class CakeLight { // byte[] data = frame.getData(); // saveFile(data, "/home/kaka/test.img"); } + + public void turnOff() { + cleanup(); + ledController.onFrame(LedFrame.from(config)); + } } diff --git a/src/kaka/cakelight/Console.java b/src/kaka/cakelight/Console.java index a856203..fef4301 100644 --- a/src/kaka/cakelight/Console.java +++ b/src/kaka/cakelight/Console.java @@ -33,7 +33,7 @@ public class Console extends Thread { config.leds.brightness = Integer.parseInt(split[1]); System.out.println("setting brightness to " + split[1]); } else if (input.matches("q|quit")) { - cakelight.cleanup(); + cakelight.turnOff(); System.out.println("stopping cakelight"); break; } diff --git a/src/kaka/cakelight/LedFrame.java b/src/kaka/cakelight/LedFrame.java index 546e78b..18b8f22 100644 --- a/src/kaka/cakelight/LedFrame.java +++ b/src/kaka/cakelight/LedFrame.java @@ -8,6 +8,9 @@ public class LedFrame { private int stride; private int roff, goff, boff; // RGB offsets + /** + * @return a frame initiated to black + */ public static LedFrame from(Configuration config) { LedFrame frame = new LedFrame(); frame.config = config;