Turn off lights when exiting
[kaka/cakelight.git] / src / kaka / cakelight / CakeLight.java
index 5401c0f..69f6677 100644 (file)
@@ -8,6 +8,7 @@ public class CakeLight {
     public CakeLight(Configuration config, LedController ledController) {
         this.config = config;
         this.ledController = ledController;
+        Color.calculateGammaCorrection(config.gamma);
     }
 
     public void setMode(Mode mode) {
@@ -24,6 +25,7 @@ public class CakeLight {
     }
 
     public void startLoop() {
+        Console.start(this, config);
         // TODO
 //        FrameGrabber grabber = FrameGrabber.from(config);
 //        grabber.prepare();
@@ -37,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));
+    }
 }