Skip to content
Snippets Groups Projects
Commit 01d1a5dd authored by Moses Swai's avatar Moses Swai
Browse files

Create and add a TestPattern to the engine

parent 3b7763a5
No related branches found
No related tags found
No related merge requests found
......@@ -34,7 +34,6 @@ abstract class Engine {
lx = createLX();
postCreateLX();
// generator = new Generator(lx, model, DataInput, DataOutput);
engineController = new EngineController(lx);
/** All engine configuration **/
......@@ -42,6 +41,7 @@ abstract class Engine {
configureAutomation();
/** For testing **/
lx.engine.addLoopTask(new FadeTest(lx));
// String testPlaylistFilename = "data/playlist.json";
// JsonArray testPlaylist = io.loadSetFile(testPlaylistFilename);
......@@ -90,6 +90,16 @@ abstract class Engine {
}
}
/* configureGeneratorOutput */
void configureGeneratorOutput() {
try {
generator = new Generator(lx, model, null, null);
lx.addOutput(generator);
} catch (Exception ex) {
System.out.println(ex.getMessage());
}
}
/* Configures the automation */
private void configureAutomation() {
......
import heronarts.lx.LX;
import heronarts.lx.modulator.SinLFO;
import heronarts.lx.pattern.LXPattern;
import heronarts.lx.parameter.BoundedParameter;
class FadeTest extends LXPattern {
final BoundedParameter speed = new BoundedParameter("SPEE", 11000, 100000, 1000);
final BoundedParameter smoothness = new BoundedParameter("SMOO", 100, 1, 100);
final BoundedParameter low = new BoundedParameter("LOW", 0, 0, 360);
final BoundedParameter high = new BoundedParameter("HIGH", 360, 0, 360);
final SinLFO color = new SinLFO(0, 360, speed);
protected final Flight model;
FadeTest(LX lx) {
super(lx);
model = (Flight)lx.getModel();
addParameter(speed);
addParameter(smoothness);
addParameter(low);
addParameter(high);
addModulator(color).start();
}
public void run(double deltaMs) {
color.setRange(low.getValuef(), high.getValuef());
for (LightSamplePoint lightPoint : model.getAllLights()) {
lightPoint.setColor(String.valueOf(lx.hsb(
(int)((int)color.getValuef() * smoothness.getValuef() / 100) * 100 / smoothness.getValuef(),
100,
100)
));
}
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment