-
Notifications
You must be signed in to change notification settings - Fork 2
/
ddtester.cpp
733 lines (661 loc) · 19.8 KB
/
ddtester.cpp
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
#include "Arduino.h"
#include "ddtester.h"
//#define TEST_GET_FEEDBACK
#define MB
#define TURTLE
#define GRAPHICAL
#define ASCII_ONLY false
namespace DDTesterImpl {
#ifdef MB
void debugMbTestStep(bool passiveConnect, MbDDLayer *pLayer, int stepCount) {
int count = stepCount % 10;
if (count == 0) {
pLayer->clear();
pLayer->backgroundColor("12-34-56");
pLayer->ledColor(DD_HEX_COLOR(0xff00ff));
pLayer->showLeds("|.#.#|####");
DDDelay(2000);
if (passiveConnect) if (!DDConnected()) return;
pLayer->backgroundColor("lightyellow");
pLayer->ledColor("green");
pLayer->toggle(1, 2);
DDDelay(1000);
if (passiveConnect) if (!DDConnected()) return;
pLayer->unplot(1, 2);
DDDelay(1000);
if (passiveConnect) if (!DDConnected()) return;
pLayer->plot(1, 2);
DDDelay(1000);
if (passiveConnect) if (!DDConnected()) return;
pLayer->noBackgroundColor();
pLayer->showIcon(SmallDiamond);
DDDelay(1000);
if (passiveConnect) if (!DDConnected()) return;
pLayer->showNumber(8);
DDDelay(1000);
if (passiveConnect) if (!DDConnected()) return;
pLayer->showString("a,B,c,D");
DDDelay(5000);
if (passiveConnect) if (!DDConnected()) return;
}
pLayer->showNumber(count);
}
#endif
#ifdef TURTLE
void debugTurtleTestStep(TurtleDDLayer *pLayer, int stepCount) {
if (stepCount == 0) {
pLayer->clear();
pLayer->setHeading(random(360));
if (random(2) == 0)
pLayer->home();
else
pLayer->goTo(10, -10);
pLayer->forward(50);
pLayer->rightTurn(25);
pLayer->backward(32);
pLayer->leftTurn(48);
pLayer->forward(88);
pLayer->home(false);
}
}
void shapeTurtleTestStep(bool passiveConnect, TurtleDDLayer *pLayer, int stepCount) {
pLayer->clear();
pLayer->home(false);
pLayer->setHeading(0);
pLayer->penSize(2);
bool filled = stepCount > 10;
pLayer->penFilled(filled);
if (filled) {
pLayer->fillColor("yellow");
}
pLayer->leftTurn(20);
pLayer->forward(20);
int shape = stepCount % 12;
switch (shape) {
case 0:
pLayer->circle(50);
break;
case 1:
pLayer->rectangle(80, 60);
break;
case 2:
pLayer->triangle(80, 50, 40);
break;
case 3:
pLayer->isoscelesTriangle(50, 65);
break;
case 4:
pLayer->circle(55, true);
break;
case 5:
pLayer->rectangle(60, 70, true);
break;
case 6:
pLayer->polygon(50, 5);
break;
case 7:
pLayer->centeredPolygon(55, 5);
break;
case 8:
pLayer->centeredPolygon(55, 5, true);
break;
case 9:
pLayer->oval(60, 80);
break;
case 10:
pLayer->oval(60, 80, true);
break;
case 11:
for (int size = 3; size <= 10; size++) {
if (passiveConnect) if (!DDConnected()) return;
pLayer->clear();
pLayer->centeredPolygon(40, size, false);
pLayer->circle(40, true);
DDDelay(500);
if (passiveConnect) if (!DDConnected()) return;
}
break;
}
pLayer->rightTurn(90);
pLayer->forward(100);
}
int r = random(0, 256);
int g = 128;
int b = 0;
void standardTurtleTestStep(TurtleDDLayer *pLayer, bool firstStep) {
if (firstStep) {
pLayer->clear();
pLayer->setHeading(0);
pLayer->home(false);
pLayer->backgroundColor("azure");
pLayer->fillColor("lemonchiffon");
pLayer->penFilled(true);
pLayer->centeredPolygon(73, 6, true);
pLayer->penFilled(false);
pLayer->penSize(1);
pLayer->circle(79, true);
}
pLayer->penColor(DD_RGB_COLOR(r, g, b));
pLayer->circle(27);
pLayer->rectangle(90, 20);
pLayer->rightTurn(10);
b = b + 20;
if (b > 255) {
b = 0;
r = random(0, 256);
}
}
#endif
#ifdef GRAPHICAL
void standardGraphicalTestStep(bool passiveConnect, GraphicalDDLayer *pLayer, int stepCount) {
int step = stepCount;
if (step-- == 0) {
if (true) {
for (int i = 0; i < 4; i++) {
if (passiveConnect) if (!DDConnected()) return;
if (i == 0) {
pLayer->backgroundColor("aliceblue");
pLayer->drawRect(2, 2, 32, 42, "black");
pLayer->drawTriangle(4, 4, 32, 32, 8, 42, "blue");
pLayer->fillTriangle(6, 8, 28, 30, 10, 40, "green");
} else if (i == 1) {
pLayer->drawRect(2, 2, 60, 70, "black");
pLayer->drawRoundRect(4, 4, 56, 66, 18, "blue");
pLayer->fillRoundRect(6, 6, 52, 62, 20, "green");
} else if (i == 2) {
pLayer->drawCircle(11, 11, 9, "green");
pLayer->fillCircle(11, 11, 7, "blue");
} else {
pLayer->drawRect(0, 0, 24, 34, "blue");
pLayer->fillRect(2, 2, 20, 30, "red");
}
DDDelay(2000);
if (passiveConnect) if (!DDConnected()) return;
pLayer->clear();
}
}
pLayer->drawPixel(5, 10, "red");
pLayer->drawLine(40, 50, 60, 100, "darkgreen");
pLayer->drawChar(20, 30, '@', "red", "blue", 32);
DDDelay(2000);
if (passiveConnect) if (!DDConnected()) return;
pLayer->backgroundColor("black");
pLayer->fillScreen("lightgreen");
pLayer->write("AA");
DDDelay(500);
if (passiveConnect) if (!DDConnected()) return;
pLayer->setCursor(20, 0);
if (ASCII_ONLY) {
pLayer->println("FRIEND");
} else {
pLayer->println("你好!");
}
}
if (step-- == 0) {
pLayer->println();
}
if (step-- == 0) {
pLayer->print("This is a very very long long text line.");
}
if (step-- == 0) {
pLayer->println(" Yes, it is a very very long long text line!");
}
if (step-- == 0) {
pLayer->println();
}
if (step-- == 0) {
pLayer->setTextColor("red", "pink");
pLayer->print("Hello");
pLayer->setTextColor("blue");
}
if (step-- == 0) {
pLayer->println(", World!");
}
if (step-- == 0) {
pLayer->println();
}
if (step-- == 0) {
pLayer->println("How are you?");
}
if (step-- == 0) {
pLayer->println();
}
if (step-- == 0) {
pLayer->print("Good");
}
if (step-- == 0) {
pLayer->println(" Day!");
}
}
void shapeGraphicalTestStep(bool passiveConnect, GraphicalDDLayer *pLayer, int stepCount) {
pLayer->backgroundColor("beige");
pLayer->clear();
pLayer->setCursor(100,100);
pLayer->setHeading(0);
pLayer->penColor("darkred");
pLayer->penSize(2);
bool filled = stepCount > 10;
if (filled) {
pLayer->fillColor("green");
}
pLayer->leftTurn(20);
pLayer->forward(20);
int shape = stepCount % 12;
switch (shape) {
case 0:
pLayer->circle(50);
break;
case 1:
pLayer->rectangle(80, 60);
break;
case 2:
pLayer->triangle(80, 50, 40);
break;
case 3:
pLayer->isoscelesTriangle(50, 65);
break;
case 4:
pLayer->circle(55, true);
break;
case 5:
pLayer->rectangle(60, 70, true);
break;
case 6:
pLayer->polygon(50, 5);
break;
case 7:
pLayer->centeredPolygon(55, 5);
break;
case 8:
pLayer->centeredPolygon(55, 5, true);
break;
case 9:
pLayer->oval(60, 80);
break;
case 10:
pLayer->oval(60, 80, true);
break;
case 11:
for (int size = 3; size <= 10; size++) {
if (passiveConnect) if (!DDConnected()) return;
pLayer->clear();
pLayer->centeredPolygon(40, size, false);
pLayer->circle(40, true);
DDDelay(500);
if (passiveConnect) if (!DDConnected()) return;
}
break;
}
pLayer->rightTurn(90);
pLayer->forward(100);
}
#endif
bool Pinned = false;
bool AutoPin = true;
#ifdef MB
MbDDLayer *pMbLayer = NULL;
#endif
#ifdef TURTLE
TurtleDDLayer *pTurtleLayer = NULL;
#endif
LedGridDDLayer *pLedGridLayer = NULL;
LcdDDLayer *pLcdLayer = NULL;
#ifdef GRAPHICAL
GraphicalDDLayer *pGraphicalLayer = NULL;
#endif
SevenSegmentRowDDLayer *p7SegmentRowLayer = NULL;
void FeedbackHandler(DDLayer* pLayer, DDFeedbackType type, const DDFeedback& feedback) {
//pLayer->writeComment("layer [" + pLayer->getLayerId() + "] FB (" + String(x) + "," + String(y) + ")");
#ifdef TURTLE
if (pLayer == pTurtleLayer) {
pLayer->flash();
} else
#endif
if (pLayer == p7SegmentRowLayer) {
int x = feedback.x;
int r = 0;
int g = 0;
int b = 0;
if (x == 0)
r = 255;
else if (x == 1)
g = 255;
else if (x == 2)
b = 255;
p7SegmentRowLayer->backgroundColor(DD_RGB_COLOR(r, g, b));
} else if (pLayer == pLcdLayer) {
int r = random(256);
int g = 255 - r;
pLcdLayer->bgPixelColor(DD_RGB_COLOR(r, 218, 218));
pLcdLayer->backgroundColor(DD_RGB_COLOR(16, g, 16));
}
}
void DDTester_autoPinLayers(DumbDisplay& dumbdisplay) {
#if defined(GRAPHICAL) && defined (MB) && defined(TURTLE)
if (pMbLayer == NULL ||
pTurtleLayer == NULL ||
pLedGridLayer == NULL ||
pLcdLayer == NULL ||
pGraphicalLayer == NULL ||
p7SegmentRowLayer == NULL) {
dumbdisplay.configAutoPin(DD_AP_HORI);
} else {
dumbdisplay.configAutoPin(DD_AP_VERT_4(
p7SegmentRowLayer->getLayerId(),
DD_AP_HORI_2(pMbLayer->getLayerId(), pTurtleLayer->getLayerId()),
pLcdLayer->getLayerId(),
DD_AP_HORI_2(pLedGridLayer->getLayerId(), pGraphicalLayer->getLayerId())
));
}
#else
dumbdisplay.configAutoPin(DD_AP_HORI);
#endif
}
#ifdef MB
void MbDDTester_testStep(bool passiveConnect, DumbDisplay& dumbdisplay, int stepCount) {
if (stepCount == 0) {
pMbLayer = dumbdisplay.createMicrobitLayer(9, 7);
#ifdef TEST_GET_FEEDBACK
pMbLayer->writeComment("enable MB FB");
pMbLayer->enableFeedback("fs");
#endif
if (Pinned) {
if (AutoPin) {
DDTester_autoPinLayers(dumbdisplay);
} else {
dumbdisplay.pinLayer(pMbLayer, 50, 50, 50, 50);
}
}
}
#ifdef TEST_GET_FEEDBACK
const DDFeedback *pFeedback = pMbLayer->getFeedback();
if (pFeedback != NULL) {
pMbLayer->writeComment("MB @ (" + String(pFeedback->x) + "," + String(pFeedback->y) + ")");
}
#endif
debugMbTestStep(passiveConnect, pMbLayer, stepCount);
}
#endif
#ifdef TURTLE
void TurtleDDTester_testStep(bool passiveConnect, DumbDisplay& dumbdisplay, int stepCount) {
if (stepCount == 0) {
pTurtleLayer = dumbdisplay.createTurtleLayer(215, 215);
pTurtleLayer->setFeedbackHandler(FeedbackHandler);
if (Pinned) {
if (AutoPin) {
DDTester_autoPinLayers(dumbdisplay);
} else {
dumbdisplay.pinLayer(pTurtleLayer, 0, 50, 50, 50);
}
}
pTurtleLayer->penColor("blue");
}
if (stepCount > 0) {
if (stepCount >= 24) {
standardTurtleTestStep(pTurtleLayer, stepCount == 24);
} else {
shapeTurtleTestStep(passiveConnect, pTurtleLayer, stepCount);
}
} else {
debugTurtleTestStep(pTurtleLayer, stepCount);
}
}
#endif
bool hori = false;
void LedGridDDTester_testStep(DumbDisplay& dumbdisplay, int stepCount) {
bool init = stepCount <= 40 && stepCount % 10 == 0;
if (init) {
if (pLedGridLayer != NULL)
dumbdisplay.deleteLayer(pLedGridLayer);
hori = random(2) == 1;
int colCount;
int rowCount;
int subColCount;
int subRowCount;
if (hori) {
colCount = 10;
rowCount = 4;
subColCount = 4;
subRowCount = 2;
} else {
colCount = 4;
rowCount = 8;
subColCount = 2;
subRowCount = 4;
}
pLedGridLayer = dumbdisplay.createLedGridLayer(colCount, rowCount, subColCount, subRowCount);
if (Pinned) {
if (AutoPin) {
DDTester_autoPinLayers(dumbdisplay);
}
}
pLedGridLayer->offColor("lightgray");
}
int c = stepCount % 4;
if (c == 0)
pLedGridLayer->toggle(2, 3);
else if (c == 1)
pLedGridLayer->turnOn(2, 3);
else if (c == 2)
pLedGridLayer->turnOff(2, 3);
else {
bool reverseSense = random(2) == 0;
if (hori)
pLedGridLayer->horizontalBar(4, reverseSense);
else
pLedGridLayer->verticalBar(4, reverseSense);
}
}
void LcdDDTester_testStep(DumbDisplay& dumbdisplay, int stepCount) {
if (stepCount == 0) {
pLcdLayer = dumbdisplay.createLcdLayer(18, 3, 16, "Courier");
pLcdLayer->setFeedbackHandler(FeedbackHandler, "f");
if (Pinned) {
if (AutoPin) {
DDTester_autoPinLayers(dumbdisplay);
} else {
dumbdisplay.pinLayer(pLcdLayer, 0, 0, 100, 50);
}
}
pLcdLayer->pixelColor("red");
pLcdLayer->bgPixelColor(DD_RGB_COLOR(200, 200, 200));
pLcdLayer->backgroundColor(DD_HEX_COLOR(0x111111));
}
pLcdLayer->setCursor(0, 0);
pLcdLayer->print("stepCount:" + String(stepCount));
if (ASCII_ONLY) {
pLcdLayer->writeLine(((stepCount / 10) % 2 == 0) ? "FRIEND" : "Hi friend", 1, "C");
pLcdLayer->writeLine("How do you do?", 2, "R");
} else {
pLcdLayer->writeLine(((stepCount / 10) % 2 == 0) ? "朋友" : "Hi friend", 1, "C");
pLcdLayer->writeLine("Bună Привіт 你好", 2, "R");
}
}
void SevenSegmentRowDDTester_testStep(DumbDisplay& dumbdisplay, int stepCount) {
if (stepCount == 0) {
p7SegmentRowLayer = dumbdisplay.create7SegmentRowLayer(4);
p7SegmentRowLayer->setFeedbackHandler(FeedbackHandler, "fa");
if (Pinned) {
if (AutoPin) {
DDTester_autoPinLayers(dumbdisplay);
}
}
p7SegmentRowLayer->backgroundColor(DD_HEX_COLOR(0x334455));
p7SegmentRowLayer->segmentColor("yellow");
}
char allSegs[] = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', '.' };
int maxCount1 = 16;
int maxCount2 = maxCount1 + 5;
if (stepCount < maxCount1) {
if ((stepCount % 2) == 0)
p7SegmentRowLayer->turnOn("abcdefg.", 2);
else
p7SegmentRowLayer->turnOff("abcdefg.", 2);
if (stepCount < 8)
p7SegmentRowLayer->turnOn(String(allSegs[stepCount % 8]));
else
p7SegmentRowLayer->turnOff(String(allSegs[stepCount % 8]));
} else if (stepCount < maxCount2) {
int counter = stepCount - maxCount1;
if (counter-- == 0) p7SegmentRowLayer->showHexNumber(0xfb);
else if (counter-- == 0) {
p7SegmentRowLayer->showFormatted("00.00");
} else {
if (stepCount % 2 == 0)
p7SegmentRowLayer->showFormatted("----------");
else
p7SegmentRowLayer->showFormatted("..........");
}
} else {
int counter = stepCount - maxCount2;
if (counter-- == 0) p7SegmentRowLayer->showNumber(1);
else if (counter-- == 0) p7SegmentRowLayer->showNumber(12);
else if (counter-- == 0) p7SegmentRowLayer->showNumber(123);
else if (counter-- == 0) p7SegmentRowLayer->showNumber(1234);
else if (counter-- == 0) p7SegmentRowLayer->showNumber(1.00001);
else if (counter-- == 0) p7SegmentRowLayer->showNumber(1.10001);
else if (counter-- == 0) p7SegmentRowLayer->showNumber(1.234567);
else {
float num = random(10000) - random(10000);
if (random(2) == 0)
num = num / random(2, 1000);
p7SegmentRowLayer->showNumber(num);
}
}
}
#ifdef GRAPHICAL
void GraphicalDDTester_testStep(bool passiveConnect, DumbDisplay& dumbdisplay, int stepCount) {
if (stepCount == 0) {
pGraphicalLayer = dumbdisplay.createGraphicalLayer(215, 215);
#ifdef TEST_GET_FEEDBACK
pGraphicalLayer->writeComment("enable GLCD FB");
pGraphicalLayer->enableFeedback("f");
#endif
if (Pinned) {
if (AutoPin) {
DDTester_autoPinLayers(dumbdisplay);
}
}
pGraphicalLayer->setTextColor("blue");
if (true) {
pGraphicalLayer->setTextFont("monospace");
pGraphicalLayer->setTextSize(14);
} else {
pGraphicalLayer->setTextFont("monospace", 14);
}
}
#ifdef TEST_GET_FEEDBACK
const DDFeedback *pFeedback = pGraphicalLayer->getFeedback();
if (pFeedback != NULL) {
pGraphicalLayer->writeComment("GLCD @ (" + String(pFeedback->x) + "," + String(pFeedback->y) + ")");
}
#endif
if (stepCount <= 14) {
standardGraphicalTestStep(passiveConnect, pGraphicalLayer, stepCount);
} else {
shapeGraphicalTestStep(passiveConnect, pGraphicalLayer, stepCount);
}
}
#endif
}
using namespace DDTesterImpl;
//void BasicDDTestLoop(DumbDisplay& dumbdisplay, bool passiveConnect, int builtinLEDPin, std::function<void(bool connected)> notConnectedCallback) {
void BasicDDTestLoop(DumbDisplay& dumbdisplay, bool passiveConnect, int builtinLEDPin, void (*notConnectedCallback)(bool)) {
if (passiveConnect && builtinLEDPin >= 0) {
pinMode(builtinLEDPin, OUTPUT);
}
// if (forDebugging) {
// const char* log_msg = "!!! start test loop !!!";
// dumbdisplay.writeComment(log_msg);
// dumbdisplay.logToSerial(log_msg);
// }
// if (false) {
// int size = 16;
// #if defined(ESP32)
// //size = 2048;
// size = 4096;
// #endif
// dumbdisplay.writeComment("DEBUG ONLY >>>");
// long startMs = millis();
// dumbdisplay.debugOnly(size);
// long takenMs = millis() - startMs;
// dumbdisplay.writeComment(">>> " + String((float) takenMs / 1000.0) + "s >>> (" + String(size) + ") DEBUG ONLY");
// }
// if (true) {
// dumbdisplay.backgroundColor(DD_HEX_COLOR(0xE0FFFF));
// }
bool mb = true/*!forDebugging*/;
bool turtle = true/*!forDebugging*/;
bool ledGrid = true/*!forDebugging*/;
bool lcd = true/*!forDebugging*/;
bool graphical = true/*!forDebugging*/;
bool sevenSegmentRow = true;
int testCount = 0;
if (mb) testCount++;
if (turtle) testCount++;
if (ledGrid) testCount++;
if (lcd) testCount++;
if (graphical) testCount++;
if (sevenSegmentRow) testCount++;
Pinned = testCount > 1;
AutoPin = true;
int stepCount = 0;
while (true) {
#ifndef DD_NO_PASSIVE_CONNECT
if (passiveConnect) {
DDConnectPassiveStatus connectStatus;
bool connected = dumbdisplay.connectPassive(&connectStatus);
if (notConnectedCallback != NULL) {
notConnectedCallback(connected);
}
if (!connected) {
if (builtinLEDPin >= 0) {
digitalWrite(builtinLEDPin, HIGH);
}
//Serial.println("// not connected ..."); // TODO: use other way for indication
delay(500);
//Serial.println("// ... not connected");
if (builtinLEDPin >= 0) {
digitalWrite(builtinLEDPin, LOW);
}
continue;
}
if (connectStatus.reconnecting) {
//Serial.println("// ... reconnecting ..."); // TODO: use other way for indication
dumbdisplay.masterReset();
//Serial.println("// ... reconnecting ...");
pMbLayer = NULL;
pTurtleLayer = NULL;
pLedGridLayer = NULL;
pLcdLayer = NULL;
pGraphicalLayer = NULL;
p7SegmentRowLayer = NULL;
stepCount = 0;
continue;
}
}
#endif
#ifdef GRAPHICAL
if (passiveConnect) if (!dumbdisplay.connected()) break;
if (graphical) GraphicalDDTester_testStep(passiveConnect, dumbdisplay, stepCount);
#endif
if (passiveConnect) if (!dumbdisplay.connected()) break;
if (sevenSegmentRow) SevenSegmentRowDDTester_testStep(dumbdisplay, stepCount);
#ifdef MB
if (passiveConnect) if (!dumbdisplay.connected()) break;
if (mb) MbDDTester_testStep(passiveConnect, dumbdisplay, stepCount);
#endif
#ifdef TURTLE
if (passiveConnect) if (!dumbdisplay.connected()) break;
if (turtle) TurtleDDTester_testStep(passiveConnect, dumbdisplay, stepCount);
#endif
if (passiveConnect) if (!dumbdisplay.connected()) break;
if (ledGrid) LedGridDDTester_testStep(dumbdisplay, stepCount);
if (passiveConnect) if (!dumbdisplay.connected()) break;
if (lcd) LcdDDTester_testStep(dumbdisplay, stepCount);
if (passiveConnect) if (!dumbdisplay.connected()) break;
stepCount++;
dumbdisplay.logToSerial("DDTest Step: " + String(stepCount));
DDDelay(1000);
}
}