6
* Copyright 2009, Dave Freese, W1HKJ
7
* Copyright 2011-2012, Terry Embry, KJ4EED
16
#define WVALS_LIMIT -1
19
mLSB, mUSB, mCW, mFM, mAM, mRTTY_L, mCW_R, mDATA_L, mRTTY_U, mFM_N, mDATA_U };
20
// 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 // mode index
22
static const char FTdx1200name_[] = "FTdx1200";
24
static const char *FTdx1200modes_[] = {
25
"LSB", "USB", "CW", "FM", "AM", "RTTY-L", "CW-R", "DATA-L", "RTTY-U", "FM-N", "DATA-U", NULL};
27
static const char FTdx1200_mode_chr[] = { '1', '2', '3', '4', '5', '6', '7', '8', '9', 'B', 'C' };
28
static const char FTdx1200_mode_type[] = { 'L', 'U', 'L', 'U', 'U', 'L', 'U', 'L', 'U', 'U', 'U' };
29
// lsb usb cw fm am ttyL cwR datL ttyU fmN datU
31
static const int FTdx1200_def_bw[] = {
32
18, 18, 10, 0, 0, 6, 10, 15, 6, 0, 15 };
33
// mLSB, mUSB, mCW, mFM, mAM, mRTTY_L, mCW_R, mDATA_L, mRTTY_U, mFM_N, mDATA_U
35
static const char *FTdx1200_widths_SSB[] = {
36
"200", "400", "600", "850", "1100",
37
"1350", "1500", "1650", "1800", "1950",
38
"2100", "2250", "2400", "2500", "2600",
39
"2700", "2800", "2900", "3000", "3200",
40
"3400", "3800", "4000", NULL }; // def_bw = 18
42
static int FTdx1200_wvals_SSB[] = {
43
1,2,3,4,5,6,7,8,9,10,11,12,13,15,16,17,18,19,20,21,22,23, WVALS_LIMIT};
45
static const char *FTdx1200_widths_SSBD[] = {
46
"50", "150", "100", "150", "200",
47
"250", "300", "350", "400", "450",
48
"500", "800", "1200", "1400", "1700",
49
"2000", "2400", NULL }; // def_bw = 16 for DATA, 6 for RTTY
51
static int FTdx1200_wvals_SSBD[] = {
52
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, WVALS_LIMIT};
54
static const char *FTdx1200_widths_CW[] = {
55
"50", "150", "100", "150", "200",
56
"250", "300", "350", "400", "450",
57
"500", "800", "1200", "1400", "1700",
58
"2000", "2400", NULL }; // def_bw = 10
60
static int FTdx1200_wvals_CW[] = {
61
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, WVALS_LIMIT};
63
// Single bandwidth modes
64
static const char *FTdx1200_widths_FMnar[] = { "NARR", NULL };
65
static const char *FTdx1200_widths_AMFM[] = { "NORM", NULL };
67
static const int FTdx1200_wvals_AMFM[] = { 0, WVALS_LIMIT };
70
static const char *US_60m_chan[] = {"000","125","126","127","128","130","141","142","143","144","146",NULL};
71
static const char *US_60m_label[] = {"VFO","U51","U52","U53","U54","U55","U56","U57","U58","U59","U50",NULL};
73
// UK 60m channel numbers by Brian, G8SEZ
74
static const char *UK_60m_chan[] = {"000","118","120","121","127","128","129","130",NULL};
75
static const char *UK_60m_label[] = {"VFO","U51","U52","U53","U54","U55","U56","U57",NULL};
77
static const char **Channels_60m = US_60m_chan;
78
static const char **label_60m = US_60m_label;
80
static GUI rig_widgets[]= {
81
{ (Fl_Widget *)btnVol, 2, 125, 50 },
82
{ (Fl_Widget *)sldrVOLUME, 54, 125, 156 },
83
{ (Fl_Widget *)sldrRFGAIN, 54, 145, 156 },
84
{ (Fl_Widget *)btnIFsh, 214, 105, 50 },
85
{ (Fl_Widget *)sldrIFSHIFT, 266, 105, 156 },
86
{ (Fl_Widget *)btnNotch, 214, 125, 50 },
87
{ (Fl_Widget *)sldrNOTCH, 266, 125, 156 },
88
{ (Fl_Widget *)sldrMICGAIN, 266, 145, 156 },
89
{ (Fl_Widget *)sldrPOWER, 266, 165, 156 },
90
{ (Fl_Widget *)btnNR, 2, 165, 50 },
91
{ (Fl_Widget *)sldrNR, 54, 165, 156 },
92
{ (Fl_Widget *)NULL, 0, 0, 0 }
95
RIG_FTdx1200::RIG_FTdx1200() {
97
name_ = FTdx1200name_;
98
modes_ = FTdx1200modes_;
99
bandwidths_ = FTdx1200_widths_SSB;
100
bw_vals_ = FTdx1200_wvals_SSB;
102
widgets = rig_widgets;
104
comm_baudrate = BR38400;
110
comm_rtsplus = false;
111
comm_dtrplus = false;
116
A.imode = B.imode = modeB = modeA = def_mode = 1;
117
A.iBW = B.iBW = bwA = bwB = def_bw = 12;
118
A.freq = B.freq = freqA = freqB = def_freq = 14070000;
123
has_xcvr_auto_on_off =
127
has_noise_reduction =
128
has_noise_reduction_control =
134
has_vox_on_dataport =
154
has_micgain_control =
157
has_bandwidth_control =
160
has_attenuator_control =
162
has_ifshift_control =
164
has_tune_control = true;
177
void RIG_FTdx1200::initialize()
179
rig_widgets[0].W = btnVol;
180
rig_widgets[1].W = sldrVOLUME;
181
rig_widgets[2].W = sldrRFGAIN;
182
rig_widgets[3].W = btnIFsh;
183
rig_widgets[4].W = sldrIFSHIFT;
184
rig_widgets[5].W = btnNotch;
185
rig_widgets[6].W = sldrNOTCH;
186
rig_widgets[7].W = sldrMICGAIN;
187
rig_widgets[8].W = sldrPOWER;
188
rig_widgets[9].W = btnNR;
189
rig_widgets[10].W = sldrNR;
191
// set progStatus defaults
192
if (progStatus.notch_val < 10) progStatus.notch_val = 1500;
193
if (progStatus.noise_reduction_val < 1) progStatus.noise_reduction_val = 1;
194
if (progStatus.power_level < 5) progStatus.power_level = 5;
195
// first-time-thru, or reset
196
if (progStatus.cw_qsk < 15) {
197
progStatus.cw_qsk = 15;
198
progStatus.cw_spot_tone = 700;
199
progStatus.cw_weight = 3.0;
200
progStatus.cw_wpm = 18;
201
progStatus.vox_on_dataport = false;
202
progStatus.vox_gain = 50;
203
progStatus.vox_anti = 50;
204
progStatus.vox_hang = 500;
206
// Disable Auto Information mode
209
// "MRnnn;" if valid, returns last channel used, "mrlll...;", along with channel nnn info.
211
waitN(27, 100, "Read UK 60m Channel Mem", ASC);
212
size_t p = replystr.rfind("MR");
213
if (p == string::npos) {
214
Channels_60m = US_60m_chan;
215
label_60m = US_60m_label;
217
char **p = (char **)US_60m_label;
218
while (*p) opSelect60->add(*p++);
221
Channels_60m = UK_60m_chan;
222
label_60m = UK_60m_label;
224
char **p = (char **)UK_60m_label;
225
while (*p) opSelect60->add(*p++);
227
opSelect60->index(m_60m_indx);
230
// waitN(11,100,"Read Vfo Adjust", ASC);
231
// size_t p = replystr.rfind("EX035");
235
void RIG_FTdx1200::post_initialize()
237
enable_bandselect_btn(12, false);
238
enable_bandselect_btn(13, true);
241
void RIG_FTdx1200::shutdown()
245
long RIG_FTdx1200::get_vfoA ()
249
waitN(11, 100, "get vfo A", ASC);
251
size_t p = replystr.rfind(rsp);
252
if (p == string::npos) return freqA;
254
for (size_t n = 2; n < 10; n++)
255
f = f*10 + replystr[p+n] - '0';
260
void RIG_FTdx1200::set_vfoA (long freq)
264
for (int i = 9; i > 1; i--) {
269
showresp(WARN, ASC, "SET vfo A", cmd, replystr);
272
long RIG_FTdx1200::get_vfoB ()
276
waitN(11, 100, "get vfo B", ASC);
278
size_t p = replystr.rfind(rsp);
279
if (p == string::npos) return freqB;
281
for (size_t n = 2; n < 10; n++)
282
f = f*10 + replystr[p+n] - '0';
288
void RIG_FTdx1200::set_vfoB (long freq)
292
for (int i = 9; i > 1; i--) {
297
showresp(WARN, ASC, "SET vfo B", cmd, replystr);
300
void RIG_FTdx1200::setVfoAdj(double v)
303
snprintf(cmdstr, sizeof(cmdstr), "EX035%+03d;", (int)v);
308
double RIG_FTdx1200::getVfoAdj()
311
sendCommand(cmd.append(";"));
312
waitN(9, 100, "get Vfo Adjust", ASC);
314
size_t p = replystr.rfind(rsp);
315
if (p == string::npos) return 0;
316
return (double)(atoi(&replystr[p+5]));
319
void RIG_FTdx1200::get_vfoadj_min_max_step(int &min, int &max, int &step)
326
bool RIG_FTdx1200::twovfos()
331
void RIG_FTdx1200::selectA()
335
showresp(WARN, ASC, "select A", cmd, replystr);
338
void RIG_FTdx1200::selectB()
342
showresp(WARN, ASC, "select B", cmd, replystr);
345
void RIG_FTdx1200::A2B()
349
showresp(WARN, ASC, "vfo A --> B", cmd, replystr);
352
bool RIG_FTdx1200::can_split()
357
void RIG_FTdx1200::set_split(bool val)
364
showresp(WARN, ASC, "Rx on B, Tx on A", cmd, replystr);
368
showresp(WARN, ASC, "Rx on B, Tx on B", cmd, replystr);
374
showresp(WARN, ASC, "Rx on A, Tx on B", cmd, replystr);
378
showresp(WARN, ASC, "Rx on A, Tx on A", cmd, replystr);
381
Fl::awake(highlight_vfo, (void *)0);
384
int RIG_FTdx1200::get_split()
392
waitN(4, 100, "get split tx vfo", ASC);
393
p = replystr.rfind(rsp);
394
if (p == string::npos) return false;
395
tx = replystr[p+2] - '0';
400
waitN(4, 100, "get split rx vfo", ASC);
402
p = replystr.rfind(rsp);
403
if (p == string::npos) return false;
404
rx = replystr[p+2] - '0';
406
split = (tx == 1 ? 2 : 0) + (rx >= 4 ? 1 : 0);
412
int RIG_FTdx1200::get_smeter()
416
waitN(7, 100, "get smeter", ASC);
418
size_t p = replystr.rfind(rsp);
419
if (p == string::npos) return 0;
420
if (p + 6 >= replystr.length()) return 0;
421
int mtr = atoi(&replystr[p+3]);
422
mtr = mtr * 100.0 / 256.0;
426
int RIG_FTdx1200::get_swr()
430
waitN(7, 100, "get swr", ASC);
432
size_t p = replystr.rfind(rsp);
433
if (p == string::npos) return 0;
434
if (p + 6 >= replystr.length()) return 0;
435
int mtr = atoi(&replystr[p+3]);
436
return (int)ceil(mtr / 2.56);
439
int RIG_FTdx1200::get_alc()
443
waitN(7, 100, "get alc", ASC);
445
size_t p = replystr.rfind(rsp);
446
if (p == string::npos) return 0;
447
if (p + 6 >= replystr.length()) return 0;
448
int mtr = atoi(&replystr[p+3]);
449
return (int)ceil(mtr / 2.56);
452
int RIG_FTdx1200::get_power_out()
455
sendCommand(cmd.append(";"));
456
waitN(7, 100, "get pout", ASC);
458
size_t p = replystr.rfind(rsp);
459
if (p == string::npos) return 0;
460
if (p + 6 >= replystr.length()) return 0;
461
double mtr = (double)(atoi(&replystr[p+3]));
463
// following conversion iaw data measured by Terry, KJ4EED
464
mtr = (.06 * mtr) + (.002 * mtr * mtr);
466
return (int)ceil(mtr);
469
// Transceiver power level
470
int RIG_FTdx1200::get_power_control()
474
waitN(6, 100, "get power", ASC);
476
size_t p = replystr.rfind(rsp);
477
if (p == string::npos) return progStatus.power_level;
478
if (p + 5 >= replystr.length()) return progStatus.power_level;
480
int mtr = atoi(&replystr[p+2]);
484
void RIG_FTdx1200::set_power_control(double val)
488
for (int i = 4; i > 1; i--) {
493
showresp(WARN, ASC, "SET power", cmd, replystr);
496
// Volume control return 0 ... 100
497
int RIG_FTdx1200::get_volume_control()
501
waitN(7, 100, "get vol", ASC);
503
size_t p = replystr.rfind(rsp);
504
if (p == string::npos) return progStatus.volume;
505
if (p + 6 >= replystr.length()) return progStatus.volume;
506
int val = round(atoi(&replystr[p+3]) / 2.55);
507
if (val > 100) val = 100;
511
void RIG_FTdx1200::set_volume_control(int val)
513
int ivol = (int)(val * 2.55);
515
for (int i = 5; i > 2; i--) {
520
showresp(WARN, ASC, "SET vol", cmd, replystr);
523
// Tranceiver PTT on/off
524
void RIG_FTdx1200::set_PTT_control(int val)
526
cmd = val ? "TX1;" : "TX0;";
528
showresp(WARN, ASC, "SET PTT", cmd, replystr);
531
// internal or external tune mode
532
void RIG_FTdx1200::tune_rig()
534
static bool extun_on = false;
535
static int rmd = modeA;
536
static int rbw = bwA;
537
static int rpwr = 100;
538
static long rfreq = freqA; // fix for menu 047 OFSt default
539
int use_int_tuner = true;
541
// On-The-Fly bandstack by bandstack int/ext tuner
542
// if rig "Tuner" light is on internal else external
545
waitN(6, 100, "is Int. Tuner Enabled", ASC);
546
size_t p = replystr.rfind(rsp);
547
if (p == string::npos) return;
548
if ((p + 5) >= replystr.length()) return;
549
if (replystr[p+4] == '0') {
550
use_int_tuner = false;
556
showresp(WARN, ASC, "tune rig", cmd, replystr);
558
if (extun_on == false) {
559
if (btnPTT->value() == true) return;
560
if (get_split() == 1 || get_split() == 2) return; // no split extune
561
useB ? rmd = modeB : rmd = modeA;
562
useB ? rbw = bwB : rbw = bwA;
563
useB ? rfreq = freqB : rfreq = freqA;
564
useB ? set_modeB(mAM) : set_modeA(mAM);
565
useB ? set_vfoB(rfreq) : set_vfoA(rfreq);
566
rpwr = get_power_control();
567
set_power_control(10);
568
sendCommand("EX0360000;"); // AM mic off
569
// sendCommand("EX0560000;"); // FM mic off
575
btnPTT->value(false);
577
sendCommand("EX0361000;"); // AM mic default
578
// sendCommand("EX0560050;"); // FM mic default
579
set_power_control(rpwr);
580
useB ? set_modeB(rmd) : set_modeA(rmd);
581
useB ? set_bwB(rbw) : set_bwA(rbw);
582
useB ? set_vfoB(rfreq) : set_vfoA(rfreq);
587
void RIG_FTdx1200::set_attenuator(int val)
589
if (atten_level == 0) {
591
atten_label("6 dB", true);
592
} else if (atten_level == 1) {
594
atten_label("12 dB", true);
595
} else if (atten_level == 2) {
597
atten_label("18 dB", true);
598
} else if (atten_level == 3) {
600
atten_label("Att", false);
603
cmd[3] += atten_level;
605
showresp(WARN, ASC, "SET att", cmd, replystr);
608
int RIG_FTdx1200::get_attenuator()
612
waitN(5, 100, "get att", ASC);
614
size_t p = replystr.rfind(rsp);
615
if (p == string::npos) return progStatus.attenuator;
616
if (p + 3 >= replystr.length()) return progStatus.attenuator;
617
atten_level = replystr[p+3] - '0';
618
if (atten_level == 1) {
619
atten_label("6 dB", true);
620
} else if (atten_level == 2) {
621
atten_label("12 dB", true);
622
} else if (atten_level == 3) {
623
atten_label("18 dB", true);
626
atten_label("Att", false);
631
void RIG_FTdx1200::set_preamp(int val)
634
if (preamp_level == 0) {
636
preamp_label("Amp 1", true);
637
} else if (preamp_level == 1) {
639
preamp_label("Amp 2", true);
640
} else if (preamp_level == 2) {
642
preamp_label("IPO", false);
644
cmd[3] = '0' + preamp_level;
646
showresp(WARN, ASC, "SET preamp", cmd, replystr);
649
int RIG_FTdx1200::get_preamp()
653
waitN(5, 100, "get pre", ASC);
655
size_t p = replystr.rfind(rsp);
656
if (p != string::npos)
657
preamp_level = replystr[p+3] - '0';
658
if (preamp_level == 1) {
659
preamp_label("Amp 1", true);
660
} else if (preamp_level == 2) {
661
preamp_label("Amp 2", true);
663
preamp_label("IPO", false);
669
int RIG_FTdx1200::adjust_bandwidth(int val)
674
bandwidths_ = FTdx1200_widths_CW;
675
bw_vals_ = FTdx1200_wvals_CW;
679
bandwidths_ = FTdx1200_widths_AMFM;
680
bw_vals_ = FTdx1200_wvals_AMFM;
683
bandwidths_ = FTdx1200_widths_FMnar;
684
bw_vals_ = FTdx1200_wvals_AMFM;
690
bandwidths_ = FTdx1200_widths_SSBD;
691
bw_vals_ = FTdx1200_wvals_SSBD;
694
bandwidths_ = FTdx1200_widths_SSB;
695
bw_vals_ = FTdx1200_wvals_SSB;
697
return FTdx1200_def_bw[val];
700
int RIG_FTdx1200::def_bandwidth(int val)
702
return FTdx1200_def_bw[val];
705
const char ** RIG_FTdx1200::bwtable(int n)
708
case mFM : return FTdx1200_widths_AMFM;
709
case mAM : return FTdx1200_widths_AMFM;
710
case mFM_N : return FTdx1200_widths_FMnar;
711
case mCW : return FTdx1200_widths_CW;
712
case mCW_R : return FTdx1200_widths_CW;
713
case mRTTY_L : return FTdx1200_widths_SSBD;
714
case mRTTY_U : return FTdx1200_widths_SSBD;
715
case mDATA_L : return FTdx1200_widths_SSBD;
716
case mDATA_U : return FTdx1200_widths_SSBD;
718
return FTdx1200_widths_SSB;
721
void RIG_FTdx1200::set_modeA(int val)
725
cmd += FTdx1200_mode_chr[val];
728
showresp(WARN, ASC, "SET mode A", cmd, replystr);
729
adjust_bandwidth(modeA);
730
if (val != mCW && val != mCW_R) return;
731
if (progStatus.spot_onoff) {
732
progStatus.spot_onoff = false;
736
showresp(WARN, ASC, "SET spot off", cmd, replystr);
741
int RIG_FTdx1200::get_modeA()
745
waitN(5, 100, "get mode A", ASC);
747
size_t p = replystr.rfind(rsp);
748
if (p != string::npos) {
749
if (p + 3 < replystr.length()) {
750
int md = replystr[p+3];
751
if (md <= '9') md = md - '1';
752
else md = 9 + md - 'A';
756
adjust_bandwidth(modeA);
760
void RIG_FTdx1200::set_modeB(int val)
764
cmd += FTdx1200_mode_chr[val];
767
showresp(WARN, ASC, "SET mode B", cmd, replystr);
768
adjust_bandwidth(modeB);
769
if (val != mCW && val != mCW_R) return;
770
if (progStatus.spot_onoff) {
771
progStatus.spot_onoff = false;
775
showresp(WARN, ASC, "SET spot off", cmd, replystr);
780
int RIG_FTdx1200::get_modeB()
784
waitN(5, 100, "get mode B", ASC);
786
size_t p = replystr.rfind(rsp);
787
if (p != string::npos) {
788
if (p + 3 < replystr.length()) {
789
int md = replystr[p+3];
790
if (md <= '9') md = md - '1';
791
else md = 9 + md - 'A';
795
adjust_bandwidth(modeB);
799
void RIG_FTdx1200::set_bwA(int val)
801
int bw_indx = bw_vals_[val];
805
if (md == mFM || md == mAM || md == mFM_N ) return;
808
case mLSB : case mUSB :
809
if (val < 8 ) ++cmd[3];
811
case mCW : case mCW_R :
812
if (val < 9) ++cmd[3];
814
case mRTTY_L : case mRTTY_U :
815
case mDATA_L : case mDATA_U :
816
if (val < 9) ++cmd[3];
821
cmd += '0' + bw_indx / 10;
822
cmd += '0' + bw_indx % 10;
825
showresp(WARN, ASC, "SET bw A", cmd, replystr);
828
int RIG_FTdx1200::get_bwA()
831
if (modeA == mFM || modeA == mAM || modeA == mFM_N) {
837
waitN(6, 100, "get bw A", ASC);
839
p = replystr.rfind(rsp);
840
if (p == string::npos) return bwA;
841
if (p + 5 >= replystr.length()) return bwA;
844
int bw_idx = fm_decimal(&replystr[p+3],2);
845
const int *idx = bw_vals_;
847
while (*idx != WVALS_LIMIT) {
848
if (*idx == bw_idx) break;
852
if (*idx == WVALS_LIMIT) i--;
857
void RIG_FTdx1200::set_bwB(int val)
859
int bw_indx = bw_vals_[val];
863
if (md == mFM || md == mAM || md == mFM_N ) return;
866
case mLSB : case mUSB :
867
if (val < 8 ) ++cmd[3];
869
case mCW : case mCW_R :
870
if (val < 9) ++cmd[3];
872
case mRTTY_L : case mRTTY_U :
873
case mDATA_L : case mDATA_U :
874
if (val < 9) ++cmd[3];
879
cmd += '0' + bw_indx / 10;
880
cmd += '0' + bw_indx % 10;
883
showresp(WARN, ASC, "SET bw B", cmd, replystr);
886
int RIG_FTdx1200::get_bwB()
889
if (modeB == mFM || modeB == mAM || modeB == mFM_N) {
895
waitN(6, 100, "get bw B", ASC);
897
p = replystr.rfind(rsp);
898
if (p == string::npos) return bwB;
899
if (p + 5 >= replystr.length()) return bwB;
902
int bw_idx = fm_decimal(&replystr[p+3],2);
903
const int *idx = bw_vals_;
905
while (*idx != WVALS_LIMIT) {
906
if (*idx == bw_idx) break;
910
if (*idx == WVALS_LIMIT) i--;
915
int RIG_FTdx1200::get_modetype(int n)
917
return FTdx1200_mode_type[n];
920
void RIG_FTdx1200::set_if_shift(int val)
923
if (val < 0) cmd[3] = '-';
925
for (int i = 4; i > 0; i--) {
926
cmd[3+i] += val % 10;
930
showresp(WARN, ASC, "SET if shift", cmd, replystr);
933
bool RIG_FTdx1200::get_if_shift(int &val)
937
waitN(9, 100, "get if shift", ASC);
939
size_t p = replystr.rfind(rsp);
940
val = progStatus.shift_val;
941
if (p == string::npos) return progStatus.shift;
942
val = atoi(&replystr[p+4]);
943
if (replystr[p+3] == '-') val = -val;
947
void RIG_FTdx1200::get_if_min_max_step(int &min, int &max, int &step)
949
if_shift_min = min = -1000;
950
if_shift_max = max = 1000;
951
if_shift_step = step = 20;
955
void RIG_FTdx1200::set_notch(bool on, int val)
957
// set notch frequency
961
showresp(WARN, ASC, "SET notch on", cmd, replystr);
963
if (val % 10 >= 5) val += 10;
965
for (int i = 3; i > 0; i--) {
966
cmd[3 + i] += val % 10;
970
showresp(WARN, ASC, "SET notch val", cmd, replystr);
977
showresp(WARN, ASC, "SET notch off", cmd, replystr);
980
bool RIG_FTdx1200::get_notch(int &val)
985
waitN(8, 100, "get notch on/off", ASC);
987
size_t p = replystr.rfind(rsp);
988
if (p == string::npos) return ison;
990
if (replystr[p+6] == '1') { // manual notch enabled
992
val = progStatus.notch_val;
995
waitN(8, 100, "get notch val", ASC);
996
p = replystr.rfind(rsp);
997
if (p == string::npos)
1000
val = fm_decimal(&replystr[p+4],3) * 10;
1005
void RIG_FTdx1200::get_notch_min_max_step(int &min, int &max, int &step)
1012
void RIG_FTdx1200::set_auto_notch(int v)
1014
cmd.assign("BC0").append(v ? "1" : "0" ).append(";");
1016
showresp(WARN, ASC, "SET DNF Auto Notch Filter", cmd, replystr);
1019
int RIG_FTdx1200::get_auto_notch()
1022
waitN(5, 100, "get auto notch", ASC);
1023
size_t p = replystr.rfind("BC0");
1024
if (p == string::npos) return 0;
1025
if (replystr[p+3] == '1') return 1;
1029
int FTdx1200_blanker_level = 2;
1031
void RIG_FTdx1200::set_noise(bool b)
1034
if (FTdx1200_blanker_level == 0) {
1035
FTdx1200_blanker_level = 1;
1036
nb_label("NB 1", true);
1037
} else if (FTdx1200_blanker_level == 1) {
1038
FTdx1200_blanker_level = 2;
1039
nb_label("NB 2", true);
1040
} else if (FTdx1200_blanker_level == 2) {
1041
FTdx1200_blanker_level = 0;
1042
nb_label("NB", false);
1044
cmd[3] = '0' + FTdx1200_blanker_level;
1046
showresp(WARN, ASC, "SET NB", cmd, replystr);
1049
int RIG_FTdx1200::get_noise()
1053
waitN(5, 100, "get NB", ASC);
1055
size_t p = replystr.rfind(rsp);
1056
if (p == string::npos) return FTdx1200_blanker_level;
1058
FTdx1200_blanker_level = replystr[p+3] - '0';
1059
if (FTdx1200_blanker_level == 1) {
1060
nb_label("NB 1", true);
1061
} else if (FTdx1200_blanker_level == 2) {
1062
nb_label("NB 2", true);
1064
nb_label("NB", false);
1065
FTdx1200_blanker_level = 0;
1067
return FTdx1200_blanker_level;
1071
void RIG_FTdx1200::set_mic_gain(int val)
1074
val = (int)(val * 2.50);
1075
for (int i = 3; i > 0; i--) {
1076
cmd[1+i] += val % 10;
1080
showresp(WARN, ASC, "SET mic", cmd, replystr);
1083
int RIG_FTdx1200::get_mic_gain()
1087
waitN(6, 100, "get mic", ASC);
1089
size_t p = replystr.rfind(rsp);
1090
if (p == string::npos) return progStatus.mic_gain;
1091
int val = atoi(&replystr[p+2]);
1092
val = (int)(val / 2.50);
1093
if (val > 100) val = 100;
1097
void RIG_FTdx1200::get_mic_min_max_step(int &min, int &max, int &step)
1104
void RIG_FTdx1200::set_rf_gain(int val)
1107
int rfval = (int)(val * 2.50);
1108
for (int i = 5; i > 2; i--) {
1109
cmd[i] = rfval % 10 + '0';
1113
showresp(WARN, ASC, "SET rfgain", cmd, replystr);
1116
int RIG_FTdx1200::get_rf_gain()
1121
waitN(7, 100, "get rfgain", ASC);
1123
size_t p = replystr.rfind(rsp);
1124
if (p == string::npos) return progStatus.rfgain;
1125
for (int i = 3; i < 6; i++) {
1127
rfval += replystr[p+i] - '0';
1129
rfval = (int)(rfval / 2.50);
1130
if (rfval > 100) rfval = 100;
1134
void RIG_FTdx1200::get_rf_min_max_step(int &min, int &max, int &step)
1141
void RIG_FTdx1200::set_vox_onoff()
1144
if (progStatus.vox_onoff) cmd[2] = '1';
1146
showresp(WARN, ASC, "SET vox", cmd, replystr);
1149
void RIG_FTdx1200::set_vox_gain()
1152
cmd.append(to_decimal(progStatus.vox_gain, 3)).append(";");
1154
showresp(WARN, ASC, "SET vox gain", cmd, replystr);
1157
void RIG_FTdx1200::set_vox_anti()
1160
cmd.append(to_decimal(progStatus.vox_anti, 3)).append(";");
1162
showresp(WARN, ASC, "SET anti-vox", cmd, replystr);
1165
void RIG_FTdx1200::set_vox_hang()
1168
cmd.append(to_decimal(progStatus.vox_hang, 4)).append(";");
1170
showresp(WARN, ASC, "SET vox delay", cmd, replystr);
1173
void RIG_FTdx1200::set_vox_on_dataport()
1176
if (progStatus.vox_on_dataport) cmd[5] = '1';
1178
showresp(WARN, ASC, "SET vox on data port", cmd, replystr);
1181
void RIG_FTdx1200::set_cw_wpm()
1184
if (progStatus.cw_wpm > 60) progStatus.cw_wpm = 60;
1185
if (progStatus.cw_wpm < 4) progStatus.cw_wpm = 4;
1186
cmd.append(to_decimal(progStatus.cw_wpm, 3)).append(";");
1188
showresp(WARN, ASC, "SET cw wpm", cmd, replystr);
1192
void RIG_FTdx1200::enable_keyer()
1195
if (progStatus.enable_keyer) cmd[2] = '1';
1197
showresp(WARN, ASC, "SET keyer on/off", cmd, replystr);
1200
bool RIG_FTdx1200::set_cw_spot()
1202
if (vfo.imode == mCW || vfo.imode == mCW_R) {
1204
if (progStatus.spot_onoff) cmd[2] = '1';
1206
showresp(WARN, ASC, "SET spot on/off", cmd, replystr);
1212
void RIG_FTdx1200::set_cw_weight()
1214
int n = round(progStatus.cw_weight * 10);
1215
cmd.assign("EX046").append(to_decimal(n, 2)).append(";");
1217
showresp(WARN, ASC, "SET cw weight", cmd, replystr);
1220
void RIG_FTdx1200::set_cw_qsk()
1222
int n = progStatus.cw_qsk / 5 - 3;
1223
cmd.assign("EX049").append(to_decimal(n, 1)).append(";");
1225
showresp(WARN, ASC, "SET cw qsk", cmd, replystr);
1228
void RIG_FTdx1200::set_cw_spot_tone()
1230
int n = (progStatus.cw_spot_tone - 300) / 50;
1231
cmd.assign("EX045").append(to_decimal(n, 2)).append(";");
1233
showresp(WARN, ASC, "SET cw tone", cmd, replystr);
1237
void RIG_FTdx1200::set_cw_vol()
1242
void RIG_FTdx1200::set_band_selection(int v)
1244
int chan_mem_on = false;
1246
waitN(27, 100, "get vfo mode in set_band_selection", ASC);
1247
size_t p = replystr.rfind("IF");
1248
if (p == string::npos) return;
1249
if ((p + 26) >= replystr.length()) return;
1250
if (replystr[p+21] != '0') { // vfo 60M memory mode
1255
m_60m_indx = opSelect60->index();
1257
cmd.assign("MC").append(Channels_60m[m_60m_indx]).append(";");
1258
else if (chan_mem_on)
1260
} else { // v == 1..11 band selection OR return to vfo mode == 0
1263
opSelect60->index(m_60m_indx = 0);
1267
cmd.assign("BS").append(to_decimal(v, 2)).append(";");
1272
showresp(WARN, ASC, "Select Band Stacks", cmd, replystr);
1276
void RIG_FTdx1200::set_noise_reduction_val(int val)
1278
cmd.assign("RL0").append(to_decimal(val, 2)).append(";");
1280
showresp(WARN, ASC, "SET_noise_reduction_val", cmd, replystr);
1283
int RIG_FTdx1200::get_noise_reduction_val()
1288
waitN(6, 100, "GET noise reduction val", ASC);
1289
size_t p = replystr.rfind(rsp);
1290
if (p == string::npos) return val;
1291
val = atoi(&replystr[p+3]);
1296
void RIG_FTdx1200::set_noise_reduction(int val)
1298
cmd.assign("NR0").append(val ? "1" : "0" ).append(";");
1300
showresp(WARN, ASC, "SET noise reduction", cmd, replystr);
1303
int RIG_FTdx1200::get_noise_reduction()
1308
waitN(5, 100, "GET noise reduction", ASC);
1309
size_t p = replystr.rfind(rsp);
1310
if (p == string::npos) return 0;
1311
val = replystr[p+3] - '0';
1315
void RIG_FTdx1200::set_xcvr_auto_on()
1317
if (!progStatus.xcvr_auto_on) return;
1321
waitN(4, 100, "Test: Is Rig ON", ASC);
1322
size_t p = replystr.rfind(rsp);
1323
if (p == string::npos) { // rig is off, power on
1326
MilliSleep(1500); // 1.0 < T < 2.0 seconds
1328
MilliSleep(3000); // Wait for rig startup? Maybe not needed.
1332
void RIG_FTdx1200::set_xcvr_auto_off()
1334
if (!progStatus.xcvr_auto_off) return;
1340
void RIG_FTdx1200::set_compression()
1342
if (progStatus.compON) {
1343
if (progStatus.compression == 0) {
1344
cmd.assign("PR2;"); // mic eq on
1346
showresp(WARN, ASC, "set Comp EQ on", cmd, replystr);
1348
cmd.assign("PR1;PL").append(to_decimal(progStatus.compression, 3)).append(";");
1350
showresp(WARN, ASC, "set Comp on", cmd, replystr);
1355
showresp(WARN, ASC, "set Comp off", cmd, replystr);
1360
// Audio Peak Filter, like set_cw_spot
1361
bool RIG_FTdx1200::set_cw_APF()
1363
if (vfo.imode == mCW || vfo.imode == mCW_R) {
1365
if (progStatus.apf_onoff) cmd[5] = '2';
1367
showresp(WARN, ASC, "SET APF on/off", cmd, replystr);