Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example of running in demo mode #16

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 52 additions & 1 deletion ANIMartRIX.ino
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,48 @@ struct rgb {
rgb pixel;


typedef void (*Pattern)();
typedef Pattern PatternList[];
typedef struct {
Pattern pattern;
String name;
} PatternAndName;
typedef PatternAndName PatternAndNameList[];

int currentPattern = 0;

#include "animation_collection.h"

PatternAndNameList gPatterns = {
{ RGB_Blobs5, "RGB_Blobs5" },
{ RGB_Blobs4, "RGB_Blobs4" },
{ RGB_Blobs3, "RGB_Blobs3" },
{ RGB_Blobs2, "RGB_Blobs2" },
{ RGB_Blobs, "RGB_Blobs" },
{ Polar_Waves, "Polar_Waves" },
{ Slow_Fade, "Slow_Fade" },
// { Zoom2, "Zoom2" },
{ Zoom, "Zoom" },
{ Hot_Blob, "Hot_Blob" },
{ Spiralus2, "Spiralus2" },
{ Spiralus, "Spiralus" },
{ Yves, "Yves" },
{ Scaledemo1, "Scaledemo1" },
{ Lava1, "Lava1" },
{ Caleido3, "Caleido3" },
{ Caleido2, "Caleido2" },
{ Caleido1, "Caleido1" },
{ Distance_Experiment, "Distance_Experiment" },
{ Center_Field, "Center_Field" },
{ Waves, "Waves" },
{ Chasing_Spirals, "Chasing_Spirals" },
{ Rotating_Blob, "Rotating_Blob" },
{ Rings, "Rings" },
};

#define ARRAY_SIZE(A) (sizeof(A) / sizeof((A)[0]))
int gPatternCount = ARRAY_SIZE(gPatterns);


//******************************************************************************************************************

Expand Down Expand Up @@ -120,7 +162,7 @@ void loop() {
//Spiralus();
//Yves();
//Scaledemo1();
Lava1();
// Lava1();
//Caleido3();
//Caleido2();
//Caleido1();
Expand All @@ -130,5 +172,14 @@ void loop() {
//Chasing_Spirals();
//Rotating_Blob();
//Rings();
EVERY_N_SECONDS(90) {
currentPattern = random(1, (gPatternCount - 1));
// autopgm++;
// if (autopgm >= gPatternCount) autopgm = 1;
Serial.print("Next Auto pattern: ");
Serial.println(gPatterns[currentPattern].name);
}

gPatterns[currentPattern].pattern();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment and logger to show effect

}

4 changes: 4 additions & 0 deletions animation_collection.ino → animation_collection.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#include "noise.h"
#include "oscillators.h"
#include "rendering.h"


void Rotating_Blob() {

Expand Down
File renamed without changes.
29 changes: 0 additions & 29 deletions notes_to_myself.ino
Original file line number Diff line number Diff line change
Expand Up @@ -35,35 +35,6 @@ idle light routine (>=min brightnes)

*/

void run_default_oscillators(){

timings.master_speed = 0.005; // master speed

timings.ratio[0] = 1; // speed ratios for the oscillators, higher values = faster transitions
timings.ratio[1] = 2;
timings.ratio[2] = 3;
timings.ratio[3] = 4;
timings.ratio[4] = 5;
timings.ratio[5] = 6;
timings.ratio[6] = 7;
timings.ratio[7] = 8;
timings.ratio[8] = 9;
timings.ratio[9] = 10;


timings.offset[0] = 000;
timings.offset[1] = 100;
timings.offset[2] = 200;
timings.offset[3] = 300;
timings.offset[4] = 400;
timings.offset[5] = 500;
timings.offset[6] = 600;
timings.offset[7] = 700;
timings.offset[8] = 800;
timings.offset[9] = 900;

calculate_oscillators(timings);
}



Expand Down
29 changes: 29 additions & 0 deletions oscillators.ino → oscillators.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,32 @@ void calculate_oscillators(oscillators &timings) {
}


void run_default_oscillators(){

timings.master_speed = 0.005; // master speed

timings.ratio[0] = 1; // speed ratios for the oscillators, higher values = faster transitions
timings.ratio[1] = 2;
timings.ratio[2] = 3;
timings.ratio[3] = 4;
timings.ratio[4] = 5;
timings.ratio[5] = 6;
timings.ratio[6] = 7;
timings.ratio[7] = 8;
timings.ratio[8] = 9;
timings.ratio[9] = 10;


timings.offset[0] = 000;
timings.offset[1] = 100;
timings.offset[2] = 200;
timings.offset[3] = 300;
timings.offset[4] = 400;
timings.offset[5] = 500;
timings.offset[6] = 600;
timings.offset[7] = 700;
timings.offset[8] = 800;
timings.offset[9] = 900;

calculate_oscillators(timings);
}
23 changes: 12 additions & 11 deletions rendering.ino → rendering.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
// float mapping maintaining 32 bit precision
// we keep values with high resolution for potential later usage

float map_float(float x, float in_min, float in_max, float out_min, float out_max) {

float result = (x-in_min) * (out_max-out_min) / (in_max-in_min) + out_min;
if (result < out_min) result = out_min;
if( result > out_max) result = out_max;

return result;
}

// Convert the 2 polar coordinates back to cartesian ones & also apply all 3d transitions.
// Calculate the noise value at this point based on the 5 dimensional manipulation of
// the underlaying coordinates.
Expand Down Expand Up @@ -46,17 +58,6 @@ void render_polar_lookup_table(float cx, float cy) {



// float mapping maintaining 32 bit precision
// we keep values with high resolution for potential later usage

float map_float(float x, float in_min, float in_max, float out_min, float out_max) {

float result = (x-in_min) * (out_max-out_min) / (in_max-in_min) + out_min;
if (result < out_min) result = out_min;
if( result > out_max) result = out_max;

return result;
}


/* unnecessary bloat
Expand Down