Dolda2000 GitWeb
/
kaka
/
cakelight.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Renamed a thread
[kaka/cakelight.git]
/
src
/
kaka
/
cakelight
/
CakeLight.java
diff --git
a/src/kaka/cakelight/CakeLight.java
b/src/kaka/cakelight/CakeLight.java
index
33e0035
..
95a3be1
100644
(file)
--- a/
src/kaka/cakelight/CakeLight.java
+++ b/
src/kaka/cakelight/CakeLight.java
@@
-8,22
+8,25
@@
public class CakeLight {
public CakeLight(Configuration config, LedController ledController) {
this.config = config;
this.ledController = ledController;
public CakeLight(Configuration config, LedController ledController) {
this.config = config;
this.ledController = ledController;
+ Color.calculateGammaCorrection(config.gamma);
}
public void setMode(Mode mode) {
cleanup();
this.mode = mode;
}
public void setMode(Mode mode) {
cleanup();
this.mode = mode;
- mode.setFrameListener(ledController);
+ mode.setFrameListener(ledController
::onFrame
);
mode.enter(config);
}
public void cleanup() {
if (this.mode != null) {
mode.enter(config);
}
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() {
this.mode.exit();
}
}
public void startLoop() {
+ Console.start(this, config);
// TODO
// FrameGrabber grabber = FrameGrabber.from(config);
// grabber.prepare();
// 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");
}
// byte[] data = frame.getData();
// saveFile(data, "/home/kaka/test.img");
}
+
+ public void turnOff() {
+ cleanup();
+ ledController.onFrame(LedFrame.from(config).fillColor(0, 0, 0));
+ }
}
}