forked from jelinj8/dso203
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDraw.c
2322 lines (2018 loc) · 93.7 KB
/
Draw.c
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
//******************** (C) COPYRIGHT 2009 e-Design Co.,Ltd. *********************
// File Name : Draw.c
// Version : DS203_APP Ver 2.3x Author : bure
//*******************************************************************************/
#include <string.h>
#include "Interrupt.h"
#include "Process.h"
#include "Draw.h"
#include "Menu.h"
#include "BIOS.h"
#include "Function.h"
#include "File.h"
void LoadBuffer(u16 Row, u8 buffer,u8 *y,u8 *Dot_Hide,u8 service);
void LoadFFTbuffer(u16 Row,u8 buffer);
void Print_Str_Row(u16 Row, u16* LCD_Buffer, u16 x0, s16 y0, char *s);
void DisplayFFtValues(u16 Row,u8 buffer);
void DisplayDbScale(u16 Row, u8 buffer, u8 service);
void Base1(u8 buffer);
void LoadBaseBuffers(void); //load all 3 buffers
void TraceShadow(u8 start,u8 limit,u8 buffer);
void VernierMark(u8 buffer,u16 color);
void LoadXYBuffer(u16 Row);
void ClearFFTbuffer(void);
s32 ScaleXposi(void);
void NFreqParse(u8 index,u8 suffix);
u16 ColorIndexGen(u8 level);
void DrawPixel(u16 x,u8 y, u16 color);
void DrawBase(u16 x,u16 color);
void DisplayDetFrqn(u16 Row, u8 buffer);
void Uart();
void PrintUart(u16 Row, u8 buffer, u8 service);
void i2c(void);
void LoadChars(u8 service);
void InitiateCharArrays(void);
void Spi(void);
void SpiChart(u16 Row,u8 buffer);
u8 BitReadPosition(u16 i);
u8 DigChLockout=0;
void PrintText(u16 x,u8 y,char *s);
void PrintConfigName(void);
void DisplayCursorValues(u16 Row, u8 buffer);
void DisplayDeltaValues(u16 Row, u8 buffer);
char Nfreq[9];
char Nsuffix[3];
u16 MAX_X;
uc16 RULE_BASE[8] ={0x020,0x040,0x080,0x040,0x020,0x010,0x008,0x010};
u8 OffsetX;
u8 OffsetY;
s16 FactorX;
s16 FactorY;
s16 FactorY13;
u16 SpecRow = 25;
u8 SpecLine = 0;
s32 Tmp2;
s16 skip;
u8 UpdateBackground;
u8 Rdiscard=0; //post-signal trace blanking
char DbScaleStr[3];
//uc16 COLOR_INDEX=0x050F; //red fft values display
u16 COLOR_INDEX=0x0503; //green fft values display
//0x0500 = cyan w black bg
//0x0501 = yellow w black bg
u16 Count_FPS = 0;
u8 SpecMode=0;
u8 InitXY=1;
u8 XYper=0;
u8 FrameCount;
u8 ClearPerst;
u8 PerstFrameNumber=0;
u8 Raw=0;
u8 UpdateScale;
s16 DetFrqn[12];
uc8 DetFrqAdj[10]= {110,108,106,104,104,104,104,104,104,104};
u16 RowMem, RowMemPeak;
u16 XYLimit=234;
u8 ListBottom;
u8 DisableCursorDisplay=0;
u8 EnableCursorDisplay=0;
u32 BaudRate;
u8 FrameSize=10;
u8 DataSize=8;
u8 Parity=0;
char AscChar[2][3][17];
char AscCharB[2][3][17];
char HexChar[6][49];
char HexCharB[6][49];
u8 ArrayIndex;
u16 BitDuration;
u8 Mask=1;
u8 DataAdj=0;
u8 ValidFrame;
typedef struct{
u8 Data;
u16 Index;
u16 End;
u8 DataB;
u8 BitsPerWord;
}ByteInfo;
ByteInfo ByteArray[96];
u8 SpiMode=0;
u8 SpiBitOrder=0;
s16 SpiNumBits=8;
u8 SpiAdj=0;
u8 WordEndFlag=0;
u8 SpiChartFlag=0;
u16 ClockPeriod=0xFFFF;
s16 ChartIndex=0x7FFF;
u16 TcurDelta=30;
u8 OSBuffer=0;
u8 Hbold=0;
u16 Limit=299;
u8 SkipFirstRow=0;
u8 CursorDisplaySelect=0;
const char CursorTypeStr[5][4]={{'T','1',':',0},{'T','2',':',0},{'V','1',':',0},{'V','2',':',0},{'T','r',':',0}};
uc8 Mark_TAB_1[7] ={0x00,0x00,0x42,0xFE,0x02,0x00,0x00}; // Mark 1
uc8 Mark_TAB_2[7] ={0x00,0x46,0x8A,0x92,0x92,0x62,0x00}; // Mark 2
uc8 Mark_TAB_3[7] ={0x00,0x44,0x82,0x92,0x92,0x6C,0x00}; // Mark 3
uc8 Mark_TAB_4[7] ={0x00,0x18,0x28,0x4A,0xFE,0x0A,0x00}; // Mark 4
uc8 Mark_TAB_T[7] ={0x00,0x40,0x40,0x7E,0x40,0x40,0x00}; // Mark T
uc8 Mark_TAB[5][7] ={{0x00,0x00,0x42,0xFE,0x02,0x00,0x00}, // Mark 1
{0x00,0x46,0x8A,0x92,0x92,0x62,0x00}, // Mark 2
{0x00,0x44,0x82,0x92,0x92,0x6C,0x00}, // Mark 3
{0x00,0x18,0x28,0x4A,0xFE,0x0A,0x00}, // Mark 4
{0x00,0x40,0x40,0x7E,0x40,0x40,0x00}}; // Mark T
uc16 FrameCountRef[22]= {18000,9000,3600,1800,900,362,182,92, 49, 29, 15, 12, 12,12,12,12,12,12,12,12,12,12};
// 1 500 200 100 50 20 10 5 2 1 500 200 time base
//uc16 Char_TAB_8x11[744] = {
//uc16 Char_TAB_8x11[752] = { // used when adding extra character
//uc16 Char_TAB_8x11[747] = { // used when adding 3 pix wide period
uc16 Char_TAB_8x11[768] = { // used when adding 3 pix period and extra char
0x000,0x000,0x000,0x780,0x040,0x020,0x020,0x020, // "the upper left corner
// 0x020,0x020,0x040,0x780,0x000,0x000,0x000,0x000, // # the upper right corner
0x1FC,0x1FC,0x1FC,0x1FC,0x1FC,0x1FC,0x1FC,0x000, // # box
// 0x000,0x000,0x000,0x00F,0x010,0x020,0x020,0x020, // $ lower left corner
// 0x070,0x0F8,0x1FC,0x1FC,0x1FC,0x0F8,0x070,0x000, // $ dot
0x006,0x00C,0x018,0x030,0x060,0x0C0,0x180,0x000, // $ backslash
0x30C,0x18C,0x0C0,0x060,0x030,0x318,0x30C,0x000, // %
0x000,0x180,0x260,0x21C,0x26A,0x284,0x140,0x000, // &
0x202,0x202,0x202,0x202,0x202,0x202,0x3FE,0x000, // ' battery Last empty
0x000,0x000,0x0F8,0x1FC,0x306,0x202,0x000,0x000, // (
0x000,0x000,0x202,0x306,0x1FC,0x0F8,0x000,0x000, // )
0x000,0x18C,0x0D8,0x070,0x070,0x0D8,0x18C,0x000, // * x
0x000,0x020,0x020,0x0F8,0x0F8,0x020,0x020,0x000, // +
0x020,0x020,0x010,0x00F,0x000,0x000,0x000,0x000, // , the lower right corner
0x000,0x020,0x020,0x020,0x020,0x020,0x020,0x000, // -
0x000,0x000,0x300,0x300,0x000,0x000,0x000,0x000, // .
0x180,0x0C0,0x060,0x030,0x018,0x00C,0x006,0x000, // /
0x1FC,0x3FE,0x242,0x222,0x212,0x3FE,0x1FC,0x000, // 0
0x000,0x208,0x20C,0x3FE,0x3FE,0x200,0x200,0x000, // 1
0x304,0x386,0x2C2,0x262,0x232,0x31E,0x30C,0x000, // 2
0x104,0x306,0x222,0x222,0x222,0x3FE,0x1DC,0x000, // 3
0x060,0x070,0x058,0x24C,0x3FE,0x3FE,0x240,0x000, // 4
0x11E,0x21E,0x212,0x212,0x212,0x3F2,0x1E2,0x000, // 5
0x1F8,0x3FC,0x226,0x222,0x222,0x3E0,0x1C0,0x000, // 6
0x006,0x006,0x3C2,0x3E2,0x032,0x01E,0x00E,0x000, // 7
0x1DC,0x3FE,0x222,0x222,0x222,0x3FE,0x1DC,0x000, // 8
0x01C,0x23E,0x222,0x222,0x322,0x1FE,0x0FC,0x000, // 9
0x000,0x000,0x000,0x198,0x198,0x000,0x000,0x000, // :
0x2FA,0x2FA,0x2FA,0x2FA,0x2FA,0x2FA,0x2FA,0x2FA, // ; battery body
0x000,0x020,0x070,0x0D8,0x18C,0x306,0x202,0x000, // <
0x090,0x090,0x090,0x090,0x090,0x090,0x000,0x000, // =
0x000,0x202,0x306,0x18C,0x0D8,0x070,0x020,0x000, // >
//0x018,0x01C,0x004,0x344,0x364,0x03C,0x018,0x000, // ?
//0x07F,0x008,0x0D4,0x322,0x441,0x300,0x0C0,0x000, // ? Kv
0x070,0x0F8,0x1FC,0x1FC,0x1FC,0x0F8,0x070,0x000, // ? dot
//0x1F8,0x104,0x272,0x272,0x2F2,0x284,0x078,0x000, // @
0x3FE,0x020,0x3FE,0x000,0x320,0x2A0,0x260,0x000, // @ Hz
0x3F0,0x3F8,0x04C,0x046,0x04C,0x3F8,0x3F0,0x000, // A
0x202,0x3FE,0x3FE,0x222,0x222,0x3FE,0x1DC,0x000, // B
0x0F8,0x1FC,0x306,0x202,0x202,0x306,0x18C,0x000, // C
0x202,0x3FE,0x3FE,0x202,0x306,0x1FC,0x0F8,0x000, // D
0x202,0x3FE,0x3FE,0x222,0x272,0x306,0x38E,0x000, // E
0x202,0x3FE,0x3FE,0x222,0x072,0x006,0x00E,0x000, // F
0x0F8,0x1FC,0x306,0x222,0x222,0x1E6,0x3EC,0x000, // G
0x3FE,0x3FE,0x020,0x020,0x020,0x3FE,0x3FE,0x000, // H
0x000,0x000,0x202,0x3FE,0x3FE,0x202,0x000,0x000, // I
0x1C0,0x3C0,0x200,0x202,0x3FE,0x1FE,0x002,0x000, // J
0x202,0x3FE,0x3FE,0x030,0x0F8,0x3CE,0x306,0x000, // K
0x202,0x3FE,0x3FE,0x202,0x200,0x200,0x300,0x000, // L
0x3FE,0x3FE,0x01C,0x038,0x01C,0x3FE,0x3FE,0x000, // M
0x3FE,0x3FE,0x01C,0x038,0x070,0x3FE,0x3FE,0x000, // N
0x0F8,0x1FC,0x306,0x202,0x306,0x1FC,0x0F8,0x000, // O
0x202,0x3FE,0x3FE,0x222,0x022,0x03E,0x01C,0x000, // P
0x1FC,0x3FE,0x202,0x282,0x302,0x3FE,0x1FC,0x000, // Q
0x202,0x3FE,0x3FE,0x022,0x062,0x3FE,0x39C,0x000, // R
0x10C,0x31E,0x232,0x222,0x262,0x3CE,0x18C,0x000, // S
0x000,0x00E,0x206,0x3FE,0x3FE,0x206,0x00E,0x000, // T
0x1FE,0x3FE,0x200,0x200,0x200,0x3FE,0x1FE,0x000, // U
0x07E,0x0FE,0x180,0x300,0x180,0x0FE,0x07E,0x000, // V
0x0FE,0x3FE,0x380,0x1E0,0x380,0x3FE,0x0FE,0x000, // W
0x306,0x3DE,0x0F8,0x020,0x0F8,0x3DE,0x306,0x000, // X
0x000,0x01E,0x23E,0x3E0,0x3E0,0x23E,0x01E,0x000, // Y
0x38E,0x3C6,0x262,0x232,0x31E,0x38E,0x000,0x000, // Z
0x200,0x300,0x2C0,0x220,0x218,0x204,0x3FE,0x000, // [ Triangle
0x000,0x022,0x042,0x1FE,0x3FE,0x240,0x220,0x000, // \ falling edge
0x020,0x010,0x008,0x006,0x008,0x010,0x020,0x020, // ] Pointer
0x000,0x220,0x210,0x3FC,0x3FE,0x012,0x022,0x000, // ^ rising edge
0x000,0x200,0x200,0x200,0x200,0x200,0x200,0x000, // _ under the dash
0x202,0x202,0x202,0x202,0x202,0x202,0x202,0x202, // ` battery itself empty
0x1C0,0x3E8,0x228,0x228,0x1F8,0x3F0,0x200,0x000, // a
0x202,0x3FE,0x1FE,0x220,0x220,0x3E0,0x1C0,0x000, // b
0x1E0,0x3F0,0x210,0x210,0x210,0x330,0x120,0x000, // c
0x000,0x1C0,0x3E0,0x220,0x222,0x3FE,0x3FE,0x000, // d
0x1E0,0x3F0,0x250,0x250,0x250,0x370,0x160,0x000, // e
0x000,0x220,0x3FC,0x3FE,0x222,0x002,0x004,0x000, // f
0x130,0x378,0x248,0x248,0x3F8,0x1F8,0x000,0x000, // g
0x202,0x3FE,0x3FE,0x020,0x010,0x3F0,0x3E0,0x000, // h
0x000,0x000,0x200,0x3F6,0x3F6,0x200,0x000,0x000, // i
0x000,0x100,0x300,0x210,0x3F6,0x1F6,0x000,0x000, // j
0x202,0x3FE,0x3FE,0x062,0x0F0,0x398,0x308,0x000, // k
0x000,0x000,0x202,0x3FE,0x3FE,0x200,0x000,0x000, // l
0x3F8,0x3F8,0x018,0x3F0,0x018,0x3F8,0x3F0,0x000, // m
0x008,0x3F8,0x3F0,0x008,0x008,0x3F8,0x3F0,0x000, // n
0x000,0x1F0,0x3F8,0x208,0x208,0x3F8,0x1F0,0x000, // o
0x208,0x3F8,0x3F0,0x248,0x048,0x078,0x030,0x000, // p
0x030,0x078,0x048,0x248,0x3F8,0x3F8,0x200,0x000, // q
0x208,0x3F8,0x3F0,0x218,0x008,0x018,0x030,0x000, // r
0x000,0x110,0x338,0x268,0x248,0x3D8,0x190,0x000, // s
0x010,0x010,0x1F8,0x3FC,0x210,0x310,0x100,0x000, // t
0x1F8,0x3F8,0x200,0x200,0x1F8,0x3F8,0x200,0x000, // u
0x000,0x0F8,0x1F8,0x300,0x300,0x1F8,0x0F8,0x000, // v
0x0F8,0x3F8,0x300,0x180,0x300,0x3F8,0x0F8,0x000, // w
0x208,0x318,0x1B0,0x0E0,0x1B0,0x318,0x208,0x000, // x
0x038,0x278,0x240,0x240,0x240,0x1F8,0x0F8,0x000, // y
0x318,0x388,0x2C8,0x268,0x238,0x318,0x000,0x000, // z
0x0F8,0x088,0x38E,0x022,0x2FA,0x2FA,0x2FA,0x2FA, // { battery head
0x000,0x000,0x000,0x3FE,0x3FE,0x000,0x000,0x000, // |
0x2FA,0x2FA,0x2FA,0x2FA,0x2FA,0x202,0x3FE,0x000, // } battery last
0x0F8,0x088,0x38E,0x202,0x202,0x202,0x202,0x202, // ~ battery empty head
//0x300,0x300,0x000}; // 3 pix wide proportional period (#127)
0x300,0x300,0x000,0x000,0x000,0x000,0x000,0x000, // 3 pix wide proportional period (#127)
0x03C,0X00A,0x03C,0x000,0x3E0,0x220,0x1C0,0x000, //"ad" i2c address word id (#128)
0x000,0x100,0x200,0x7FC,0X200,0X100,0X000,0X000};// down arrow (#129)
//0x000,0x004,0x002,0x1FF,0X002,0X004,0X000,0X000};// up arrow (#129)
char HexLookup[3];
sc8 DbScale[29]=
{-40,-37,-35,-33,-32,-31,-30,-29,-28,-27,-27,-26,-25,-25,-24,-24,-23,-23,-22,-22,
-21,-21,-21,-20,-20,-20,-20,-19,-19};
u16 Color[16] = { CYAN, // #0 TRACK1
YEL, // #1 TRACK2
PURPL, // #2 TRACK3
GRN, // #3 TRACK4
WHT, // #4 VERNIE
BLACK, // #5 SCRN
ORANGE, // #6 X_POSI
//BLUE, // #7 TRIGG
PURPL, // #7 TRIGG
CYAN, // #8 VERNIE
GRAY, // #9 GRID
WHT, // #10 TEXT
//GRN, // #11 TEXT2
//0x47E8, // #11 TEXT2 (bright green with 1/4 blue and red
0x87F0, // #11 TEXT2 (bright green with 1/2 blue and red
BLUE, // #12 TEXT3
//GRAY, // #13 BLOCK
0x7BEF, // #13 DARK GRAY
YEL_, // #14 SIDE
RED }; // #15 NOTE
trigg V_Trigg[4] = {// Value, Flag:( HID=0x04, UPDAT=0x02 )
{ 175, UPDAT + HID },
{ 116, UPDAT },
{ 75, UPDAT + HID },
{ 35, UPDAT + HID },
};
u16 LCD_Buffer[2][240];
u16 Base4Buffer[201];
u16 Base3Buffer[201];
u16 Base2Buffer[201];
/*******************************************************************************
Get_TAB_8x11
*******************************************************************************/
u16 Get_TAB_8x11(u8 Code, u8 Row)
{
return Char_TAB_8x11[((Code-0x22)*8)+Row];
}
/*******************************************************************************
Print_Str:
*******************************************************************************/
void Print_Str(u16 x0, u16 y0, u16 Type, u8 Mode, char *s)
{
signed short i, j, b;
__LCD_Set_Block(x0, LCD_X2, y0, y0+10);
if(SkipFirstRow==0){
for (j=0; j<11;++j){
if(Mode == 0) __LCD_SetPixl(Color[Type & 0x0F]); //Normal replace Display
else __LCD_SetPixl(Color[Type >> 0x8]); //Inverse replace Display
}
x0++; // a string to add a blank row
}
while (*s!=0) {
for(i=0;i<8;++i){
if((*s==0x20)||(*s==0x21)) b = 0x0000;
else b = Get_TAB_8x11(*s, i);
if((*s==0x21)&&(i==4)) break;
for(j=0;j<11;++j){
if((b << j)& 0x400) {
if(Mode == 0) __LCD_SetPixl(Color[Type >> 0x8]);
else __LCD_SetPixl(Color[Type & 0x0F]);
} else {
if(Mode == 0) __LCD_SetPixl(Color[Type & 0x0F]);
else __LCD_SetPixl(Color[Type >> 0x8]);
}
}
}
if(*s==0x21) x0 +=4; // display position horizontally +4 ("!" character - shift by 1/2 a character)
else x0 += 8; // display position horizontally +8
++s; // string pointer +1
}
__LCD_Set_Block(LCD_X1,LCD_X2,LCD_Y1,LCD_Y2); // restore the full-size window
}
void PrintConfigName(void){
char Str[2]={0,0};
u8 i;
u8 j=0;
if((_4_source!=SPEC_A)&&(_4_source!=SPEC_B)&&(ListOverride)){
for(i=204;i>126;i-=11){
Str[0]=ConfigFileName[j++]; //print config name
PrintText(0,i,Str);
}
}
__LCD_Set_Block(LCD_X1,LCD_X2,LCD_Y1,LCD_Y2); // restore the full-size window
}
void PrintText(u16 x, u8 y,char *s){
u8 i;
u16 j,b;
__LCD_Set_Block(x,x+6,y,y+10);
while (*s!=0) {
for(i=0;i<7;++i){
if((*s==32)||(*s==95)) b = 0x0000;
else b = Get_TAB_8x11(*s, i);
for(j=0;j<11;++j){
if((b << j)& 0x400) {
__LCD_SetPixl(WHT);
} else {
__LCD_SetPixl(BLACK);
}
}
}
x += 8; // display position horizontally +8
++s; // string pointer +1
}
}
/*******************************************************************************
Print_Str2:
*******************************************************************************/
void Print_Str2(u16 x0,u16 x1,u16 y0, u16 Type, u8 Mode, char *s,u8 LeadingBlanks,u8 TrailingBlanks)
{
u8 LeadingLine=0;
signed short i, j, b;
u8 xm, ym;
__LCD_Set_Block(x0, x1, y0, y0+21);
if(LeadingBlanks>10){ //special case to add 1 leading line
LeadingBlanks-=10;
LeadingLine=1;
}
for (i=0;i<LeadingBlanks;i++){
for (j=0;j<22;j++){
__LCD_SetPixl(BLACK); //Normal replace Display
}
x0++; // a string to add a blank row
}
if(LeadingLine){
for (j=0; j<44;++j){
if(Mode == 0) __LCD_SetPixl(Color[Type & 0x0F]); //Normal replace Display
else __LCD_SetPixl(Color[Type >> 0x8]); //Inverse replace Display
}
x0+=2; // a string to add a blank row
}
while (*s!=0) {
for(i=0;i<8;++i){
if((*s==0x20)||(*s==0x21)) b = 0x0000;
else b = Get_TAB_8x11(*s, i);
if((*s==0x21)&&(i==4)) break;
for(xm=0;xm<2;++xm){
for(j=0;j<11;++j){
if((b << j)& 0x400) {
if(Mode == 0) for(ym=0;ym<2;++ym) __LCD_SetPixl(Color[Type >> 0x8]);
else for(ym=0;ym<2;++ym) __LCD_SetPixl(Color[Type & 0x0F]);
} else {
if(Mode == 0) for(ym=0;ym<2;++ym) __LCD_SetPixl(Color[Type & 0x0F]);
else for(ym=0;ym<2;++ym) __LCD_SetPixl(Color[Type >> 0x8]);
}
}
}
}
if(*s==0x21) x0 +=8; // display position horizontally +4 ("!" character - shift by 1/2 a character)
else x0 += 16; // display position horizontally +8
++s; // string pointer +1
}
for (i=0;i<TrailingBlanks;i++){
for (j=0;j<22;j++){
__LCD_SetPixl(BLACK); //Normal replace Display
}
x0++; // a string to add a blank row
}
//__LCD_Set_Block(LCD_X1,LCD_X2,LCD_Y1,LCD_Y2); // restore the full-size window > Now done externally
}
/*******************************************d************************************
Draw_Row : to ease the DMA conflict, in two buffers alternately
*******************************************************************************/
void Draw_Row(u16 Row)
{
u8 i, y[8], Dot_Hide[8]; //,Zm=0,Zn=0;
s16 Tmp, m, n;
if((_T_base<11)&&((ClearLeadingEdge)||(_Mode==NORHLD))){
if(OsBufferLogicFlag){
skip = MIN_X+JumpCnt-(StartOffset+1);
}else{
skip = MIN_X+JumpCnt-_X_posi.Value;
if(OsChartFlag)skip--;
}
}else skip=0x7FFF;
if(ChartLogic())ChartIndex=(JumpCnt+11)-_X_posi.Value;else ChartIndex=0x7FFF;
if((Row > MIN_X)&&(Row <= MAX_X)){ // waveform display data preprocessing
m = (Row - MIN_X-1)* 4;
n = (Row - MIN_X) * 4;
for(i = 0; i < 8; i += 2) {
if( ((OsBufferLogicFlag)||(OsChartFlag)) &&(i>2))break; // Digital channels cannot be displayed in OS mode
Dot_Hide[i] = 0;
y[i] = TrackBuff[m + i/2]; // endpoint to extract
y[i+1] = TrackBuff[n + i/2];
if(y[i]>199)y[i]= 199; // bounds
else if(y[i]<1)y[i]=1;
if(y[i+1]>199)y[i+1]=199;
else if(y[i+1]<1)y[i+1]=1;
if(y[i] == y[i+1]){
if((y[i] == Y_BASE+1)||(y[i] == Y_SIZE-1)){
if( (((!OsBufferLogicFlag)||(OSAvg))&&(!OsChartFlag)) ||(y[i]==TrackBuff[m + 2+(i/2)])||
((y[i]==1)&&(TrackBuff[m + 2+(i/2)]==0)))Dot_Hide[i] = 1; //regular mode or not being drawn down by OS data
}else{ // else if((FPGAosFlag==0)||(!OsBufferLogicFlag)){
if((y[i] >= Y_BASE+2)&&(Hbold<1)) y[i] -= 1; // alt config, allows OS display bold on display 2 & 3
if((y[i+1] <= Y_BASE+Y_SIZE-2)&&(Hbold<2)) y[i+1] += 1; // non OS modes: 1, 2 or 3 bold lines
//if((y[i] >= Y_BASE+2)&&(Hbold<2)) y[i] -= 1; // OS modes: bold only on 3
//if((y[i+1] <= Y_BASE+Y_SIZE-2)&&(Hbold<1)) y[i+1] += 1;
//if((y[i+1] <= Y_BASE+Y_SIZE-2)&&((Hbold<1)||((OsBufferLogicFlag)&&(OS_Bold))))y[i+1] += 1;//Hyst OS_Bold flag for dir os bold on 2
}
}
if(y[i] > y[i+1]){ // order of
Tmp = y[i+1]; y[i+1]= y[i]; y[i]= Tmp;
}
if( ( ((OsBufferLogicFlag)&&(!OSAvg))||(OsChartFlag) ) &&(Row>(MIN_X+1))){
if(TrackBuff[m + 2+(i/2)]<TrackBuff[n + 2+(i/2)])y[i]=TrackBuff[m + 2+(i/2)];
else y[i]=TrackBuff[n + 2+(i/2)];
}
}
}
if((_Mode!=NORHLD)||((_State.Value==0)&&((Update)||(UpdateBackground==3)||(ClearPerst==2)))){
__Row_DMA_Ready();
__Point_SCR(Row, MIN_Y);
if(Row & 1){ // Odd row process
//----------------------- Fill the row base data -------------------------------
__Row_Copy(Base2Buffer, LCD_Buffer[0]);
//------------------------- Draw the Curve data --------------------------------
if((Row > MIN_X)&&(Row < MAX_X)){
LoadBuffer(Row,1,y,Dot_Hide,1);
//------------------------- Draw the Trigg Vernie data -------------------------
if (_Mode!=SCAN){
for(i=0;i<4;i++){
if((Title[TRIGG][SOURCE].Value == i)&&(Title[i][SOURCE].Value != HIDE))
LCD_Buffer[1][V_Trigg[i].Value] |= Color[i];
}
if(Title[TRIGG][SOURCE].Value == 4){ //display both trigger verniers in alt mode
LCD_Buffer[1][V_Trigg[TRACK1].Value] |= Color[0];
LCD_Buffer[1][V_Trigg[TRACK2].Value] |= Color[1];
}
//------------------------- Draw the X Vernie data -----------------------------
Tmp2=ScaleXposi();
if(Tmp2 > MIN_X) {
if((Row == Tmp2)&&((_X_posi.Flag & HID)== 0)){
for(i = 1; i < Y_SIZE; i+=3) LCD_Buffer[1][i] |= ORANGE; //X vernier
}
if((Row == Tmp2-1)||(Row == Tmp2+1)){ //mid portion for marks, aligned with borders, 2 outside pix
LCD_Buffer[1][Y_SIZE] = ORANGE;
LCD_Buffer[1][Y_BASE] = ORANGE;
}
if(Row == Tmp2)VernierMark(1,ORANGE);
}
}//if mode !scan
Tmp = MIN_X + Title[T_VERNIE][T1].Value;
if((Row == Tmp)&&((Title[T_VERNIE][T1].Flag & HID)== 0)){
for(i = 1; i < Y_SIZE; i+=3) LCD_Buffer[1][i] |= WHT; //T1 vernier
}
if((Row == Tmp-1)||(Row == Tmp+1)){ //mark mid portions minus mid
LCD_Buffer[1][Y_SIZE] = WHT;
LCD_Buffer[1][Y_BASE] = WHT;
}
if(Row == Tmp)VernierMark(1,WHT);
Tmp = MIN_X + Title[T_VERNIE][T2].Value;
if((Row == Tmp)&&((Title[T_VERNIE][T2].Flag & HID)== 0)){
for(i = 1; i < Y_SIZE; i+=3) LCD_Buffer[1][i] |= WHT;
}
if((Row == Tmp-1)||(Row == Tmp+1)){
LCD_Buffer[1][Y_SIZE] = WHT;
LCD_Buffer[1][Y_BASE] = WHT;
}
if(Row == Tmp)VernierMark(1,WHT);
}else{ //if row>min x & < max x //CHANGED
//------------------------- Draw the Y Vernie data -----------------------------
for(Tmp=-1;Tmp<2;Tmp++)LCD_Buffer[1][Title[V_VERNIE][V1].Value+Tmp] |= WHT;
for(Tmp=-1;Tmp<2;Tmp++)LCD_Buffer[1][Title[V_VERNIE][V2].Value+Tmp] |= WHT;
}
if((((Det&1)&&(_1_source))||((Det&2)&&(_2_source)))&&(ShowFFT==0))DisplayDbScale(Row,1,1);
LoadFFTbuffer(Row,1);
if(Sweep==1)DisplayDetFrqn(Row,1);else EnableMeterCalc=0;
if(!((Current==OUTPUT)&&(_Det==1)&&(_Kind==8)&&((Key_Buffer==K_INDEX_DEC)||(Key_Buffer==K_INDEX_INC)))){
if(UartLogic())PrintUart(Row,1,0);
if(i2cLogic())PrintUart(Row,1,1);
if(SpiLogic())PrintUart(Row,1,2);
}
if((Row<192)&&(ShowFFT==0)&&(((CursorDisplayTimer)||(FlagMeter))&&(EnableCursorDisplay)))
DisplayCursorValues(Row,1);
if((Row>311)&&(CursorDisplayTimer))
DisplayDeltaValues(Row,1);
if ((Current==9)&&(_Det==3))PrintDir(Row,1,0);
__LCD_Copy(LCD_Buffer[1], Y_SIZE+1); // Odd row Transitive
} else { // Even row process
//----------------------- Fill the row base data -------------------------------
if(Row+1 == MAX_X)Base1(1);
else if(Row+1 == MIN_X);
else if((Row+1 - MIN_X)%30 == 0) __Row_Copy(Base4Buffer, LCD_Buffer[1]);
else if((Row+1 - MIN_X)%6 == 0) __Row_Copy(Base3Buffer, LCD_Buffer[1]);
else __Row_Copy(Base2Buffer, LCD_Buffer[1]);
//------------------------- Draw the Y Vernie data -----------------------------
if((Row==MIN_X+1)||(Row==MAX_X-1)){
LCD_Buffer[0][Title[V_VERNIE][V1].Value] |= WHT;
LCD_Buffer[0][Title[V_VERNIE][V2].Value] |= WHT;
}
if((Title[V_VERNIE][V1].Flag & HID)== 0)
LCD_Buffer[0][Title[V_VERNIE][V1].Value] |= WHT;
if((Title[V_VERNIE][V2].Flag & HID)== 0)
LCD_Buffer[0][Title[V_VERNIE][V2].Value] |= WHT;
//------------------------- Draw the Curve data --------------------------------
if((Row > MIN_X)&&(Row < MAX_X))LoadBuffer(Row,0,y,Dot_Hide,1);
//------------------------- Draw the X Vernie data -----------------------------
if (_Mode!=SCAN){
Tmp2=ScaleXposi();
if(Tmp2 > MIN_X) {
if((Row == Tmp2)&&((_X_posi.Flag & HID)== 0)){
for(i = 1; i < Y_SIZE; i+=3) LCD_Buffer[0][i] |= ORANGE;
}
if((Row == Tmp2-1)||(Row == Tmp2+1)){
LCD_Buffer[0][Y_SIZE] = ORANGE;
LCD_Buffer[0][Y_BASE] = ORANGE;
}
if(Row == Tmp2)VernierMark(0,ORANGE);
}
}
Tmp = MIN_X + Title[T_VERNIE][T1].Value;
if((Row == Tmp)&&((Title[T_VERNIE][T1].Flag & HID)== 0)){
for(i = 1; i < Y_SIZE; i+=3) LCD_Buffer[0][i] |= WHT;
}
if((Row == Tmp-1)||(Row == Tmp+1)){
LCD_Buffer[0][Y_SIZE] = WHT;
LCD_Buffer[0][Y_BASE] = WHT;
}
if(Row == Tmp)VernierMark(0,WHT);
Tmp = MIN_X + Title[T_VERNIE][T2].Value;
if((Row == Tmp)&&((Title[T_VERNIE][T2].Flag & HID)== 0)){
for(i = 1; i < Y_SIZE; i+=3) LCD_Buffer[0][i] |= WHT;
}
if((Row == Tmp-1)||(Row == Tmp+1)){
LCD_Buffer[0][Y_SIZE] = WHT;
LCD_Buffer[0][Y_BASE] = WHT;
}
if(Row == Tmp)VernierMark(0,WHT);
if((((Det&1)&&(_1_source))||((Det&2)&&(_2_source)))&&(ShowFFT==0))DisplayDbScale(Row,0,1);
LoadFFTbuffer(Row,0);
if(Sweep==1)DisplayDetFrqn(Row,0);else EnableMeterCalc=0;
if(!((Current==OUTPUT)&&(_Det==1)&&(_Kind==8)&&((Key_Buffer==K_INDEX_DEC)||(Key_Buffer==K_INDEX_INC)))){
if(UartLogic())PrintUart(Row,0,0);
if(i2cLogic())PrintUart(Row,0,1);
if(SpiLogic())PrintUart(Row,0,2);
}
if((Row<192)&&(ShowFFT==0)&&(((CursorDisplayTimer)||(FlagMeter))&&(EnableCursorDisplay)))
DisplayCursorValues(Row,0);
if((Row>311)&&(CursorDisplayTimer))
DisplayDeltaValues(Row,0);
if ((Current==9)&&(_Det==3))PrintDir(Row,0,0);
__LCD_Copy(LCD_Buffer[0], Y_SIZE+1); // Even row Transitive
}//even row process
}else if((_State.Value==0)&&(Row > MIN_X)&&(Row < MAX_X)){ //persistence mode
if((_T_base>10)||(Row!=skip)){
if(ClearPerst!=1)LoadBuffer(Row,0,y,Dot_Hide,0); //ClearPerst==1 denotes variable timer to display after loading X frames
__Point_SCR(Row, MIN_Y);
}
LoadFFTbuffer(Row,0);
}
}
/***************u16 Color[16] = { CYAN, // #0 TRACK1
YEL, // #1 TRACK2
PURPL, // #2 TRACK3
GRN, // #3 TRACK4
WHT, // #4 VERNIE
BLACK, // #5 SCRN
ORANGE, // #6 X_POSI
BLUE, // #7 TRIGG
CYAN, // #8 VERNIE
GRAY, // #9 GRID
WHT, // #10 TEXT
GRN, // #11 TEXT2
BLUE, // #12 TEXT3
GRAY, // #13 BLOCK
YEL, // #14 SIDE
RED }; // #15 NOTE
****************************************************************
Draw_Window :
*******************************************************************************/
void Draw_Window(void)
{
s32 Tmp;
u16 Row,i,Offset,SpecLimit;
s16 h=0;
u16 TrackColor=0;
u8 j,end=0;
if(FlagMeter)Limit=213;else Limit=299;
ListBottom=174+11;
for(i=0;i<15;i++){if(Label[i][0]==0)break;else ListBottom-=11;}
Base1(1);
__Row_DMA_Ready();
__Row_Copy(Base2Buffer, LCD_Buffer[0]);
//if(_4_source>13)COLOR_INDEX=0x0500; else COLOR_INDEX=0x0501; //sets fft values display to source channel color (need to change uc)
if(((ShowFFT==1)||(_4_source==SPEC_A))&&(_Mode!=X_Y)){
if(_T_base==8){ //special case to align with data flow and other timebases
Delayms(2);
Count_FPS++;
Delayms(4);
}
if(DownConvertMode==0){
FFTflag=1;
Display_Value(FRQ); //calculate NFreq using meter routine, sets N_UNIT and ShiftDigits for proper display
FFTflag=0;
}
PeakFreq = 2; //Called for as array index for LCD_Buffer @ -2. Less than 2 could put index out of bounds
imax = 0;
for (i=1; i < FFTSize/2; i++) {
if (PeakFreq < fi[i]) {
PeakFreq= fi[i] ;
imax = i;
}
}
if((AutoFFT==1)&&((EnableFFT==2)||(_T_base>7)||(freerun))){ //auto fft is on if =1
if(FFTGain>7)FFTGain=7; //auto gain limit
if((PeakFreq==198)&&(FFTGain>0))FFTGain--;
else{
if(PeakFreq<100){
if(FFTGain<7)FFTGain++;
if((PeakFreq<78)&&(FFTGain<7))FFTGain++;
}
}
}
if(EnableFFT==2)EnableFFT=0;
if(DownConvertMode==0){
Int2Str(NFreqStr, NFreq,N_UNIT, 4, UNSIGN,ShiftDigits);
Int2Str(FreqDivStr, ((NFreq / FFTBins) * 30),N_UNIT, 4, UNSIGN,ShiftDigits);
Tmp=(NFreq/FFTBins)*_T1;
if((ChartLogic())&&(Tmp<1000))Tmp=0x80000000;
Int2Str(FreqT1Str, Tmp,N_UNIT, 4, UNSIGN,ShiftDigits);
Tmp=(NFreq/FFTBins)*imax;
if((ChartLogic())&&(Tmp<1000))Tmp=0x80000000;
if (imax>0)Int2Str(PeakFreqStr, Tmp, N_UNIT, 4, UNSIGN,ShiftDigits);
}
}
if ((_Mode!=X_Y)&&(((_4_source!=SPEC_A)&&(_4_source!=SPEC_B))||(ChartLogic()))){
Count_FPS++;
if((_Mode==NORHLD)&&(PerstFrameNumber>0)){
if(ClearPerst==0){
if(FrameCount>PerstFrameNumber){
FrameCount=0;
ClearPerst=1;
//if(PerstFrameNumber>50)PersHoldTimer=50;else PersHoldTimer=PerstFrameNumber; //adds delay after x frames displayed
PersHoldTimer=0; //no delay
}else if(FrameEndFlag)FrameCount++;
}
if((ClearPerst==1)&&(PersHoldTimer==0))ClearPerst=2;
}else ClearPerst=0;
if(_4_source>11) NFreqParse(1,0);
TcurDelta=(((_T2-_T1)*_Kp1)+512)/1024;
if(!((Current==OUTPUT)&&(_Det==1)&&(_Kind==8)&&((Key_Buffer==K_INDEX_DEC)||(Key_Buffer==K_INDEX_INC)))){
if(UartLogic())Uart();
if(i2cLogic())i2c();
if(SpiLogic())Spi();
}
for(Row = MIN_X; Row <= MAX_X; ++Row){
if(!(OsBufferLogicFlag||OsChartFlag)){
if (Row<(discard + MIN_X)){ //blanks first few pixels of traces to eliminate noise
Color[TR_1]=0x0000; //process makes these into a hor line so "low brightness"
Color[TR_2]=0x0000; //in draw row does not turn them on
}
if (Row>(404-Rdiscard)){ //post-signal blanking for dig ch triggering jitter stabilization
Color[TR_1]=0x0000;
Color[TR_2]=0x0000; //404 aligns with x_size @ 392 and IP routine bailing out @ 392
Color[TR_3]=0x0000;
Color[TR_4]=0x0000;
}
if ((Row>382)&&(Row<398)){ //post trace blanking of detector trace
if((Det&1)&&_1_source)Color[TR_1]=0x0000;
if((Det&2)&&_2_source)Color[TR_2]=0x0000;
}
if ((Title[TRIGG][SOURCE].Value<2)||(Title[TRIGG][SOURCE].Value==4))end=discard+5; else end=discard; //was 4, changed to 5
if (Row<(MIN_X+end)){ //blanks first pixels shifted in dig channels to align with analog chs
Color[TR_3]=0x0000;
}
if ((_4_source==A_add_B)||(_4_source==A_sub_B))end=discard;
if (Row<(MIN_X+end)){ //blanks first pixels shifted in dig channels to align with analog chs
Color[TR_4]=0x0000;
}
} //if !OsBufferLogicFlag
Draw_Row(Row); //Modo oscilloscopio
if((Row<(discard+5+MIN_X))||(Row>(404-Rdiscard))) { //was4, changed to 5
Color[TR_1]=0xFFE0; //return to correct colors
Color[TR_2]=0x07FF;
Color[TR_3]=0xF81F;
Color[TR_4]=0x07E0;
}
if ((Row>382)&&(Row<398)){ //post trace blanking of detector trace, return to correct colors
if ((Det&1)&&_1_source)Color[TR_1]=0xFFE0;
if((Det&2)&&_2_source)Color[TR_2]=0x07FF;
}
} //end for loop
} //if mode !XY...
if(ClearPerst==2)ClearPerst=0;
if (_Mode==X_Y){
PrintConfigName();
Count_FPS++;
FactorX=((s16)OffsetX-100)+((-ADCoffset)+Ka1[_A_Range]);
FactorY=((s16)OffsetY-100)+((-ADCoffset)+Kb1[_B_Range]);
FactorY13=FactorY+13; //for direct screen access, need offset 13
if(EditListActive(1))XYLimit=310;else XYLimit=234;
for(Row = MIN_X; Row <= MAX_X; ++Row) LoadXYBuffer(Row);
__LCD_DMA_Ready();
__Row_DMA_Ready();
if((XYper)&&(EditListActive(1)))PrintDir(0,0,1);
InitXY=0;
}
if(((_4_source==SPEC_A)||(_4_source==SPEC_B))&&(!ChartLogic())){
if((_Mode!=X_Y)&&(_State.Value==0)&&((FrameEndFlag==1)||((SpecFrameCount>FrameCountRef[_T_base])&&((_T_base>10) ||(_Mode==SCAN) ||
((FrameEndFlag==0)&&(__Get(FIFO_START)==0)))))){ //spectrograph/MAP modes
if(SpecMode>0){
if(_1_source){h=(a_Max-a_Min)/(4/SpecMode);TrackColor=CYAN_;} //scale and remove offset using last frame
else if(_2_source){h=(b_Max-b_Min)/(4/SpecMode);TrackColor=YEL_;} //done vars (not accumulated)
if(h<0)h=-h;
}
if((FrameEndFlag==0)&&(_Mode!=AUTO)&&(_Mode!=SCAN)&&(__Get(FIFO_START)==0)){
for (i=0; i<MAX_X; i++){TrackBuff[i*4]=0;TrackBuff[(i*4)+1]=0;} //clear track data if triggering lost
ClearFFTbuffer();
h=0; //clear envelope
}
if(_4_source==SPEC_B){ //MAP mode
Count_FPS++;
if (SpecLine<MIN_Y)SpecLine=MAX_Y;
if ((EditListActive(1))&&(SpecLine<(MAX_Y-15))){
if(SpecLine>(ListBottom+MIN_Y))SpecLimit=Limit;else SpecLimit=X_SIZE;
}else SpecLimit=X_SIZE;
for (i=0; i<MAX_X+1; i++) { //max_x=397 with meters off
__Point_SCR(i,SpecLine);
if((i>MIN_X)&&(i<X_SIZE)){
if(i>SpecLimit)continue;
if(_1_source)__LCD_SetPixl(ColorIndexGen(TrackBuff[(i-6)*4]));
else if(_2_source)__LCD_SetPixl(ColorIndexGen(TrackBuff[((i-6)*4)+1]));
}else if((i>3)&&(i<9)&&(SpecLine>(MIN_Y+1))){
__LCD_SetPixl(0);
DrawPixel(i,SpecLine-1,YEL_);
if(_T_base>9)DrawPixel(i,SpecLine-2,YEL_);
}else __LCD_SetPixl(0);
}
if(FlagMeter==0)for(i=397;i<400;i++)DrawPixel(i,SpecLine,0);
if((SpecLine==MIN_Y)||(SpecLine==MAX_Y))for(i=0;i<MAX_X;i++)DrawPixel(i,SpecLine,GRAY);
SpecLine--;
}
if(_4_source==SPEC_A){ //now defines A/B spec and envelope display
Count_FPS++;
if((SpecRow==25)||(UpdateScale)){ //>>>> need to reset specrow @ 25 every time mode is engaged
ClearScreenArea(0,26,12,214);
UpdateScale=0;
Print_Str(0,193+MIN_Y,0x050E,INV,"sec");
if(_T_base<2)Offset=128;else Offset=512;
for(i=34;i<195;i+=34){ //draw freq scale in spec mode
for(j=20;j<25;j++)DrawPixel(j,i+MIN_Y,YEL_);
Tmp=((NFreq+Offset)/255)*i;
Int2Str(NFreqStr,Tmp,N_UNIT, 4, UNSIGN,ShiftDigits);
NFreqParse(0,1);
if(Nfreq[2]==46){Nfreq[2]=0;j=4;}else j=0; //remove trailing periods, shift over
Print_Str(j,i+(MIN_Y+2),0x0508,INV,Nfreq);
Print_Str(4,i+3,0x0508,INV,Nsuffix);
}
}
if(SpecRow==25)SecondsTick=0;
if(AutoFFT==0){for(i=0;i<200;i++){if(fi[i]<51){fi[i]=(fi[i]*fi[i]*fi[i])/2500;}}} // x^3/50^2 noise suppression in log mode
for (i=Y_BASE+1;i<200;i++) {
if(SpecMode==0){
LCD_Buffer[SpecRow & 1][i] = ColorIndexGen(fi[i-Y_BASE]); //spec display only
}else if(SpecMode==1){
if((i>=(150-h))&&(i<=(150+h))) //spec + envelope display(1/2size)
LCD_Buffer[SpecRow & 1][i] = TrackColor;
else LCD_Buffer[SpecRow & 1][i] = ColorIndexGen(fi[i-Y_BASE]);
}else{
if((i>=(100-h))&&(i<=(100+h)))LCD_Buffer[SpecRow & 1][i] = TrackColor; //envelope display only full size
else LCD_Buffer[SpecRow & 1][i] = BLACK;
}
}
if ((EditListActive(1))&&(SpecRow>Limit)){
PrintDir(SpecRow,SpecRow&1,0);
}
if(SpecRow<MAX_X-1)for(i=209;i<213;i++)DrawPixel(SpecRow+2,i,YEL_); //moving cursor
if ((_T_base>5)&&(SecondsTick==0)&&(SpecRow<MAX_X-1)){
for(i=209;i<213;i++)DrawPixel(SpecRow-1,i,YEL_); //seconds ticks
SecondsTick=48;
}
__Point_SCR(SpecRow, MIN_Y);
__LCD_Copy(LCD_Buffer[SpecRow & 1], Y_SIZE+1);
SpecRow++;
if (SpecRow > MAX_X) SpecRow = 25;
}
if(_Mode==AUTO)SpecFrameCount=3;else SpecFrameCount=0; //reset interrupt based frame timing
} //if mode != xy
} // is in spec a or b
if((FrameEndFlag)&&(ResetEnableFFT==0))EnableFFT=1;
ResetEnableFFT=0;
FrameEndFlag=0;
RowMemPeak = RowMem;
__LCD_DMA_Ready();
__Row_DMA_Ready();
if ((Current==9)&&(_Det==3)&&((ListLogic())||(_Mode==NORHLD)))PrintDir(0,0,1);
}
/*******************************************************************************
Draw_Mark : Routine per un marcatore laterale
*******************************************************************************/
void Draw_Mark(u16 m, u16 n)
{
u16 i, j, Tmp;
V_Trigg[2].Value=Title[2][POSI].Value + 10; // show ch3 and 4 trigger points at their actual values
V_Trigg[3].Value=Title[3][POSI].Value + 10;
if(m < 4) { if((Title[m][POSI].Value > 200-3)||(Title[m][POSI].Value <3))return; } //shut off at bottom too
else { if((V_Trigg[n].Value > 200-3)||(V_Trigg[n].Value <3))return; }
for(i = 0; i <= 10; ++i){
if(i < 7){
if(m < 4){ //Y position mark
Tmp = Mark_TAB[m][i];
__Point_SCR(i, Title[m][POSI].Value +(MIN_Y-4));
} else {
Tmp = Mark_TAB[4][i];
__Point_SCR(i, V_Trigg[n].Value +(MIN_Y-4)); //Trigg vernier position mark
}
for(j = 0; j < 8; ++j){
if(Tmp & 1) __LCD_SetPixl(BLACK);
else __LCD_SetPixl(Color[n]);
Tmp >>= 1;
}
__LCD_SetPixl(Color[n]);
} else {
if(m < 4){
__Point_SCR(i, Title[m][POSI].Value +(MIN_Y-10)+ i);
for(j=Title[m][POSI].Value+(MIN_Y-10)+i;j<(Title[m][POSI].Value+(MIN_Y+11)-i);++j) //Y position mark
__LCD_SetPixl(Color[n]);
} else {
__Point_SCR(i, V_Trigg[n].Value +(MIN_Y-10)+ i);
for(j=V_Trigg[n].Value+(MIN_Y-10)+i;j<(V_Trigg[n].Value+(MIN_Y+11)-i);++j) //Trigg vernier position mark
__LCD_SetPixl(Color[n]);
}
}
}
}
/*******************************************************************************
Update_Mark : Disegna Marcatori laterali
*******************************************************************************/
void Update_Mark(void)
{
s16 i, Tmp;
u8 j=0;
__Row_DMA_Ready();
ClearScreenArea(0,11,MIN_Y-2,MAX_Y+3);
if(ConfNameTimer>0)PrintConfigName(); //marks cover text
for(i=0;i<4;i++){
if(Title[i][SOURCE].Value!=HIDE)Draw_Mark(i,i); // Display Track mark
if(_Tr_source==i)Draw_Mark(TRIGG,i); // Display Trigg mark
}