-
Notifications
You must be signed in to change notification settings - Fork 0
/
vfo.cpp
826 lines (747 loc) · 34.3 KB
/
vfo.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
#include "vfo.h"
#include "ui_vfo.h"
#include <QDebug>
vfo::vfo(QWidget *parent) :
QWidget(parent),
ui(new Ui::vfo)
{
ui->setupUi(this);
cur_Band = 20; // Initialise to a value which is != to any band.
browsePtr = 0;
selectedVFO = 'A';
ptt = false;
bands = new int*[12]; // Create 12 rows (there are 12 buttons)
for (int nCount=0; nCount < 12; nCount++)
bands[nCount] = new int[bDat_index + 1]; // Create 8 columns
for (int row = 0; row < 12; row ++) {
for (int col = 0; col == bDat_index; col++) {
bands[row][col] = 10000000;
}
bands[row][bDat_index] = 0; // Overwrite the index to zero for each row
}
readSettings();
setBandButton(readA());
connect(ui->btnGrpBand, SIGNAL(buttonClicked(int)),
this, SLOT(btnGrpBand(int)));
connect(ui->hSlider, SIGNAL(valueChanged(int)),
this, SLOT(processRIT(int)));
connect(ui->pBtnClrTrail, SIGNAL(toggled(bool)),
this, SLOT(togglePTT(bool)));
}
vfo::~vfo()
{
delete ui;
}
void vfo::togglePTT(bool pttRq)
{
int freq;
bool vfoUsed; // true = vfoA, false = vfoB.
if (selectedVFO == 'A') {
freq = readA();
vfoUsed = true;
} else if (selectedVFO == 'B') {
freq = readB();
vfoUsed = false;
} else if (pttRq == true) { // Must be split and
freq = readB(); //we will Tx on vfoB
vfoUsed = false;
} else { // We are receiving so we
freq = readA(); // will Rx on vfoA.
vfoUsed = true;
} // We have decided on vfo to use and got basic freq. Lets now see if we
// are doing a valid changeover and if it is Rx to Tx or Tx to Rx.
if (pttRq == true && ptt == false) { // Going from Rx to Tx
ptt = true;
if (ui->pBtnRIT->isChecked()) {
if (selectedVFO == 'A' || selectedVFO == 'B'){
freq = freq + ui->hSlider->value() * -1;
ui->pBtnRIT->setEnabled(false);
ui->hSlider->setEnabled(false);
} // We don't modify the vfo frequencies if on split
} // and of course no modification if RIT not checked.
if (vfoUsed == true) { // Using vfoA for transmit frequency
writeA(freq);
ui->pBtnvfoA->setStyleSheet("background-color: rgb(255, 0, 0)"); //Red
} else {
writeB(freq);
//TODO set vfoA background to light green and disable display vfoEnabled(false, true)
vfoEnabled(false, true);
ui->pBtnvfoA->setStyleSheet("background-color: normal"); //Red
ui->pBtnvfoB->setStyleSheet("background-color: rgb(255, 0, 0)"); //Red
}
} else if (pttRq == false && ptt == true) { //Going from Tx to Rx
ptt = false;
if (ui->pBtnRIT->isChecked()) {
if (selectedVFO == 'A' || selectedVFO == 'B'){
freq = freq + ui->hSlider->value();
ui->pBtnRIT->setEnabled(true);
ui->hSlider->setEnabled(true);
} // We don't modify the vfo frequencies if on split
} // and again no modification if RIT not checked.
if (selectedVFO == 'A') { // Using vfoA for receive frequency
writeA(freq);
ui->pBtnvfoA->setStyleSheet("background-color: rgb(85, 255, 0)"); //Green
} else if (selectedVFO == 'B'){
writeB(freq);
ui->pBtnvfoB->setStyleSheet("background-color: rgb(85, 255, 0)"); //Green
} else {
writeA(freq);
ui->pBtnvfoB->setStyleSheet("background-color: rgb(255, 155, 155)"); //Light Red
ui->pBtnvfoA->setStyleSheet("background-color: rgb(85, 255, 0)"); //Green
vfoEnabled(true, false);
}
}
}
void vfo::processRIT(int rit)
{
static int freq = 0;
freq = rit - freq; // freq now holds difference between last rit and this.
if (selectedVFO != 'B') { // Using vfoA or Split if 'B' is not selectedVFO.
freq += readA();
if (ui->pBtnRIT->isChecked()) writeA(freq);
} else {
freq += readB();
if (ui->pBtnRIT->isChecked()) writeB(freq);
}
freq = rit;
}
void vfo::on_pBtnRIT_clicked()
{
int chkd = -1;
if (ui->pBtnRIT->isChecked()) {
chkd = 1;
}
if (selectedVFO != 'B') { // Using vfoA or Split if 'B' is not selectedVFO.
writeA(readA() + ui->hSlider->value() * chkd);
} else {
writeB(readB() + ui->hSlider->value() * chkd);
}
}
void vfo::btnGrpBand(int btn)
{
int retrievedFreq;
int vfoFreq;
int cnt;
// bool vfoBflag;
btn = -1 * (btn + 2); //Map buttons (-2 .. -14) to (0 .. 11)
// Test to see if we are changing band.
if (btn != cur_Band) {
cur_Band = btn; //Yes, so retrieve current freq for band.
retrievedFreq = bands[btn][bDat_cFreq];
for (cnt = 0; cnt < 4; cnt++) { //If the freq is in one of the memories then set
if (retrievedFreq == bands[btn][cnt]) break; // the browsePtr to point to it.
}
if (cnt != 4) { //cnt will be 4 if no matching memory.
browsePtr = cnt; // Points to matching memory position
} else {
browsePtr = bands[btn][bDat_index]; //Initialised to point to last stored freq.
}
} else {
retrievedFreq = bands[btn][browsePtr];
if (selectedVFO != 'B') {
vfoFreq = readA();
} else {
vfoFreq = readB();
}
if (vfoFreq == retrievedFreq) {
browsePtr++;
browsePtr &= 0x03;
retrievedFreq = bands[btn][browsePtr];
}
}
if (selectedVFO != 'B') {
writeA(retrievedFreq);
} else {
writeB(retrievedFreq);
}
}
// When we arrive here from a right button click on the bandButtons group the variable
// cur_Band will hold the index to the required band button
void vfo::storeVFO()
{
int retrievedFreq;
int cnt;
qDebug() << "From storeVFO(), band button = " << cur_Band;
if (selectedVFO != 'B') {
retrievedFreq = readA(); //Using vfoA
} else {
retrievedFreq = readB();
}
// Search to see if the freq is already stored
for (cnt = 0; cnt < 4; cnt++) { //If the freq is in one of the memories then set
if (retrievedFreq == bands[cur_Band][cnt]) break; // the browsePtr to point to it.
}
if (cnt != 4) { //cnt will be 4 if no matching memory freq.
browsePtr = cnt; // Points to matching memory position & we don't need to store it.
} else {
bands[cur_Band][bDat_index]--;
bands[cur_Band][bDat_index] &= 0x03;
bands[cur_Band][bands[cur_Band][bDat_index]] = retrievedFreq;
browsePtr = bands[cur_Band][bDat_index]; //Point to last stored freq.
}
timer.start(500,this);
ui->btnGrpBand->checkedButton()->setStyleSheet("background-color: yellow");
}
void vfo::timerEvent(QTimerEvent *event)
{
if (event->timerId() == timer.timerId()) {
timer.stop();
ui->btnGrpBand->checkedButton()->setStyleSheet("background-color: normal");
} else {
QWidget::timerEvent(event);
}
}
void vfo::mousePressEvent(QMouseEvent *event)
{
bool isVFOa = false;
int digit, cnt;
QString myStr = "";
if (event->button() == Qt::RightButton) {
// qDebug() << (QString::number(event->x()) + "/" + QString::number(event->y()));
//Check to see if we have right clicked on the band button group
if ((event->x() > 414) && (event->x() < 573) && (event->y() > 6) && (event->y() < 111)) {
// qDebug() << "Button Group Clicked";
storeVFO();
// Check to see if we have right clicked the RIT slider
} else if ((event->x() > 189) && (event->x() < 403) && (event->y() > 89) && (event->y() < 111)) {
ui->hSlider->setValue(0);
} else { // We have clicked either on the display or somewhere else on the widget
digit = getDigit(event->x(), event->y());
if (digit != 9) { // getDigit returns 9 if click was outside display area.
if (digit < 9) { // getDigit returns 0 ... 8 if we clicked on vfoA
isVFOa = true;
myStr = ui->lbl_Amhz->text() + ui->lbl_Akhz->text() + ui->lbl_Ahz->text();
} else { // getDigit returns 10 ... 18 if we clicked on vfoB
digit = digit - 10; // so convert to 1 ... 8.
myStr = ui->lbl_Bmhz->text() + ui->lbl_Bkhz->text() + ui->lbl_Bhz->text();
}
for (cnt = myStr.length(); cnt < 9; cnt++) {
myStr = "0" + myStr;
}
for (cnt = digit; cnt < 9; cnt++) {
myStr[cnt] = QChar('0');
ui->hSlider->setValue(0);
}
if (isVFOa) {
writeA(myStr.toInt());
} else writeB(myStr.toInt());
}
}
}
}
int vfo::getDigit(int x, int y)
{
static const int idx[] = {64,87,107,137,159,178,207,226,241,257}; //These are the LHS of each digit of the frequency.
int digit;
if ((y < 12 || y > 84) || (x <64 || x > 257)) {
digit = 9; //digit will = 9 if outside x or y dial display range.
}
else {
for (digit = 0; idx[digit] != 257; digit++) { // we exit this loop with digit at the wheeled digit.
if ((x >= idx[digit]) && (x <= idx[digit + 1])) break;
} // digit will be 0 ... 9 if inside x range or 9 if under or over range.
// if (y < 12 || y > 84) digit = 9; //digit will = 9 if outside x or y dial display range.
if (y > 48 && y < 85) digit = digit + 10; //10 to 18 signifies vfoB
}
return digit; //0 ... 8 = vfoA; 9 = mouse pointer is outside x or y range; 10 ... 18 = vfoB.
}
void vfo::wheelEvent(QWheelEvent *event)
{
QString str;
int x, digit;
int direction = 0;
static const int mult[2][9] = {
{100000000,10000000,1000000,100000,10000,1000,100,10,1}, // Retrieve with mult[0][0 ... 8]
{-100000000,-10000000,-1000000,-100000,-10000,-1000,-100,-10,-1} // Retrieve with mult[1][0 ... 8]
};
digit = getDigit(event->x(), event->y());
if (digit != 9) { // getDigit returns 9 if click was outside display area so we just fall through.
if (event->delta() < 0) direction = 1; // x becomes pos or neg depending on wheel rotation.
if (digit < 9) { // getDigit returns 0 ... 8 if we clicked on vfoA
x = mult[direction][digit];
x = x + readA();
if (x >= 0 && x <= 999999999) // Safe to update the display without overflow or underflow.
writeA(x);
} else { // getDigit returns 10 ... 18 if we clicked on vfoB
digit = digit - 10; // so convert to 1 ... 8.
x = mult[direction][digit];
x = x + readB();
if (x >= 0 && x <= 999999999) // Safe to update the display without overflow or underflow.
writeB(x);
}
} //We fall through to here without processing the wheel if getDigit returns 9.
}
void vfo::writeA(int freq)
{
QString myStr;
int cnt = 0;
int stgChrs;
myStr.setNum(freq);
stgChrs = myStr.size() -1;
ui->lbl_Ahz->setText(""); // Clear the screen for VFO A
ui->lbl_Akhz->setText("");
ui->lbl_Amhz->setText("");
for (cnt = stgChrs; cnt > -1; cnt--) {
if (stgChrs - cnt < 3) ui->lbl_Ahz->setText(myStr.at(cnt)+ui->lbl_Ahz->text());
else if (stgChrs - cnt < 6) ui->lbl_Akhz->setText(myStr.at(cnt)+ui->lbl_Akhz->text());
else ui->lbl_Amhz->setText(myStr.at(cnt)+ui->lbl_Amhz->text());
}
if (selectedVFO != 'B') { // i.e. selectedVFO is 'A' or 'S'
setBandButton(freq);
}
if (ptt) {
if (selectedVFO == 'A') {
emit setFreq(freq, ptt);
qDebug() << "Using vfoA, freq = " << freq << ", ptt = " << ptt;
}
} else if (selectedVFO != 'B') {
emit setFreq(freq, ptt);
qDebug() << "Using vfoA, freq = " << freq << ", ptt = " << ptt;
}
}
void vfo::writeB(int freq)
{
QString myStr;
int cnt = 0;
int stgChrs;
myStr.setNum(freq);
stgChrs = myStr.size() -1;
ui->lbl_Bhz->setText(""); // Clear the screen for VFO B
ui->lbl_Bkhz->setText("");
ui->lbl_Bmhz->setText("");
for (cnt = stgChrs; cnt > -1; cnt--)
{
if (stgChrs - cnt < 3) ui->lbl_Bhz->setText(myStr.at(cnt)+ui->lbl_Bhz->text());
else if (stgChrs - cnt < 6) ui->lbl_Bkhz->setText(myStr.at(cnt)+ui->lbl_Bkhz->text());
else ui->lbl_Bmhz->setText(myStr.at(cnt)+ui->lbl_Bmhz->text());
}
if (selectedVFO == 'B') {
setBandButton(freq);
}
if (ptt) {
if (selectedVFO != 'A') {
emit setFreq(freq, ptt);
qDebug() << "Using vfoB, freq = " << freq << ", ptt = " << ptt;
}
} else if (selectedVFO == 'B') {
emit setFreq(freq, ptt);
qDebug() << "Using vfoB, freq = " << freq << ", ptt = " << ptt;
}
}
void vfo::setBandButton(int freq)
{
int cnt;
for (cnt = 0; cnt < 12; cnt++) { // 12 buttons (0 ... 11)
if (bands[cnt][bDat_fqmin] <= freq && bands[cnt][bDat_fqmax] >= freq) {
cur_Band = cnt;
ui->btnGrpBand->button((cnt+2)*-1)->setChecked(true);
bands[cnt][bDat_cFreq] = freq;
break;
}
}
}
int vfo::readA()
{
QString myStr;
myStr = (ui->lbl_Amhz->text() + ui->lbl_Akhz->text() + ui->lbl_Ahz->text());
return myStr.toInt();
}
int vfo::readB()
{
QString myStr;
myStr = ui->lbl_Bmhz->text() + ui->lbl_Bkhz->text() + ui->lbl_Bhz->text();
return myStr.toInt();
}
void vfo::on_pBtnvfoA_clicked()
{
if (selectedVFO != 'A') {
if (ui->pBtnRIT->isChecked()) {
ui->pBtnRIT->setChecked(false);
on_pBtnRIT_clicked();
}
selectedVFO = 'A';
ui->pBtnvfoA->setStyleSheet("background-color: rgb(85, 255, 0)"); //Set button to Green
ui->pBtnvfoB->setStyleSheet("background-color: normal");
ui->pBtnSplit->setStyleSheet("background-color: normal");
vfoEnabled(true, false);
setBandButton(readA());
writeA(readA());
}
}
void vfo::on_pBtnvfoB_clicked()
{
if (selectedVFO != 'B') {
if (ui->pBtnRIT->isChecked()) {
ui->pBtnRIT->setChecked(false);
on_pBtnRIT_clicked();
}
selectedVFO = 'B';
ui->pBtnvfoB->setStyleSheet("background-color: rgb(85, 255, 0)");
ui->pBtnvfoA->setStyleSheet("background-color: normal");
ui->pBtnSplit->setStyleSheet("background-color: normal");
vfoEnabled(false, true);
setBandButton(readB());
writeB(readB());
}
}
void vfo::on_pBtnSplit_clicked()
{
if (selectedVFO != 'S') {
if (ui->pBtnRIT->isChecked()) {
ui->pBtnRIT->setChecked(false);
on_pBtnRIT_clicked();
}
selectedVFO = 'S';
ui->pBtnvfoA->setStyleSheet("background-color: rgb(85, 255, 0)");
ui->pBtnvfoB->setStyleSheet("background-color: rgb(255, 155, 155)");
ui->pBtnSplit->setStyleSheet("background-color: rgb(0, 170, 255)");
vfoEnabled(true, false);
setBandButton(readA());
if (ptt == true) {
writeB(readB());
} else {
writeA(readA());
}
}
}
void vfo::on_pBtnScanDn_clicked()
{
ui->pBtnScanUp->setChecked(false);
}
void vfo::on_pBtnScanUp_clicked()
{
ui->pBtnScanDn->setChecked(false);
}
void vfo::on_pBtnExch_clicked()
{
int exchTemp;
exchTemp = readA();
writeA(readB());
writeB(exchTemp);
}
void vfo::on_pBtnAtoB_clicked()
{
writeB(readA());
}
void vfo::on_pBtnBtoA_clicked()
{
writeA(readB());
}
void vfo::vfoEnabled(bool setA, bool setB)
// Set the screen info for the vfo in use to enabled.
{
ui->lbl_Ahz->setEnabled(setA); //These are the labels used
ui->lbl_Akhz->setEnabled(setA);//to draw the frequency display.
ui->lbl_Amhz->setEnabled(setA);
ui->label->setEnabled(setA); //The MHz decimal
ui->label_2->setEnabled(setA); //The Khz comma
ui->lbl_Bhz->setEnabled(setB);
ui->lbl_Bkhz->setEnabled(setB);
ui->lbl_Bmhz->setEnabled(setB);
ui->label_3->setEnabled(setB);
ui->label_4->setEnabled(setB);
}
void vfo::readSettings()
{
QSettings settings("freesoftware", "vfo");
bands[0][bDat_mem00] = (settings.value("Band0_Mem00",1850000).toInt());
bands[0][bDat_mem01] = (settings.value("Band0_Mem01",1860000).toInt());
bands[0][bDat_mem02] = (settings.value("Band0_Mem02",1870000).toInt());
bands[0][bDat_mem03] = (settings.value("Band0_Mem03",1880000).toInt());
bands[0][bDat_cFreq] = (settings.value("Band0_Cfreq",1840000).toInt());
bands[0][bDat_fqmin] = (settings.value("Band0_Fqmin",1800000).toInt());
bands[0][bDat_fqmax] = (settings.value("Band0_Fqmax",1950000).toInt());
bands[0][bDat_modee] = (settings.value("Band0_Modee",1).toInt());
bands[0][bDat_filtH] = (settings.value("Band0_FiltH",2800).toInt());
bands[0][bDat_filtL] = (settings.value("Band0_FiltL",200).toInt());
bands[0][bDat_index] = (settings.value("Band0_Index",0).toInt());
bands[1][bDat_mem00] = (settings.value("Band1_Mem00",3550000).toInt());
bands[1][bDat_mem01] = (settings.value("Band1_Mem01",3560000).toInt());
bands[1][bDat_mem02] = (settings.value("Band1_Mem02",3570000).toInt());
bands[1][bDat_mem03] = (settings.value("Band1_Mem03",3580000).toInt());
bands[1][bDat_cFreq] = (settings.value("Band1_Cfreq",3540000).toInt());
bands[1][bDat_fqmin] = (settings.value("Band1_Fqmin",3500000).toInt());
bands[1][bDat_fqmax] = (settings.value("Band1_Fqmax",3900000).toInt());
bands[1][bDat_modee] = (settings.value("Band1_Modee",1).toInt());
bands[1][bDat_filtH] = (settings.value("Band1_FiltH",2800).toInt());
bands[1][bDat_filtL] = (settings.value("Band1_FiltL",200).toInt());
bands[1][bDat_index] = (settings.value("Band1_Index",0).toInt());
bands[2][bDat_mem00] = (settings.value("Band2_Mem00",7050000).toInt());
bands[2][bDat_mem01] = (settings.value("Band2_Mem01",7060000).toInt());
bands[2][bDat_mem02] = (settings.value("Band2_Mem02",7070000).toInt());
bands[2][bDat_mem03] = (settings.value("Band2_Mem03",7080000).toInt());
bands[2][bDat_cFreq] = (settings.value("Band2_Cfreq",7040000).toInt());
bands[2][bDat_fqmin] = (settings.value("Band2_Fqmin",7000000).toInt());
bands[2][bDat_fqmax] = (settings.value("Band2_Fqmax",7300000).toInt());
bands[2][bDat_modee] = (settings.value("Band2_Modee",1).toInt());
bands[2][bDat_filtH] = (settings.value("Band2_FiltH",2800).toInt());
bands[2][bDat_filtL] = (settings.value("Band2_FiltL",200).toInt());
bands[2][bDat_index] = (settings.value("Band2_Index",0).toInt());
bands[3][bDat_mem00] = (settings.value("Band3_Mem00",10110000).toInt());
bands[3][bDat_mem01] = (settings.value("Band3_Mem01",10120000).toInt());
bands[3][bDat_mem02] = (settings.value("Band3_Mem02",10130000).toInt());
bands[3][bDat_mem03] = (settings.value("Band3_Mem03",10140000).toInt());
bands[3][bDat_cFreq] = (settings.value("Band3_Cfreq",10125000).toInt());
bands[3][bDat_fqmin] = (settings.value("Band3_Fqmin",10100000).toInt());
bands[3][bDat_fqmax] = (settings.value("Band3_Fqmax",10150000).toInt());
bands[3][bDat_modee] = (settings.value("Band3_Modee",1).toInt());
bands[3][bDat_filtH] = (settings.value("Band3_FiltH",2800).toInt());
bands[3][bDat_filtL] = (settings.value("Band3_FiltL",200).toInt());
bands[3][bDat_index] = (settings.value("Band3_Index",0).toInt());
bands[4][bDat_mem00] = (settings.value("Band4_Mem00",14020000).toInt());
bands[4][bDat_mem01] = (settings.value("Band4_Mem01",14120000).toInt());
bands[4][bDat_mem02] = (settings.value("Band4_Mem02",14130000).toInt());
bands[4][bDat_mem03] = (settings.value("Band4_Mem03",14140000).toInt());
bands[4][bDat_cFreq] = (settings.value("Band4_Cfreq",14125000).toInt());
bands[4][bDat_fqmin] = (settings.value("Band4_Fqmin",14000000).toInt());
bands[4][bDat_fqmax] = (settings.value("Band4_Fqmax",14350000).toInt());
bands[4][bDat_modee] = (settings.value("Band4_Modee",1).toInt());
bands[4][bDat_filtH] = (settings.value("Band4_FiltH",2800).toInt());
bands[4][bDat_filtL] = (settings.value("Band4_FiltL",200).toInt());
bands[4][bDat_index] = (settings.value("Band4_Index",0).toInt());
bands[5][bDat_mem00] = (settings.value("Band5_Mem00",18010000).toInt());
bands[5][bDat_mem01] = (settings.value("Band5_Mem01",18020000).toInt());
bands[5][bDat_mem02] = (settings.value("Band5_Mem02",18030000).toInt());
bands[5][bDat_mem03] = (settings.value("Band5_Mem03",18040000).toInt());
bands[5][bDat_cFreq] = (settings.value("Band5_Cfreq",18025000).toInt());
bands[5][bDat_fqmin] = (settings.value("Band5_Fqmin",18068000).toInt());
bands[5][bDat_fqmax] = (settings.value("Band5_Fqmax",18168000).toInt());
bands[5][bDat_modee] = (settings.value("Band5_Modee",1).toInt());
bands[5][bDat_filtH] = (settings.value("Band5_FiltH",2800).toInt());
bands[5][bDat_filtL] = (settings.value("Band5_FiltL",200).toInt());
bands[5][bDat_index] = (settings.value("Band5_Index",0).toInt());
bands[6][bDat_mem00] = (settings.value("Band6_Mem00",21010000).toInt());
bands[6][bDat_mem01] = (settings.value("Band6_Mem01",21020000).toInt());
bands[6][bDat_mem02] = (settings.value("Band6_Mem02",21130000).toInt());
bands[6][bDat_mem03] = (settings.value("Band6_Mem03",21140000).toInt());
bands[6][bDat_cFreq] = (settings.value("Band6_Cfreq",21225000).toInt());
bands[6][bDat_fqmin] = (settings.value("Band6_Fqmin",21000000).toInt());
bands[6][bDat_fqmax] = (settings.value("Band6_Fqmax",21450000).toInt());
bands[6][bDat_modee] = (settings.value("Band6_Modee",1).toInt());
bands[6][bDat_filtH] = (settings.value("Band6_FiltH",2800).toInt());
bands[6][bDat_filtL] = (settings.value("Band6_FiltL",200).toInt());
bands[6][bDat_index] = (settings.value("Band6_Index",0).toInt());
bands[7][bDat_mem00] = (settings.value("Band7_Mem00",24900000).toInt());
bands[7][bDat_mem01] = (settings.value("Band7_Mem01",24920000).toInt());
bands[7][bDat_mem02] = (settings.value("Band7_Mem02",24930000).toInt());
bands[7][bDat_mem03] = (settings.value("Band7_Mem03",24940000).toInt());
bands[7][bDat_cFreq] = (settings.value("Band7_Cfreq",24925000).toInt());
bands[7][bDat_fqmin] = (settings.value("Band7_Fqmin",24890000).toInt());
bands[7][bDat_fqmax] = (settings.value("Band7_Fqmax",24990000).toInt());
bands[7][bDat_modee] = (settings.value("Band7_Modee",1).toInt());
bands[7][bDat_filtH] = (settings.value("Band7_FiltH",2800).toInt());
bands[7][bDat_filtL] = (settings.value("Band7_FiltL",200).toInt());
bands[7][bDat_index] = (settings.value("Band7_Index",0).toInt());
bands[8][bDat_mem00] = (settings.value("Band8_Mem00",26955000).toInt());
bands[8][bDat_mem01] = (settings.value("Band8_Mem01",26960000).toInt());
bands[8][bDat_mem02] = (settings.value("Band8_Mem02",26970000).toInt());
bands[8][bDat_mem03] = (settings.value("Band8_Mem03",26980000).toInt());
bands[8][bDat_cFreq] = (settings.value("Band8_Cfreq",26990000).toInt());
bands[8][bDat_fqmin] = (settings.value("Band8_Fqmin",26950000).toInt());
bands[8][bDat_fqmax] = (settings.value("Band8_Fqmax",27300000).toInt());
bands[8][bDat_modee] = (settings.value("Band8_Modee",1).toInt());
bands[8][bDat_filtH] = (settings.value("Band8_FiltH",2800).toInt());
bands[8][bDat_filtL] = (settings.value("Band8_FiltL",200).toInt());
bands[8][bDat_index] = (settings.value("Band8_Index",0).toInt());
bands[9][bDat_mem00] = (settings.value("Band9_Mem00",28010000).toInt());
bands[9][bDat_mem01] = (settings.value("Band9_Mem01",28420000).toInt());
bands[9][bDat_mem02] = (settings.value("Band9_Mem02",28430000).toInt());
bands[9][bDat_mem03] = (settings.value("Band9_Mem03",28440000).toInt());
bands[9][bDat_cFreq] = (settings.value("Band9_Cfreq",28425000).toInt());
bands[9][bDat_fqmin] = (settings.value("Band9_Fqmin",28000000).toInt());
bands[9][bDat_fqmax] = (settings.value("Band9_Fqmax",29700000).toInt());
bands[9][bDat_modee] = (settings.value("Band9_Modee",1).toInt());
bands[9][bDat_filtH] = (settings.value("Band9_FiltH",2800).toInt());
bands[9][bDat_filtL] = (settings.value("Band9_FiltL",200).toInt());
bands[9][bDat_index] = (settings.value("Band9_Index",0).toInt());
bands[10][bDat_mem00] = (settings.value("Band10_Mem00",51010000).toInt());
bands[10][bDat_mem01] = (settings.value("Band10_Mem01",51060000).toInt());
bands[10][bDat_mem02] = (settings.value("Band10_Mem02",51070000).toInt());
bands[10][bDat_mem03] = (settings.value("Band10_Mem03",51080000).toInt());
bands[10][bDat_cFreq] = (settings.value("Band10_Cfreq",51940000).toInt());
bands[10][bDat_fqmin] = (settings.value("Band10_Fqmin",51000000).toInt());
bands[10][bDat_fqmax] = (settings.value("Band10_Fqmax",53000000).toInt());
bands[10][bDat_modee] = (settings.value("Band10_Modee",1).toInt());
bands[10][bDat_filtH] = (settings.value("Band10_FiltH",2800).toInt());
bands[10][bDat_filtL] = (settings.value("Band10_FiltL",200).toInt());
bands[10][bDat_index] = (settings.value("Band10_Index",0).toInt());
bands[11][bDat_mem00] = (settings.value("Band11_Mem00",8050000).toInt());
bands[11][bDat_mem01] = (settings.value("Band11_Mem01",9060000).toInt());
bands[11][bDat_mem02] = (settings.value("Band11_Mem02",10070000).toInt());
bands[11][bDat_mem03] = (settings.value("Band11_Mem03",11080000).toInt());
bands[11][bDat_cFreq] = (settings.value("Band11_Cfreq",15040000).toInt());
bands[11][bDat_fqmin] = (settings.value("Band11_Fqmin",000000).toInt());
bands[11][bDat_fqmax] = (settings.value("Band11_Fqmax",999000000).toInt());
bands[11][bDat_modee] = (settings.value("Band11_Modee",1).toInt());
bands[11][bDat_filtH] = (settings.value("Band11_FiltH",2800).toInt());
bands[11][bDat_filtL] = (settings.value("Band11_FiltL",200).toInt());
bands[11][bDat_index] = (settings.value("Band11_Index",0).toInt());
writeA(settings.value("vfoA_f",3502000).toInt()); // These need to be done after all the frequency
writeB(settings.value("vfoB_f",14234567).toInt()); // settings have been read and set.
}
void vfo::writeSettings()
{
QSettings settings("freesoftware","vfo");
settings.setValue("vfoA_f", readA());
settings.setValue("vfoB_f", readB());
settings.setValue("Band0_Mem00",bands[0][bDat_mem00]);
settings.setValue("Band0_Mem01",bands[0][bDat_mem01]);
settings.setValue("Band0_Mem02",bands[0][bDat_mem02]);
settings.setValue("Band0_Mem03",bands[0][bDat_mem03]);
settings.setValue("Band0_Cfreq",bands[0][bDat_cFreq]);
settings.setValue("Band0_Fqmin",bands[0][bDat_fqmin]);
settings.setValue("Band0_Fqmax",bands[0][bDat_fqmax]);
settings.setValue("Band0_Modee",bands[0][bDat_modee]);
settings.setValue("Band0_FiltH",bands[0][bDat_filtH]);
settings.setValue("Band0_FiltL",bands[0][bDat_filtL]);
settings.setValue("Band0_Index",bands[0][bDat_index]);
settings.setValue("Band1_Mem00",bands[1][bDat_mem00]);
settings.setValue("Band1_Mem01",bands[1][bDat_mem01]);
settings.setValue("Band1_Mem02",bands[1][bDat_mem02]);
settings.setValue("Band1_Mem03",bands[1][bDat_mem03]);
settings.setValue("Band1_Cfreq",bands[1][bDat_cFreq]);
settings.setValue("Band1_Fqmin",bands[1][bDat_fqmin]);
settings.setValue("Band1_Fqmax",bands[1][bDat_fqmax]);
settings.setValue("Band1_Modee",bands[1][bDat_modee]);
settings.setValue("Band1_FiltH",bands[1][bDat_filtH]);
settings.setValue("Band1_FiltL",bands[1][bDat_filtL]);
settings.setValue("Band1_Index",bands[1][bDat_index]);
settings.setValue("Band2_Mem00",bands[2][bDat_mem00]);
settings.setValue("Band2_Mem01",bands[2][bDat_mem01]);
settings.setValue("Band2_Mem02",bands[2][bDat_mem02]);
settings.setValue("Band2_Mem03",bands[2][bDat_mem03]);
settings.setValue("Band2_Cfreq",bands[2][bDat_cFreq]);
settings.setValue("Band2_Fqmin",bands[2][bDat_fqmin]);
settings.setValue("Band2_Fqmax",bands[2][bDat_fqmax]);
settings.setValue("Band2_Modee",bands[2][bDat_modee]);
settings.setValue("Band2_FiltH",bands[2][bDat_filtH]);
settings.setValue("Band2_FiltL",bands[2][bDat_filtL]);
settings.setValue("Band2_Index",bands[2][bDat_index]);
settings.setValue("Band3_Mem00",bands[3][bDat_mem00]);
settings.setValue("Band3_Mem01",bands[3][bDat_mem01]);
settings.setValue("Band3_Mem02",bands[3][bDat_mem02]);
settings.setValue("Band3_Mem03",bands[3][bDat_mem03]);
settings.setValue("Band3_Cfreq",bands[3][bDat_cFreq]);
settings.setValue("Band3_Fqmin",bands[3][bDat_fqmin]);
settings.setValue("Band3_Fqmax",bands[3][bDat_fqmax]);
settings.setValue("Band3_Modee",bands[3][bDat_modee]);
settings.setValue("Band3_FiltH",bands[3][bDat_filtH]);
settings.setValue("Band3_FiltL",bands[3][bDat_filtL]);
settings.setValue("Band3_Index",bands[3][bDat_index]);
settings.setValue("Band4_Mem00",bands[4][bDat_mem00]);
settings.setValue("Band4_Mem01",bands[4][bDat_mem01]);
settings.setValue("Band4_Mem02",bands[4][bDat_mem02]);
settings.setValue("Band4_Mem03",bands[4][bDat_mem03]);
settings.setValue("Band4_Cfreq",bands[4][bDat_cFreq]);
settings.setValue("Band4_Fqmin",bands[4][bDat_fqmin]);
settings.setValue("Band4_Fqmax",bands[4][bDat_fqmax]);
settings.setValue("Band4_Modee",bands[4][bDat_modee]);
settings.setValue("Band4_FiltH",bands[4][bDat_filtH]);
settings.setValue("Band4_FiltL",bands[4][bDat_filtL]);
settings.setValue("Band4_Index",bands[4][bDat_index]);
settings.setValue("Band5_Mem00",bands[5][bDat_mem00]);
settings.setValue("Band5_Mem01",bands[5][bDat_mem01]);
settings.setValue("Band5_Mem02",bands[5][bDat_mem02]);
settings.setValue("Band5_Mem03",bands[5][bDat_mem03]);
settings.setValue("Band5_Cfreq",bands[5][bDat_cFreq]);
settings.setValue("Band5_Fqmin",bands[5][bDat_fqmin]);
settings.setValue("Band5_Fqmax",bands[5][bDat_fqmax]);
settings.setValue("Band5_Modee",bands[5][bDat_modee]);
settings.setValue("Band5_FiltH",bands[5][bDat_filtH]);
settings.setValue("Band5_FiltL",bands[5][bDat_filtL]);
settings.setValue("Band5_Index",bands[5][bDat_index]);
settings.setValue("Band6_Mem00",bands[6][bDat_mem00]);
settings.setValue("Band6_Mem01",bands[6][bDat_mem01]);
settings.setValue("Band6_Mem02",bands[6][bDat_mem02]);
settings.setValue("Band6_Mem03",bands[6][bDat_mem03]);
settings.setValue("Band6_Cfreq",bands[6][bDat_cFreq]);
settings.setValue("Band6_Fqmin",bands[6][bDat_fqmin]);
settings.setValue("Band6_Fqmax",bands[6][bDat_fqmax]);
settings.setValue("Band6_Modee",bands[6][bDat_modee]);
settings.setValue("Band6_FiltH",bands[6][bDat_filtH]);
settings.setValue("Band6_FiltL",bands[6][bDat_filtL]);
settings.setValue("Band6_Index",bands[6][bDat_index]);
settings.setValue("Band7_Mem00",bands[7][bDat_mem00]);
settings.setValue("Band7_Mem01",bands[7][bDat_mem01]);
settings.setValue("Band7_Mem02",bands[7][bDat_mem02]);
settings.setValue("Band7_Mem03",bands[7][bDat_mem03]);
settings.setValue("Band7_Cfreq",bands[7][bDat_cFreq]);
settings.setValue("Band7_Fqmin",bands[7][bDat_fqmin]);
settings.setValue("Band7_Fqmax",bands[7][bDat_fqmax]);
settings.setValue("Band7_Modee",bands[7][bDat_modee]);
settings.setValue("Band7_FiltH",bands[7][bDat_filtH]);
settings.setValue("Band7_FiltL",bands[7][bDat_filtL]);
settings.setValue("Band7_Index",bands[7][bDat_index]);
settings.setValue("Band8_Mem00",bands[8][bDat_mem00]);
settings.setValue("Band8_Mem01",bands[8][bDat_mem01]);
settings.setValue("Band8_Mem02",bands[8][bDat_mem02]);
settings.setValue("Band8_Mem03",bands[8][bDat_mem03]);
settings.setValue("Band8_Cfreq",bands[8][bDat_cFreq]);
settings.setValue("Band8_Fqmin",bands[8][bDat_fqmin]);
settings.setValue("Band8_Fqmax",bands[8][bDat_fqmax]);
settings.setValue("Band8_Modee",bands[8][bDat_modee]);
settings.setValue("Band8_FiltH",bands[8][bDat_filtH]);
settings.setValue("Band8_FiltL",bands[8][bDat_filtL]);
settings.setValue("Band8_Index",bands[8][bDat_index]);
settings.setValue("Band9_Mem00",bands[9][bDat_mem00]);
settings.setValue("Band9_Mem01",bands[9][bDat_mem01]);
settings.setValue("Band9_Mem02",bands[9][bDat_mem02]);
settings.setValue("Band9_Mem03",bands[9][bDat_mem03]);
settings.setValue("Band9_Cfreq",bands[9][bDat_cFreq]);
settings.setValue("Band9_Fqmin",bands[9][bDat_fqmin]);
settings.setValue("Band9_Fqmax",bands[9][bDat_fqmax]);
settings.setValue("Band9_Modee",bands[9][bDat_modee]);
settings.setValue("Band9_FiltH",bands[9][bDat_filtH]);
settings.setValue("Band9_FiltL",bands[9][bDat_filtL]);
settings.setValue("Band9_Index",bands[9][bDat_index]);
settings.setValue("Band10_Mem00",bands[10][bDat_mem00]);
settings.setValue("Band10_Mem01",bands[10][bDat_mem01]);
settings.setValue("Band10_Mem02",bands[10][bDat_mem02]);
settings.setValue("Band10_Mem03",bands[10][bDat_mem03]);
settings.setValue("Band10_Cfreq",bands[10][bDat_cFreq]);
settings.setValue("Band10_Fqmin",bands[10][bDat_fqmin]);
settings.setValue("Band10_Fqmax",bands[10][bDat_fqmax]);
settings.setValue("Band10_Modee",bands[10][bDat_modee]);
settings.setValue("Band10_FiltH",bands[10][bDat_filtH]);
settings.setValue("Band10_FiltL",bands[10][bDat_filtL]);
settings.setValue("Band10_Index",bands[10][bDat_index]);
settings.setValue("Band11_Mem00",bands[11][bDat_mem00]);
settings.setValue("Band11_Mem01",bands[11][bDat_mem01]);
settings.setValue("Band11_Mem02",bands[11][bDat_mem02]);
settings.setValue("Band11_Mem03",bands[11][bDat_mem03]);
settings.setValue("Band11_Cfreq",bands[11][bDat_cFreq]);
settings.setValue("Band11_Fqmin",bands[11][bDat_fqmin]);
settings.setValue("Band11_Fqmax",bands[11][bDat_fqmax]);
settings.setValue("Band11_Modee",bands[11][bDat_modee]);
settings.setValue("Band11_FiltH",bands[11][bDat_filtH]);
settings.setValue("Band11_FiltL",bands[11][bDat_filtL]);
settings.setValue("Band11_Index",bands[11][bDat_index]);
}
void vfo::closeEvent(QCloseEvent *)
{
SaveMySettings();
}
void vfo::on_toolBtnUp_clicked()
{
switch (selectedVFO) {
case 'A':
case 'S': {
writeA(readA() + 24000);
break;
}
case 'B':
writeB(readB() + 24000);
}
}
void vfo::on_toolBtnDn_clicked()
{
switch (selectedVFO) {
case 'A':
case 'S': {
writeA(readA() - 24000);
break;
}
case 'B':
writeB(readB() - 24000);
}
}