1 // ----------------------------------------------------------------------------
2 // Copyright (C) 2014
3 // David Freese, W1HKJ
4 // Fernando M. Maresca,
5 //
6 // This file is part of flrig.
7 //
8 // flrig is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 3 of the License, or
11 // (at your option) any later version.
12 //
13 // flrig is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
17 //
18 // You should have received a copy of the GNU General Public License
19 // aunsigned long int with this program. If not, see <http://www.gnu.org/licenses/>.
20 // ----------------------------------------------------------------------------
21 /*
22 * Note for anyone wishing to expand on the command set.
23 *
24 * A rejected command is responded to by a three character sequence "Zy\r".
25 * where the y is the letter of the command in error
26 * you need to check for that response
27 *
28 */
29
30 #include "TT588.h"
31 #include "support.h"
32 #include "math.h"
33
34 #include "debug.h"
35 // fer, debugging purpose
36 #include <iostream>
37 #include <typeinfo>
38
39 static const char TT588name_[] = "Omni-VII";
40
41 //static const char *TT588modes_[] = { "D-USB", "USB", "LSB", "CW", "AM", "FM", NULL}
42 //static const char TT588mode_chr[] = { '1', '1', '2', '3', '0', '4' };
43 //static const char TT588mode_type[] = { 'U', 'U', 'L', 'L', 'U', 'U' };
44 static const char *TT588modes_[] = {
45 "AM", "USB", "LSB", "CWU", "FM", "CWL", "FSK", NULL};
46 static const char TT588mode_chr[] = { '0', '1', '2', '3', '4', '5', '6' };
47 static const char TT588mode_type[] = { 'U', 'U', 'L', 'U', 'U', 'L', 'L' };
48
49 // filter # is 37 - index
50 static const char *TT588_widths[] = {
51 "200", "250", "300", "350", "400", "450", "500", "600", "700", "800",
52 "900", "1000", "1200", "1400", "1600", "1800", "2000", "2200", "2400", "2500",
53 "2600", "2800", "3000", "3200", "3400", "3600", "3800", "4000", "4500", "5000",
54 "5500", "6000", "6500", "7000", "7500", "8000", "9000", "12000", NULL};
55 static int TT588_bw_vals[] = {
56 1, 2, 3, 4, 5, 6, 7, 8, 9,10,
57 11,12,13,14,15,16,17,18,19,20,
58 21,22,23,24,25,26,27,28,29,30,
59 31,32,33,34,35,36,37,38,
60 WVALS_LIMIT};
61
62 static const int TT588_numeric_widths[] = {
63 200, 250, 300, 350, 400, 450, 500, 600, 700, 800,
64 900, 1000, 1200, 1400, 1600, 1800, 2000, 2200, 2400, 2500,
65 2600, 2800, 3000, 3200, 3400, 3600, 3800, 4000, 4500, 5000,
66 5500, 6000, 6500, 7000, 7500, 8000, 9000, 12000, 0};
67
68
69 static char TT588setFREQA[] = "*Annnn\r";
70 static char TT588setFREQB[] = "*Bnnnn\r";
71 //static char TT588setAGC[] = "*Gn\r";
72 static char TT588setSQLCH[] = "*Hc\r";
73 static char TT588setRF[] = "*Ic\r";
74 static char TT588setATT[] = "*Jc\r";
75 static char TT588setNB[] = "*Knar\r";
76 static char TT588setMODE[] = "*Mnn\r";
77 static char TT588setSPLIT[] = "*Nn\r";
78 static char TT588setPBT[] = "*Pxx\r";
79 static char TT588setVOL[] = "*Un\r";
80 static char TT588setBW[] = "*Wx\r";
81
82 // these C1* and C2* commands are for ethernet only
83 //static char TT588setPOWER[] = "*C1Xn\r";
84 //static char TT588setPREAMP[] = "*C1Zn\r";
85 //static char TT588getPOWER[] = "?C1X\r";
86 //static char TT588getPREAMP[] = "?C1Z\r";
87 // set pout is not available under serial interface
88 //static char TT588setPOWER[] = "*C1Xn\r";
89 // F command gets fwd and ref power
90 //static char TT588getFWDPWR[] = "?F\r";
91 static char TT588getPOWER[] = "?F\r";
92
93 static char TT588getFREQA[] = "?A\r";
94 static char TT588getFREQB[] = "?B\r";
95 //static char TT588getAGC[] = "?G\r";
96 static char TT588getSQLCH[] = "?H\r";
97 static char TT588getRF[] = "?I\r";
98 static char TT588getATT[] = "?J\r";
99 static char TT588getNB[] = "?K\r";
100 static char TT588getMODE[] = "?M\r";
101 static char TT588getSPLIT[] = "?N\r";
102 static char TT588getPBT[] = "?P\r";
103 static char TT588getSMETER[] = "?S\r";
104 static char TT588getVOL[] = "?U\r";
105 static char TT588getBW[] = "?W\r";
106
107 //static char TT588getFWDPWR[] = "?F\r";
108 //static char TT588getREFPWR[] = "?R\r";
109
110 static char TT588setXMT[] = "*Tnn\r";
111
112 static GUI tt588_widgets[]= {
113 { (Fl_Widget *)btnVol, 2, 125, 50 },
114 { (Fl_Widget *)sldrVOLUME, 54, 125, 156 },
115 { (Fl_Widget *)sldrRFGAIN, 54, 145, 156 },
116 { (Fl_Widget *)sldrMICGAIN, 266, 125, 156 },
117 { (Fl_Widget *)sldrSQUELCH, 266, 145, 156 },
118 { (Fl_Widget *)NULL, 0, 0, 0 }
119 };
120
RIG_TT588()121 RIG_TT588::RIG_TT588() {
122 // base class values
123 name_ = TT588name_;
124 modes_ = TT588modes_;
125 bandwidths_ = TT588_widths;
126 bw_vals_ = TT588_bw_vals;
127
128 widgets = tt588_widgets;
129
130 comm_baudrate = BR57600;
131 stopbits = 1;
132 comm_retries = 2;
133 comm_wait = 20;
134 comm_timeout = 50;
135 comm_echo = false;
136 comm_rtscts = true;
137 comm_rtsplus = false;
138 comm_dtrplus = true;
139 comm_catptt = true;// false;
140 comm_rtsptt = false;
141 comm_dtrptt = false;
142 serloop_timing = 200;
143
144 def_mode = modeB = modeA = A.imode = B.iBW = 1;
145 def_bw = bwB = bwA = A.iBW = B.iBW = 15;
146 def_freq = freqB = freqA = A.freq = B.freq = 14070000;
147 max_power = 100;
148 pbt = 0;
149 VfoAdj = progStatus.vfo_adj;
150 vfo_corr = 0;
151
152 atten_level = 0;
153 nb_ = 0;
154 an_ = 0;
155
156 has_preamp_control =
157 has_bpf_center =
158 has_power_control = // must be in REMOTE mode
159 has_micgain_control = // must be in REMOTE mode
160 has_tune_control =
161 has_vfo_adj = false;
162
163 can_change_alt_vfo =
164
165 // has_auto_notch =
166 // has_notch_control =
167
168 has_split =
169 has_split_AB =
170 has_smeter =
171 has_power_out =
172 has_swr_control =
173 has_volume_control =
174 has_rf_control =
175 has_attenuator_control =
176 has_ifshift_control =
177 has_sql_control =
178 has_ptt_control =
179 has_bandwidth_control =
180 has_noise_control =
181 has_mode_control = true;
182
183 precision = 1;
184 ndigits = 8;
185
186 }
187
initialize()188 void RIG_TT588::initialize()
189 {
190 tt588_widgets[0].W = btnVol;
191 tt588_widgets[1].W = sldrVOLUME;
192 tt588_widgets[2].W = sldrRFGAIN;
193 tt588_widgets[3].W = sldrMICGAIN;
194 tt588_widgets[4].W = sldrSQUELCH;
195
196 VfoAdj = progStatus.vfo_adj;
197 }
198
shutdown()199 void RIG_TT588::shutdown()
200 {
201 set_if_shift(0);
202 }
203
check()204 bool RIG_TT588::check ()
205 {
206 cmd = TT588getFREQA;
207 int ret = waitN(6, 100, "check");
208 if (ret < 6) return false;
209 return true;
210 }
211
get_vfoA()212 unsigned long int RIG_TT588::get_vfoA ()
213 {
214 cmd = TT588getFREQA;
215 int ret = waitN(6, 100, "get vfo A");
216 if (ret >= 6) {
217 /*
218 whenever 41 is in the freq. value answered, we don't want to use that index
219 for an offset. (reproduce: freq. set around 21 MHz, then drag
220 the wf to change freq. up and down.)
221 */
222 size_t p = replystr.rfind("A");
223 if (p != string::npos) {
224 int f = 0;
225 for (size_t n = 1; n < 5; n++)
226 f = f*256 + (unsigned char)replystr[n];
227 freqA = f;
228 }
229 }
230 return (unsigned long int)(freqA - vfo_corr);
231 }
232
set_vfoA(unsigned long int freq)233 void RIG_TT588::set_vfoA (unsigned long int freq)
234 {
235 freqA = freq;
236 vfo_corr = (freq / 1e6) * VfoAdj + 0.5;
237 unsigned long int xfreq = freqA + vfo_corr;
238 cmd = TT588setFREQA;
239 cmd[5] = xfreq & 0xff; xfreq = xfreq >> 8;
240 cmd[4] = xfreq & 0xff; xfreq = xfreq >> 8;
241 cmd[3] = xfreq & 0xff; xfreq = xfreq >> 8;
242 cmd[2] = xfreq & 0xff;
243 sendCommand(cmd);
244 showresp(WARN, HEX, "set vfo A", cmd, replystr);
245 return ;
246 }
247
get_vfoB()248 unsigned long int RIG_TT588::get_vfoB()
249 {
250 cmd = TT588getFREQB;
251 int ret = waitN(6, 100, "get vfo B");
252 if (ret >= 6) {
253 size_t p = replystr.rfind("B");
254 if (p != string::npos) {
255 int f = 0;
256 for (size_t n = 1; n < 5; n++)
257 f = f*256 + (unsigned char)replystr[n];
258 freqB = f;
259 }
260 }
261 return (unsigned long int)(freqB - vfo_corr);
262 }
263
set_vfoB(unsigned long int freq)264 void RIG_TT588::set_vfoB (unsigned long int freq)
265 {
266 freqB = freq;
267 vfo_corr = (freq / 1e6) * VfoAdj + 0.5;
268 unsigned long int xfreq = freqB + vfo_corr;
269 cmd = TT588setFREQB;
270 cmd[5] = xfreq & 0xff; xfreq = xfreq >> 8;
271 cmd[4] = xfreq & 0xff; xfreq = xfreq >> 8;
272 cmd[3] = xfreq & 0xff; xfreq = xfreq >> 8;
273 cmd[2] = xfreq & 0xff;
274 sendCommand(cmd);
275 showresp(WARN, HEX, "set vfo B", cmd, replystr);
276 return ;
277 }
278
setVfoAdj(double v)279 void RIG_TT588::setVfoAdj(double v)
280 {
281 VfoAdj = v;
282 }
283
set_modeA(int val)284 void RIG_TT588::set_modeA(int val)
285 {
286 modeA = val;
287 cmd = TT588setMODE;
288 cmd[2] = TT588mode_chr[modeA];
289 cmd[3] = TT588mode_chr[modeB];
290 sendCommand(cmd);
291 showresp(WARN, HEX, "set mode A", cmd, replystr);
292 }
293
set_modeB(int val)294 void RIG_TT588::set_modeB(int val)
295 {
296 modeB = val;
297 cmd = TT588setMODE;
298 cmd[2] = TT588mode_chr[modeA];
299 cmd[3] = TT588mode_chr[modeB];
300 sendCommand(cmd);
301 showresp(WARN, HEX, "set mode B", cmd, replystr);
302 }
303
get_modeA()304 int RIG_TT588::get_modeA()
305 {
306 cmd = TT588getMODE;
307 int ret = waitN(4, 100, "get mode A");
308 if (ret < 4) return modeA;
309 size_t p = replystr.rfind("M");
310 if (p == string::npos) return modeA;
311 modeA = replystr[p + 1] - '0';
312 return modeA;
313 }
314
get_modeB()315 int RIG_TT588::get_modeB()
316 {
317 cmd = TT588getMODE;
318 int ret = waitN(4, 100, "get mode B");
319 if (ret < 4) return modeB;
320 size_t p = replystr.rfind("M");
321 if (p == string::npos) return modeB;
322 modeB = replystr[p + 2] - '0';
323 return modeB;
324 }
325
get_modetype(int n)326 int RIG_TT588::get_modetype(int n)
327 {
328 return TT588mode_type[n];
329 }
330
set_bwA(int val)331 void RIG_TT588::set_bwA(int val)
332 {
333 bwA = val;
334 cmd = TT588setBW;
335 cmd[2] = 37 - val;
336 sendCommand(cmd);
337 showresp(WARN, HEX, "set BW A", cmd, replystr);
338 set_if_shift(pbt);
339 }
340
set_bwB(int val)341 void RIG_TT588::set_bwB(int val)
342 {
343 bwB = val;
344 cmd = TT588setBW;
345 cmd[2] = 37 - val;
346 sendCommand(cmd);
347 showresp(WARN, HEX, "set BW B", cmd, replystr);
348 set_if_shift(pbt);
349 }
350
get_bwA()351 int RIG_TT588::get_bwA()
352 {
353 cmd = TT588getBW;
354 int ret = waitN(3, 100, "get BW A");
355 if (ret < 3) return 37 - bwA;
356 size_t p = replystr.rfind("W");
357 if (p == string::npos) return 37 - bwA;
358 bwA = (int)(replystr[p + 1] & 0x7F);
359 return 37 - bwA;
360 }
361
get_bwB()362 int RIG_TT588::get_bwB()
363 {
364 cmd = TT588getBW;
365 int ret = waitN(3, 100, "get BW B");
366 if (ret < 3) return 37 - bwB;
367 size_t p = replystr.rfind("W");
368 if (p == string::npos) return 37 - bwB;
369 bwB = (int)(replystr[p + 1] & 0x7F);
370 return 37 - bwB;
371 }
372
adjust_bandwidth(int m)373 int RIG_TT588::adjust_bandwidth(int m)
374 {
375 if (m == 0) return 35; // AM
376 if (m == 1 || m == 2) return 22; // LSB-USB
377 if (m == 3 || m == 5) return 9;
378 if (m == 6) return 0;
379 if (m == 4) return 25;
380 return 22;
381 }
382
def_bandwidth(int m)383 int RIG_TT588::def_bandwidth(int m)
384 {
385 return adjust_bandwidth(m);
386 }
387
set_if_shift(int val)388 void RIG_TT588::set_if_shift(int val)
389 {
390 pbt = val;
391 cmd = TT588setPBT;
392 short int si = val;
393 int bpval = progStatus.bpf_center - 200 - TT588_numeric_widths[bwA]/2;
394 if ((modeA == 1 || modeA == 2) && progStatus.use_bpf_center)
395 si += (bpval > 0 ? bpval : 0);
396 cmd[2] = (si & 0xff00) >> 8;
397 cmd[3] = (si & 0xff);
398 sendCommand(cmd);
399 showresp(WARN, HEX, "set pbt", cmd, replystr);
400 }
401
get_if_shift(int & val)402 bool RIG_TT588::get_if_shift(int &val)
403 {
404 cmd = TT588getPBT;
405 int ret = waitN(4, 100, "get pbt");
406 val = pbt;
407 if (ret >= 4) {
408 size_t p = replystr.rfind("P");
409 if (p != string::npos) {
410 val = ((replystr[p + 1] & 0xFF) << 8) | (replystr[p+2] & 0xFF);
411 if (val > 0x7FFF) val -= 0x10000;
412 }
413 }
414 return (val == 0 ? false : true);
415 }
416
get_if_min_max_step(int & min,int & max,int & step)417 void RIG_TT588::get_if_min_max_step(int &min, int &max, int &step)
418 {
419 min = -2500;
420 max = 2500;
421 step = 10;
422 }
423
next_attenuator()424 int RIG_TT588::next_attenuator()
425 {
426 switch (atten_level) {
427 case 0: return 1;
428 case 1: return 2;
429 case 2: return 3;
430 case 3: return 0;
431 }
432 return 0;
433 }
434
set_attenuator(int val)435 void RIG_TT588::set_attenuator(int val)
436 {
437 atten_level = val;
438 cmd = TT588setATT;
439
440 cmd[2] = '0' + atten_level;
441 switch (atten_level) {
442 case 0: atten_label("0 dB", false); break;
443 case 1: atten_label("6 dB", true); break;
444 case 2: atten_label("12 dB", true); break;
445 case 3: atten_label("18 dB", true); break;
446 }
447 sendCommand(cmd);
448 showresp(WARN, HEX, "set att", cmd, replystr);
449 }
450
451
get_attenuator()452 int RIG_TT588::get_attenuator()
453 {
454 cmd = TT588getATT;
455 int ret = waitN(3, 100, "get att");
456 int val = atten_level;
457 if (ret >= 3) {
458 size_t p = replystr.rfind("J");
459 if (p != string::npos) val = (replystr[p + 1] - '0');
460 }
461 if (atten_level != val) atten_level = val;
462 switch (atten_level) {
463 case 0: atten_label("0 dB", false); break;
464 case 1: atten_label("6 dB", true); break;
465 case 2: atten_label("12 dB", true); break;
466 case 3: atten_label("18 dB", true); break;
467 }
468 return atten_level;
469 }
470
get_smeter()471 int RIG_TT588::get_smeter()
472 {
473 int sval = 0;
474 float fval = 0;
475 cmd = TT588getSMETER;
476 int ret = waitN(6, 100, "get smeter");
477 if (ret < 6) return sval;
478 size_t p = replystr.rfind("S");
479 if (p == string::npos) return sval;
480
481 sscanf(&replystr[p + 1], "%4x", &sval);
482 fval = sval/256.0;
483 sval = (int)(fval * 100.0 / 18.0);
484 if (sval > 100) sval = 100;
485 return sval;
486 }
487
get_volume_control()488 int RIG_TT588::get_volume_control()
489 {
490 cmd = TT588getVOL;
491 int ret = waitN(3, 100, "get vol");
492 if (ret < 3) return progStatus.volume;
493 size_t p = replystr.rfind("U");
494 if (p == string::npos) return progStatus.volume;
495
496 return (int)((replystr[p + 1] & 0x7F) / 1.27);
497 }
498
set_volume_control(int vol)499 void RIG_TT588::set_volume_control(int vol)
500 {
501 cmd = TT588setVOL;
502 cmd[2] = 0x7F & (int)(vol * 1.27);
503 sendCommand(cmd);
504 showresp(WARN, HEX, "set vol", cmd, replystr);
505 }
506
set_rf_gain(int val)507 void RIG_TT588::set_rf_gain(int val)
508 {
509 cmd = TT588setRF;
510 cmd[2] = 0x7F & (int)(val * 1.27);
511 sendCommand(cmd);
512 showresp(WARN, HEX, "set rfgain", cmd, replystr);
513 }
514
get_rf_gain()515 int RIG_TT588::get_rf_gain()
516 {
517 cmd = TT588getRF;
518 int ret = waitN(3, 100, "get rfgain");
519 if (ret < 3) return 100;
520 size_t p = replystr.rfind("I");
521 if (p == string::npos) return 100;
522 return (int)((replystr[p+1] & 0x7F) / 1.27);
523 }
524
525 // Tranceiver PTT on/off
526
set_PTT_control(int val)527 void RIG_TT588::set_PTT_control(int val)
528 {
529 cmd = TT588setXMT;
530 if (val) {
531 cmd[2] = 0x04;
532 cmd[3] = 0;
533 } else {
534 cmd[2] = 0;
535 cmd[3] = 0;
536 }
537 sendCommand(cmd);
538 showresp(WARN, HEX, "set PTT", cmd, replystr);
539 }
540
get_power_out()541 int RIG_TT588::get_power_out()
542 {
543 cmd = TT588getPOWER;
544 int ret = waitN(4, 100, "get pout");
545 if (ret < 4) return 0;
546 size_t p = replystr.rfind("F");
547 if (p == string::npos) return 0;
548 fwdpwr = replystr[p + 1] & 0x7F;
549 refpwr = replystr[p + 2] & 0x7F;
550 // it looks like it never returns reflected power < 1
551 refpwr -= 1;
552 fwdv = sqrtf(fwdpwr);
553 refv = sqrtf(refpwr);
554 return fwdpwr;
555 }
get_swr()556 int RIG_TT588::get_swr()
557 {
558 float swr = (fwdv + refv)/(fwdv - refv) ;
559 swr -= 1;
560 swr *= 25.0;
561 if (swr < 0) swr = 0;
562 if (swr > 100) swr = 100;
563 return (int)swr;
564 }
set_squelch(int val)565 void RIG_TT588::set_squelch(int val)
566 {
567 cmd = TT588setSQLCH;
568 cmd[2] = (unsigned char)(val * 1.27);
569 sendCommand(cmd);
570 showresp(WARN, HEX, "set sql", cmd, replystr);
571 }
572
get_squelch()573 int RIG_TT588::get_squelch()
574 {
575 cmd = TT588getSQLCH;
576 int ret = waitN(3, 100, "get sql");
577 if (ret < 3) return 0;
578 size_t p = replystr.rfind("H");
579 if (p == string::npos) return 0;
580 return (int)((replystr[p+1] & 0x7F) / 1.27);
581 }
582
set_noise(bool val)583 void RIG_TT588::set_noise(bool val)
584 {
585 static char nblabel[] = "NB ";
586 nb_++;
587 if (nb_ == 8) nb_ = 0;
588 nblabel[2] = '0' + nb_;
589 nb_label(nblabel, nb_ ? true : false);
590 cmd = TT588setNB;
591 cmd[2] = (unsigned char)nb_;
592 cmd[3] = 0;
593 cmd[4] = (unsigned char)an_;
594 sendCommand(cmd);
595 showresp(WARN, HEX, "set NB", cmd, replystr);
596 }
597
get_noise()598 int RIG_TT588::get_noise()
599 {
600 cmd = TT588getNB;
601 int ret = waitN(5, 100, "get NB");
602 if (ret < 5) return nb_;
603 size_t p = replystr.rfind("K");
604 if (p == string::npos) return nb_;
605 int val = replystr[p+1];
606 if (nb_ != val) nb_ = val;
607 static char nblabel[] = "NB ";
608 nblabel[2] = '0' + nb_;
609 nb_label(nblabel, nb_ ? true : false);
610 return nb_;
611 }
612
613 /*
614 void RIG_TT588::set_auto_notch(int val)
615 {
616 static char anlabel[] = "AN ";
617 an_++;
618 if (an_ == 10) an_ = 0;
619 anlabel[2] = '0' + an_;
620 auto_notch_label(anlabel, an_ > 0 ? true : false);
621 cmd = TT588setNB;
622 cmd[2] = (unsigned char)nb_;
623 cmd[3] = 0;
624 cmd[4] = (unsigned char)an_;
625 sendCommand(cmd);
626 }
627
628 int RIG_TT588::get_auto_notch()
629 {
630 cmd = TT588getNB;
631 int ret = sendCommand(cmd);
632 showresp(WARN, HEX, "get AN", cmd, replystr);
633 int val = an_;
634 if (ret >= 5) {
635 size_t p = replystr.rfind("K");
636 if (p != string::npos) val = replystr[p+3];
637 }
638 if (an_ != val) an_ = val;
639 static char anlabel[] = "AN ";
640 anlabel[2] = '0' + an_;
641 auto_notch_label(anlabel, an_ ? true : false);
642 return an_;
643 }
644 */
645
set_split(bool val)646 void RIG_TT588::set_split(bool val)
647 {
648 cmd = TT588setSPLIT;
649 cmd[2] = val == true ? 1 : 0;
650 sendCommand(cmd);
651 showresp(WARN, HEX, "set split", cmd, replystr);
652 }
653
get_split()654 int RIG_TT588::get_split()
655 {
656 cmd = TT588getSPLIT;
657 int ret = waitN(3, 100, "get split");
658 if (ret == 3)
659 return (replystr[1] == 0x01);
660 return false;
661 }
662
663 /*
664 int RIG_TT588::get_power_control(void)
665 {
666 cmd = TT588getPOWER;
667 int ret = waitN(7, 100, "get pc");
668 if (ret == 7) {
669 int pc = replystr[3] & 0x7F;
670 return (int)ceil(pc / 1.27);
671 }
672 return 0;
673 }
674
675 void RIG_TT588::set_power_control(double val)
676 {
677 cmd = TT588setPOWER;
678 cmd[4] = ((int)(val * 1.27) & 0x7f);
679 sendCommand(cmd);
680 showresp(WARN, HEX, "set pc", cmd, replystr);
681 }
682
683 int RIG_TT588::get_preamp()
684 {
685 cmd = TT588getPREAMP;
686 int ret = waitN(5, 100, "get preamp");
687 if (ret == 5)
688 return replystr[3];
689 return 0;
690 }
691
692 void RIG_TT588::set_preamp(int val)
693 {
694 cmd = TT588setPREAMP;
695 cmd[4] = (val == 0 ? 0 : 1);
696 sendCommand(cmd);
697 showresp(WARN, HEX, "set preamp", cmd, replystr);
698 }
699 */
700