|
@@ -253,11 +253,39 @@ void printErrors(uint8_t e) {
|
253
|
253
|
serialWriteString(getString(5));
|
254
|
254
|
}
|
255
|
255
|
}
|
|
256
|
+
|
|
257
|
+void randomAnimation(void) {
|
|
258
|
+ uint8_t *b = (uint8_t *)malloc(64);
|
|
259
|
+ uint8_t x, y, z;
|
|
260
|
+ if (b == NULL) {
|
|
261
|
+ serialWriteString(getString(24));
|
|
262
|
+ return;
|
|
263
|
+ }
|
|
264
|
+ for (x = 0; x < 64; x++) {
|
|
265
|
+ b[x] = 0;
|
|
266
|
+ }
|
|
267
|
+ while(1) {
|
|
268
|
+ setImage(b);
|
|
269
|
+ while(isFinished() == 0);
|
|
270
|
+ x = rand() / 4096;
|
|
271
|
+ y = rand() / 4096;
|
|
272
|
+ z = rand() / 4096;
|
|
273
|
+ b[x + (8 * y)] ^= (1 << z);
|
|
274
|
+
|
|
275
|
+ if (serialHasChar()) {
|
|
276
|
+ serialWriteString(getString(25));
|
|
277
|
+ free(b);
|
|
278
|
+ serialHandler(serialGet());
|
|
279
|
+ return;
|
|
280
|
+ }
|
|
281
|
+ }
|
|
282
|
+ free(b);
|
|
283
|
+}
|
256
|
284
|
#endif
|
257
|
285
|
|
258
|
286
|
void serialHandler(char c) {
|
259
|
287
|
// Used letters:
|
260
|
|
- // a, c, d, e, g, n, s, t, v, x, 0, 1, 2
|
|
288
|
+ // a, c, d, e, g, i, n, r, s, t, v, x, y, 0, 1, 2
|
261
|
289
|
uint8_t i, y, z;
|
262
|
290
|
#ifdef DEBUG
|
263
|
291
|
serialWrite(c);
|
|
@@ -308,6 +336,10 @@ void serialHandler(char c) {
|
308
|
336
|
break;
|
309
|
337
|
|
310
|
338
|
#ifdef DEBUG
|
|
339
|
+ case 'r': case 'R':
|
|
340
|
+ randomAnimation();
|
|
341
|
+ break;
|
|
342
|
+
|
311
|
343
|
case 't': case 'T':
|
312
|
344
|
printTime();
|
313
|
345
|
break;
|
|
@@ -350,17 +382,11 @@ void serialHandler(char c) {
|
350
|
382
|
|
351
|
383
|
case '0':
|
352
|
384
|
fillBuffer(0);
|
353
|
|
- setAnimationCount(0);
|
354
|
|
- refreshAnimationCount = 1;
|
355
|
|
- serialWriteString(getString(20));
|
356
|
385
|
DebugDone |= 4;
|
357
|
386
|
break;
|
358
|
387
|
|
359
|
388
|
case '1':
|
360
|
389
|
fillBuffer(0xFF);
|
361
|
|
- setAnimationCount(0);
|
362
|
|
- refreshAnimationCount = 1;
|
363
|
|
- serialWriteString(getString(20));
|
364
|
390
|
DebugDone |= 4;
|
365
|
391
|
break;
|
366
|
392
|
|