|
@@ -54,6 +54,9 @@
|
54
|
54
|
// x = errorcode, e = error definition, not NOERROR
|
55
|
55
|
#define ISERROR(x, e) ((x) & (e))
|
56
|
56
|
|
|
57
|
+// Length of an idle animation frame, 24 -> 1 second
|
|
58
|
+#define IDLELENGTH 24
|
|
59
|
+
|
57
|
60
|
void serialHandler(char c);
|
58
|
61
|
void sendAudioData(void);
|
59
|
62
|
void recieveAnimations(void);
|
|
@@ -83,13 +86,16 @@ uint8_t defaultImage[64] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
83
|
86
|
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
84
|
87
|
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
|
85
|
88
|
|
|
89
|
+uint8_t DebugDone = 0; // Bit 0: 10s int. count, Bit 1: switch idle display
|
|
90
|
+ // Bit 2: state changed, disable idle
|
|
91
|
+
|
86
|
92
|
int main(void) {
|
87
|
93
|
uint8_t *audioData = NULL;
|
88
|
94
|
uint8_t *imageData = NULL;
|
89
|
95
|
uint8_t i, length = 0, lastMode;
|
90
|
96
|
uint16_t count;
|
91
|
97
|
uint64_t lastChecked;
|
92
|
|
- uint8_t DebugDone = 0; // Bit 0: 10s int. count, Bit 1: switch idle display
|
|
98
|
+ uint32_t temp;
|
93
|
99
|
|
94
|
100
|
initCube();
|
95
|
101
|
serialInit(25, 8, NONE, 1);
|
|
@@ -172,14 +178,16 @@ int main(void) {
|
172
|
178
|
free(imageData);
|
173
|
179
|
}
|
174
|
180
|
} else {
|
175
|
|
- if (isFinished() >= 12) {
|
176
|
|
- // Should happen every half second
|
177
|
|
- if (DebugDone & 2) {
|
178
|
|
- fillBuffer(0);
|
179
|
|
- DebugDone &= ~(2);
|
180
|
|
- } else {
|
181
|
|
- fillBuffer(0xFF);
|
182
|
|
- DebugDone |= 2;
|
|
181
|
+ if (!(DebugDone & 4)) {
|
|
182
|
+ if (isFinished() >= IDLELENGTH) {
|
|
183
|
+ // Should happen every half second
|
|
184
|
+ if (DebugDone & 2) {
|
|
185
|
+ fillBuffer(0);
|
|
186
|
+ DebugDone &= ~(2);
|
|
187
|
+ } else {
|
|
188
|
+ fillBuffer(0xFF);
|
|
189
|
+ DebugDone |= 2;
|
|
190
|
+ }
|
183
|
191
|
}
|
184
|
192
|
}
|
185
|
193
|
}
|
|
@@ -190,9 +198,11 @@ int main(void) {
|
190
|
198
|
}
|
191
|
199
|
|
192
|
200
|
if ((getSystemTime() >= 1000) && ((DebugDone & 1) == 0)) {
|
193
|
|
- printTime();
|
194
|
|
- serialWriteString(ltoa(getTriggerCount(), buffer, 10));
|
195
|
|
- serialWrite('\n');
|
|
201
|
+ temp = getTriggerCount();
|
|
202
|
+ serialWriteString(ltoa(temp, buffer, 10));
|
|
203
|
+ serialWriteString(getString(27));
|
|
204
|
+ serialWriteString(ltoa((temp / 8), buffer, 10));
|
|
205
|
+ serialWriteString(getString(28));
|
196
|
206
|
DebugDone |= 1;
|
197
|
207
|
}
|
198
|
208
|
|
|
@@ -275,9 +285,15 @@ void serialHandler(char c) {
|
275
|
285
|
|
276
|
286
|
case 'd': case 'D':
|
277
|
287
|
clearMem();
|
|
288
|
+#ifndef DEBUG
|
278
|
289
|
serialWrite(OK);
|
|
290
|
+#endif
|
|
291
|
+#ifdef DEBUG
|
|
292
|
+ serialWriteString(getString(29));
|
|
293
|
+#endif
|
279
|
294
|
break;
|
280
|
295
|
|
|
296
|
+#ifndef DEBUG
|
281
|
297
|
case 'g': case 'G':
|
282
|
298
|
transmitAnimations();
|
283
|
299
|
break;
|
|
@@ -285,6 +301,7 @@ void serialHandler(char c) {
|
285
|
301
|
case 's': case 'S':
|
286
|
302
|
recieveAnimations();
|
287
|
303
|
break;
|
|
304
|
+#endif
|
288
|
305
|
|
289
|
306
|
case 'v': case 'V':
|
290
|
307
|
serialWriteString(getString(0));
|
|
@@ -336,6 +353,7 @@ void serialHandler(char c) {
|
336
|
353
|
setAnimationCount(0);
|
337
|
354
|
refreshAnimationCount = 1;
|
338
|
355
|
serialWriteString(getString(20));
|
|
356
|
+ DebugDone |= 4;
|
339
|
357
|
break;
|
340
|
358
|
|
341
|
359
|
case '1':
|
|
@@ -343,9 +361,11 @@ void serialHandler(char c) {
|
343
|
361
|
setAnimationCount(0);
|
344
|
362
|
refreshAnimationCount = 1;
|
345
|
363
|
serialWriteString(getString(20));
|
|
364
|
+ DebugDone |= 4;
|
346
|
365
|
break;
|
347
|
366
|
|
348
|
367
|
case '2':
|
|
368
|
+ DebugDone |= 4;
|
349
|
369
|
fillBuffer(0);
|
350
|
370
|
for (i = 0; i < 64; i++) {
|
351
|
371
|
defaultImage[i] = 0;
|