-
Notifications
You must be signed in to change notification settings - Fork 2
/
scenes.h
136 lines (130 loc) · 3.89 KB
/
scenes.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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
void taskFunction(){
// Debug.println(F("currentTask: 0x%02X"), currentTask);
if(currentTask != TASK_IDLE) {
lastTaskBeforeMessage = currentTask;
//exit WAIT state
if(!statusM1) statusM1 = true;
if(!statusM2) statusM2 = true;
if(!statusM3) statusM3 = true;
if(!statusM4) statusM4 = true;
}
switch(currentTask){
case ALL_OFF:
setAll(0,0,0,0);
dimmer.taskOff();
break;
case WHITE:
setAll(0,0,0,255);
dimmer.taskOn();
break;
case RED:
setAll(255,0,0,0);
break;
case YELLOW:
setAll(255,255,0,0);
break;
case GREEN:
setAll(0,255,0,0);
break;
case CYAN:
setAll(0,255,255,0);
break;
case BLUE:
setAll(0,0,255,0);
break;
case PURPLE:
setAll(255,0,255,0);
break;
case ORANGE:
setAll(255,81,0,0);
break;
case USER_COLOR_1:
setAll(ucRed[0],ucGreen[0],ucBlue[0],ucWhite[0]);
break;
case USER_COLOR_2:
setAll(ucRed[1],ucGreen[1],ucBlue[1],ucWhite[1]);
break;
case USER_COLOR_3:
setAll(ucRed[2],ucGreen[2],ucBlue[2],ucWhite[2]);
break;
case USER_COLOR_4:
setAll(ucRed[3],ucGreen[3],ucBlue[3],ucWhite[3]);
break;
case USER_COLOR_5:
setAll(ucRed[4],ucGreen[4],ucBlue[4],ucWhite[4]);
break;
case RAINBOW:
rainbow();
break;
case SINGLERGB:
singlergb();
break;
case TWINKYSTARS:
twinkystars();
break;
case CHASER:
chaser();
break;
case HUEFADER:
huefader();
break;
case SPEEDTRAILS:
speedtrails();
break;
case BOUNCYBALLS:
bouncyballs();
break;
case TWOBRUSHCOLORMIXING:
twobrushcolormixing();
break;
case SPARKLER:
sparkler();
break;
case WHIREMIDDLEON:
whitemiddleon();
break;
case WHIREMIDDLEOFF:
whitemiddleoff();
break;
case TASK_RGB:
if(acceptNewRGBW){
// Debug.println(F("valuesRGBW R: %d, G: %d, B: %d, W: %d"),valuesRGBW[R],valuesRGBW[G],valuesRGBW[B],valuesRGBW[W]);
setAll(valuesRGBW[R], valuesRGBW[G], valuesRGBW[B], valuesRGBW[W]);
acceptNewRGBW = false;
rgbwChanged = false;
//reset color because of time out (acceptNewRGBW)
new3Byte[0] = 0;
new3Byte[1] = 0;
new3Byte[2] = 0;
Debug.println(F("TASK_RGB done"));
}
break;
case TASK_RGBW:
if(acceptNewRGBW){
//first 12 bits are not defined, 4 bits ignored
Debug.println(F("valuesRGBW R: %d, G: %d, B: %d, W: %d"), valuesRGBW[R], valuesRGBW[G], valuesRGBW[B], valuesRGBW[W]);
setAll(valuesRGBW[R], valuesRGBW[G], valuesRGBW[B], valuesRGBW[W]);
acceptNewRGBW = false;
rgbwChanged = false;
Debug.println(F("TASK_RGBW done"));
}
break;
case TASK_HSV:
if(acceptNewHSV){
setAllHsv(valuesHSV[0], valuesHSV[1], valuesHSV[2]);
acceptNewHSV = false;
Debug.println(F("TASK_HSV done"));
}
break;
case TASK_DIMMER:
setAll(0, 0, 0, lastDimmerValue);
break;
case TASK_IDLE:
default:
break;
}
showMessage();
if(pixelsShow){
showPixels();
}
}