-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathSDT.ino
3175 lines (2859 loc) · 133 KB
/
SDT.ino
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
/*********************************************************************************************
This comment block must appear in the load page (e.g., main() or setup()) in any source code
that uses code presented as whole or part of the T41-EP source code.
(c) Frank Dziock, DD4WH, 2020_05_8
"TEENSY CONVOLUTION SDR" substantially modified by Jack Purdum, W8TEE, and Al Peter, AC8GY
This software is made available under the GNU GPLv3 license agreement. If commercial use of this
software is planned, we would appreciate it if the interested parties contact Jack Purdum, W8TEE,
and Al Peter, AC8GY.
Any and all other uses, written or implied, by the GPLv3 license are forbidden without written
permission from from Jack Purdum, W8TEE, and Al Peter, AC8GY.
V049.3 October XX, 20XX Greg Raven (KF5N)
1. Fixed muting after calibration.
2. Minor comment edits.
3. Fixed mic compression bug which caused default to -15 dB.
4. Added ITU Region 3.
5. The transmit equalizer has a default profile based on Neville's testing for SSB voice.
6. SSB transmit compression defaults changed to Neville's settings.
7. Morse decode will print last character and then a space.
V049.2 October 16, 2023 Greg Raven (KF5N)
1. Changed folder to SDT and file to SDT.ino.
2. Mic compression indicator fixed.
3. Updates to fix remaining paddle flip issues.
4. Mic compressor fixes.
5. CW sidetone adjustment via encoder.
6. Changed volume control to logarithmic.
7. Changed instances of currentBandA to currentBand in CW Excite.
8. Removed Serial print statement.
9. Removed Serial print statements from volume control.
10. Increased audio memory to 450.
11. Working sidetone adjust with encoder.
12. Perfect log responding volume control for sidetone.
13. Inserted G0ORX main loop efficiency improvement. Si5351 CLK2 is now set to PLLB.
14. John G0ORX AGC enhancements.
15. AGC updates.
16. Fixed minor problem with RX/TX indicator showing TX coming out of setup().
17. Added defines for ITU_REGION and TIME24H for internationalization. (DB2OO)
18. S-Meter bar aligned to dBm value (DB2OO)
19. Fixed override of EEPROM defaults in EEPROMRead(). (DB2OO)
20. Jack changed encoder pins for 4SQRP.
21. Changed ENCODER3_ENCODER_A/B to FINETUNE_ENCODER_A/B.
22. Updated SetBandRelay() function to toggle only necessary GPOs.
23. Fixed receiver outage after sidetone adjust. Sidetone default = 50.0
24. S-Meter: added debug code and rfGainAllBands (DB2OO)
25. Add additional debug info in DisplaydbM() (DB2OO)
26. Removed attribute DMAMEM from audioSpectBuffer because it breaks the S-meter.
27. Added Jack's code to change color of version when running 4SQRP.
28. Deleted increment variable in Encoders.cpp. Was causing a compile warning.
29. ITU_REGION set to 2, TCXO_25MHZ undefined, DEBUG_SMETER undefined.
30. Added comments to ITU_REGION.
31. Updated changes list in SDT.ino. Added macro to increment variable in Encoders.cpp to eliminate warning.
V049.1 Aug 21, 2023 Greg Raven (KF5N)
1. Changed 3 instances of VFO_A to activeVFO in function ButtonFrequencyEntry().
2. Added TxRxFreq = centerFreq to EEPROMRead() to fix frequency related bugs.
3. Added clean-up code to CopySDtoEEPROM() in function EEPROMOptions().
4. Fixes for calibration graphics.
5. Changed 2 instances of currentFreqA to currentFreq in ResetTuning() function.
6. Previous fix to CopySDToEEPROM() accidentally overwritten. This puts it back.
7. Reactivated text in Direct Frequency Entry.
8. Replaced keyer symbolic constants with appropriate global variables.
9. Removed call to CopyEEPROMToSD() from EEPROMStartup().
10. Bypass paddle flip in the case of a straight key.
11. Frequency overwrite, Bearing, exit, and Direct Entry updates.
12. Fixed receive cal not saving, cal graphics, SSB power cal.
13. Revised RX cal again because it was saving 1X zoom.
14. Restored option for KD0RC switch matrix calibration code.
15. A significant refactoring of calibration.
16. Fix for keyer click-clack.
17. Keyer lower limit 5 WPM.
18. Decoder was modifying keyer WPM.
V049a Aug 06, 2023, 2023 Jack Purdum (W8TEE)
1. Corrected paddle flip issue
2. Made several changes to set sdCardPresent to the proper value when tested.
3. Changed frequency display to account for new font.
4. Raised the frequencies by 2 pixels as the new font made then display too low and affect band info
5. If only 1 map file found, no longer asks you to pick. It selects automatically the one file.
FLASH: code:244340, data:123488, headers:8996 free for files:7749640
RAM1: variables:206304, code:240792, padding:21352 free for local variables:55840
RAM2: variables:342944 free for malloc/new:181344
V049 Aug 03, 2023, 2023 Jack Purdum (W8TEE)
1. Numerous UI and formating fixes
FLASH: code:243636, data:123488, headers:8676 free for files:7750664
RAM1: variables:206304, code:240088, padding:22056 free for local variables:55840
RAM2: variables:342944 free for malloc/new:181344
V048g July 31, 2023 Jack Purdum (W8TEE)
1. If you have multiple QTH files for the bearing feature, it did not clear screen properly. Fixed.
2. CW filter graphics managed between mode, band, and VFO changes.
3. Several tuning fixes by Greg (KF5N)
FLASH: code:243572, data:123488, headers:8740 free for files:7750664
RAM1: variables:206304, code:240024, padding:22120 free for local variables:55840
RAM2: variables:342944 free for malloc/new:181344
V048e July 30, 2023 Jack Purdum (W8TEE)
1. Really made EEPROMSaveDefaults2() the function to initialize the EEPROM struct
2. Noise filters were not completely erased in all cases after a change. Fixed.
3. Fixed overrun of spectrum floor if a negative number entered.
4. If you have multiple QTH files for the bearing feature, it did not clear screen properly. Fixed.
FLASH: code:246388, data:123488, headers:8996 free for files:7747592
RAM1: variables:206304, code:242840, padding:19304 free for local variables:55840
RAM2: variables:342944 free for malloc/new:181344
V048d July 29, 2023 Jack Purdum (W8TEE)
1. Made EEPROMSaveDefaults2() the function to initialize the EEPROM struct
FLASH: code:246260, data:123488, headers:9124 free for files:7747592
RAM1: variables:206304, code:242712, padding:19432 free for local variables:55840
RAM2: variables:342944 free for malloc/new:181344
V048c July 28, 2023 Jack Purdum (W8TEE)
1. Removed string literals for EEPROM switch values from EEPROMToSD() function call.
2. Reformatted the EEPROMShow() output.
FLASH: code:246388, data:123488, headers:8996 free for files:7747592
RAM1: variables:206304, code:242840, padding:19304 free for local variables:55840
RAM2: variables:342944 free for malloc/new:181344
V048b July 28, 2023 Jack Purdum (W8TEE)
1. More bug fixes by Greg, mainly in the EEPROM code.
FLASH: code:242804, data:123488, headers:8484 free for files:7751688
RAM1: variables:206304, code:239256, padding:22888 free for local variables:55840
RAM2: variables:342944 free for malloc/new:181344
V048a July 27, 2023 Jack Purdum (W8TEE)
1. FIxed EEPROMWrite() bug.
FLASH: code:249780, data:131680, headers:8676 free for files:7736328
RAM1: variables:214496, code:246232, padding:15912 free for local variables:47648
RAM2: variables:342944 free for malloc/new:181344
V048 July 26, 2023 Jack Purdum (W8TEE)
1. Integrated Greg's display and encoder changes
2. Fixed the EEPROM to SD copy routine
FLASH: code:249780, data:131680, headers:8676 free for files:7736328
RAM1: variables:214496, code:246232, padding:15912 free for local variables:47648
RAM2: variables:342944 free for malloc/new:181344
V047k July 22, 2023 Greg KF5N
1. Update to calibration for improved button response.
2. Added additional improvements for audio quality.
3. Added user settable noise floor by band feature.
4. Implemented fix for VFO relay switching bug.
5. Fixed EEPROM so separator character displays correctly on EEPROM/SD dump
FLASH: code:239700, data:131680, headers:8516 free for files:7746568
RAM1: variables:214496, code:236152, padding:25992 free for local variables:47648
RAM2: variables:342944 free for malloc/new:181344
V047i July 18, 2023 Jack Purdum (W8TEE)
1. Removed SD_CARD_PRESENT and set global sdCardPresent by call to SDPresentCheck()
FLASH: code:237972, data:134128, headers:8820 free for files:7745544
RAM1: variables:214496, code:234424, padding:27720 free for local variables:47648
RAM2: variables:342944 free for malloc/new:181344
V047h July 17, 2023 Jack Purdum (W8TEE)
1. EEPROM Cancel option was not shown on secondary menu.
2. currentFrreqA and currentFreqB now properly stored in EEPROM when Saved.
FLASH: code:233556, data:132040, headers:9180 free for files:7751688
RAM1: variables:212384, code:230008, padding:32136 free for local variables:49760
RAM2: variables:342944 free for malloc/new:181344
V047g July 17, 2023 Jack Purdum (W8TEE)
1. Move several constants to MyConfigurationFile.h and rearranged them
2. Increased Splash delay to 4 seconds
FLASH: code:233556, data:132040, headers:9180 free for files:7751688
RAM1: variables:212384, code:230008, padding:32136 free for local variables:49760
RAM2: variables:342944 free for malloc/new:181344
V047f July 15, 2023 Jack Purdum (W8TEE)
1. Change ShowFrequency() and FormatFrequency() to properly align digits
2. Fixed EEPROM sync indicator for main tune changes
3. Commented clearScreen function call in DrawBandWidthIndicatorBar() to clean up audio. KF5N
4. DMAMEM attribute added to TX equalizer buffers to free up stack space. KF5N
5. Consolidated Si5351 start-up code into setup() function. KF5N
6. Revised waterfall. User needs to adjust noise level (pixels above axis) to just above bottom of spectrum display. KF5N
FLASH: code:237076, data:134064, headers:8756 free for files:7746568
RAM1: variables:228832, code:233528, padding:28616 free for local variables:33312
RAM2: variables:328544 free for malloc/new:195744
Vo47e July 15, 2023 Jack Purdum (W8TEE)
1. Changed the font to use the onboard font for frequency display
2. Change SHowFrequency() and FormatFrequency() to accommodate new font.
FLASH: code:237012, data:134064, headers:8820 free for files:7746568
RAM1: variables:228832, code:233464, padding:28680 free for local variables:33312
RAM2: variables:328544 free for malloc/new:195744
V047c July 14, 2023 Jack Purdum (W8TEE)
1. Merged Greg's latest code with Jack's. The main difference is the calibration and bearing code, plus the new header file.
2. Main tuning fixed
3. Missing dB scale added back and prints correctly now
FLASH: code:236820, data:134064, headers:9012 free for files:7746568
RAM1: variables:228832, code:233272, padding:28872 free for local variables:33312
RAM2: variables:328544 free for malloc/new:195744
V047b July 13, 2023 Jack Purdum (W8TEE)
1. FIxed the "waterfall stripe" per Greg email.
FLASH: code:232980, data:144160, headers:8900 free for files:7740424
RAM1: variables:227808, code:229432, padding:32712 free for local variables:34336
RAM2: variables:328544 free for malloc/new:195744
V047a July 3, 2023 Jack Purdum (W8TEE)
1. Started work on the use of a user configuration file. Added new struct to hold map names, longitude, latitude.
2. Added code to allow for up to 10 map files for different QTHs. They appear below starting at approximately line 300.
3. Added new menu, Bearing, to the front of the menu list. It allows you to select the map file to use in bearing calculations
4. Push button 18 activates the bearing calculation. Assumes the file has already been selected. Press 18 again when done. 17 backspaces.
5. Removed several debugging Serial.print() calls.
6. Refactored code in numerous places.
7. FIxed the wonky color problem if you entered a call prefix that doesn't exist.
8. Moved several symbolic constants from SDT.h to MyCOnfigurationFile.h.
FLASH: code:232980, data:144160, headers:8900 free for files:7740424
RAM1: variables:227808, code:229432, padding:32712 free for local variables:34336
RAM2: variables:328544 free for malloc/new:195744
V046f July 1, 2023 Jack Purdum (W8TEE)
1. Changed FREQ_SEP_CHARACTER in SDT.h to comma as use in FormatFrequency() in Display.cpp, near line 648
2. Removed unused and duplicated symbolic constants.
FLASH: code:233428, data:144160, headers:8452 free for files:7740424
RAM1: variables:227808, code:229880, padding:32264 free for local variables:34336
RAM2: variables:328544 free for malloc/new:195744
V046e June 30, 2023 Jack Purdum (W8TEE) and includes changes by Greg:
1. Changed the way EEPROM works at startup. It reads the EEPROM and then checks to see if the version numbers match. If so, control
returns to setup() and continues. IF EEPROM is virgin or has a value in the switch matrix that doesn't make sense. The code is
the last function in EEPROM.cpp and is heavily commented.
FLASH: code:229300, data:143144, headers:8476 free for files:7745544
RAM1: variables:226592, code:225752, padding:3624 free for local variables:68320
RAM2: variables:328544 free for malloc/new:195744
V046d June 27, 2023 Jack Purdum (W8TEE) and includes changes by Greg:
1. Added Greg's changes to fix the SSB flip
2. Fixed sync indicators for EEPROM and SD. Those variables stored in EEPROM may differ from their
current values (e.g. WPM) and this causes the EEPROM sync indicator to turn on. SD is RED for no
SD card, green otherwise.
3. During calibrate, automatically switch to CW mode and set spectrum scale to 10 dB
4. Changed menu index on startup to 0. This allows for Menu Down to get to Calibrate option quickly.
5. Formattted power out to use only 1 decimal place
FLASH: code:231284, data:144320, headers:8388 free for files:7742472
RAM1: variables:227616, code:227736, padding:1640 free for local variables:67296
RAM2: variables:328544 free for malloc/new:195744
V046c June 25, 2023 Jack Purdum (W8TEE) and includes changes by Greg:
1. Added symbolic constant UPDATE_SWITCH_MATRIX that is set to 1 by default, which means run the switch calibration code. If set to 0,
the call to update the switch values is bypassed and the values stored in EEPROM are used.
2. Removed the call to EEPROMSaveDefaults() from EEPROMStartup() because the defaults would be overwritten if just the version number
was changed. If the user wants to save the defaults, they can uncomment the call in setup().
FLASH: code:231284, data:144320, headers:8388 free for files:7742472
RAM1: variables:227616, code:227736, padding:1640 free for local variables:67296
RAM2: variables:328544 free for malloc/new:195744
V046b June 16, 2023 Jack Purdum (W8TEE) and includes changes by Greg:
1. Add PROGMEM to line 97 in Bearing.cpp (John's change).
2. In EEPROM.cpp, change the strcpy function to strncpy in 2 places. Add the parameter 10 as the third parameter. Do this on lines 18 and 160.
3. In SDTVer045.ino, change line 1032 to:
int audioVolume = 30;
4. In SDTVer045.ino, comment line 698, thereby removing the global variable audioTemp.
Also remove it from line 673 of SDT.h (the extern).
Next, add this line
int audioTemp;
to the function DoCWReceiveProcessing in CWProcessing.cpp.
This is line 40 (remove the commented line).
5. in SDTVer045.ino, remove two calls to the function SetFreq() at lines 2493 and 2617.
6. Add new buffer play code in the file Process2.cpp at line 360.
7. Remove redundant call to ShowSpectrum() at line 246.
8. Fixed warning of uninitialized use of R[]. It actually was initialized via a pointer,
but the compiler doesn't recognize that. Used memset() call in DSP_Fn.cpp, line 103.
Unneeded, but it bugged me (JJP).
9. Change Fine Tune increment so it may have values 10, 50, 250, and 500. Press the Fine Tune inrement button
and it advances to the next value and wraps at the end. EEPROM sync indicator displayed to show this value
is different than what's in EEPROM. Use meu EEPROM-->Save Current to persist it.
10. Fixed the "ghosting" image after CW xmit is finished.
V045 May 12, 2023 Jack Purdum (W8TEE):
fixed: Al reviewed, fixed, and test all of the Calibrate routines
fixed: The IDEs compiler was replaced with the latest incarnation, leading to an increase in the number of warnings. We have fixed those where possible. (Some can't be because of the way the parser works.)
fixed: The fine tune increment is now stored in EEPROM
FLASH: code:230964, data:144400, headers:8628 free for files:7742472
RAM1: variables:256288, code:227416, padding:1960 free for local variables:38624
RAM2: variables:328544 free for malloc/new:195744
V040a Feb 01, 2023 Jack Purdum (W8TEE):
Fixed: used wrong character array for first member of the CopyEEPROMToSD() routine.
Added: to main increment 100,000 and 1,000,000 to allow faster moves in frequency (i.e., Calibrate on WWV)
Fixed: Calibration called the wrong function. Now calls the correct function.
FLASH: code:227096, data:138388, headers:8272 free for files:7752708
RAM1: variables:246592, code:223432, padding:5944 free for local variables:48320
RAM2: variables:340864 free for malloc/new:183424
V040 Feb 01, 2023 Jack Purdum (W8TEE):
Expanded EEPROM code
Added code to use SD card for EEPROM back up and to calculate bearing heading.
Added code to process SD card, including EEPROM dump
FLASH: code:225912, data:137400, headers:8396 free for files:7754756
RAM1: variables:245536, code:222600, padding:6776 free for local variables:49376
RAM2: variables:340864 free for malloc/new:183424
V039d Jan 11, 2023 Jack Purdum (W8TEE):
Fixed: Requesting switch matrix values when already in place
Fixed: VFOb problem of not changing to the correct frequecy
Fixed: Sync problem with SD card and EEPROM
FLASH: code:226872, data:137576, headers:8284 free for files:7753732
RAM1: variables:245632, code:223560, padding:5816 free for local variables:49280
RAM2: variables:340864 free for malloc/new:183424
V039 Jan 11, 2023 Jack Purdum (W8TEE):
Activated SD card for EEPROM data and BMP file for bearing mapping. Bearing mapping requires
creating a BMP file which is copied onto the SD card. The name of the file appears at line
226 in the Button.cpp file and as a symbolic constant at line 48 in the header file.
FLASH: code:245832, data:135512, headers:8796 free for files:7736324
RAM1: variables:243584, code:242520, padding:19624 free for local variables:18560
RAM2: variables:340864 free for malloc/new:183424
V034a Nov. 24, 2022 Jack Purdum (W8TEE):
Fixed the code that generated warnings. Also refactored the code and several math expressions that used constants only.
FLASH: code:202851, data:99675, headers:8668 free for files:7815176
RAM1: variables:207104, code:199624, padding:29752 free for local variables:87808
RAM2: variables:328512 free for malloc/new:195776
V033_DE Nov, 11, 2022 Al Peter (AC8GY)
Added Direct Frequency input using Switch Matrix Base code courtesy of Harry GM3RVL
V033 Nov, 06, 2022 Al Peter (AC8GY)
Revised Receive Cal and Transmit Cal to utilize T41 Excite to provide reference signal - no Sig Gen or Freq Analyzer required.
Fixed problem with startup parameter setting of bands and last frequencies
Reorganized EEPROM and formatted printout of EEPROM data
Added Synchronous AM detection - SAM
Set Demod mode and set Receive filters for Favorite frequencies.
Extended favorite frequecies to add WWV and set proper Receive filter
Fixed CW mode display of sidetone & audio out
Changed High Pass filter around DC for 1x spectrum display
Revised Xmit Cal routine - added real time on-screen spectrum display of cal process
Added new Mic Compressor with full parameter selection.
Added Mic Gain Menu option
Fixed : Print center freq correctly in zoom = 1X
V031d Oct, 30, 2022 Al Peter (AC8GY)
Recalibrated Main Spectrum display
Recalibrated Audio Spectrum display
Fixed: a couple of zoom anomolies
Fixed: AM demod window width issue
Added additional Cal parameter for xmit Power calibration
Fixed: vol value over-writes AGC display
Fixed: favorite frequency sets frequency and freq display
Added Auto band selection when new favorite frequency is in a different band
V031b Oct, 27, 2022 Al Peter (AC8GY)
Added PA power output by band for CW and SSB separately. Added to EEPROM
Added IQ calibration variables by band. Each band is separately calibrated.
Fixed: Filter/demod window tracks Zoom
Fixed: Set Spectrum Scale display
Changed AGC indicator
Added: Fine Tune demod window resets to center at band ends
Fixed Zoom Fine tune action
V031a Oct, 27, 2022 Al Peter (AC8GY)
Fixed: Tuning "jumps" when using Fine Tune
Reset CW Decode Detection Level
Revised CW Decode Narrow band filter
Implimented Power-on reset with button hold per KD0RC
Fixed AM demodulation
Adjusted Audio spectrum display height
Fixed Zoom Display
Adjusted NR levels
Moved Clock update to Process
Refactored several if else to switch case
Removed unused AM demod code
V029 Oct, 19, 2022 Al Peter (AC8GY), and Jack Purdum (W8TEE) .
Added: 5 New CW filters and save choice in EEPROM
Fixed: VFO jumps
Fixed: power output
Fixed: Spectrum scale disappeared after band change
Fixed: Touch-up on Zoom feature - fixed scale markings
Fixed: Notch filter
Added: Power output calibration for both CW and SSB
Added: Power variables for CW and SSB and calibration variables
FLASH: code:188404, data:98128, headers:8372 free for files:7831560
RAM1: variables:200864, code:185128, padding:11480 free for local variables:126816
RAM2: variables:325920 free for malloc/new:198368
V027e Oct, 17, 2022 Jack Purdum (W8TEE):
Fixed: height of filter plots for USB/AM too high by 3 pixels
Fixed: removed all dead variables from the EEPROM code which affect read(), write(), and show().
Fixed: only shows red for out of band conditions for both VFOs
V026f-7 Oct, 10, 2022 Jack Purdum (W8TEE) and Al Peter (AC8GY):
Added: If the VFO moves outside of a US band, the active VFO frequency is displayed in RED. The band
limits are found in the bands[] structure array defined in this file.
Activated: Receiver EQ
Activated; Mic compression, but not yet tested
Simplified: Refactored the band up-/down code
Added: Menu CW option to set sidetone volume
Fixed: Activated transmit qualizer
Fixed: Reset fine tune indicator to center line when main tuning changed
Fixed: AGC attach speed
Fixed: Band up/down bugs plus several menu prompts and formatting
Fixed: 80M upper limit was wrong.
Fixed: Switching between bands now preserves the last frequency of the VFO before the switch so you
Added: Last used frequency by band and by VFO saved in EEPROM if an EEPROM --> Save is done before poer off
Fixed: Could lock up after a mode push button change
Added: Display noise filter currently in use
Added: EEPROM option to save up to 10 "favorite frequencies
Fixed: spectrum display scale disappeared after band change
Added: Sidetone Volume and Transmit Delay variables added to CWOptions choices
Fixed: When calibrating the switch matrix, some of the prompts overwrote data on the display
Fixed: Spectrum scale disappeared after the mode was changed
Added: When changing bands, saves the current frequency before band change. Returning to that band recalls this last frequency
Fixed: Changing Noise Filter erased part of Zoom message in Information Window when display updated.
Fixed: Changing VFO's did not change the x axis for frequency
Fixed: Press Select with no menu selected followed by a menu decrease locked up system
Added: Small rectangle below the Seconds field to show the Xmt/Rec state of the T41
Removed: Menu options: Display, Audio post processor, Sidetone. They are 0no longer used.
Fixed: CW-->Paddle Flip prompt was overwritten
Moved "CW Fine Tune" message from Audio plot to bottom of Info Window to minimize refresh jitter
Fixed: Some Noise Reduction filter info was not written to EEPROM and display was awkward and didn't erase correctly
Changed: Noise floor changed to the number of pixels above the spectrum X axis to plot the noise floor.
Fixed: The CalibrateFrequency() is now functional. I'll be writing up how to use it with and without a signal generator.
Fixed: Overwrote Zoom field on setting the Noise filter. Same for Compress field when writing Zoom.
Fixed: Changing Noise Filter erased part of Zoom message in Information Window when display updated.
Fixed: Changing VFO's did not change the x axis for frequency
Fixed: Press Select with no menu selected followed by a menu decrease locked up system
Added: Small rectangle below the Seconds field to show the Xmt/Rec state of the T41
Removed: Menu options: Display, Audio post processor, Sidetone. They are 0no longer used.
Fixed: CW-->Paddle Flip prompt was overwritten
Moved "CW Fine Tune" message from Audio plot to bottom of Info Window to minimize refresh jitter
Fixed: Some Noise Reduction filter info was not written to EEPROM and display was awkward and didn't erase correctly
Changed: Noise floor changed to the number of pixels above the spectrum X axis to plot the noise floor.
Fixed: The CalibrateFrequency() is now functional. I'll be writing up how to use it with and without a signal generator.
Fixed: Overwrote Zoom field on setting the Noise filter. Same for Compress field when writing Zoom.
Memory Usage on Teensy 4.1:
FLASH: code:188276, data:98016, headers:8612 free for files:7831560
RAM1: variables:200832, code:185000, padding:11608 free for local variables:126848
RAM2: variables:323872 free for malloc/new:200416
V015 Aug, 06, 2022 Jack Purdum (W8TEE): Made the following changes (most "runaway" problems caused by moving to ISR's):
Fixed: Changed encoders from polling to interrupt-driven
Fixed: Spectrum set now saved to EEPROM
Fixed: frequency filter overlay (i.e., the "blue box") so it doesn't "jump" when Fine Tune used
Fixed: Opaque overlay after band changed
Fixed: Kim noise reduction has "runaway" (where the code auto-incremented the value)
Fixed: "AGC" removed from Info Window when turned off: WHITE = Slow, ORANGE = Medium, GREEN = FAST, RED = AGC in action
Fixed: Part of "T41-EP" in upper-right corner partially erased when doing certain screen updates.
Fixed: Text under VFO A partially erased on certain screen updates.
Fixed: Switching modes caused filter overlay to disappear.
Fixed: Receiver equalization caused "runaway"
Fixed: transmit equalization caused "runaway"
Fixed: switching to VFO B and tuning messed up VFO A frequency readout.
Fixed: Audio post-processing caused "runaway"
Fixed: RF Gain caused "runaway"
Fixed: Power setting caused "runaway"
Fixed: Mic compression caused "runaway"
Fixed: Mode switch
Fixed: Pushing Select when no menu item selected; issue error message
Fixed: EEPROM SetFavoriteFrequency() and GetFavoriteFrequency()
Fixed: No longer need to remove spectrum or waterfall displays; removed.
Not fixed yet: Unresponsive S Meter
Not fixed yet: IQ Manual setting
Not fixed yet: Other undiscovered bugs...and there will be some!
Removed dead code, unused variables, etc. Also added Split VFO code
Removed non-macro Serial.print() statements
FLASH: code:182384, data:95848, headers:8484 free for files:7839748
RAM1: variables:165280, code:179112, padding:17496 free for local variables:162400
RAM2: variables:425824 free for malloc/new:98464
V010 June, 03, 2022 Jack Purdum (W8TEE): CW sending section still incomplete
FLASH: code:193424, data:82860, headers:8384 free for files:7841796
RAM1: variables:162528, code:190152, padding:6456 free for local variables:165152
RAM2: variables:429920 free for malloc/new:94368
V025 9-30-22 Al Peter AC8GY : 1. RFGain is hooked up – set gain from -60dB to +10dB
2. Optimized the CW straight key lags
3. Fixed the Decoder on/off so it is is only on when the front button is pushed to turn it on
4. Set up the filter band display so it works correctly at each Zoom level
5. Re-organized the T41 States for SSB Receive, SSB Transmit, CW Receive, and CW transmit
6. Fixed the interaction between Center tune and Fine tune so hey work properly
7. Fixed up fine Tune to work with the spectrum Zoom
8. Got rid of a bunch of dead code – display spectrum and waterfall that we don’t use.
9. Power Setting calibration in Watts
10. IQ for Receive and Xmit and frequency cal all combined into one submenu.
11. Exciter IQ calibration Partly done
12. Receive EQ connected with menu options
*********************************************************************************************/
// setup() and loop() at the bottom of this file
#ifndef BEENHERE
#include "SDT.h"
#endif
#if defined(G0ORX_FRONTPANEL) || defined(G0ORX_FRONTPANEL_2) || defined(G0ORX_CAT)
int my_ptt=HIGH; // Active LOW
void PTT_Interrupt() {
my_ptt = digitalRead(PTT);
}
#endif
#ifdef G0ORX_FRONTPANEL_2
int touchPrimaryMenuIndex = -1;
int touchSecondaryMenuIndex = -1;
#endif
#ifdef NETWORK
bool network_initialized = false;
uint8_t my_mac[] = {
0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0x02
};
#endif
float32_t squelch = 0; // 0=Off.. 100 // JDM 02/24/24
#ifndef G0ORX_VFO
/* Presented here so you can see how the members allign
struct maps {
char mapNames[50];
float lat;
float lon;
};
*/
struct maps myMapFiles[10] = {
{ "Cincinnati.bmp", 39.07466, -84.42677 }, // Map name and coordinates for QTH
{ "Denver.bmp", 39.61331, -105.01664 },
{ "Honolulu.bmp", 21.31165, -157.89291 },
{ "SiestaKey.bmp", 27.26657, -82.54197 },
{ "", 0.0, 0.0 },
{ "", 0.0, 0.0 },
{ "", 0.0, 0.0 },
{ "", 0.0, 0.0 },
{ "", 0.0, 0.0 }
};
#endif
bool save_last_frequency = false;
struct band bands[NUMBER_OF_BANDS] = { //AFP Changed 1-30-21 // G0ORX Changed AGC to 20
//freq band low band hi name mode Low Hi Gain type gain AGC pixel
// filter filter correct offset
//DB2OO, 29-AUG-23: take ITU_REGION into account for band limits
// and changed "gainCorrection" to see the correct dBm value on all bands.
// Calibration done with TinySA as signal generator with -73dBm levels (S9) at the FT8 frequencies
// with V010 QSD with the 12V mod of the pre-amp
#if defined(ITU_REGION) && ITU_REGION == 1
{3700000, 3500000, 3800000, "80M", DEMOD_LSB, -200, -3000, 1, HAM_BAND, -2.0, 20, 20},
{7150000, 7000000, 7200000, "40M", DEMOD_LSB, -200, -3000, 1, HAM_BAND, -2.0, 20, 20},
#elif defined(ITU_REGION) && ITU_REGION == 2
{3700000, 3500000, 4000000, "80M", DEMOD_LSB, -200, -3000, 1, HAM_BAND, -2.0, 20, 20},
{7150000, 7000000, 7300000, "40M", DEMOD_LSB, -200, -3000, 1, HAM_BAND, -2.0, 20, 20},
#elif defined(ITU_REGION) && ITU_REGION == 3
{3700000, 3500000, 3900000, "80M", DEMOD_LSB, -200, -3000, 1, HAM_BAND, -2.0, 20, 20},
{7150000, 7000000, 7200000, "40M", DEMOD_LSB, -200, -3000, 1, HAM_BAND, -2.0, 20, 20},
#endif
{14200000, 14000000, 14350000, "20M", DEMOD_USB, 3000, 200, 1, HAM_BAND, 2.0, 20, 20},
{18100000, 18068000, 18168000, "17M", DEMOD_USB, 3000, 200, 1, HAM_BAND, 2.0, 20, 20},
{21200000, 21000000, 21450000, "15M", DEMOD_USB, 3000, 200, 1, HAM_BAND, 5.0, 20, 20},
{24920000, 24890000, 24990000, "12M", DEMOD_USB, 3000, 200, 1, HAM_BAND, 6.0, 20, 20},
{28350000, 28000000, 29700000, "10M", DEMOD_USB, 3000, 200, 1, HAM_BAND, 8.5, 20, 20},
#ifdef V12
{50300000, 50000000, 52000000, "6M", DEMOD_USB, 3000, 200, 1, HAM_BAND, 8.5, 20, 20}, // G0ORX
{70100000, 70000000, 70500000, "4M", DEMOD_USB, 3000, 200, 1, HAM_BAND, 8.5, 20, 20}, // G0ORX
{144300000, 144000000, 148000000, "2M", DEMOD_USB, 3000, 200, 1, HAM_BAND, 8.5, 20, 20} // G0ORX
#endif
};
const char *topMenus[] = { "CW Options", "RF Set", "VFO Select",
"EEPROM", "AGC", "Spectrum Options",
"Noise Floor", "Mic Gain", "Mic Comp",
"EQ Rec Set", "EQ Xmt Set", "Calibrate"
#ifndef G0ORX_VFO
, "Bearing"
#endif
};
const char *secondaryChoices[][8] = {
{ "WPM", "Key Type", "CW Filter", "Paddle Flip", "Sidetone Vol", "Xmit Delay", "Cancel" }, // CW Options
{ "Power level", "Gain", "Cancel" }, // RF
{ "VFO A", "VFO B", "Split", "Cancel" }, // VFO
{ "Save Current", "Set Defaults", "Get Favorite", "Set Favorite", "EEPROM-->SD", "SD-->EEPROM", "SD Dump", "Cancel" }, // EEPROM
{ "Off", "Long", "Slow", "Medium", "Fast", "Cancel" }, // AGC
{ "20 dB/unit", "10 dB/unit", " 5 dB/unit", " 2 dB/unit", " 1 dB/unit", "Cancel" }, // Spectrum
{ "Set floor", "Cancel" }, // Noise
{ "Set Mic Gain", "Cancel" }, // Mic gain
{ "On", "Off", "Set Threshold", "Set Ratio", "Set Attack", "Set Decay", "Cancel" }, // Mic Compression
{ "On", "Off", "EQSet", "Cancel" }, // Receiver equalizer
{ "On", "Off", "EQSet", "Cancel" }, // Transmiiter equilizer
{ "Freq Cal", "CW PA Cal", "Rec Cal", "Xmit Cal", "SSB PA Cal", "Cancel" }, // Calibrate
#ifndef G0ORX_VFO
{ "Set Prefix", "Cancel" } // Bearing
#endif
};
int secondaryMenuCounts[TOP_MENU_COUNT] = {7, 3, 4, 8, 6, 6, 2, 2, 7, 4, 4, 6,
#ifndef G0ORX_VFO
2
#endif
}; // The are the number of secondary menu for each primary menu
int (*functionPtr[])() = { &CWOptions, &RFOptions, &VFOSelect,
&EEPROMOptions, &AGCOptions, &SpectrumOptions,
&ButtonSetNoiseFloor, &MicGainSet, &MicOptions,
&EqualizerRecOptions, &EqualizerXmtOptions, &IQOptions
#ifndef G0ORX_VFO
, &BearingMaps
#endif
};
const char *labels[] = { "Select", "Menu Up", "Band Up",
"Zoom", "Menu Dn", "Band Dn",
"Filter", "DeMod", "Mode",
"NR", "Notch", "Noise Floor",
"Fine Tune", "Decoder", "Tune Increment",
"Reset Tuning", "Frequ Entry", "User 2" };
const char *CWFilter[] = { "0.8kHz", "1.0kHz", "1.3kHz", "1.8kHz", "2.0kHz", " Off " };
int switchThreshholds[] = { 921, 867, 818,
767, 715, 665,
614, 563, 511,
460, 406, 352,
299, 242, 184,
124, 64, 5 };
uint32_t FFT_length = FFT_LENGTH;
extern "C" uint32_t set_arm_clock(uint32_t frequency);
// lowering this from 600MHz to 200MHz makes power consumption less
uint32_t T4_CPU_FREQUENCY = 500000000UL; //AFP 2-10-21
//uint32_t T4_CPU_FREQUENCY = 400000000UL;
//======================================== Global object definitions ==================================================
// =========================== AFP 08-22-22
AudioControlSGTL5000_Extended sgtl5000_1; //controller for the Teensy Audio Board
AudioConvert_I16toF32 int2Float1, int2Float2; //Converts Int16 to Float. See class in AudioStream_F32.h
AudioEffectGain_F32 gain1, gain2; //Applies digital gain to audio data. Expected Float data.
AudioEffectCompressor_F32 comp1, comp2;
AudioConvert_F32toI16 float2Int1, float2Int2; //Converts Float to Int16. See class in AudioStream_F32.h
AudioInputI2SQuad i2s_quadIn;
AudioOutputI2SQuad i2s_quadOut;
AudioMixer4 recMix_3; // JJP
AudioMixer4 modeSelectInR; // AFP 09-01-22
AudioMixer4 modeSelectInL; // AFP 09-01-22
AudioMixer4 modeSelectInExR; // AFP 09-01-22
AudioMixer4 modeSelectInExL; // AFP 09-01-22
AudioMixer4 modeSelectOutL; // AFP 09-01-22
AudioMixer4 modeSelectOutR; // AFP 09-01-22
AudioMixer4 modeSelectOutExL; // AFP 09-01-22
AudioMixer4 modeSelectOutExR; // AFP 09-01-22
//=============== // AFP 09-01-22
//AudioMixer4 CW_AudioOutR; //AFP 09-01-22
//AudioMixer4 CW_AudioOutL; //AFP 09-01-22
AudioMixer4 CW_AudioOut;
AudioRecordQueue Q_in_L;
AudioRecordQueue Q_in_R;
AudioRecordQueue Q_in_L_Ex;
AudioRecordQueue Q_in_R_Ex;
AudioPlayQueue Q_out_L;
AudioPlayQueue Q_out_R;
AudioPlayQueue Q_out_L_Ex;
AudioPlayQueue Q_out_R_Ex;
// ===============
#ifdef V12
AudioConnection patchCord1(i2s_quadIn, 0, modeSelectInExL, 0); //connect the Left input to the Left Int->Float converter
AudioConnection patchCord2(i2s_quadIn, 1, modeSelectInExR, 0); //connect the Right input to the Right Int->Float converter
#else
AudioConnection patchCord1(i2s_quadIn, 0, int2Float1, 0); //connect the Left input to the Left Int->Float converter
AudioConnection patchCord2(i2s_quadIn, 1, int2Float2, 0); //connect the Right input to the Right Int->Float converter
AudioConnection_F32 patchCord3(int2Float1, 0, comp1, 0); //Left. makes Float connections between objects
AudioConnection_F32 patchCord4(int2Float2, 0, comp2, 0); //Right. makes Float connections between objects
AudioConnection_F32 patchCord5(comp1, 0, float2Int1, 0); //Left. makes Float connections between objects
AudioConnection_F32 patchCord6(comp2, 0, float2Int2, 0); //Right. makes Float connections between objects
//AudioConnection_F32 patchCord3(int2Float1, 0, float2Int1, 0); //Left. makes Float connections between objects
//AudioConnection_F32 patchCord4(int2Float2, 0, float2Int2, 0); //Right. makes Float connections between objects
#endif
// ===============
AudioConnection patchCord7(float2Int1, 0, modeSelectInExL, 0); //Input Ex
AudioConnection patchCord8(float2Int2, 0, modeSelectInExR, 0);
AudioConnection patchCord9(i2s_quadIn, 2, modeSelectInL, 0); //Input Rec
AudioConnection patchCord10(i2s_quadIn, 3, modeSelectInR, 0);
AudioConnection patchCord11(modeSelectInExR, 0, Q_in_R_Ex, 0); //Ex in Queue
AudioConnection patchCord12(modeSelectInExL, 0, Q_in_L_Ex, 0);
AudioConnection patchCord13(modeSelectInR, 0, Q_in_R, 0); //Rec in Queue
AudioConnection patchCord14(modeSelectInL, 0, Q_in_L, 0);
AudioConnection patchCord15(Q_out_L_Ex, 0, modeSelectOutExL, 0); //Ex out Queue
AudioConnection patchCord16(Q_out_R_Ex, 0, modeSelectOutExR, 0);
AudioConnection patchCord17(Q_out_L, 0, modeSelectOutL, 0); //Rec out Queue
AudioConnection patchCord18(Q_out_R, 0, modeSelectOutR, 0);
AudioConnection patchCord19(modeSelectOutExL, 0, i2s_quadOut, 0); //Ex out
AudioConnection patchCord20(modeSelectOutExR, 0, i2s_quadOut, 1);
AudioConnection patchCord21(modeSelectOutL, 0, i2s_quadOut, 2); //Rec out
AudioConnection patchCord22(modeSelectOutR, 0, i2s_quadOut, 3);
AudioConnection patchCord23(Q_out_L_Ex, 0, modeSelectOutL, 1); //Rec out Queue for sidetone
AudioConnection patchCord24(Q_out_R_Ex, 0, modeSelectOutR, 1);
// ================================== AFP 11-01-22
// ===================
//AudioControlSGTL5000 sgtl5000_1;
AudioControlSGTL5000 sgtl5000_2;
// =========================== AFP 08-22-22 end
#if !(defined(G0ORX_FRONTPANEL) || defined(G0ORX_FRONTPANEL_2))
Bounce decreaseBand = Bounce(BAND_MENUS, 50);
Bounce increaseBand = Bounce(BAND_PLUS, 50);
Bounce modeSwitch = Bounce(CHANGE_MODE, 50);
Bounce decreaseMenu = Bounce(MENU_MINUS, 50);
Bounce frequencyIncrement = Bounce(CHANGE_INCREMENT, 50);
Bounce filterSwitch = Bounce(CHANGE_FILTER, 50);
Bounce increaseMenu = Bounce(MENU_PLUS, 50);
Bounce selectExitMenues = Bounce(CHANGE_MENU2, 50);
Bounce changeNR = Bounce(CHANGE_NOISE, 50);
Bounce demodSwitch = Bounce(CHANGE_DEMOD, 50);
Bounce zoomSwitch = Bounce(CHANGE_ZOOM, 50);
Bounce cursorSwitch = Bounce(SET_FREQ_CURSOR, 50);
Bounce KeyPin2 = Bounce(KEYER_DAH_INPUT_RING, 5);
Bounce KeyPin1 = Bounce(KEYER_DIT_INPUT_TIP, 5);
Rotary volumeEncoder = Rotary(VOLUME_ENCODER_A, VOLUME_ENCODER_B); //( 2, 3)
Rotary tuneEncoder = Rotary(TUNE_ENCODER_A, TUNE_ENCODER_B); //(16, 17)
Rotary filterEncoder = Rotary(FILTER_ENCODER_A, FILTER_ENCODER_B); //(15, 14)
Rotary fineTuneEncoder = Rotary(FINETUNE_ENCODER_A, FINETUNE_ENCODER_B); //( 4, 5)
#endif
Metro ms_500 = Metro(500); // Set up a Metro
Metro ms_300000 = Metro(300000);
Metro encoder_check = Metro(100); // Set up a Metro
Si5351 si5351;
int radioState, lastState; // KF5N
int resetTuningFlag = 0;
#ifndef RA8875_DISPLAY
ILI9488_t3 tft = ILI9488_t3(&SPI, TFT_CS, TFT_DC, TFT_RST);
#else
#define RA8875_CS TFT_CS
#define RA8875_RESET TFT_DC // any pin or nothing!
RA8875 tft = RA8875(RA8875_CS, RA8875_RESET);
#endif
SPISettings settingsA(70000000UL, MSBFIRST, SPI_MODE1);
#ifdef V12
// =========== Quad Si5351 stuff //AFP 09-24-23 V12
unsigned long long Clk2SetFreq; //AFP 09-24-23 V12
unsigned long long Clk0SetFreq; // AFP 09-27-22
unsigned long long Clk1SetFreq = 1000000000ULL;
unsigned long long pll_min = 60000000000ULL;
unsigned long long pll_max = 90000000000ULL;
unsigned long long f_pll_freq;
unsigned long long pll_freq;
unsigned long long freq;
int multiple = 126;
int oldMultiple = 126;
unsigned long long oldfreq;
unsigned long long freq1;
const uint32_t N_B_EX = 16;
//AFP 09-24-23 V12 end Quad stuff
#else
const uint32_t N_B_EX = 16;
#endif
#ifdef G0ORX_AUDIO_DISPLAY
float32_t mic_audio_buffer[256];
#endif
//================== Receive EQ Variables================= AFP 08-08-22
float32_t recEQ_Level[14];
float32_t recEQ_LevelScale[14];
//Setup for EQ filters
float32_t rec_EQ1_float_buffer_L[256];
float32_t rec_EQ2_float_buffer_L[256];
float32_t rec_EQ3_float_buffer_L[256];
float32_t rec_EQ4_float_buffer_L[256];
float32_t rec_EQ5_float_buffer_L[256];
float32_t rec_EQ6_float_buffer_L[256];
float32_t rec_EQ7_float_buffer_L[256];
float32_t rec_EQ8_float_buffer_L[256];
float32_t rec_EQ9_float_buffer_L[256];
float32_t rec_EQ10_float_buffer_L[256];
float32_t rec_EQ11_float_buffer_L[256];
float32_t rec_EQ12_float_buffer_L[256];
float32_t rec_EQ13_float_buffer_L[256];
float32_t rec_EQ14_float_buffer_L[256];
float32_t rec_EQ_Band1_state[IIR_NUMSTAGES * 2] = { 0, 0, 0, 0, 0, 0, 0, 0 }; //declare and zero biquad state variables
float32_t rec_EQ_Band2_state[IIR_NUMSTAGES * 2] = { 0, 0, 0, 0, 0, 0, 0, 0 };
float32_t rec_EQ_Band3_state[IIR_NUMSTAGES * 2] = { 0, 0, 0, 0, 0, 0, 0, 0 };
float32_t rec_EQ_Band4_state[IIR_NUMSTAGES * 2] = { 0, 0, 0, 0, 0, 0, 0, 0 };
float32_t rec_EQ_Band5_state[IIR_NUMSTAGES * 2] = { 0, 0, 0, 0, 0, 0, 0, 0 };
float32_t rec_EQ_Band6_state[IIR_NUMSTAGES * 2] = { 0, 0, 0, 0, 0, 0, 0, 0 };
float32_t rec_EQ_Band7_state[IIR_NUMSTAGES * 2] = { 0, 0, 0, 0, 0, 0, 0, 0 };
float32_t rec_EQ_Band8_state[IIR_NUMSTAGES * 2] = { 0, 0, 0, 0, 0, 0, 0, 0 }; //declare and zero biquad state variables
float32_t rec_EQ_Band9_state[IIR_NUMSTAGES * 2] = { 0, 0, 0, 0, 0, 0, 0, 0 };
float32_t rec_EQ_Band10_state[IIR_NUMSTAGES * 2] = { 0, 0, 0, 0, 0, 0, 0, 0 };
float32_t rec_EQ_Band11_state[IIR_NUMSTAGES * 2] = { 0, 0, 0, 0, 0, 0, 0, 0 };
float32_t rec_EQ_Band12_state[IIR_NUMSTAGES * 2] = { 0, 0, 0, 0, 0, 0, 0, 0 };
float32_t rec_EQ_Band13_state[IIR_NUMSTAGES * 2] = { 0, 0, 0, 0, 0, 0, 0, 0 };
float32_t rec_EQ_Band14_state[IIR_NUMSTAGES * 2] = { 0, 0, 0, 0, 0, 0, 0, 0 };
//EQ filter instances
arm_biquad_cascade_df2T_instance_f32 S1_Rec = { IIR_NUMSTAGES, rec_EQ_Band1_state, EQ_Band1Coeffs };
arm_biquad_cascade_df2T_instance_f32 S2_Rec = { IIR_NUMSTAGES, rec_EQ_Band2_state, EQ_Band2Coeffs };
arm_biquad_cascade_df2T_instance_f32 S3_Rec = { IIR_NUMSTAGES, rec_EQ_Band3_state, EQ_Band3Coeffs };
arm_biquad_cascade_df2T_instance_f32 S4_Rec = { IIR_NUMSTAGES, rec_EQ_Band4_state, EQ_Band4Coeffs };
arm_biquad_cascade_df2T_instance_f32 S5_Rec = { IIR_NUMSTAGES, rec_EQ_Band5_state, EQ_Band5Coeffs };
arm_biquad_cascade_df2T_instance_f32 S6_Rec = { IIR_NUMSTAGES, rec_EQ_Band6_state, EQ_Band6Coeffs };
arm_biquad_cascade_df2T_instance_f32 S7_Rec = { IIR_NUMSTAGES, rec_EQ_Band7_state, EQ_Band7Coeffs };
arm_biquad_cascade_df2T_instance_f32 S8_Rec = { IIR_NUMSTAGES, rec_EQ_Band8_state, EQ_Band8Coeffs };
arm_biquad_cascade_df2T_instance_f32 S9_Rec = { IIR_NUMSTAGES, rec_EQ_Band9_state, EQ_Band9Coeffs };
arm_biquad_cascade_df2T_instance_f32 S10_Rec = { IIR_NUMSTAGES, rec_EQ_Band10_state, EQ_Band10Coeffs };
arm_biquad_cascade_df2T_instance_f32 S11_Rec = { IIR_NUMSTAGES, rec_EQ_Band11_state, EQ_Band11Coeffs };
arm_biquad_cascade_df2T_instance_f32 S12_Rec = { IIR_NUMSTAGES, rec_EQ_Band12_state, EQ_Band12Coeffs };
arm_biquad_cascade_df2T_instance_f32 S13_Rec = { IIR_NUMSTAGES, rec_EQ_Band13_state, EQ_Band13Coeffs };
arm_biquad_cascade_df2T_instance_f32 S14_Rec = { IIR_NUMSTAGES, rec_EQ_Band14_state, EQ_Band14Coeffs };
// =============================== AFP 10-02-22 ================
//Setup for Xmit EQ filters
float32_t DMAMEM xmtEQ_Level[14];
//EQBuffers
float32_t DMAMEM xmt_EQ1_float_buffer_L[256];
float32_t DMAMEM xmt_EQ2_float_buffer_L[256];
float32_t DMAMEM xmt_EQ3_float_buffer_L[256];
float32_t DMAMEM xmt_EQ4_float_buffer_L[256];
float32_t DMAMEM xmt_EQ5_float_buffer_L[256];
float32_t DMAMEM xmt_EQ6_float_buffer_L[256];
float32_t DMAMEM xmt_EQ7_float_buffer_L[256];
float32_t DMAMEM xmt_EQ8_float_buffer_L[256];
float32_t DMAMEM xmt_EQ9_float_buffer_L[256];
float32_t DMAMEM xmt_EQ10_float_buffer_L[256];
float32_t DMAMEM xmt_EQ11_float_buffer_L[256];
float32_t DMAMEM xmt_EQ12_float_buffer_L[256];
float32_t DMAMEM xmt_EQ13_float_buffer_L[256];
float32_t DMAMEM xmt_EQ14_float_buffer_L[256];
float32_t xmt_EQ_Band1_state[IIR_NUMSTAGES * 2] = { 0, 0, 0, 0, 0, 0, 0, 0 }; //declare and zero biquad state variables
float32_t xmt_EQ_Band2_state[IIR_NUMSTAGES * 2] = { 0, 0, 0, 0, 0, 0, 0, 0 };
float32_t xmt_EQ_Band3_state[IIR_NUMSTAGES * 2] = { 0, 0, 0, 0, 0, 0, 0, 0 };
float32_t xmt_EQ_Band4_state[IIR_NUMSTAGES * 2] = { 0, 0, 0, 0, 0, 0, 0, 0 };
float32_t xmt_EQ_Band5_state[IIR_NUMSTAGES * 2] = { 0, 0, 0, 0, 0, 0, 0, 0 };
float32_t xmt_EQ_Band6_state[IIR_NUMSTAGES * 2] = { 0, 0, 0, 0, 0, 0, 0, 0 };
float32_t xmt_EQ_Band7_state[IIR_NUMSTAGES * 2] = { 0, 0, 0, 0, 0, 0, 0, 0 };
float32_t xmt_EQ_Band8_state[IIR_NUMSTAGES * 2] = { 0, 0, 0, 0, 0, 0, 0, 0 };
float32_t xmt_EQ_Band9_state[IIR_NUMSTAGES * 2] = { 0, 0, 0, 0, 0, 0, 0, 0 };
float32_t xmt_EQ_Band10_state[IIR_NUMSTAGES * 2] = { 0, 0, 0, 0, 0, 0, 0, 0 };
float32_t xmt_EQ_Band11_state[IIR_NUMSTAGES * 2] = { 0, 0, 0, 0, 0, 0, 0, 0 };
float32_t xmt_EQ_Band12_state[IIR_NUMSTAGES * 2] = { 0, 0, 0, 0, 0, 0, 0, 0 };
float32_t xmt_EQ_Band13_state[IIR_NUMSTAGES * 2] = { 0, 0, 0, 0, 0, 0, 0, 0 };
float32_t xmt_EQ_Band14_state[IIR_NUMSTAGES * 2] = { 0, 0, 0, 0, 0, 0, 0, 0 };
//EQ filter instances
arm_biquad_cascade_df2T_instance_f32 S1_Xmt = { IIR_NUMSTAGES, xmt_EQ_Band1_state, EQ_Band1Coeffs };
arm_biquad_cascade_df2T_instance_f32 S2_Xmt = { IIR_NUMSTAGES, xmt_EQ_Band2_state, EQ_Band2Coeffs };
arm_biquad_cascade_df2T_instance_f32 S3_Xmt = { IIR_NUMSTAGES, xmt_EQ_Band3_state, EQ_Band3Coeffs };
arm_biquad_cascade_df2T_instance_f32 S4_Xmt = { IIR_NUMSTAGES, xmt_EQ_Band4_state, EQ_Band4Coeffs };
arm_biquad_cascade_df2T_instance_f32 S5_Xmt = { IIR_NUMSTAGES, xmt_EQ_Band5_state, EQ_Band5Coeffs };
arm_biquad_cascade_df2T_instance_f32 S6_Xmt = { IIR_NUMSTAGES, xmt_EQ_Band6_state, EQ_Band6Coeffs };
arm_biquad_cascade_df2T_instance_f32 S7_Xmt = { IIR_NUMSTAGES, xmt_EQ_Band7_state, EQ_Band7Coeffs };
arm_biquad_cascade_df2T_instance_f32 S8_Xmt = { IIR_NUMSTAGES, xmt_EQ_Band8_state, EQ_Band8Coeffs };
arm_biquad_cascade_df2T_instance_f32 S9_Xmt = { IIR_NUMSTAGES, xmt_EQ_Band9_state, EQ_Band9Coeffs };
arm_biquad_cascade_df2T_instance_f32 S10_Xmt = { IIR_NUMSTAGES, xmt_EQ_Band10_state, EQ_Band10Coeffs };
arm_biquad_cascade_df2T_instance_f32 S11_Xmt = { IIR_NUMSTAGES, xmt_EQ_Band11_state, EQ_Band11Coeffs };
arm_biquad_cascade_df2T_instance_f32 S12_Xmt = { IIR_NUMSTAGES, xmt_EQ_Band12_state, EQ_Band12Coeffs };
arm_biquad_cascade_df2T_instance_f32 S13_Xmt = { IIR_NUMSTAGES, xmt_EQ_Band13_state, EQ_Band13Coeffs };
arm_biquad_cascade_df2T_instance_f32 S14_Xmt = { IIR_NUMSTAGES, xmt_EQ_Band14_state, EQ_Band14Coeffs };
// ===============================End xmit EQ filter setup AFP 10-02-22 ================
// HP BiQuad IIR DC filter
float32_t HP_DC_Butter_state[6] = { 0, 0, 0, 0, 0, 0 };
float32_t HP_DC_Butter_state2[2] = { 0, 0 }; // AFP 11-04-11
arm_biquad_cascade_df2T_instance_f32 s1_Receive = { 3, HP_DC_Butter_state, HP_DC_Filter_Coeffs }; //AFP 09-23-22
arm_biquad_cascade_df2T_instance_f32 s1_Receive2 = { 1, HP_DC_Butter_state2, HP_DC_Filter_Coeffs2 }; //AFP 11-04-22
//Hilbert FIR Filters
float32_t FIR_Hilbert_state_L[100 + 256 - 1];
float32_t FIR_Hilbert_state_R[100 + 256 - 1];
arm_fir_instance_f32 FIR_Hilbert_L;
arm_fir_instance_f32 FIR_Hilbert_R;
// CW decode Filters
arm_fir_instance_f32 FIR_CW_DecodeL; //AFP 10-25-22
arm_fir_instance_f32 FIR_CW_DecodeR; //AFP 10-25-22
float32_t FIR_CW_DecodeL_state[64 + 256 - 1];
float32_t FIR_CW_DecodeR_state[64 + 256 - 1];
//Decimation and Interpolation Filters
arm_fir_decimate_instance_f32 FIR_dec1_EX_I;
arm_fir_decimate_instance_f32 FIR_dec1_EX_Q;
arm_fir_decimate_instance_f32 FIR_dec2_EX_I;
arm_fir_decimate_instance_f32 FIR_dec2_EX_Q;
arm_fir_interpolate_instance_f32 FIR_int1_EX_I;
arm_fir_interpolate_instance_f32 FIR_int1_EX_Q;
arm_fir_interpolate_instance_f32 FIR_int2_EX_I;
arm_fir_interpolate_instance_f32 FIR_int2_EX_Q;
float32_t DMAMEM FIR_dec1_EX_I_state[2095];
float32_t DMAMEM FIR_dec1_EX_Q_state[2095];
float32_t audioMaxSquaredAve;
float32_t DMAMEM FIR_dec2_EX_I_state[535];
float32_t DMAMEM FIR_dec2_EX_Q_state[535];
float32_t DMAMEM FIR_int2_EX_I_state[519];
float32_t DMAMEM FIR_int2_EX_Q_state[519];
float32_t DMAMEM FIR_int1_EX_coeffs[48];
float32_t DMAMEM FIR_int2_EX_coeffs[48];
float32_t DMAMEM FIR_int1_EX_I_state[279];
float32_t DMAMEM FIR_int1_EX_Q_state[279];
float32_t DMAMEM float_buffer_L_EX[2048];
float32_t DMAMEM float_buffer_R_EX[2048];
float32_t DMAMEM float_buffer_LTemp[2048];
float32_t DMAMEM float_buffer_RTemp[2048];
//==================== End Excite Variables================================
//======================================== Global structure declarations ===============================================
//=== CW Filter ===
float32_t CW_Filter_state[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
float32_t CW_AudioFilter1_state[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // AFP 10-18-22
float32_t CW_AudioFilter2_state[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // AFP 10-18-22
float32_t CW_AudioFilter3_state[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // AFP 10-18-22
float32_t CW_AudioFilter4_state[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // AFP 10-18-22
float32_t CW_AudioFilter5_state[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // AFP 10-18-22
//--------- Code Filter instance -----
arm_biquad_cascade_df2T_instance_f32 S1_CW_Filter = { IIR_CW_NUMSTAGES, CW_Filter_state, CW_Filter_Coeffs };
arm_biquad_cascade_df2T_instance_f32 S1_CW_AudioFilter1 = { 6, CW_AudioFilter1_state, CW_AudioFilterCoeffs1 }; // AFP 10-18-22
arm_biquad_cascade_df2T_instance_f32 S1_CW_AudioFilter2 = { 6, CW_AudioFilter2_state, CW_AudioFilterCoeffs2 }; // AFP 10-18-22
arm_biquad_cascade_df2T_instance_f32 S1_CW_AudioFilter3 = { 6, CW_AudioFilter3_state, CW_AudioFilterCoeffs3 }; // AFP 10-18-22
arm_biquad_cascade_df2T_instance_f32 S1_CW_AudioFilter4 = { 6, CW_AudioFilter4_state, CW_AudioFilterCoeffs4 }; // AFP 10-18-22
arm_biquad_cascade_df2T_instance_f32 S1_CW_AudioFilter5 = { 6, CW_AudioFilter5_state, CW_AudioFilterCoeffs5 }; // AFP 10-18-22
//=== end CW Filter ===
struct config_t EEPROMData;
const struct SR_Descriptor SR[18] = {
// x_factor, x_offset and f1 to f4 are NOT USED ANYMORE !!!
// SR_n , rate, text, f1, f2, f3, f4, x_factor = pixels per f1 kHz in spectrum display, x_offset
{ SAMPLE_RATE_8K, 8000, " 8k", " 1", " 2", " 3", " 4", 64.00, 11 }, // not OK
{ SAMPLE_RATE_11K, 11025, " 11k", " 1", " 2", " 3", " 4", 43.10, 17 }, // not OK
{ SAMPLE_RATE_16K, 16000, " 16k", " 4", " 4", " 8", "12", 64.00, 1 }, // OK
{ SAMPLE_RATE_22K, 22050, " 22k", " 5", " 5", "10", "15", 58.05, 6 }, // OK
{ SAMPLE_RATE_32K, 32000, " 32k", " 5", " 5", "10", "15", 40.00, 24 }, // OK, one more indicator?
{ SAMPLE_RATE_44K, 44100, " 44k", "10", "10", "20", "30", 58.05, 6 }, // OK
{ SAMPLE_RATE_48K, 48000, " 48k", "10", "10", "20", "30", 53.33, 11 }, // OK
{ SAMPLE_RATE_50K, 50223, " 50k", "10", "10", "20", "30", 53.33, 11 }, // NOT OK
{ SAMPLE_RATE_88K, 88200, " 88k", "20", "20", "40", "60", 58.05, 6 }, // OK
{ SAMPLE_RATE_96K, 96000, " 96k", "20", "20", "40", "60", 53.33, 12 }, // OK
{ SAMPLE_RATE_100K, 100000, "100k", "20", "20", "40", "60", 53.33, 12 }, // NOT OK
{ SAMPLE_RATE_101K, 100466, "101k", "20", "20", "40", "60", 53.33, 12 }, // NOT OK
{ SAMPLE_RATE_176K, 176400, "176k", "40", "40", "80", "120", 58.05, 6 }, // OK
{ SAMPLE_RATE_192K, 192000, "192k", "40", "40", "80", "120", 53.33, 12 }, // OK
{ SAMPLE_RATE_234K, 234375, "234k", "40", "40", "80", "120", 53.33, 12 }, // NOT OK
{ SAMPLE_RATE_256K, 256000, "256k", "40", "40", "80", "120", 53.33, 12 }, // NOT OK
{ SAMPLE_RATE_281K, 281000, "281k", "40", "40", "80", "120", 53.33, 12 }, // NOT OK
{ SAMPLE_RATE_353K, 352800, "353k", "40", "40", "80", "120", 53.33, 12 } // NOT OK
};
const arm_cfft_instance_f32 *S;
const arm_cfft_instance_f32 *iS;
const arm_cfft_instance_f32 *maskS;
const arm_cfft_instance_f32 *NR_FFT;
const arm_cfft_instance_f32 *NR_iFFT;
const arm_cfft_instance_f32 *spec_FFT;
arm_biquad_casd_df1_inst_f32 biquad_lowpass1;
arm_biquad_casd_df1_inst_f32 IIR_biquad_Zoom_FFT_I;
arm_biquad_casd_df1_inst_f32 IIR_biquad_Zoom_FFT_Q;
arm_fir_decimate_instance_f32 FIR_dec1_I;
arm_fir_decimate_instance_f32 FIR_dec1_Q;
arm_fir_decimate_instance_f32 FIR_dec2_I;
arm_fir_decimate_instance_f32 FIR_dec2_Q;
arm_fir_decimate_instance_f32 Fir_Zoom_FFT_Decimate_I;
arm_fir_decimate_instance_f32 Fir_Zoom_FFT_Decimate_Q;
arm_fir_interpolate_instance_f32 FIR_int1_I;
arm_fir_interpolate_instance_f32 FIR_int1_Q;