X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;f=src%2Fkaka%2Fcakelight%2FCakeLight.java;h=3769dcecd2774e0a3ab57c659d2f30b9253239d3;hb=adc29b9a70fa1d03ac67b0b3f397fed7a75f4d7b;hp=5401c0f078c049f4c7ca80cc6dba830042759cfc;hpb=d182b8ccdbbbdadc4441170f0135ec98c76f5d17;p=kaka%2Fcakelight.git diff --git a/src/kaka/cakelight/CakeLight.java b/src/kaka/cakelight/CakeLight.java index 5401c0f..3769dce 100644 --- a/src/kaka/cakelight/CakeLight.java +++ b/src/kaka/cakelight/CakeLight.java @@ -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) { @@ -19,15 +20,17 @@ public class CakeLight { public void cleanup() { if (this.mode != null) { + this.mode.setFrameListener(ledFrame -> {}); // To avoid any frame being sent to the controller while the thread is exiting this.mode.exit(); } } public void startLoop() { + Console.start(this, config); // TODO // FrameGrabber grabber = FrameGrabber.from(config); // grabber.prepare(); -// Frame frame = grabber.grabFrame(); +// VideoFrame frame = grabber.grabFrame(); // double time = 0; // for (int i = 0; i < 100; i++) { // time += timeIt("frame", () -> grabber.grabFrame()); @@ -37,4 +40,9 @@ public class CakeLight { // byte[] data = frame.getData(); // saveFile(data, "/home/kaka/test.img"); } + + public void turnOff() { + cleanup(); + ledController.onFrame(LedFrame.from(config).fillColor(0, 0, 0)); + } }