Bugfixes
[kaka/cakelight.git] / src / kaka / cakelight / CakeLight.java
index 6a00a37..95a3be1 100644 (file)
@@ -20,6 +20,7 @@ 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();
         }
     }
@@ -39,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));
+    }
 }