6
* Copyright 2011, Dave Freese, W1HKJ
13
static const char FT990name_[] = "FT-990";
14
static const char *FT990modes_[] =
15
{ "LSB", "USB", "CW2.4", "CW500",
16
"AM6.0", "AM2.4", "FM",
17
"RTTY(L)", "RTTY(U)", "PKT(L)", "PKT(FM)", NULL};
19
static const int FT990_def_bw[] = {
24
static const int FT990_mode_val[] = {
29
static const char FT990_mode_type[] = {
34
static const char *FT990widths_[] =
35
{ "2400", "2000", "500", "250", "6000", NULL};
37
static const int FT990_bw_val[] =
40
RIG_FT990::RIG_FT990() {
43
bandwidths_ = FT990widths_;
44
comm_baudrate = BR4800;
55
afreq = bfreq = A.freq = B.freq = 14070000;
56
amode = bmode = A.imode = B.imode = 1;
57
aBW = bBW = A.iBW = B.iBW = 2;
63
has_split = has_split_AB =
69
has_bandwidth_control =
70
has_ptt_control = true;
74
int RIG_FT990::adjust_bandwidth(int m)
76
if (m == 0 || m == 1 || m == 5) return 2;
77
if (m == 2 || m == 3 ) return 1;
78
if (m == 4 || m == 6 || m == 7) return 3;
82
void RIG_FT990::init_cmd()
85
for (size_t i = 0; i < 5; i++) cmd[i] = 0;
89
void RIG_FT990::initialize()
93
void RIG_FT990::selectA()
98
showresp(WARN, HEX, "select A", cmd, replystr);
101
void RIG_FT990::selectB()
107
showresp(WARN, HEX, "select B", cmd, replystr);
110
void RIG_FT990::set_split(bool val)
114
cmd[3] = val ? 0x01 : 0x00;
118
showresp(WARN, HEX, "set split ON", cmd, replystr);
120
showresp(WARN, HEX, "set split OFF", cmd, replystr);
123
bool RIG_FT990::get_info()
125
bool memmode = false, vfobmode = false;
126
int pfreq, pmode, pbw;
130
int ret = waitN(5, 100, "Read flags");
134
memmode = ((replystr[p+1] & 0x10) == 0x10);
135
vfobmode = ((replystr[p] & 0x02) == 0x02);
136
if (memmode) return false;
137
if (vfobmode && !useB) {
139
Fl::awake(highlight_vfo, (void *)0);
140
} else if (!vfobmode && useB) {
142
Fl::awake(highlight_vfo, (void *)0);
147
cmd[4] = 0x10; // update info
148
cmd[0] = 0x02; // 1 16 byte sequences for current VFO / MEM
149
ret = waitN(16, 100, "Read info");
155
for (size_t n = 1; n < 5; n++)
156
pfreq = pfreq * 256 + (unsigned char)replystr[p + n];
157
pfreq = pfreq * 1.25; // 100D resolution is 1.25 Hz / bit for read
159
int rmode = replystr[p + 7] & 0x07;
161
case 0 : pmode = 0; break; // LSB
162
case 1 : pmode = 1; break; // USB
163
case 2 : pmode = 2; break; // CW
164
case 3 : pmode = 5; break; // AM
165
case 4 : pmode = 6; break; // FM
166
case 5 : pmode = 8; break; // RTTY
167
case 6 : pmode = 9; break; // PKT
168
default : pmode = 1; break;
171
int rpbw = replystr[p + 8];
173
if (pbw > 4) pbw = 4;
174
if ((rpbw & 0x80) == 0x80) {
175
if (pmode == 10) pmode = 11;
176
if (pmode == 8) pmode = 9;
178
if (pmode == 6) pbw = 0;
180
B.freq = pfreq; B.imode = pmode; B.iBW = pbw;
182
A.freq = pfreq; A.imode = pmode; A.iBW = pbw;
184
LOG_WARN("Vfo %c = %d, BW %s", vfobmode ? 'B' : 'A', pfreq, FT990widths_[pbw]);
190
long RIG_FT990::get_vfoA ()
195
void RIG_FT990::set_vfoA (long freq)
198
freq /=10; // 100D does not support 1 Hz resolution
199
cmd = to_bcd_be(freq, 8);
202
showresp(WARN, HEX, "set freq A", cmd, replystr);
205
int RIG_FT990::get_modeA()
210
void RIG_FT990::set_modeA(int val)
214
cmd[3] = FT990_mode_val[val];
217
showresp(WARN, HEX, "set mode A", cmd, replystr);
220
void RIG_FT990::set_bwA (int val)
224
cmd[3] = FT990_bw_val[val];
227
showresp(WARN, HEX, "set BW A", cmd, replystr);
231
int RIG_FT990::get_bwA()
236
long RIG_FT990::get_vfoB()
241
void RIG_FT990::set_vfoB(long freq)
245
cmd = to_bcd_be(freq, 8);
248
showresp(WARN, HEX, "set freq B", cmd, replystr);
251
void RIG_FT990::set_modeB(int val)
255
cmd[3] = FT990_mode_val[val];
258
showresp(WARN, HEX, "set mode B", cmd, replystr);
261
int RIG_FT990::get_modeB()
266
void RIG_FT990::set_bwB(int val)
270
cmd[3] = FT990_bw_val[val];
273
showresp(WARN, HEX, "set bw B", cmd, replystr);
276
int RIG_FT990::get_bwB()
281
int RIG_FT990::def_bandwidth(int m)
283
return FT990_def_bw[m];
286
// Tranceiver PTT on/off
287
void RIG_FT990::set_PTT_control(int val)
294
showresp(WARN, HEX, "set PTT ON", cmd, replystr);
296
showresp(WARN, HEX, "set PTT OFF", cmd, replystr);
299
int RIG_FT990::get_smeter()
303
int ret = waitN(5, 100, "S-meter");
304
if (ret < 5) return 0;
305
int sval = (unsigned char)replybuff[0];
306
if (sval < 90) sval = 90;
307
if (sval > 200) sval = 200;
308
if (sval < 120) sval = 250 - 5 * sval / 3;
309
else sval = 125 - 5 * sval / 8;
313
int RIG_FT990::get_swr()
318
int RIG_FT990::get_power_out()
322
int ret = waitN(5, 100, "Power out");
323
if (ret < 5) return 0;
324
int sval = (unsigned char)replybuff[0];
325
if (sval < 90) sval = 90;
326
if (sval > 200) sval = 200;
327
if (sval < 120) sval = 250 - 5 * sval / 3;
328
else sval = 125 - 5 * sval / 8;