-
Notifications
You must be signed in to change notification settings - Fork 7
/
aurora.h
108 lines (94 loc) · 2.53 KB
/
aurora.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#ifndef aurora_h
#define aurora_h
#include "neomatrix_config.h"
#include "Aurora/Effects.h"
#include "Aurora/Drawable.h"
#include "Aurora/Boid.h"
#include "Aurora/Attractor.h"
#include "Aurora/Geometry.h"
#include "Aurora/PatternAttract.h"
PatternAttract attract;
#include "Aurora/PatternBounce.h"
PatternBounce bounce;
#include "Aurora/PatternCube.h"
PatternCube cube;
#include "Aurora/PatternFlock.h"
PatternFlock Aflock;
#include "Aurora/PatternFlowField.h"
PatternFlowField flowfield;
#include "Aurora/PatternIncrementalDrift.h"
PatternIncrementalDrift incrementaldrift;
#include "Aurora/PatternIncrementalDrift2.h"
PatternIncrementalDrift2 incrementaldrift2;
#include "Aurora/PatternPendulumWave.h"
PatternPendulumWave pendulumwave;
#include "Aurora/PatternRadar.h"
PatternRadar radar;
#include "Aurora/PatternSpiral.h"
PatternSpiral spiral;
#include "Aurora/PatternSpiro.h"
PatternSpiro spiro;
#include "Aurora/PatternSwirl.h"
PatternSwirl swirl;
#include "Aurora/PatternWave.h"
PatternWave wave;
AuroraDrawable* items[] = {
&attract,
&bounce,
&cube,
&Aflock,
&flowfield,
&incrementaldrift,
&incrementaldrift2,
&pendulumwave,
&radar, // 8 not great on non square
&spiral,
&spiro,
&swirl, // 11 not great on bigger display
&wave,
};
AuroraDrawable *drawable;
// defined in NeoMatrix-FastLED-IR.ino
extern bool MATRIX_RESET_DEMO;
int8_t item = -1;
uint8_t numitems = sizeof(items) / sizeof(items[0]);
uint8_t aurora(uint32_t item) {
static uint8_t delayframe = 1;
uint8_t repeat = 1;
static uint16_t counter = 1;
uint16_t loops = 2000;
// 13 demos, 0 to 12
if (item == 0 ) { loops = 3000; } // bounce
if (item == 5 ) { loops = 4000; } // Incremental Drift
if (item == 6 ) { loops = 6000; } // Incremental Drift Rose
if (item == 7 ) { loops = 5000; } // Pendulum Wave
if (item == 10) { loops = 7000; } // Spiro
if (MATRIX_RESET_DEMO) {
counter = 0;
drawable = items[item];
Serial.print("Switching to drawable #");
Serial.print(item);
Serial.print(": ");
Serial.println(drawable->name);
drawable->start();
MATRIX_RESET_DEMO = false;
matrix->clear();
}
if (--delayframe) {
matrix_show(); // make sure we still run at the same speed.
return repeat;
}
delayframe = 1;
drawable->drawFrame();
matrix_show();
if (counter++ < loops) return repeat;
MATRIX_RESET_DEMO = true;
matrix->setPassThruColor();
return 0;
}
void aurora_setup() {
effects.leds = matrixleds;
effects.Setup();
}
#endif // aurora_h
// vim:sts=4:sw=4