|
@@ -7,17 +7,23 @@
|
|
|
|
|
|
|
|
void LightCluster::runAnimation() {
|
|
void LightCluster::runAnimation() {
|
|
|
if (shouldRun()) {
|
|
if (shouldRun()) {
|
|
|
- //Serial.println("Animation begin");
|
|
|
|
|
- animationObject.runAnimation(animationNumber);
|
|
|
|
|
|
|
+ Serial.println("Animation begin");
|
|
|
|
|
+ delay(100);
|
|
|
|
|
+ animationObject->runAnimation(animationNumber);
|
|
|
lastRun = millis();
|
|
lastRun = millis();
|
|
|
|
|
|
|
|
- for (int i = 0; i < numLights; i++) {
|
|
|
|
|
-// Serial.print("lights mapped = ");
|
|
|
|
|
-// Serial.println(lights[i].mapped);
|
|
|
|
|
-// Serial.print("color = ");
|
|
|
|
|
-// Serial.println(lights[i].color, HEX);
|
|
|
|
|
- leds.setPixelColor(animationObject.lights[i].mapped, animationObject.lights[i].color);
|
|
|
|
|
|
|
+ Serial.println("Animation call success, setting colors");
|
|
|
|
|
+ Serial.println(animationObject->numLeds);
|
|
|
|
|
+ delay(100);
|
|
|
|
|
+ for (int i = 0; i < animationObject->numLeds; i++) {
|
|
|
|
|
+ Serial.print("lights mapped = ");
|
|
|
|
|
+ Serial.println(animationObject->lights[i].mapped);
|
|
|
|
|
+ Serial.print("color = ");
|
|
|
|
|
+ Serial.println(animationObject->lights[i].color, HEX);
|
|
|
|
|
+ leds.setPixelColor(animationObject->lights[i].mapped, animationObject->lights[i].color);
|
|
|
}
|
|
}
|
|
|
|
|
+ Serial.println("Colors set");
|
|
|
|
|
+ delay(100);
|
|
|
//Serial.println("Animation has run");
|
|
//Serial.println("Animation has run");
|
|
|
//return true;
|
|
//return true;
|
|
|
}
|
|
}
|
|
@@ -26,7 +32,7 @@ void LightCluster::runAnimation() {
|
|
|
|
|
|
|
|
void LightCluster::runSetup() {
|
|
void LightCluster::runSetup() {
|
|
|
Serial.println("Before setup");
|
|
Serial.println("Before setup");
|
|
|
- animationObject.runSetup(animationNumber);
|
|
|
|
|
|
|
+ animationObject->runSetup(animationNumber);
|
|
|
Serial.println("After setup");
|
|
Serial.println("After setup");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -36,7 +42,7 @@ void LightCluster::changeAnimation(int newAnimationNumber) {
|
|
|
runAnimation();
|
|
runAnimation();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-LightCluster::LightCluster(struct light *incomingLights, int size, int animation, Animations animationObject)
|
|
|
|
|
|
|
+LightCluster::LightCluster(struct light *incomingLights, int size, int animation, Animations *animationObject)
|
|
|
: animationObject(animationObject) {
|
|
: animationObject(animationObject) {
|
|
|
// for (int i = 0; i < sizeof(lights); i++) {
|
|
// for (int i = 0; i < sizeof(lights); i++) {
|
|
|
// light data;
|
|
// light data;
|
|
@@ -46,6 +52,7 @@ LightCluster::LightCluster(struct light *incomingLights, int size, int animation
|
|
|
Serial.println("Inside light cluster constructor");
|
|
Serial.println("Inside light cluster constructor");
|
|
|
animationNumber = animation;
|
|
animationNumber = animation;
|
|
|
numLights = size;
|
|
numLights = size;
|
|
|
|
|
+ animationObject->numLeds = size;
|
|
|
lastRun = 0;
|
|
lastRun = 0;
|
|
|
Serial.println("About to set up animation object");
|
|
Serial.println("About to set up animation object");
|
|
|
this->animationObject = animationObject;
|
|
this->animationObject = animationObject;
|
|
@@ -53,12 +60,14 @@ LightCluster::LightCluster(struct light *incomingLights, int size, int animation
|
|
|
//this->animationObject.createLookup();
|
|
//this->animationObject.createLookup();
|
|
|
Serial.println("Construct done, running setup and animation");
|
|
Serial.println("Construct done, running setup and animation");
|
|
|
runSetup();
|
|
runSetup();
|
|
|
|
|
+ Serial.println("Running animation");
|
|
|
|
|
+ delay(100);
|
|
|
runAnimation();
|
|
runAnimation();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
bool LightCluster::shouldRun() {
|
|
bool LightCluster::shouldRun() {
|
|
|
//Serial.println("ShouldRun started");
|
|
//Serial.println("ShouldRun started");
|
|
|
- if (millis() - lastRun >= animationObject.delayTimeMS) {
|
|
|
|
|
|
|
+ if (millis() - lastRun >= animationObject->delayTimeMS) {
|
|
|
//Serial.println("ShouldRun true");
|
|
//Serial.println("ShouldRun true");
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|