Преглед изворни кода

Idle animation now displays each frame now for 125 ms...

Max Nuding пре 12 година
родитељ
комит
5c8455dd69
1 измењених фајлова са 74 додато и 68 уклоњено
  1. 74
    68
      CubeFirmware/animations.c

+ 74
- 68
CubeFirmware/animations.c Прегледај датотеку

@@ -47,104 +47,110 @@ void executeAnimation(uint8_t id) {
47 47
 
48 48
 void simpleAnimation(void) {
49 49
 	uint8_t *buff;
50
-	int8_t x, y, z;
50
+	int8_t x, y, z, i;
51 51
 	
52 52
 	buff = buffNew();
53 53
 
54 54
 	//Up-wave
55
-	for(y = 0; y < 8; y++) {
56
-		for(x = 0; x < 8; x++) {
57
-			for(z = 0; z < 8; z++) {
58
-				buffSetPixel(buff, x, y, z);
55
+	for(i = 0; i < 3; i++) { //Display frame 3/24 seconds
56
+		for(y = 0; y < 8; y++) {
57
+			for(x = 0; x < 8; x++) {
58
+				for(z = 0; z < 8; z++) {
59
+					buffSetPixel(buff, x, y, z);
60
+				}
59 61
 			}
60
-		}
61 62
 
62
-		setImage(buff);
63
-		while(!isFinished()) {
64
-			wdt_reset();
65
-		}
63
+			setImage(buff);
64
+			while(!isFinished()) {
65
+				wdt_reset();
66
+			}
66 67
 	
67
-		buffClearAllPixels(buff);	
68
+			buffClearAllPixels(buff);	
69
+		}
68 70
 	}
69
-	
70 71
 	// Down-wave (Frames 9-15 of showoff.cube)
71
-	for(y = 7; y >= 0; y--) {
72
-		for(x = 0; x < 8; x++) {
73
-			for(z = 0; z < 8; z++) {
74
-				buffSetPixel(buff, x, y, z);
72
+	for(i = 0; i < 3; i++) {
73
+		for(y = 7; y >= 0; y--) {
74
+			for(x = 0; x < 8; x++) {
75
+				for(z = 0; z < 8; z++) {
76
+					buffSetPixel(buff, x, y, z);
77
+				}
75 78
 			}
76
-		}
77
-
78
-		setImage(buff);
79
-		while(!isFinished()) {
80
-			wdt_reset();
81
-		}
82 79
 	
83
-		buffClearAllPixels(buff);	
84
-	}
85
-
86
-	//x-axis wave
87
-	for(x = 0; x < 8; x++) {
88
-		for(y = 0; y < 8; y++) {
89
-			for(z = 0; z < 8; z++) {
90
-				buffSetPixel(buff, x, y, z);
80
+			setImage(buff);
81
+			while(!isFinished()) {
82
+				wdt_reset();
91 83
 			}
92
-		}
93
-
94
-		setImage(buff);
95
-		while(!isFinished()) {
96
-			wdt_reset();
97
-		}
98 84
 		
99
-		buffClearAllPixels(buff);
85
+			buffClearAllPixels(buff);	
86
+		}
100 87
 	}
101
-	
102
-		for(x = 7; x >= 0; x--) {
88
+
89
+	//x-axis wave
90
+	for(i = 0; i < 3; i++){
91
+		for(x = 0; x < 8; x++) {
103 92
 			for(y = 0; y < 8; y++) {
104 93
 				for(z = 0; z < 8; z++) {
105 94
 					buffSetPixel(buff, x, y, z);
95
+				}
106 96
 			}
97
+	
98
+			setImage(buff);
99
+			while(!isFinished()) {
100
+				wdt_reset();
101
+			}
102
+			
103
+			buffClearAllPixels(buff);
107 104
 		}
108
-
109
-		setImage(buff);
110
-		while(!isFinished()) {
111
-			wdt_reset();
112
-		}
105
+		
106
+			for(x = 7; x >= 0; x--) {
107
+				for(y = 0; y < 8; y++) {
108
+					for(z = 0; z < 8; z++) {
109
+						buffSetPixel(buff, x, y, z);
110
+				}
111
+			}
113 112
 	
114
-		buffClearAllPixels(buff);
113
+			setImage(buff);
114
+			while(!isFinished()) {
115
+				wdt_reset();
116
+			}
117
+		
118
+			buffClearAllPixels(buff);
119
+		}
115 120
 	}
116 121
 
117 122
 	//z-axis-wave
118
-	for(z = 0; z < 8; z++) {
119
-		for(y = 0; y < 8; y++) {
120
-			for(x = 0; x < 8; x++) {
121
-				buffSetPixel(buff, x, y, z);
123
+	for(i = 0; i < 3; i++) {
124
+		for(z = 0; z < 8; z++) {
125
+			for(y = 0; y < 8; y++) {
126
+				for(x = 0; x < 8; x++) {
127
+					buffSetPixel(buff, x, y, z);
128
+				}
122 129
 			}
123
-		}
124
-
125
-		setImage(buff);
126
-		while(!isFinished()) {
127
-			wdt_reset();
130
+	
131
+			setImage(buff);
132
+			while(!isFinished()) {
133
+				wdt_reset();
134
+			}
135
+			
136
+			buffClearAllPixels(buff);
128 137
 		}
129 138
 		
130
-		buffClearAllPixels(buff);
131
-	}
139
+		for(z = 7; z >= 0; z--) {
140
+			for(x = 0; x < 8; x++) {
141
+				for(y = 0; y < 8; y++) {
142
+					buffSetPixel(buff, x, y, z);
143
+				}
144
+			}
132 145
 	
133
-	for(z = 7; z >= 0; z--) {
134
-		for(x = 0; x < 8; x++) {
135
-			for(y = 0; y < 8; y++) {
136
-				buffSetPixel(buff, x, y, z);
146
+			setImage(buff);
147
+			while(!isFinished()) {
148
+				wdt_reset();
137 149
 			}
150
+	
151
+			buffClearAllPixels(buff);
138 152
 		}
139
-
140
-		setImage(buff);
141
-		while(!isFinished()) {
142
-			wdt_reset();
143
-		}
144
-
145
-		buffClearAllPixels(buff);
146 153
 	}
147
-
148 154
 }
149 155
 
150 156
 void anotherAnimation(void) {

Loading…
Откажи
Сачувај