-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathE_paper.cpp
1264 lines (1228 loc) · 51.3 KB
/
E_paper.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
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#include "E_paper.h"
#include "Definitions.h"
#include <LITTLEFS.h>
// row height 14pt spacing 2pt
#define ROW_SPACING 2
// 3 rows 9pt font (9pt font height 18px-22pt)
// row height 14pt spacing 2pt
#define ROW_9PT 14
#define ROW_9PT_W_SPACING (ROW_9PT + ROW_SPACING)
#define ROW_1_9PT ROW_9PT
#define ROW_2_9PT (ROW_1_9PT + ROW_9PT_W_SPACING) //30
#define ROW_3_9PT (ROW_2_9PT + ROW_9PT_W_SPACING) //46
#define ROW_4_9PT (ROW_3_9PT + ROW_9PT_W_SPACING) //62
#define ROW_5_9PT (ROW_4_9PT + ROW_9PT_W_SPACING) //78
#define ROW_6_9PT (ROW_5_9PT + ROW_9PT_W_SPACING) //94
#define ROW_7_9PT (ROW_6_9PT + ROW_9PT_W_SPACING) //110
// 4 rows 12pt (12 pt font height 24-29pt)
// row height 19pt, spacing 2pt
#define ROW_12PT 19
#define ROW_12PT_W_SPACING (ROW_12PT + ROW_SPACING)
#define ROW_1_12PT ROW_12PT // 0-25
#define ROW_2_12PT (ROW_1_12PT + ROW_12PT_W_SPACING) //40 // 27-52
#define ROW_3_12PT (ROW_2_12PT + ROW_12PT_W_SPACING) //61 // 54-79
#define ROW_4_12PT (ROW_3_12PT + ROW_12PT_W_SPACING) //82 // 81-106
#define ROW_5_12PT (ROW_4_12PT + ROW_12PT_W_SPACING) //104 // 81-106
// 4 rows 18pt (18 pt font height 35-42pt)
// row height 25pt, spacing 2pt
#define ROW_18PT 25
#define ROW_18PT_W_SPACING (ROW_18PT + ROW_SPACING)
#define ROW_1_18PT ROW_18PT // 0-25
#define ROW_2_18PT (ROW_1_18PT + ROW_18PT_W_SPACING) //52 // 27-52
#define ROW_3_18PT (ROW_2_18PT + ROW_18PT_W_SPACING) //79 // 54-79
#define ROW_4_18PT (ROW_3_18PT + ROW_18PT_W_SPACING) //106 // 81-106
// esp logo
#define ESP_GPS_LOGO_40 display.drawExampleBitmap(ESP_GPS_logo_40, offset + 198, 6, 40, 40, GxEPD_BLACK);
#define ESP_GPS_LOGO_48 display.drawExampleBitmap(ESP_GPS_logo, offset + 178, 0, 48, 48, GxEPD_BLACK);
// bottom area 15px reserved to info bar
#define INFO_BAR_HEIGHT 15
#define INFO_BAR_TOP (displayHeight - INFO_BAR_HEIGHT)
#define INFO_BAR_ROW (displayHeight - 2)
//display.setFont(&FreeSansBold9pt7b);
#define TITLE_9PT \
display.setFont(&FreeSansBold9pt7b); \
display.setCursor(offset, ROW_1_9PT);
#define TOP_TITLE_MSG(msg) display.print(msg);
#define TOP_TITLE(msg) \
TOP_LEFT_TITLE_MSG(msg) \
display.setCursor(offset, ROW_2_9PT);
#define TOP_LEFT_TITLE(msg) TITLE_9PT TOP_TITLE(msg)
#define TOP_LEFT_TITLE_MSG(msg) TITLE_9PT TOP_TITLE_MSG(msg)
#ifndef T5_E_PAPER
void Boot_screen(void){};
//void Off_screen(int choice){};
//void sleep_screen(void);
void Sleep_screen(int choice){};
void Update_screen(int screen){};
#else
char time_now[8];
char time_now_sec[12];
int16_t displayHeight;
int16_t displayWidth;
int bar_length = 1852;
int bar_position = 32;
int total_bar_length=240;
int run_rectangle_length=0;
void InfoBar(int offset);
void InfoBarRtc(int offset);
void sdCardInfo(void);
const char* gpsChip(int longname);
char bar_info[8]="info";
void Speed_font0(String message1,String message2,float speed1,float speed2,float speed,int screen) {
int decimal=1;
if(screen==2)decimal=0; //screen==1 : Run xx.x AVG xx.x
display.setFont(&FreeSansBold12pt7b); //screen==2 : Gate xx Exit xx
display.setCursor(offset, 24); //screen==3 : Alfa MISS alfa xx.x
display.print(message1);
display.setFont(&FreeSansBold18pt7b);
if(screen<=2){ //Run xx.x Avg xx.x
display.print(speed1,decimal); //last 10s max from run
}
display.setFont(&FreeSansBold12pt7b);
display.setCursor(offset + 122, 24);
display.print(message2);
display.setFont(&FreeSansBold18pt7b);
display.print(speed2,decimal);
display.setFont(&SansSerif_bold_96_nr);
display.setCursor(offset, 120);
display.println(speed, 1);
}
void Speed_font1(String message1,String message2,float speed1,float speed2,float speed,int screen) {
display.setCursor(offset, 36);
if(screen==0) { //Run "A" AVG
display.setFont(&SansSerif_bold_46_nr); //Test for bigger alfa fonts
display.print(speed1, 1); //last 10s max from run
display.setFont(&FreeSansBold12pt7b);
display.setCursor(offset + 113, 36);
display.print(message2);
display.setFont(&SansSerif_bold_46_nr);
display.print(speed2, 1);
}
else if(screen==1){ //Alfa screen, Gate xx Ex xx
display.setFont(&FreeSansBold12pt7b);
display.print(message1);
display.setFont(&SansSerif_bold_46_nr);
display.print(speed1,0);
//display.setCursor(offset + 110, 36);
display.setFont(&FreeSansBold12pt7b);
display.print(message2);
display.setFont(&SansSerif_bold_46_nr);
display.print(speed2,0);
}
else if(screen==2) { //Alfa= xx.xx
display.setFont(&FreeSansBold18pt7b);
display.print(message1);
display.setFont(&SansSerif_bold_46_nr);
display.print(speed1,2);
}
else if(screen==3) { //Alfa = MISS
display.setFont(&FreeSansBold18pt7b);
display.print(message1);
}
display.setFont(&SansSerif_bold_96_nr);
display.setCursor(offset, 120);
display.println(speed, 1);
}
void Speed_font3(String message1,float speed) {
display.setFont(&FreeSansBold24pt7b);
display.setCursor(offset, 36);
bar_position=40;
display.print(message1);
display.setCursor(offset, 120);
display.setFont(&SansSerif_bold_96_nr);
display.print(speed, 1);
}
int device_boot_log(int rows, int ws) {
int r = 2, row = ROW_9PT + ROW_SPACING;
display.setCursor(offset, ROW_2_9PT);
if (ws) delay(ws);
display.print(SW_version);
if (rows == 2 || rows == 23 || rows == 24 || rows == 234) {
display.setCursor(offset, ROW_3_9PT);
if (ws) delay(ws);
sdCardInfo();
}
if (rows == 3 || rows == 23 || rows == 34 || rows == 234) {
r = (rows == 23 || rows == 34) ? 3 : rows == 234 ? 4
: 2;
if (ws) delay(ws);
display.setCursor(offset, (rows == 234 || rows == 23 || rows == 34) ? ROW_4_9PT : ROW_3_9PT);
display.printf("Display size %dx%d\n", displayWidth, displayHeight);
}
if ((rows == 4 || rows == 24 || rows == 34 || rows == 234) && ubxMessage.monVER.hwVersion[0]) {
r = (rows == 24 || rows == 34) ? 3 : rows == 234 ? 4
: 2;
if (ws) delay(ws);
display.setCursor(offset, rows == 24 || rows == 34 ? ROW_4_9PT : (rows == 234 ? ROW_5_9PT : ROW_3_9PT));
display.printf("Gps %s at %dHz", gpsChip(1), config.sample_rate);
}
//display.updateWindow(0,ROW_1_9PT+1,175,r*row,true);
return r;
}
#define DEVICE_BOOT_LOG(rows) device_boot_log(rows, 0)
void Boot_screen(void) {
display.init();
display.setRotation(1);
displayHeight = display.height();
displayWidth = display.width();
display.fillScreen(GxEPD_WHITE);
display.setTextColor(GxEPD_BLACK);
display.drawExampleBitmap(ESP_GPS_logo_40, offset + 198, 6, 40, 40,GxEPD_BLACK);
InfoBarRtc(offset);
display.setFont(&FreeSansBold9pt7b); \
display.setCursor(offset,14);
if (RTC_voltage_bat < MINIMUM_VOLTAGE) {
//int cursor = ROW_2_9PT;
display.println("EPS-GPS sleeping");
display.print("Go back to sleep...");
display.setFont(&FreeSansBold12pt7b);
display.setCursor(offset, 60);
display.printf("Voltage to low: %.2f", RTC_voltage_bat);
display.setCursor(offset,80);
display.print("Please charge lipo!");
display.update();
} else {
display.println("ESP-GPS booting");
display.println(SW_version);
sdCardInfo();
display.updateWindow(0, 0, displayWidth, displayWidth, true);
delay(100);
display.update();
}
}
void Off_screen(int choice) { //choice 0 = old screen, otherwise Simon screens
//int offset=0;
float session_time = (millis() - start_logging_millis) / 1000;
display.setRotation(1);
display.fillScreen(GxEPD_WHITE);
display.setTextColor(GxEPD_BLACK);
int cursor = ROW_3_9PT + ROW_12PT_W_SPACING;
if (choice == 0) {
ESP_GPS_LOGO_40
TOP_LEFT_TITLE_MSG("ESP-GPS saving"); //row1 14
DEVICE_BOOT_LOG(4); //2 rows until 46
//display.println("Need for speed!");
display.setFont(&FreeSansBold12pt7b);
display.setCursor(offset, cursor);
if (Shut_down_Save_session == true) {
display.println("Saving session");
display.setFont(&FreeSansBold9pt7b);
display.setCursor(offset, (cursor += ROW_9PT_W_SPACING));
display.print("Time: ");
display.print(session_time, 0);
display.print(" s");
display.setCursor(offset, (cursor += ROW_9PT_W_SPACING));
display.print("AVG: ");
display.print(RTC_avg_10s, 2);
display.setCursor(offset + 120, cursor);
display.print("Dist: ");
display.print(Ublox.total_distance / 1000, 0);
} else {
display.println("Going back to sleep");
}
}
if (choice == 1) {
Serial.println("Off_screen Simon");
ESP_GPS_LOGO_40
TOP_LEFT_TITLE_MSG("ESP-GPS saving");
DEVICE_BOOT_LOG(4); //row 2 and 3
//display.println("Need for speed!");
display.setFont(&FreeSansBold12pt7b);
display.setCursor(offset, cursor); //62
if (Shut_down_Save_session == true) {
display.println("Saving session");
display.setFont(&FreeSansBold9pt7b);
display.setCursor(offset, (cursor += ROW_9PT_W_SPACING));
display.print("Time: ");
display.print(session_time, 0);
display.print(" s");
display.setCursor(offset, (cursor += ROW_9PT_W_SPACING));
display.print("AVG: ");
display.print(RTC_avg_10s, 2);
display.setCursor(offset + 120, cursor);
display.print("Dist: ");
display.print(Ublox.total_distance / 1000, 0);
} else {
display.println("Going back to sleep");
}
}
InfoBar(offset);
display.updateWindow(0, 0, displayWidth, displayHeight, true);
delay(3000); //om te voorkomen dat update opnieuw start !!!
}
//Screen in deepsleep, update bat voltage, refresh every 4000s !!
void Sleep_screen(int choice) {
if (offset > 9) offset--;
if (offset < 1) offset++;
display.init();
display.setRotation(1);
displayHeight = display.height();
displayWidth = display.width();
display.fillScreen(GxEPD_WHITE);
display.setTextColor(GxEPD_BLACK);
InfoBarRtc(offset);
if (choice == 0) {
display.setFont(&FreeSansBold18pt7b);
display.setCursor(offset, 24);
display.print("Dist: ");
display.println(RTC_distance, 0);
display.setCursor(offset, 56);
display.print("AVG: ");
display.println(RTC_avg_10s, 2);
display.setCursor(offset, 88);
display.print("2s: ");
display.print(RTC_max_2s);
display.update();
} else {
int row1 = 15;
int row = 15;
int row2 = row1 + row;
int row3 = row2 + row;
int row4 = row3 + row;
int row5 = row4 + row;
int row6 = row5 + row;
int col1 = 0 + offset;
int col2 = 34 + offset;
int col3 = 90 + offset;
int col4 = 146 + offset;
// Board Logo's:
// add special logos - funlogos
//Board logos
if (RTC_Board_Logo == 1) //Logo's Simon Dijkstra
display.drawExampleBitmap(Starboard_logoS_zwart, 195, 0, 48, 48, GxEPD_BLACK);
if (RTC_Board_Logo == 2)
display.drawExampleBitmap(Fanatic_logoS_zwart, 195, 0, 48, 48, GxEPD_BLACK);
if (RTC_Board_Logo == 3)
display.drawExampleBitmap(JP_logoS_zwart, 195, 0, 48, 48, GxEPD_BLACK);
if (RTC_Board_Logo == 4)
display.drawExampleBitmap(NoveNove_logoS_zwart, 195, 0, 48, 48, GxEPD_BLACK);
if (RTC_Board_Logo == 5) //Logo's Jan Scholten
display.drawExampleBitmap(Mistral_logoS_zwart, 195, 0, 48, 48, GxEPD_BLACK);
if (RTC_Board_Logo == 6)
display.drawExampleBitmap(Goya_logoS_zwart, 195, 0, 48, 48, GxEPD_BLACK);
if (RTC_Board_Logo == 7)
display.drawExampleBitmap(Patrik_logoS_zwart, 195, 0, 48, 48, GxEPD_BLACK);
if (RTC_Board_Logo == 8)
display.drawExampleBitmap(Severne_logoS_zwart, 195, 0, 48, 48, GxEPD_BLACK);
if (RTC_Board_Logo == 9)
display.drawExampleBitmap(Tabou_logoS_zwart, 195, 0, 48, 48, GxEPD_BLACK);
if (RTC_Board_Logo == 10)
display.drawExampleBitmap(F2_logo_zwart, 195, 0, 48, 48, GxEPD_BLACK);
if (RTC_Board_Logo == 11) // Schwechater - Austrian Beer - by tritondm
display.drawExampleBitmap(epd_bitmap_Schwechater, 195, -10, 79, 132, GxEPD_BLACK);
if (RTC_Board_Logo == 12)
display.drawExampleBitmap(Thommen1_logo_BW, 195, 0, 64, 48, GxEPD_BLACK);
if (RTC_Board_Logo == 13)
display.drawExampleBitmap(BIC_logo_BW, 195, 0, 48, 48, GxEPD_BLACK);
if (RTC_Board_Logo == 14)
display.drawExampleBitmap(Carbon_art, 195, 0, 48, 39, GxEPD_BLACK);
if (RTC_Board_Logo == 15)
display.drawExampleBitmap(FutureFly_logo_zwart, 195, 0, 48, 48, GxEPD_BLACK);
if (RTC_Board_Logo == 16)
display.drawExampleBitmap(OneHundred_logoS_zwart, 195, 0, 48, 48, GxEPD_BLACK);
if (RTC_Board_Logo == 17)
display.drawExampleBitmap(FMX_logoS_zwart, 195, 0, 48, 48, GxEPD_BLACK);
if (RTC_Board_Logo == 18)
display.drawExampleBitmap(Phantom_logoS_zwart, 195, 0, 48, 48, GxEPD_BLACK);
if (RTC_Board_Logo == 19)
display.drawExampleBitmap(f4_foils_logoS_zwart, 195, 0, 48, 48, GxEPD_BLACK);
if (RTC_Board_Logo == 20)
display.drawExampleBitmap(Logo_LISA, 195, 0, 48, 48, GxEPD_BLACK);
// Zeil Logo's:
if (RTC_Sail_Logo == 1) //Logo's Simon Dijkstra
display.drawExampleBitmap(GAsails_logoS_zwart, 195, 50, 48, 48, GxEPD_BLACK);
if (RTC_Sail_Logo == 2)
display.drawExampleBitmap(DuoTone_logoS_zwart, 195, 50, 48, 48, GxEPD_BLACK);
if (RTC_Sail_Logo == 3)
display.drawExampleBitmap(NP_logoS_zwart, 195, 50, 48, 48, GxEPD_BLACK);
if (RTC_Sail_Logo == 4)
display.drawExampleBitmap(Pryde_logoS_zwart, 195, 50, 48, 48, GxEPD_BLACK);
if (RTC_Sail_Logo == 5) //Logo's Jan Scholten
display.drawExampleBitmap(Loftsails_logoS_zwart, 195, 50, 48, 48, GxEPD_BLACK);
if (RTC_Sail_Logo == 6)
display.drawExampleBitmap(Gunsails_logoS_zwart, 195, 50, 48, 48, GxEPD_BLACK);
if (RTC_Sail_Logo == 7)
display.drawExampleBitmap(Point7_logoS_zwart, 195, 50, 48, 48, GxEPD_BLACK);
if (RTC_Sail_Logo == 8)
display.drawExampleBitmap(Simmer_logoS_zwart, 195, 50, 48, 48, GxEPD_BLACK);
if (RTC_Sail_Logo == 9)
display.drawExampleBitmap(Naish_logoS_zwart, 195, 50, 48, 48, GxEPD_BLACK);
if (RTC_Sail_Logo == 10) {
display.drawExampleBitmap(Severne_logoS_zwart, 195, 50, 48, 48, GxEPD_BLACK);
}
if (RTC_Sail_Logo == 11) {
display.drawExampleBitmap(S2maui_logoS_zwart, 195, 50, 48, 48, GxEPD_BLACK);
}
if (RTC_Sail_Logo == 12) {
display.drawExampleBitmap(North_Sails_logoS_zwart, 195, 50, 48, 48, GxEPD_BLACK);
}
if (RTC_Sail_Logo == 13) {
display.drawExampleBitmap(Challenger_Sails_logoS_zwart, 195, 50, 48, 48, GxEPD_BLACK);
}
if (RTC_Sail_Logo == 14) {
display.drawExampleBitmap(Phantom_logoS_zwart, 195, 50, 48, 30, GxEPD_BLACK);//Patrik_logoS_zwart
}
if (RTC_Sail_Logo == 15) {
display.drawExampleBitmap(Patrik_logoS_zwart, 195, 50, 48, 48, GxEPD_BLACK);//Patrik_logoS_zwart
}
if (RTC_Sail_Logo == 16) {
display.drawExampleBitmap(Logo_LISA_vertical, 195, 50, 48, 48, GxEPD_BLACK);//Patrik_logoS_zwart
}
display.setCursor(col1, 105); // was 121
display.setFont(&SF_Distant_Galaxy9pt7b);
display.print(RTC_Sleep_txt);
display.setRotation(0);
display.setCursor(30, 249); //was 30, 249
display.setFont(&FreeSansBold6pt7b);
if ((int)(calibration_speed * 100000) == 194) display.print("speed in knots"); //1.94384449 m/s to knots !!!
if ((int)(calibration_speed * 1000000) == 3600) display.print("speed in km/h");
display.setRotation(1);
// left column
display.setFont(&FreeMonoBold9pt7b);
display.setCursor(col1, row1);
display.print("AV:");
display.setCursor(col1, row2);
display.print("R1:");
display.setCursor(col1, row3);
display.print("R2:");
display.setCursor(col1, row4);
display.print("R3:");
display.setCursor(col1, row5);
display.print("R4:");
display.setCursor(col1, row6);
display.print("R5:");
display.setFont(&FreeSansBold9pt7b);
display.setCursor(col2, row1);
display.println(RTC_avg_10s, 2);
display.setCursor(col2, row2);
display.println(RTC_R1_10s, 2);
display.setCursor(col2, row3);
display.println(RTC_R2_10s, 2);
display.setCursor(col2, row4);
display.println(RTC_R3_10s, 2);
display.setCursor(col2, row5);
display.println(RTC_R4_10s, 2);
display.setCursor(col2, row6);
display.println(RTC_R5_10s, 2);
// right column
display.setFont(&FreeMonoBold9pt7b);
display.setCursor(col3, row1);
display.print("2sec:");
display.setCursor(col3, row2);
display.print("Dist:");
display.setCursor(col3, row3);
display.print("Alph:");
display.setCursor(col3, row4);
display.print("1h:"); //
display.setCursor(col3, row5);
display.print("NM:");
display.setCursor(col3, row6);
display.print("500m:");
display.setFont(&FreeSansBold9pt7b);
display.setCursor(col4, row1);
display.println(RTC_max_2s, 2);
display.setCursor(col4, row2);
display.println(RTC_distance, 2);
display.setCursor(col4, row3);
display.println(RTC_alp, 2);
display.setCursor(col4, row4);
display.println(RTC_1h, 2); //
display.setCursor(col4, row5);
display.println(RTC_mile, 2);
display.setCursor(col4, row6);
display.println(RTC_500m, 2);
display.update();
}
}
int update_time() {
int ret = 0;
if (!NTP_time_set) {
if (!Gps_time_set) {
if (Set_GPS_Time(config.timezone)) Gps_time_set = 1;
}
}
if ((!Gps_time_set && !NTP_time_set) || !getLocalTime(&tmstruct)) return 1;
sprintf(time_now, "%02d:%02d", tmstruct.tm_hour, tmstruct.tm_min);
sprintf(time_now_sec, "%02d:%02d:%02d", tmstruct.tm_hour, tmstruct.tm_min, tmstruct.tm_sec);
return ret;
}
//for print hour&minutes with 2 digits
void time_print(int time) {
if (time < 10) display.print("0");
display.print(time);
}
void Bat_level(int X_offset, int Y_offset) {
float bat_symbol = 0;
display.fillRect(X_offset + 3, Y_offset, 6, 3, GxEPD_BLACK);
display.fillRect(X_offset, Y_offset + 3, 12, 30, GxEPD_BLACK); //monitor=(4.2-RTC_voltage_bat)*26
if (RTC_voltage_bat < VOLTAGE_100) {
bat_symbol = (VOLTAGE_100 - RTC_voltage_bat) * 28;
display.fillRect(X_offset + 2, Y_offset + 7, 8, (int)bat_symbol, GxEPD_WHITE);
}
}
void Bat_level_Simon(int offset) {
float bat_perc = 100 * (1 - (VOLTAGE_100 - RTC_voltage_bat) / (VOLTAGE_100 - VOLTAGE_0));
if (bat_perc < 0) bat_perc = 0;
if (bat_perc > 100) bat_perc = 100;
int batW = 8;
int batL = 15;
int posX = displayWidth - batW - 6;//was -10
int posY = displayHeight - batL;
int line = 2;
int seg = 3;
int segW = batW - 2 * line;
int segL = (batL - 0.25 * batW - 2 * line - (seg - 1)) / seg;
display.fillRect(offset + posX, posY, 0.5 * batW, 0.25 * batW, GxEPD_BLACK); //battery top
display.fillRect(offset + posX - 0.25 * batW, posY + 0.25 * batW, batW, batL, GxEPD_BLACK); //battery body
if (bat_perc < 67) display.fillRect(offset + posX - 0.25 * batW + line, posY + 0.25 * batW + line, segW, segL, GxEPD_WHITE);
if (bat_perc < 33) display.fillRect(offset + posX - 0.25 * batW + line, posY + 0.25 * batW + line + 1 * (segL + 1), segW, segL, GxEPD_WHITE);
if (bat_perc < 1) display.fillRect(offset + posX - 0.25 * batW + line, posY + 0.25 * batW + line + 2 * (segL + 1), segW, segL, GxEPD_WHITE);
//Serial.printf("info bar cursor pos: %d, display height: %d\n", INFO_BAR_ROW,displayHeight);
display.setFont(&FreeSansBold9pt7b);
//display.setCursor(displayWidth-8,(INFO_BAR_ROW-ROW_9PT));
//display.print("-");
if (bat_perc < 100) display.setCursor(offset + 156, (INFO_BAR_ROW));//was 193
else display.setCursor(offset + 146, (INFO_BAR_ROW));//was 184
display.print(RTC_voltage_bat+0.04,1);
display.print("V ");
display.print(int(bat_perc));
display.print("%");
}
void Sats_level(int offset) {
if (!ubxMessage.monVER.swVersion[0]) return;
int circelL = 5;
int circelS = 2;
int posX = 120 + offset;//was 176
int posY = INFO_BAR_TOP; //-(circelL+2*circelS);
int satnum = ubxMessage.navPvt.numSV;
display.drawExampleBitmap(ESP_Sat_15, posX, posY, 15, 15, GxEPD_BLACK);
display.setFont(&FreeSansBold9pt7b);
display.setCursor(posX - (satnum < 10 ? 9 : 18), INFO_BAR_ROW);
display.print(satnum);
}
const char* gpsChip(int longname) {
switch (config.ublox_type) {
case M8_9600BD:
return longname ? "M8 9.6Kbd" : "M8";
break;
case M8_38400BD:
return longname ? "M8 38.4Kbd" : "M8";
break;
case M9_9600BD:
return longname ? "M9 9.6Kbd" : "M9";
break;
case M9_38400BD:
return longname ? "M9 38.4Kbd" : "M9";
break;
case M10_9600BD:
return longname ? "M10 9.6Kbd" : "M10";
break;
case M10_38400BD:
return longname ? "M10 38.4Kbd" : "M10";
break;
default:
return "unknown";
break;
}
}
void M8_M10(int offset) {
display.setFont(&FreeSansBold9pt7b);
display.setCursor(offset + 60 , INFO_BAR_ROW);
display.print(gpsChip(0));
}
int Time(int offset) {
if (!update_time()) {
display.setFont(&FreeSansBold9pt7b);
display.setCursor(offset, INFO_BAR_ROW);
display.print(time_now);
}
return 0;
}
int TimeRtc(int offset) {
display.setFont(&FreeSansBold9pt7b);
display.setCursor(offset, INFO_BAR_ROW);
display.printf("%d:%d", RTC_hour, RTC_min);
return 0;
}
int DateTimeRtc(int offset) {
display.setFont(&FreeSansBold9pt7b);
display.setCursor(offset, INFO_BAR_ROW);
display.printf("%02d:%02d %02d-%02d-%02d", RTC_hour, RTC_min, RTC_day, RTC_month, RTC_year);
return 0;
}
void InfoBar(int offset) {
Bat_level_Simon(offset);
Sats_level(offset);
if(ubxMessage.navPvt.numSV>4) M8_M10(offset);
Time(offset);
}
void InfoBarRtc(int offset) {
Bat_level_Simon(offset);
DateTimeRtc(offset);
}
void Speed_in_Unit(int offset) {
display.setRotation(0);
display.setFont(&FreeSansBold6pt7b);
display.setCursor(30, offset + 245); //was 30, 249
if ((int)(calibration_speed * 100000) == 194) display.print("speed in knots"); //1.94384449 m/s to knots !!!
if ((int)(calibration_speed * 1000000) == 3600) display.print("speed in km/h");
display.setRotation(1);
}
void sdCardInfo(void) {
if (sdOK) display.printf("SD : %d Mb\n", freeSpace);
if (LITTLEFS_OK) display.printf("Local : %d kb\n", (LITTLEFS.totalBytes() - LITTLEFS.usedBytes()) / 1024);
}
void Update_screen(int screen) {
static int count, old_screen, update_delay;
update_time();
update_epaper = 1; //was zonder else
if (count % 20 < 10) offset++;
else offset--;
if (offset > 10) offset = 0;
if (offset < 0) offset = 0;
int cursor = 0;
display.fillScreen(GxEPD_WHITE);
if ((screen != SPEED)&(screen != RUNS_STAT)&(screen != STATS8)&(screen != STATSA)) InfoBar(offset);
if (screen == BOOT_SCREEN) {
update_delay = 1000;
ESP_GPS_LOGO_40
TOP_LEFT_TITLE_MSG("ESP-GPS config");
DEVICE_BOOT_LOG(234);
if (screen != old_screen) count = 0; //eerste keer full update
Speed_in_Unit(offset);
delay(1000);
}
if (screen == GPS_INIT_SCREEN) {
update_delay = 100;
ESP_GPS_LOGO_40
TOP_LEFT_TITLE_MSG("ESP-GPS GPS init");
DEVICE_BOOT_LOG(24);
if(config.ublox_type==0xFF){
display.setFont(&FreeSansBold12pt7b);
display.setCursor(offset, (cursor = ROW_4_9PT + ROW_12PT_W_SPACING));
display.print("Auto detect gps-type");
}
else if (!ubxMessage.monVER.hwVersion[0]) {
display.setFont(&FreeSansBold12pt7b);
display.setCursor(offset, (cursor = ROW_4_9PT + ROW_12PT_W_SPACING));
display.print("Gps initializing");
}
if (screen != old_screen) count = 0; //eerste keer full update
Speed_in_Unit(offset);
}
if (screen == WIFI_ON) {
update_delay = 100;//was 1000
if (count % 20 < 10) offset++;
else offset--;
ESP_GPS_LOGO_40
TOP_LEFT_TITLE_MSG("ESP-GPS connect");
DEVICE_BOOT_LOG(2);
if (Wifi_on == 1) {
display.setFont(&FreeSansBold12pt7b);
display.setCursor(offset, (cursor = ROW_3_9PT + ROW_12PT_W_SPACING));
//display.fillRect(0, ROW_3_9PT+1, 180, INFO_BAR_TOP-ROW_3_9PT-1, GxEPD_WHITE);//clear lower part
display.print("Ssid: ");
if (SoftAP_connection == true) display.print("ESP32AP"); //ap mode
else display.print(actual_ssid);//display.print(config.ssid);
display.setFont(&FreeSansBold9pt7b);
display.setCursor(offset, (cursor += ROW_9PT_W_SPACING));
if (SoftAP_connection == true) {
display.print("Password: password");
display.setCursor(offset, (cursor += ROW_9PT_W_SPACING));
}
display.printf("http://%s", IP_adress.c_str());
} else {
display.fillRect(0, 0, 180, 104, GxEPD_WHITE);
TOP_LEFT_TITLE_MSG("ESP-GPS ready");
DEVICE_BOOT_LOG(24);
display.setFont(&FreeSansBold12pt7b);
display.setCursor(offset, (cursor = ROW_4_9PT + ROW_12PT_W_SPACING));
if (ubxMessage.navPvt.numSV < 5) {
display.println("Waiting for Sat >=5");
display.setFont(&FreeSansBold9pt7b);
display.setCursor(offset, (cursor += ROW_9PT_W_SPACING));
display.println("Please go outside");
} else {
display.println("Ready for action");
display.setFont(&FreeSansBold9pt7b);
display.setCursor(offset, (cursor += ROW_9PT_W_SPACING));
display.print("Move faster than ");
if ((int)(calibration_speed * 100000) == 194) {
display.print(config.start_logging_speed * 1.94384449);
display.print("kn");
}
if ((int)(calibration_speed * 1000000) == 3600) {
display.print(config.start_logging_speed * 3.6);
display.print("km/h");
}
Speed_in_Unit(offset);
}
}
}
if (screen == WIFI_STATION) {
update_delay = 100;
ESP_GPS_LOGO_40
TOP_LEFT_TITLE_MSG("ESP-GPS try to connect");
DEVICE_BOOT_LOG(2);
display.setFont(&FreeSansBold12pt7b);
display.setCursor(offset, (cursor = ROW_3_9PT + ROW_12PT_W_SPACING));
//display.println("Trying to connect...");
display.print(actual_ssid);
display.setFont(&FreeSansBold9pt7b);
display.setCursor(offset, (cursor += ROW_9PT_W_SPACING));
display.printf("For AP: use magnet in %ds", wifi_search);
if (screen != old_screen) count = 0; //eerste keer full update
}
if (screen == WIFI_SOFT_AP) {
update_delay = 100;//was 500
ESP_GPS_LOGO_40
TOP_LEFT_TITLE_MSG("Connect to ESP-GPS");
DEVICE_BOOT_LOG(2);
display.setFont(&FreeSansBold12pt7b);
display.setCursor(offset, (cursor = ROW_3_9PT + ROW_12PT_W_SPACING));
display.print("Ssid: ESP32AP");
display.setFont(&FreeSansBold9pt7b);
display.setCursor(offset, (cursor += ROW_9PT_W_SPACING));
display.print("Password: password");
display.setCursor(offset, (cursor += ROW_9PT_W_SPACING));
display.printf("http://%s/ in %ds\n", IP_adress.c_str(), wifi_search);
if (screen != old_screen) count = 0; //eerste keer full update
}
if (screen == SPEED) {
update_delay = 50;
int field = config.field_actual; //default is in config.txt
bool alfa_screen = false;
bool nautical_mile_screen = false;
bool x_10km_screen = false;
if ((Ublox.alfa_distance / 1000 < 350) & (alfa_window < 100)) alfa_screen=true; //true until 350 m after the jibe
if (Ublox.alfa_distance / 1000 >1852) nautical_mile_screen=true; // true if run exceeds 1852 m
if (((int)(Ublox.total_distance / 1000000) % 10 == 0) & (Ublox.alfa_distance / 1000 > 1000)) x_10km_screen=true; //true if distance is x *10 km
display.setFont(&FreeSansBold6pt7b);
display.setCursor(displayWidth - 20, INFO_BAR_TOP);
char c=config.field_actual;
display.print(c); //show config field in small font
if (config.field_actual == SPEED1) {
field = SPEED2; //Default actual RUN + AVG screen
if(nautical_mile_screen) field = SPEED4;
if(x_10km_screen) field=SPEED5;
if(alfa_screen)field=SPEED3;
}
if (config.field_actual == SPEED2) {
field = SPEED2;
if(nautical_mile_screen) field = SPEED4;
}
if (config.field_actual == SPEED7) {
field = SPEED7;
if(alfa_screen)field=SPEED3;
}
if (config.field_actual == SPEED8) {
field = SPEED8;
if(alfa_screen)field=SPEED3;
}
if (config.field_actual == SPEED9) { //1 hour default, but prio alfa, and if good run, last run
field = SPEED2;//default Run / Avg
if(nautical_mile_screen) field = SPEED4;//after 1852 m
if (Ublox.alfa_distance / 1000 < 1000) field = SPEED8; // 350m - 1000m : 1h !!
if (S10.s_max_speed > S10.display_speed[5]) field = SPEED2; //if run faster then slowest run, show AVG & run after 1000 m
if(alfa_screen)field=SPEED3; //prio alfa
}
if (GPS_Signal_OK == true) {
//test for bigger font alfa
if (config.speed_large_font == 2) { //test for bigger font speed (Simon)
//int gps_speed_int=(int)(gps_speed*calibration_speed);
int gps_speed_komma=(int)((gps_speed*calibration_speed)*10)%10;
display.setFont(&FreeSansBold75pt7b);
display.setCursor(offset-6, 115);
display.print((int)(gps_speed*calibration_speed)); //print main in large font, float with rounding ???
display.setFont(&FreeSansBold30pt7b);
display.print(".");
display.setFont(&SansSerif_bold_84_nr);
display.println(gps_speed_komma);
//display.println(int((gps_speed * calibration_speed - int(gps_speed * calibration_speed)) * 10), 0); //int((x-int(x))*10) round to correct digit
}
} else {
display.setFont(&FreeSansBold18pt7b);
display.setCursor(offset, 60);
display.print("Low GPS signal !");
}
if (field <= SPEED2) { //Run and AVG first line speed screen
if (config.speed_large_font == 0) {
Speed_font0("Run","Avg ",S10.s_max_speed * calibration_speed,S10.avg_5runs * calibration_speed,gps_speed * calibration_speed,0);
}
if (config.speed_large_font == 1) {
Speed_font1("","A",S10.s_max_speed * calibration_speed,S10.avg_5runs * calibration_speed,gps_speed * calibration_speed,0);
}
if (config.speed_large_font == 3) {
if(S10.s_max_speed<S10.display_speed[5]){
Speed_font3(" SPEED",gps_speed * calibration_speed);
}
else{
Speed_font3("LAST RUN",S10.s_max_speed * calibration_speed) ;
}
}
}
/*
First 250m after jibe, if Window>99 m : Window and Exit
Between 250m and 400m after jibe : Result Alfa (speed or MISS)
Between 400m and 1852m after jibe : Actual Run + AVG
More then 1852m : NM actual speed and NM Best speed
*/
if (field == SPEED3){
if(config.speed_large_font == 0) {
if ((alfa_window < 99) & (Ublox.alfa_distance / 1000 < 255)) { //Window alleen indien Window<100 en Run>350 meter !!!!&(A500.alfa_speed_max*calibration_speed<1)
if (alfa_exit > 99) alfa_exit = 99; //begrenzen alfa_exit...
Speed_font0("Gate"," Ex ",alfa_window,alfa_exit,gps_speed * calibration_speed,2);
} else {
if (A500.alfa_speed_max * calibration_speed > 1) { //laatste alfa was geldig !!!!
Speed_font0("Alfa ","Ab ",A500.display_max_speed * calibration_speed,A500.alfa_speed_max * calibration_speed,gps_speed * calibration_speed,1);
} else {
Speed_font0("Alfa MISS","Ab ",0,A500.alfa_speed_max * calibration_speed,gps_speed * calibration_speed,3);
}
}
}
if(config.speed_large_font == 1) {
if ((alfa_window < 99) & (Ublox.alfa_distance / 1000 < 255)) { //Window alleen indien Window<100 en Run>350 meter !!!!&(A500.alfa_speed_max*calibration_speed<1)
if (alfa_exit > 99) alfa_exit = 99; //begrenzen alfa_exit...
Speed_font1("Gate","Ex",alfa_window,alfa_exit,gps_speed * calibration_speed,1);
} else {
if (A500.alfa_speed_max * calibration_speed > 1) { //laatste alfa was geldig !!!!
Speed_font1("Alfa= ","",A500.alfa_speed_max * calibration_speed,0,gps_speed * calibration_speed,2);
}
else {
Speed_font1("Alfa = MISS","",0,0,gps_speed * calibration_speed,3);
}
}
}
if (config.speed_large_font == 3){
if ((alfa_window < 99) & (Ublox.alfa_distance / 1000 < 255)) { //Window alleen indien Window<100 en Run>350 meter !!!!&(A500.alfa_speed_max*calibration_speed<1)
Speed_font3(" GATE",alfa_window);
}
else{
if (A500.alfa_speed_max * calibration_speed > 1) { //laatste alfa was geldig !!!!
Speed_font3(" Alfa",A500.alfa_speed_max * calibration_speed);
}
else {
Speed_font3("Alfa MISS",-1);
}
}
}
}
if (field == SPEED4) { //First line speed screen = nautical mile info
if (config.speed_large_font == 0) {
Speed_font0("NMa "," NM ",M1852.display_max_speed * calibration_speed,M1852.m_max_speed * calibration_speed,gps_speed * calibration_speed,0);
}
if (config.speed_large_font == 1) {
Speed_font1("NM= "," ",M1852.m_max_speed * calibration_speed,0,gps_speed * calibration_speed,2);
}
if (config.speed_large_font == 3) {
Speed_font3(" N. MILE",M1852.m_max_speed * calibration_speed);
}
}
if (field == SPEED5) {
if (config.speed_large_font == 1) {
Speed_font1("Dist "," ",Ublox.total_distance / 1000000,0,gps_speed * calibration_speed,2);//distance in km xx.xx
}
else if (config.speed_large_font == 3) {
Speed_font3("Dist ",Ublox.total_distance / 1000000);//distance in km xx.xx
}
else if (config.speed_large_font == 0) {
Speed_font0("Run"," Dist",Ublox.total_distance / 1000,Ublox.alfa_distance /1000000,gps_speed * calibration_speed,2);
}
}
if (field == SPEED6) {
if ((config.speed_large_font != 2)&(config.speed_large_font != 4)) {//Simon font, alleen speed !)
Speed_font0("2S ","10S ",S2.display_max_speed * calibration_speed,S10.display_max_speed * calibration_speed,gps_speed * calibration_speed,0);
}
}
if (field == SPEED7) {
if (config.speed_large_font == 1) {
Speed_font1("500m "," ",M500.m_max_speed * calibration_speed,M500.m_max_speed * calibration_speed,gps_speed * calibration_speed,2);
}
else if(config.speed_large_font == 3){
Speed_font3("500m :",M500.m_max_speed * calibration_speed);
}
else if(config.speed_large_font == 0) {
Speed_font0("500A","Max",M500.m_max_speed * calibration_speed,M500.display_max_speed * calibration_speed,gps_speed * calibration_speed,0);
}
}
if (config.speed_large_font == 4) {
double speed=gps_speed * calibration_speed;
display.setFont(&FreeSansBold75pt7b);
display.setCursor(offset-6, 118);
display.print(speed, 0);
display.setFont(&SansSerif_bold_84_nr);
display.print(".");
int komma=(int)(speed*10)%10;
display.print(komma, 0);
}
int log_seconds;
static int low_speed_seconds;
static int start_hour_millis=millis();//only set @declaration
log_seconds = (millis() - start_hour_millis) / 1000; //aantal seconden sinds loggen is gestart
if (S10.avg_s > 2000) { low_speed_seconds = 0; } //if the speed is higher then 2000 mm/s, reset the counter
low_speed_seconds++;//update rate e-paper is about 1s....
if (low_speed_seconds > 120) { start_hour_millis = millis(); } //bar will be reset if the 10s speed drops under 2m/s for more then 120 s !!!!
if (field == SPEED8) {
if (log_seconds > 3600) { start_hour_millis = millis();}//reset bar
if (config.speed_large_font == 1) {
Speed_font1("1h: "," ",S3600.display_max_speed * calibration_speed,S3600.avg_s * calibration_speed,gps_speed * calibration_speed,2);
}
else if(config.speed_large_font == 3){
Speed_font3("1 Hour",S3600.display_max_speed * calibration_speed);
}
else if(config.speed_large_font == 0) {
Speed_font0("1hA ","1hB ",S3600.avg_s * calibration_speed,S3600.display_max_speed * calibration_speed,gps_speed * calibration_speed,0);
}
}
/*progress bar**************************************************************************************************************************/
if (config.speed_large_font == 0) {total_bar_length=180;bar_position=32;}
if (config.speed_large_font == 1) {total_bar_length=240;bar_position=38;}
if ((config.speed_large_font == 2)|(config.speed_large_font == 4)) {total_bar_length=240;bar_position=0;}
bar_length = config.bar_length * 1000 / total_bar_length;
sprintf(bar_info,"%dm",config.bar_length); //default in config 1852m
//strcpy(bar_info,"1852m");//default
if (field==SPEED3) {bar_length = 250 * 1000 / total_bar_length;strcpy(bar_info,"250m");}
if (field==SPEED7) {bar_length = 500 * 1000 / total_bar_length;strcpy(bar_info,"500m");}
if(field==SPEED8) {run_rectangle_length = log_seconds * total_bar_length / 3600;strcpy(bar_info,"3600s");}
else {run_rectangle_length = (Ublox.alfa_distance / bar_length); }
if(run_rectangle_length>total_bar_length) {run_rectangle_length=total_bar_length;}//limit bar length for time...
if((run_rectangle_length<180)&(config.speed_large_font == 1)){
display.setTextWrap(false);
display.setFont(&FreeMonoBold9pt7b);//print bar infoFreeMonoBold9pt7b
display.setCursor(offset+186, 48);
display.print(bar_info);
}
if(config.speed_large_font == 0) {
display.setFont(&FreeSansBold12pt7b);//print time
display.setCursor(offset+180, 43);
display.print(time_now);
}
if((run_rectangle_length<160)&(config.speed_large_font == 2)){
display.setTextWrap(false);
display.setFont(&FreeMonoBold9pt7b);//print bar infoFreeMonoBold9pt7b
display.setCursor(offset+186, 10);
display.print(bar_info);
}
display.fillRect(offset, bar_position, run_rectangle_length, 8, GxEPD_BLACK); //balk voor run_distance weer te geven...
}
if (screen == TROUBLE) {
display.setFont(&FreeSansBold12pt7b);
display.setCursor(offset, ROW_1_12PT);
display.println("No GPS frames for");
display.println("more then 10 s.... ");
//display.setCursor(offset,120);
//display.print(time_now);
}
if (screen == STATS1) { //2s,10sF,10sS, AVG
display.setFont(&FreeSansBold12pt7b);
display.setCursor(offset, ROW_1_18PT);
display.print("2l: ");
display.setFont(&FreeSansBold18pt7b);
display.print(S2.display_last_run * calibration_speed, 1); //last 2s max from rundisplay.print(S2.avg_speed[9]*calibration_speed);
display.setFont(&FreeSansBold12pt7b);
display.setCursor(120 + offset % 2, ROW_1_18PT); //zodat SXX niet groter wordt dan 244 pix
display.print("2s: ");
display.setFont(&FreeSansBold18pt7b);
display.print(S2.display_max_speed * calibration_speed); //best 2s, was avg_speed[9]
display.setCursor(offset, ROW_2_18PT);
display.print("10sF: ");
display.println(S10.display_max_speed * calibration_speed); //best 10s(Fast), was avg_speed[9]
display.setCursor(offset, ROW_3_18PT);
display.print("10sS: ");
display.println(S10.display_speed[5] * calibration_speed); //langzaamste 10s(Slow) run van de sessie
display.setCursor(offset, ROW_4_18PT);
display.print("Avg: ");
display.println(S10.avg_5runs * calibration_speed); //average 5*10s
}
if (screen == STATS2) { //alfa 500m,1852m, 1800s,total_dist
static int toggle = 0;
display.setFont(&FreeSansBold18pt7b);
display.setCursor(offset, ROW_1_18PT);
display.print("Dist: ");
display.print(Ublox.total_distance / 1000, 0);
display.setCursor(offset, ROW_2_18PT);
display.print("1852m: ");
display.println(M1852.display_max_speed * calibration_speed); //was avg_speed[9]
display.setCursor(offset, ROW_3_18PT);
if (toggle == 0) {
display.print("1800s: ");
display.println(S1800.display_max_speed * calibration_speed);
display.setCursor(offset, ROW_4_18PT);
display.print("Alfa: ");
display.print(A500.avg_speed[9] * calibration_speed); //best Alfa on 500 m
toggle = 1;
} else {
display.print("3600s: ");
display.println(S3600.display_max_speed * calibration_speed);
display.setCursor(offset, ROW_4_18PT);
display.print(time_now_sec);
toggle = 0;
}
}
if (screen == STATS3) { //100m,250m, 500m,Alfa
display.setFont(&FreeSansBold18pt7b);
display.setCursor(offset, ROW_1_18PT);
display.print("100m: ");
display.print(M100.avg_speed[9] * calibration_speed); //best 2s, was avg_speed[9]
display.setCursor(offset, ROW_2_18PT);
display.print("250m: ");
display.println(M250.display_max_speed * calibration_speed); //best 10s(Fast), was avg_speed[9]
display.setCursor(offset, ROW_3_18PT);
display.print("500m: ");
display.println(M500.avg_speed[9] * calibration_speed); //langzaamste 10s(Slow) run van de sessie
display.setCursor(offset, ROW_4_18PT);
display.print("Alfa: ");