X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;f=src%2Fkaka%2Fcakelight%2FCakeLight.java;h=95a3be11f639b20786597345012901655d5f8b0f;hb=6e568391dad1a1c47b5697a2f1ef90a685859a84;hp=9b32c026b34649b3bae075542f2b32d7837788ec;hpb=01ee91e7622bbdf6a940b2d8ca9efc1f133cbe97;p=kaka%2Fcakelight.git diff --git a/src/kaka/cakelight/CakeLight.java b/src/kaka/cakelight/CakeLight.java index 9b32c02..95a3be1 100644 --- a/src/kaka/cakelight/CakeLight.java +++ b/src/kaka/cakelight/CakeLight.java @@ -5,9 +5,10 @@ public class CakeLight { private Mode mode; private LedController ledController; - public CakeLight(Configuration config) { + public CakeLight(Configuration config, LedController ledController) { this.config = config; - this.ledController = new LedController(config); + this.ledController = ledController; + Color.calculateGammaCorrection(config.gamma); } public void setMode(Mode mode) { @@ -19,11 +20,13 @@ 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(); @@ -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)); + } }