|
@@ -59,11 +59,11 @@ void serialHandler(char c);
|
59
|
59
|
uint8_t defaultImageCube[64] = { 0x81, 0x42, 0x24, 0x18, 0x18, 0x24, 0x42, 0x81,
|
60
|
60
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
61
|
61
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
62
|
+ 0x81, 0x42, 0x24, 0x18, 0x18, 0x24, 0x42, 0x81,
|
|
63
|
+ 0x81, 0x42, 0x24, 0x18, 0x18, 0x24, 0x42, 0x81,
|
62
|
64
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
63
|
65
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
64
|
|
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
65
|
|
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
66
|
|
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
|
66
|
+ 0x81, 0x42, 0x24, 0x18, 0x18, 0x24, 0x42, 0x81 };
|
67
|
67
|
|
68
|
68
|
#define NOERROR 0
|
69
|
69
|
// Audio does not answer
|
|
@@ -99,8 +99,9 @@ int main(void) {
|
99
|
99
|
uint8_t i;
|
100
|
100
|
uint8_t imageIndex = 0, imageCount = 0;
|
101
|
101
|
uint8_t idleIndex = 0, idleCount = 0;
|
102
|
|
- uint8_t lastButtonCheck, fpsWasSent = 0;
|
103
|
|
- uint32_t temp;
|
|
102
|
+ uint8_t lastButtonCheck;
|
|
103
|
+ // uint8_t fpsWasSent = 0;
|
|
104
|
+ // uint32_t temp;
|
104
|
105
|
uint8_t *imageData = NULL, *audioData = NULL;
|
105
|
106
|
uint8_t duration = 0;
|
106
|
107
|
|
|
@@ -141,7 +142,7 @@ int main(void) {
|
141
|
142
|
serialHandler((char)(serialGet()));
|
142
|
143
|
}
|
143
|
144
|
|
144
|
|
- if ((getSystemTime() - lastButtonCheck) > 150) { // Check button state every 150ms
|
|
145
|
+ if ((getSystemTime() - lastButtonCheck) >= 150) { // Check button state every 150ms
|
145
|
146
|
audioModeSelected();
|
146
|
147
|
lastButtonCheck = getSystemTime();
|
147
|
148
|
}
|
|
@@ -174,18 +175,31 @@ int main(void) {
|
174
|
175
|
}
|
175
|
176
|
} else {
|
176
|
177
|
// An audiomode is selected
|
177
|
|
-
|
|
178
|
+ if (disableAudioData == 0) {
|
|
179
|
+ if (isFinished()) {
|
|
180
|
+ audioData = getAudioData();
|
|
181
|
+ if (audioData != NULL) {
|
|
182
|
+ runVisualization(audioData, (lastButtonState - 1));
|
|
183
|
+ } else {
|
|
184
|
+ lastButtonState = 0;
|
|
185
|
+ duration = 24;
|
|
186
|
+ setImage(defaultImageCube); // Quasi Error Screen
|
|
187
|
+ }
|
|
188
|
+ }
|
|
189
|
+ } else {
|
|
190
|
+ lastButtonState = 0;
|
|
191
|
+ }
|
178
|
192
|
}
|
179
|
193
|
|
180
|
194
|
// Print fps after one second
|
181
|
|
- if ((getSystemTime() >= 1000) && (fpsWasSent == 0)) {
|
|
195
|
+ /* if ((getSystemTime() >= 1000) && (fpsWasSent == 0)) {
|
182
|
196
|
temp = getTriggerCount();
|
183
|
197
|
serialWriteString(ltoa(temp, buffer, 10));
|
184
|
198
|
serialWriteString(getString(27));
|
185
|
199
|
serialWriteString(ltoa((temp / 8), buffer, 10));
|
186
|
200
|
serialWriteString(getString(28));
|
187
|
201
|
fpsWasSent = 1;
|
188
|
|
- }
|
|
202
|
+ } */
|
189
|
203
|
|
190
|
204
|
}
|
191
|
205
|
|
|
@@ -230,7 +244,6 @@ uint8_t selfTest(void) {
|
230
|
244
|
if (data == NULL) {
|
231
|
245
|
result |= AUDIOERROR;
|
232
|
246
|
} else {
|
233
|
|
- free(data);
|
234
|
247
|
}
|
235
|
248
|
|
236
|
249
|
data = memGetBytes(0, 1);
|
|
@@ -334,7 +347,11 @@ void serialHandler(char c) {
|
334
|
347
|
break;
|
335
|
348
|
|
336
|
349
|
case 'm': case 'M':
|
337
|
|
- lastButtonState = !lastButtonState;
|
|
350
|
+ if (lastButtonState < (maxButtonState - 1)) {
|
|
351
|
+ lastButtonState++;
|
|
352
|
+ } else {
|
|
353
|
+ lastButtonState = 0;
|
|
354
|
+ }
|
338
|
355
|
if (lastButtonState) {
|
339
|
356
|
serialWriteString(getString(41));
|
340
|
357
|
} else {
|