1 // ----------------------------------------------------------------------------
2 // Copyright (C) 2014
3 // David Freese, W1HKJ
4 //
5 // This file is part of flrig.
6 //
7 // flrig is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation; either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // flrig is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // aunsigned long int with this program. If not, see <http://www.gnu.org/licenses/>.
19 // ----------------------------------------------------------------------------
20
21 // TenTec Pegasus computer controlled transceiver
22
23 #include <stdlib.h>
24 #include <stdio.h>
25 #include <iostream>
26 #include <sstream>
27
28 #include <math.h>
29 #include <vector>
30 #include <queue>
31
32 #include "TT550.h"
33 #include "support.h"
34 #include "util.h"
35 #include "debug.h"
36 #include "trace.h"
37
38 #include "rigbase.h"
39 #include "rig.h"
40
41 static const char TT550name_[] = "TT-550";
42
43 enum TT550_MODES {
44 TT550_AM_MODE, TT550_USB_MODE, TT550_LSB_MODE, TT550_CW_MODE, TT550_DIGI_MODE, TT550_FM_MODE };
45
46 static const char *TT550modes_[] = {
47 "AM", "USB", "LSB", "CW", "DIGI", "FM", NULL};
48
49 static const int TT550_def_bw[] = { 32, 20, 20, 10, 20, 32 };
50
51 static const char TT550mode_chr[] = { '0', '1', '2', '3', '1', '4' };
52 static const char TT550mode_type[] = { 'U', 'U', 'L', 'L', 'U', 'U' };
53
54 static const char *TT550_widths[] = {
55 "300", "330", "375", "450", "525", "600", "675", "750", "900", "1050",
56 "1200", "1350", "1500", "1650", "1800", "1950", "2100", "2250", "2400", "2550",
57 "2700", "2850", "3000", "3300", "3600", "3900", "4200", "4500", "4800", "5100",
58 "5400", "5700", "6000", "8000", NULL};
59 static int TT550_bw_vals[] = {
60 1, 2, 3, 4, 5, 6, 7, 8, 9,10,
61 11,12,13,14,15,16,17,18,19,20,
62 21,22,23,24,25,26,27,28,29,30,
63 31,32,33,34,
64 WVALS_LIMIT};
65
66 static const int TT550_filter_nbr[] = {
67 32, 31, 30, 29, 28, 27, 26, 25, 24, 23,
68 22, 21, 20, 19, 18, 17, 16, 15, 14, 13,
69 12, 11, 10, 9, 8, 7, 6, 5, 4, 3,
70 2, 1, 0, 33 };
71
72 static const int TT550_filter_width[] = {
73 300, 330, 375, 450, 525, 600, 675, 750, 900, 1050,
74 1200, 1350, 1500, 1650, 1800, 1950, 2100, 2250, 2400, 2550,
75 2700, 2850, 3000, 3300, 3600, 3900, 4200, 4500, 4800, 5100,
76 5400, 5700, 6000, 8000 };
77
78 const char *TT550_xmt_widths[] = {
79 "900", "1050", "1200", "1350", "1500", "1650", "1800", "1950", "2100", "2250",
80 "2400", "2550", "2700", "2850", "3000", "3300", "3600", "3900", NULL};
81
82 static const int TT550_xmt_filter_nbr[] = {
83 24, 23, 22, 21, 20, 19, 18, 17, 16,
84 15, 14, 13, 12, 11, 10, 9, 8, 7};
85
86 static const int TT550_xmt_filter_width[] = {
87 900, 1050, 1200, 1350, 1500, 1650, 1800, 1950, 2100,
88 2250, 2400, 2550, 2700, 2850, 3000, 3300, 3600, 3900 };
89
90 static const int TT550_steps[] = { 1, 10, 100, 1000, 10000 };
91
92 static char TT550restart[] = "XX\r";
93 static char TT550init[] = "P1\r";
94 //static char TT550isRADIO[] = " RADIO START";
95 //static char TT550isDSP[] = " DSP START";
96
97 //static char TT550setFREQ[] = "N123456\r";
98
99 static char TT550setMODE[] = "Mnn\r";
100 static char TT550setRcvBW[] = "Wx\r";
101 static char TT550setXmtBW[] = "Cx\r";
102 static char TT550setVolume[] = "Vn\r";
103 static char TT550setAGC[] = "Gc\r";
104 static char TT550setRFGAIN[] = "An\r";
105 static char TT550setATT[] = "Bc\r";
106 static char TT550setCWWPM[] = "Eabcdef\r";
107 static char TT550setMONVOL[] = "Hn\r";
108 static char TT550setCWMONVOL[] = "Jn\r";
109 static char TT550setNRNOTCH[] = "Kna\r";
110 static char TT550setLINEOUT[] = "Ln\r"; // 63 - min, 0 - max
111 static char TT550setMICLINE[] = "O1cn\r"; // *******************************************
112 static char TT550setPOWER[] = "Pn\r"; // ****************************************
113 static char TT550setXMT[] = "Q1\r";
114 static char TT550setRCV[] = "Q0\r";
115 static char TT550setSQUELCH[] = "Sn\r"; // 0..19; 6db / unit
116 static char TT550setVOX[] = "Uc\r"; // '0' = off; '1' = on
117 static char TT550setVOXGAIN[] = "UGn\r"; // 0 <= n <= 255
118 static char TT550setANTIVOX[] = "UAn\r"; // 0..255
119 static char TT550setVOXHANG[] = "UHn\r"; // 0..255; n= delay*0.0214 sec
120 static char TT550setCWSPOTLVL[] = "Fn\r"; // 0..255; 0 = off
121 static char TT550setCWQSK[] = "UQn\r"; // 0..255; 0 = none
122 static char TT550setAUXHANG[] = "UTn\r"; // 0..255; 0 = none
123 static char TT550setBLANKER[] = "Dn\r"; // 0..7; 0 = off
124 static char TT550setSPEECH[] = "Yn\r"; // 0..127; 0 = off
125
126 static char TT550setDISABLE[] = "#0\r"; // disable transmitter
127 static char TT550setENABLE[] = "#1\r"; // enable transmitter
128 static char TT550setTLOOP_OFF[] = "#2\r"; // disable T loop
129 static char TT550setTLOOP_ON[] = "#3\r"; // enable T loop
130 static char TT550setKEYER_OFF[] = "#6\r"; // enable keyer
131 static char TT550setKEYER_ON[] = "#7\r"; // disable keyer
132 static char TT550setALIVE_OFF[] = "#8\r"; // disable keep alive
133 //static char TT550setALIVE_ON[] = "#9\r"; // enable keep alive
134
135 //static char TT550getAGC[] = "?Y\r"; // 0..255
136 //static char TT550getFWDPWR[] = "?F\r"; // F<0..255>
137 //static char TT550getREFPWR[] = "?R\r"; // R<0..255>
138 static char TT550query[] = "?S\r"; // S<0..255><0..255>
139 static char TT550getFWDREF[] = "?S\r"; // T<0..255><0..255>
140
141 static char TT550setAMCARRIER[] = "R \r"; // enables AM mode transmit
142
143 static string xcvrstream = "";
144
145 static GUI rig_widgets[]= {
146 { (Fl_Widget *)btnVol, 2, 125, 50 },
147 { (Fl_Widget *)sldrVOLUME, 54, 125, 156 },
148 { (Fl_Widget *)sldrRFGAIN, 54, 145, 156 },
149 { (Fl_Widget *)btnIFsh, 214, 125, 50 },
150 { (Fl_Widget *)sldrIFSHIFT, 266, 125, 156 },
151 { (Fl_Widget *)sldrMICGAIN, 266, 145, 156 },
152 { (Fl_Widget *)sldrPOWER, 54, 165, 368 },
153 { (Fl_Widget *)NULL, 0, 0, 0 }
154 };
155
RIG_TT550()156 RIG_TT550::RIG_TT550() {
157 // base class values
158 name_ = TT550name_;
159 modes_ = TT550modes_;
160 bandwidths_ = TT550_widths;
161 bw_vals_ = TT550_bw_vals;
162
163 widgets = rig_widgets;
164
165 comm_baudrate = BR57600;
166 stopbits = 1;
167 comm_retries = 2;
168 comm_wait = 5;
169 comm_timeout = 50;
170 comm_rtscts = true;
171 comm_rtsplus = false;
172 comm_dtrplus = true;
173 comm_catptt = true;
174 comm_rtsptt = false;
175 comm_dtrptt = false;
176 serloop_timing = 100;
177
178 def_mode = modeA = modeB = 1;
179 def_bw = bwA = bwB = 20;
180 def_freq = freqA = freqB = 14070000;
181 max_power = 100;
182 can_change_alt_vfo = true;
183
184 VfoAdj = 0;
185 Bfo = 600;
186
187 ATTlevel = 0;
188 RFgain = 100;
189
190 has_notch_control =
191 has_preamp_control = false;
192
193 has_extras =
194 has_bfo =
195 has_smeter =
196 has_power_out =
197 has_split =
198 has_split_AB =
199 has_swr_control =
200 has_micgain_control =
201 has_power_control =
202 has_agc_level =
203 has_cw_wpm =
204 has_cw_vol =
205 has_cw_spot =
206 has_vox_onoff =
207 has_vox_gain =
208 has_vox_anti =
209 has_vox_hang =
210 has_compression =
211 has_rit =
212 has_xit =
213 has_rf_control =
214 has_attenuator_control =
215 has_volume_control =
216 has_ifshift_control =
217 has_ptt_control =
218 has_bandwidth_control =
219 has_auto_notch =
220 has_tune_control =
221 has_noise_control =
222 has_mode_control =
223 has_vfo_adj = true;
224
225 auto_notch = noise_reduction = false;
226
227 precision = 1;
228 ndigits = 8;
229
230 }
231
232 static std::string ctlvals[] = {
233 "x00", "x01", "x02", "x03", "x04", "x05", "x06", "x07",
234 "x08", "x09", "x0a", "x0b", "x0c", "x0d", "x0e", "x0f"};
235
noctl(std::string cmd)236 static std::string noctl(std::string cmd)
237 {
238 stringstream s;
239 unsigned int c;
240 s << cmd[0];
241 for (size_t n = 1; n < cmd.length(); n++) {
242 c = cmd[n] & 0xFF;
243 if (c < 0x10) s << " " << ctlvals[c];
244 else s << " x" << hex << c;
245 }
246 return s.str();
247 }
248
info(string s)249 static const char* info(string s)
250 {
251 static string infostr;
252 infostr.assign(s);
253 if (infostr[infostr.length()-1] == '\r')
254 infostr.replace(infostr.length()-1, 1, "<0d>");
255 infostr.append(" ");
256 infostr.append(str2hex(s.c_str(), s.length()));
257 return infostr.c_str();
258 }
259
showASCII(string s1,string s)260 void RIG_TT550::showASCII(string s1, string s)
261 {
262 while (s[0] == ' ' || s[0] == '\r' || s[0] == '\n') s.erase(0,1);
263 for (size_t i = 0; i < s.length(); i++) {
264 if (s[i] == '\r' || s[i] == '\n') s[i] = ' ';
265 }
266 LOG_INFO("%9s : %s", s1.c_str(), s.c_str());
267 }
268
initialize()269 void RIG_TT550::initialize()
270 {
271 progStatus.settrace = true;
272
273 rig_widgets[0].W = btnVol;
274 rig_widgets[1].W = sldrVOLUME;
275 rig_widgets[2].W = sldrRFGAIN;
276 rig_widgets[3].W = btnIFsh;
277 rig_widgets[4].W = sldrIFSHIFT;
278 rig_widgets[5].W = sldrMICGAIN;
279 rig_widgets[6].W = sldrPOWER;
280
281 sendCommand(TT550restart, 14);
282
283 if (replystr.find("RADIO") == string::npos) {
284 showASCII("Power up", "DSP START");
285 sendCommand(TT550init); // put into radio mode
286 }
287 showASCII("Init", replystr);
288
289 sendCommand("?V\r", 13);
290 showASCII("Version", replystr);
291
292 sendCommand(TT550setALIVE_OFF, 0);
293
294 set_volume_control(0);
295
296 set_auto_notch(auto_notch);
297 set_compression(0,0);
298
299 set_vox_hang();
300 set_vox_anti();
301 set_vox_gain();
302 set_vox_onoff();
303
304 set_cw_spot();
305 set_cw_vol();
306 set_cw_wpm();
307 set_cw_qsk();
308 enable_keyer();
309
310 set_agc_level();
311 set_line_out();
312 // use_line_in = progStatus.use_line_in;
313 set_mic_gain(progStatus.mic_gain);
314 set_mic_line(0);
315 set_rf_gain(RFgain);
316
317 XitFreq = progStatus.xit_freq;
318 RitFreq = progStatus.rit_freq;
319
320 split = false;
321
322 Bfo = progStatus.bfo_freq;
323 // set_vfoA(freqA);
324
325 VfoAdj = progStatus.vfo_adj;
326
327 // setXit(XitFreq);
328 // setRit(RitFreq);
329 // setBfo(Bfo);
330
331 set_attenuator(0);
332 set_mon_vol();
333 set_squelch_level();
334 // set_if_shift(pbt);
335 set_aux_hang();
336
337 set_volume_control(progStatus.volume);
338
339 cmd = TT550setAMCARRIER;
340 cmd[1] = 0x0F;
341 sendCommand(cmd, 0);
342
343 enable_tloop();
344 enable_xmtr();
345
346 xcvrstream.clear();
347 keypad_timeout = 0;
348
349 encoder_count = 0;
350
351 }
352
enable_xmtr()353 void RIG_TT550::enable_xmtr()
354 {
355 if (progStatus.tt550_enable_xmtr)
356 cmd = TT550setENABLE;
357 else
358 cmd = TT550setDISABLE;
359 sendCommand(cmd, 0);
360 set_trace(2, "enable_xmtr()", noctl(cmd).c_str());
361 }
362
enable_tloop()363 void RIG_TT550::enable_tloop()
364 {
365 if (progStatus.tt550_enable_tloop)
366 cmd = TT550setTLOOP_ON;
367 else
368 cmd = TT550setTLOOP_OFF;
369 sendCommand(cmd, 0);
370 set_trace(2, "enable_tloop()", noctl(cmd).c_str());
371 }
372
shutdown()373 void RIG_TT550::shutdown()
374 {
375 cmd = "Vx\r";
376 cmd[1] = 0;
377 sendCommand(cmd, 0); // volume = zero
378 cmd = "Lx\r";
379 cmd[1] = 0x3F;
380 sendCommand(cmd, 0); // line out = minimum
381 set_trace(2, "shutdown()", noctl(cmd).c_str());
382 }
383
384 int DigiAdj = 0;
385
set_vfoRX(unsigned long int freq)386 void RIG_TT550::set_vfoRX(unsigned long int freq)
387 {
388 int NVal = 0, FVal = 0; // N value / finetune value
389 int TBfo = 0; // temporary BFO (Hz)
390 int IBfo = 0; // Intermediate BFO Freq (Hz)
391
392 int PbtAdj = PbtActive ? pbt : 0;//PbtFreq : 0; // passband adj (Hz)
393 int RitAdj = RitActive ? RitFreq : 0; // RIT adj (Hz)
394
395 int FiltAdj = (TT550_filter_width[def_bw])/2; // filter bw (Hz)
396
397 unsigned long int lFreq = freq * (1 + VfoAdj * 1e-6);
398
399 lFreq += RitAdj;
400
401 if(def_mode == TT550_DIGI_MODE) {
402 DigiAdj = 1500 - FiltAdj - 200;
403 DigiAdj = DigiAdj < 0 ? 0 : DigiAdj;
404 IBfo = FiltAdj + 200;
405 lFreq += (IBfo + PbtAdj + DigiAdj);
406 IBfo = IBfo + PbtAdj + DigiAdj;
407 }
408
409 if(def_mode == TT550_USB_MODE) {
410 IBfo = FiltAdj + 200;
411 lFreq += (IBfo + PbtAdj);
412 IBfo = IBfo + PbtAdj;
413 }
414
415 if(def_mode == TT550_LSB_MODE) {
416 IBfo = FiltAdj + 200;
417 lFreq -= (IBfo + PbtAdj);
418 IBfo = IBfo + PbtAdj;
419 }
420
421 if(def_mode == TT550_CW_MODE) {
422 // CW Mode uses LSB Mode
423 if (( FiltAdj + 300) <= Bfo) {
424 IBfo = PbtAdj + Bfo;
425 } else {
426 IBfo = FiltAdj + 300;
427 lFreq += (Bfo - IBfo);
428 IBfo = IBfo + PbtAdj;
429 }
430 }
431
432 if(def_mode == TT550_FM_MODE) {
433 lFreq += Bfo;
434 IBfo = 0;
435 }
436
437 lFreq -= 1250;
438
439 NVal = lFreq / 2500 + 18000;
440 FVal = (int)((lFreq % 2500) * 5.46);
441
442 cmd = "N";
443 cmd += (NVal >> 8) & 0xff;
444 cmd += NVal & 0xff;
445 cmd += (FVal >> 8) & 0xff;
446 cmd += FVal & 0xff;
447
448 TBfo = (int)((IBfo + 8000)*2.73);
449 cmd += (TBfo >> 8) & 0xff;
450 cmd += TBfo & 0xff;
451 cmd += '\r';
452 sendCommand(cmd, 0);
453
454 stringstream s;
455 s << "Rx freq = " << freq << " / adjusted to " << lFreq << ", " << noctl(cmd);
456 set_trace(2, "set vfoRX", s.str().c_str());
457
458 }
459
set_vfoTX(unsigned long int freq)460 void RIG_TT550::set_vfoTX(unsigned long int freq)
461 {
462 int NVal = 0, FVal = 0; // N value / finetune value
463 int TBfo = 0; // temporary BFO
464 int IBfo = 1500; // Intermediate BFO Freq
465 int bwBFO = 0; // BFO based on selected bandwidth
466 int FilterBw = 0; // Filter Bandwidth determined from table
467
468 int XitAdj;
469 unsigned long int lFreq = freq * (1 + VfoAdj * 1e-6);
470
471 lFreq += XitAdj = XitActive ? XitFreq : 0;
472
473 if (progStatus.tt550_use_xmt_bw)
474 FilterBw = TT550_xmt_filter_width[progStatus.tt550_xmt_bw];
475 else
476 FilterBw = TT550_filter_width[def_bw];
477 if (FilterBw < 900) FilterBw = 900;
478 if (FilterBw > 3900) FilterBw = 3900;
479 // if (def_mode == TT550_DIGI_MODE) FilterBw = 3000;
480
481 bwBFO = (FilterBw/2) + 200;
482 IBfo = (bwBFO > IBfo) ? bwBFO : IBfo ;
483
484 if (def_mode == TT550_USB_MODE || def_mode == TT550_DIGI_MODE) {
485 lFreq += IBfo;
486 TBfo = (int)(IBfo * 2.73);
487 }
488
489 if (def_mode == TT550_LSB_MODE) {
490 lFreq -= IBfo;
491 TBfo = (int)(IBfo * 2.73);
492 }
493
494 // CW Mode uses LSB Mode
495 if(def_mode == TT550_CW_MODE) {
496 IBfo = 1500; // fixed for CW
497 lFreq += Bfo - IBfo;
498 TBfo = (int)(Bfo * 2.73);
499 }
500
501 if(def_mode == TT550_FM_MODE) {
502 IBfo = 0;
503 lFreq -= IBfo;
504 TBfo = 0;
505 }
506
507 lFreq -= 1250;
508 NVal = lFreq / 2500 + 18000;
509 FVal = (int)((lFreq % 2500) * 5.46);
510
511 cmd = "T";
512 cmd += (NVal >> 8) & 0xff;
513 cmd += NVal & 0xff;
514 cmd += (FVal >> 8) & 0xff;
515 cmd += FVal & 0xff;
516 cmd += (TBfo >> 8) & 0xff;
517 cmd += TBfo & 0xff;
518 cmd += '\r';
519 sendCommand(cmd, 0);
520
521 stringstream s;
522 s << "Tx freq = " << freq << " / adjusted to " << lFreq << ", " << noctl(cmd);
523 set_trace(2, "set vfoTX", s.str().c_str());
524
525 }
526
set_split(bool val)527 void RIG_TT550::set_split(bool val)
528 {
529 split = val;
530 if (split) {
531 if (!useB)
532 set_vfoTX(freqB);
533 else
534 set_vfoTX(freqA);
535 } else {
536 if (!useB)
537 set_vfoTX(freqA);
538 else
539 set_vfoTX(freqB);
540 }
541 set_trace(2, "set split ", (val ? "ON" : "OFF"));
542 }
543
set_vfo(unsigned long int freq)544 void RIG_TT550::set_vfo(unsigned long int freq)
545 {
546 set_vfoRX(freq);
547 if (!split)
548 set_vfoTX(freq);
549 xcvrstream.clear();
550 }
551
set_vfoA(unsigned long int freq)552 void RIG_TT550::set_vfoA (unsigned long int freq)
553 {
554 freqA = freq;
555 if (!useB)
556 set_vfo(freq);
557 }
558
559 int enc_change = 0;
process_encoder(int val)560 void RIG_TT550::process_encoder(int val)
561 {
562 }
563
check()564 bool RIG_TT550::check()
565 {
566 return true;
567 }
568
get_vfoA()569 unsigned long int RIG_TT550::get_vfoA ()
570 {
571 if (!useB) {
572 freqA += enc_change;
573 enc_change = 0;
574 }
575 return freqA;
576 }
577
set_vfoB(unsigned long int freq)578 void RIG_TT550::set_vfoB (unsigned long int freq)
579 {
580 freqB = freq;
581 if (useB)
582 set_vfo(freqB);
583 }
584
get_vfoB()585 unsigned long int RIG_TT550::get_vfoB ()
586 {
587 if (useB) {
588 freqB += enc_change;
589 enc_change = 0;
590 }
591 return freqB;
592 }
593
594 // Tranceiver PTT on/off
595 static unsigned int fp[FPLEN];
596 static unsigned int rp[FPLEN];
597 static int iswr;
598
set_PTT_control(int val)599 void RIG_TT550::set_PTT_control(int val)
600 {
601 ptt_ = val;
602 if (val) {
603 for (int i = 0; i < FPLEN; i++)
604 fp[i] = rp[i] = 0;
605 iswr = 0;
606 }
607 if (val) cmd = TT550setXMT;
608 else cmd = TT550setRCV;
609 sendCommand(cmd, 0);
610
611 stringstream s;
612 s << "set PTT " << (val ? "ON " : "OFF ") << noctl(cmd);
613
614 set_trace(1, s.str().c_str());
615
616 }
617
get_PTT()618 int RIG_TT550::get_PTT()
619 {
620 return ptt_;
621 }
622
set_mode(int val)623 void RIG_TT550::set_mode(int val)
624 {
625 def_mode = val;
626 if (val == TT550_AM_MODE) {
627
628 cmd = TT550setMODE;
629 cmd[1] = cmd[2] = TT550mode_chr[val];
630 sendCommand(cmd, 0);
631
632 stringstream s;
633 s << "Set Mode " << noctl(cmd);
634 set_trace(1, s.str().c_str());
635
636 cmd = TT550setPOWER;
637 cmd[1] = 0xFF;
638 sendCommand(cmd, 0);
639
640 set_power_control(progStatus.tt550_AM_level);
641
642 } else {
643
644 cmd = TT550setMODE;
645 cmd[1] = cmd[2] = TT550mode_chr[val];
646 sendCommand(cmd, 0);
647
648 stringstream s;
649 s << "Set Mode " << noctl(cmd);
650 set_trace(1, s.str().c_str());
651
652 set_power_control(progStatus.power_level);
653 }
654 set_bw(def_bw);
655 }
656
set_modeA(int val)657 void RIG_TT550::set_modeA(int val)
658 {
659 modeA = val;
660 set_mode(val);
661 }
662
set_modeB(int val)663 void RIG_TT550::set_modeB(int val)
664 {
665 modeB = val;
666 if (useB)
667 set_mode(val);
668 }
669
get_modeB()670 int RIG_TT550::get_modeB()
671 {
672 return modeB;
673 }
674
675 static int ret_mode = TT550_CW_MODE;
676
tt550_tune_off(void *)677 static void tt550_tune_off(void *)
678 {
679 selrig->set_PTT_control(0);
680 selrig->set_power_control(progStatus.power_level);
681 if (useB)
682 selrig->set_modeB(ret_mode);
683 else
684 selrig->set_modeA(ret_mode);
685 }
686
tune_rig(int val)687 void RIG_TT550::tune_rig(int val)
688 {
689 set_PTT_control(0);
690 if (!useB) {
691 ret_mode = modeA;
692 set_modeA(TT550_CW_MODE);
693 }
694 else {
695 ret_mode = modeB;
696 set_modeB(TT550_CW_MODE);
697 }
698 set_power_control(10);
699
700 set_PTT_control(1);
701 set_trace(1, "tune rig");
702
703 Fl::add_timeout(5.0, tt550_tune_off);
704 }
705
get_modeA()706 int RIG_TT550::get_modeA()
707 {
708 return modeA;
709 }
710
get_modetype(int n)711 int RIG_TT550::get_modetype(int n)
712 {
713 return TT550mode_type[n];
714 }
715
set_bw(int val)716 void RIG_TT550::set_bw(int val)
717 {
718 def_bw = val;
719 int rxbw = TT550_filter_nbr[val];
720 int txbw = rxbw;
721 if (progStatus.tt550_use_xmt_bw)
722 txbw = TT550_xmt_filter_nbr[progStatus.tt550_xmt_bw];
723 if (txbw < 7) txbw = 7;
724 if (txbw > 24) txbw = 24;
725 cmd = TT550setRcvBW;
726 cmd[1] = rxbw;
727 sendCommand(cmd, 0);
728
729 stringstream s;
730 s << "Set RX bandwidth " << val << " " << noctl(cmd);
731 set_trace(1, s.str().c_str());
732
733 cmd = TT550setXmtBW;
734 cmd[1] = txbw;
735 sendCommand(cmd, 0);
736
737 stringstream s2;
738 s2 << "Set TX bandwidth " << val << " " << noctl(cmd);
739 set_trace(1, s2.str().c_str());
740
741 set_vfo(!useB ? freqA : freqB);
742 }
743
set_bwA(int val)744 void RIG_TT550::set_bwA(int val)
745 {
746 bwA = val;
747 set_bw(bwA);
748 }
749
get_bwA()750 int RIG_TT550::get_bwA()
751 {
752 return bwA;
753 }
754
set_bwB(int val)755 void RIG_TT550::set_bwB(int val)
756 {
757 bwB = val;
758 if (useB)
759 set_bw(val);
760 }
761
get_bwB()762 int RIG_TT550::get_bwB()
763 {
764 return bwB;
765 }
766
adjust_bandwidth(int md)767 int RIG_TT550::adjust_bandwidth(int md)
768 {
769 return bwA;
770 }
771
def_bandwidth(int m)772 int RIG_TT550::def_bandwidth(int m)
773 {
774 if (m < 0) m = 0;
775 if (m > 4) m = 4;
776 return TT550_def_bw[m];
777 }
778
set_if_shift(int val)779 void RIG_TT550::set_if_shift(int val)
780 {
781 pbt = val;
782 if (pbt) PbtActive = true;
783 set_vfoRX(!useB ? freqA : freqB);
784 }
785
get_if_shift(int & val)786 bool RIG_TT550::get_if_shift(int &val)
787 {
788 val = pbt;
789 if (!val) return false;
790 return true;
791 }
792
get_if_min_max_step(int & min,int & max,int & step)793 void RIG_TT550::get_if_min_max_step(int &min, int &max, int &step)
794 {
795 min = -500;
796 max = 500;
797 step = 50;
798 }
799
set_attenuator(int val)800 void RIG_TT550::set_attenuator(int val)
801 {
802 progStatus.attenuator = val;
803 cmd = TT550setATT;
804 if (val) cmd[1] = '1';
805 else cmd[1] = '0';
806 sendCommand(cmd, 0);
807
808 stringstream s;
809 s << "Set attenuator " << noctl(cmd);
810 set_trace(1, s.str().c_str());
811
812 }
813
get_attenuator()814 int RIG_TT550::get_attenuator()
815 {
816 return progStatus.attenuator;
817
818 }
819
set_volume_control(int val)820 void RIG_TT550::set_volume_control(int val)
821 {
822 cmd = TT550setVolume;
823 cmd[1] = 0xFF & ((val * 255) / 100);
824 sendCommand(cmd, 0);
825
826 stringstream s;
827 s << "Set volume " << noctl(cmd);
828 set_trace(1, s.str().c_str());
829 }
830
get_volume_control()831 int RIG_TT550::get_volume_control()
832 {
833 return progStatus.volume;
834 }
835
show_encA(void *)836 static void show_encA(void *)
837 {
838 txt_encA->show();
839 }
hide_encA(void *)840 static void hide_encA(void *)
841 {
842 txt_encA->hide();
843 }
update_encA(void * d)844 static void update_encA(void *d)
845 {
846 char *str = (char *)d;
847 txt_encA->value(str);
848 }
849
selectA()850 void RIG_TT550::selectA()
851 {
852 Fl::awake(hide_encA, NULL);
853 xcvrstream.clear();
854 set_trace(1, "Select A");
855
856 freqA = vfoA.freq;
857 set_modeA (vfoA.imode);
858 set_bwA (vfoA.iBW);
859 set_vfoRX(freqA);
860 set_vfoTX(freqA);
861 }
862
selectB()863 void RIG_TT550::selectB()
864 {
865 Fl::awake(hide_encA, NULL);
866 xcvrstream.clear();
867 set_trace(1, "Select B");
868 freqB = vfoB.freq;
869 set_modeB (vfoB.imode);
870 set_bwB (vfoB.iBW);
871 set_vfoRX(freqB);
872 set_vfoTX(freqB);
873 }
874
process_freq_entry(char c)875 void RIG_TT550::process_freq_entry(char c)
876 {
877 static bool have_decimal = false;
878 float ffreq = 0.0;
879 unsigned long int freq = 0;
880 if (xcvrstream.empty()) have_decimal = false;
881 if (c != '\r') {
882 if ((c >= '0' && c <= '9') || c == '.') {
883 xcvrstream += c;
884 if (!have_decimal && c == '.') have_decimal = true;
885 else if (have_decimal && c == '.') {
886 xcvrstream.clear();
887 have_decimal = false;
888 keypad_timeout = 0;
889 Fl::awake(hide_encA, NULL);
890 return;
891 }
892 ffreq = 0;
893 sscanf(xcvrstream.c_str(), "%f", &ffreq);
894 if (have_decimal) ffreq *= 1000;
895 freq = (unsigned long int) ffreq;
896 if (!txt_encA->visible())
897 Fl::awake(show_encA, NULL);
898 Fl::awake(update_encA, (void*)xcvrstream.c_str());
899 // LOG_INFO("%s => %ld", str2hex(xcvrstream.c_str(), xcvrstream.length()), freq);
900 keypad_timeout = progStatus.tt550_keypad_timeout / progStatus.serloop_timing;
901 }
902 } else {
903 keypad_timeout = 0;
904 if (xcvrstream.empty()) return;
905 ffreq = 0;
906 sscanf(xcvrstream.c_str(), "%f", &ffreq);
907 if (have_decimal) ffreq *= 1000;
908 freq = (unsigned long int) ffreq;
909 if (freq < 50000) freq *= 1000;
910 Fl::awake(hide_encA, NULL);
911 if (!useB) {
912 freqA = freq;
913 } else {
914 freqB = freq;
915 }
916 xcvrstream.clear();
917 have_decimal = false;
918 }
919 }
920
921 //static const char *tt550_fkey_strings[] = {"None","Clear","CW++","CW--","Band++","Band--","Step++","Step--"};
922
fkey_clear()923 void RIG_TT550::fkey_clear()
924 {
925 // LOG_INFO("%s", tt550_fkey_strings[1]);
926 xcvrstream.clear();
927 keypad_timeout = 0;
928 Fl::awake(hide_encA, NULL);
929 }
930
fkey_cw_plus()931 void RIG_TT550::fkey_cw_plus()
932 {
933 // LOG_INFO("%s", tt550_fkey_strings[2]);
934 if (progStatus.tt550_cw_wpm >= 80) return;
935 progStatus.tt550_cw_wpm++;
936 spnr_tt550_cw_wpm->value(progStatus.tt550_cw_wpm);
937 spnr_tt550_cw_wpm->redraw();
938 selrig->set_cw_wpm();
939 }
940
fkey_cw_minus()941 void RIG_TT550::fkey_cw_minus()
942 {
943 if (progStatus.tt550_cw_wpm <= 5) return;
944 progStatus.tt550_cw_wpm--;
945 spnr_tt550_cw_wpm->value(progStatus.tt550_cw_wpm);
946 spnr_tt550_cw_wpm->redraw();
947 selrig->set_cw_wpm();
948 }
949
950 struct BANDS { unsigned int lo; unsigned int hi; unsigned int digi; };
951
952 static BANDS ibands[] = {
953 { 0, 1800000, 28120000 },
954 { 1800000, 2000000, 1807000 },
955 { 3500000, 4000000, 3580000 },
956 { 7000000, 7300000, 7035000 },
957 { 10100000, 10150000, 10140000 },
958 { 14000000, 14350000, 14070000 },
959 { 18068000, 18168000, 18100000 },
960 { 21000000, 21450000, 21070000 },
961 { 24890000, 24990000, 24920000 },
962 { 28000000, 29700000, 28120000 },
963 { 29700000, 0, 1807000 }
964 };
965
fkey_band_plus()966 void RIG_TT550::fkey_band_plus()
967 {
968 VFOQUEUE qvfo;
969 if (useB) qvfo.vfo = vfoB;
970 else qvfo.vfo = vfoA;
971 for (size_t i = 1; i < sizeof(ibands) / sizeof(BANDS); i++) {
972 if (qvfo.vfo.freq < ibands[i].lo) {
973 qvfo.vfo.freq = ibands[i].digi;
974 break;
975 }
976 }
977 qvfo.vfo.src = UI;
978 qvfo.vfo.iBW = 255;
979 qvfo.vfo.imode = -1;
980 if (useB) qvfo.change = vB;
981 else qvfo.change = vA;
982 srvc_reqs.push(qvfo);
983 }
984
fkey_band_minus()985 void RIG_TT550::fkey_band_minus()
986 {
987 VFOQUEUE qvfo;
988 if (useB) qvfo.vfo = vfoB;
989 else qvfo.vfo = vfoA;
990 for (size_t i = sizeof(ibands) / sizeof(BANDS) - 2; i >= 0; i--) {
991 if (qvfo.vfo.freq > ibands[i].hi) {
992 qvfo.vfo.freq = ibands[i].digi;
993 break;
994 }
995 }
996 qvfo.vfo.src = UI;
997 qvfo.vfo.iBW = 255;
998 qvfo.vfo.imode = -1;
999 if (useB) qvfo.change = vB;
1000 else qvfo.change = vA;
1001 srvc_reqs.push(qvfo);
1002 }
1003
fkey_step_plus()1004 void RIG_TT550::fkey_step_plus()
1005 {
1006 progStatus.tt550_encoder_step++;
1007 if (progStatus.tt550_encoder_step > 4) progStatus.tt550_encoder_step = 0;
1008 sel_tt550_encoder_step->value(progStatus.tt550_encoder_step);
1009 sel_tt550_encoder_step->redraw();
1010 }
1011
fkey_step_minus()1012 void RIG_TT550::fkey_step_minus()
1013 {
1014 progStatus.tt550_encoder_step--;
1015 if (progStatus.tt550_encoder_step < 0) progStatus.tt550_encoder_step = 4;
1016 sel_tt550_encoder_step->value(progStatus.tt550_encoder_step);
1017 sel_tt550_encoder_step->redraw();
1018 }
1019
process_fkey(char c)1020 void RIG_TT550::process_fkey(char c)
1021 {
1022 if (c == 0x11)
1023 switch (progStatus.tt550_F1_func) {
1024 case 1 : fkey_clear(); break;
1025 case 2 : fkey_cw_plus(); break;
1026 case 3 : fkey_cw_minus(); break;
1027 case 4 : fkey_band_plus(); break;
1028 case 5 : fkey_band_minus(); break;
1029 case 6 : fkey_step_plus(); break;
1030 case 7 : fkey_step_minus(); break;
1031 default: ;
1032 }
1033 if (c == 0x12)
1034 switch (progStatus.tt550_F2_func) {
1035 case 1 : fkey_clear(); break;
1036 case 2 : fkey_cw_plus(); break;
1037 case 3 : fkey_cw_minus(); break;
1038 case 4 : fkey_band_plus(); break;
1039 case 5 : fkey_band_minus(); break;
1040 case 6 : fkey_step_plus(); break;
1041 case 7 : fkey_step_minus(); break;
1042 default: ;
1043 }
1044 if (c == 0x13)
1045 switch (progStatus.tt550_F3_func) {
1046 case 1 : fkey_clear(); break;
1047 case 2 : fkey_cw_plus(); break;
1048 case 3 : fkey_cw_minus(); break;
1049 case 4 : fkey_band_plus(); break;
1050 case 5 : fkey_band_minus(); break;
1051 case 6 : fkey_step_plus(); break;
1052 case 7 : fkey_step_minus(); break;
1053 default: ;
1054 }
1055 }
1056
process_keypad(char c)1057 void RIG_TT550::process_keypad(char c)
1058 {
1059 if (c < 0 || c > 0x7f) return;
1060 if (c == 0x11 || c == 0x12 || c == 0x13)
1061 process_fkey(c);
1062 else
1063 process_freq_entry(c);
1064 }
1065
get_302()1066 void RIG_TT550::get_302()
1067 {
1068 if (keypad_timeout) {
1069 keypad_timeout--;
1070 if (keypad_timeout == 0) {
1071 xcvrstream.clear();
1072 Fl::awake(hide_encA, NULL);
1073 }
1074 }
1075 // reading any pending encoder / keyboard strings
1076 size_t p = 0;
1077 int encval = 0;
1078 int encode = 0;
1079 size_t len;
1080
1081 if (!readResponse()) return;
1082
1083 pending.append(replystr);
1084 len = replystr.length();
1085
1086 while (p < len) {
1087 switch (replystr[p]) {
1088 case 'U' :
1089 if (len - p < 3) {
1090 pending.erase(0,p);
1091 break;
1092 }
1093 process_keypad(replystr[p+1]);
1094 p += 3;
1095 break;
1096 case '!' :
1097 if (len - p < 5) {
1098 pending.erase(0,p);
1099 break;
1100 }
1101 encval = ((unsigned char)replystr[p+1] << 8) | (unsigned char)replystr[p+2];
1102 if (encval > 16383) encval -= 65536;
1103 encode += encval;
1104 p += 5;
1105 break;
1106 default :
1107 p++;
1108 break;
1109 }
1110 }
1111 if (encode)
1112 enc_change = encode * TT550_steps[progStatus.tt550_encoder_step];
1113 }
1114
get_smeter()1115 int RIG_TT550::get_smeter()
1116 {
1117 int sval = 0;
1118 float fval;
1119 int fp;
1120 size_t p;
1121 size_t len;
1122
1123 get_302();
1124
1125 p = 0;
1126 sendCommand( TT550query, 0);
1127 get_trace(1, "get smeter");
1128 len = readResponse();
1129
1130 while ((p < len) && (replystr[p] != 'S') && (replystr[p] != 'T'))
1131 p++;
1132 if (p) {
1133 pending.append(replystr.substr(0,p));
1134 replystr.erase(0,p);
1135 }
1136
1137 len = replystr.length();
1138
1139 if (replystr[0] == 'S' && len > 5) {
1140 sscanf(&replystr[1], "%4x", &sval);
1141 fval = sval/256.0;
1142 sval = (int)(fval * 100.0 / 18.0);
1143 if (sval > 100) sval = 0;
1144 Fl::awake(updateFwdPwr, (void*)0);
1145 }
1146
1147 else if (replystr[0] == 'T' && len > 3) {
1148 fp = (unsigned char)replystr[1];
1149 Fl::awake(updateFwdPwr, reinterpret_cast<void*>(fp));
1150 }
1151
1152 return sval;
1153 }
1154
get_swr()1155 int RIG_TT550::get_swr()
1156 {
1157 return iswr;
1158 }
1159
get_power_out()1160 int RIG_TT550::get_power_out()
1161 {
1162 cmd = TT550getFWDREF;
1163 int ret = sendCommand(cmd, 4);
1164 get_trace(1, "get power out");
1165
1166 if (ret < 4) return fwdpwr;
1167 size_t p = replystr.rfind("T");
1168 if (p == string::npos) return fwdpwr;
1169
1170 for (int i = 0; i < FPLEN - 1; i++) {
1171 fp[i] = fp[i+1];
1172 rp[i] = rp[i+1];
1173 }
1174 fp[FPLEN-1] = (unsigned int)replystr[p+1];
1175 rp[FPLEN-1] = (unsigned int)replystr[p+2];
1176 fwdpwr = refpwr = 0;
1177 for (int i = FPLEN - progStatus.tt550_Nsamples; i < FPLEN; i++) {
1178 if (fp[i] > fwdpwr) {
1179 fwdpwr = fp[i];
1180 refpwr = rp[i];
1181 }
1182 }
1183
1184 double swr = 1.0;
1185 if (fwdpwr < 5) iswr = 0;
1186 else if (fwdpwr == refpwr) iswr = 100;
1187 else {
1188 swr = (fwdpwr + refpwr) / (fwdpwr - refpwr);
1189 iswr = (swr-1.0) * 25;
1190 if (iswr < 0) iswr = 0;
1191 if (iswr > 100) iswr = 100;
1192 }
1193
1194 stringstream s;
1195 s << "Get pwr: fwc " << fwdpwr << ", refpwr" << refpwr << ", swr " << swr;
1196 set_trace(1, s.str().c_str());
1197
1198 return fwdpwr;
1199 }
1200
setBfo(int val)1201 void RIG_TT550::setBfo(int val)
1202 {
1203 progStatus.bfo_freq = Bfo = val;
1204 if (useB) {
1205 set_vfoRX(freqB);
1206 set_vfoTX(freqB);
1207 } else if (split) {
1208 set_vfoRX(freqA);
1209 set_vfoTX(freqB);
1210 } else {
1211 set_vfoRX(freqA);
1212 set_vfoTX(freqA);
1213 }
1214 }
1215
getBfo()1216 int RIG_TT550::getBfo()
1217 {
1218 return Bfo;
1219 }
1220
setVfoAdj(double v)1221 void RIG_TT550::setVfoAdj(double v)
1222 {
1223 VfoAdj = v;
1224 set_vfoRX(!useB ? freqA : freqB);
1225 }
1226
setRit(int val)1227 void RIG_TT550::setRit(int val)
1228 {
1229 progStatus.rit_freq = RitFreq = val;
1230 if (RitFreq) RitActive = true;
1231 if (useB) {
1232 set_vfoRX(freqB);
1233 set_vfoTX(freqB);
1234 } else if (split) {
1235 set_vfoRX(freqA);
1236 set_vfoTX(freqB);
1237 } else {
1238 set_vfoRX(freqA);
1239 set_vfoTX(freqA);
1240 }
1241 }
1242
getRit()1243 int RIG_TT550::getRit()
1244 {
1245 return RitFreq;
1246 }
1247
setXit(int val)1248 void RIG_TT550::setXit(int val)
1249 {
1250 progStatus.xit_freq = XitFreq = val;
1251 if (XitFreq) XitActive = true;
1252 if (useB) {
1253 set_vfoRX(freqB);
1254 set_vfoTX(freqB);
1255 } else if (split) {
1256 set_vfoRX(freqA);
1257 set_vfoTX(freqB);
1258 } else {
1259 set_vfoRX(freqA);
1260 set_vfoTX(freqA);
1261 }
1262 }
1263
getXit()1264 int RIG_TT550::getXit()
1265 {
1266 return XitFreq;
1267 }
1268
set_rf_gain(int val)1269 void RIG_TT550::set_rf_gain(int val)
1270 {
1271 cmd = TT550setRFGAIN;
1272 cmd[1] = (unsigned char)(255 - val * 2.55);
1273 if (cmd[1] == 0x0D) cmd[1] = 0x0E;
1274 RFgain = val;
1275 sendCommand(cmd, 0);
1276
1277 stringstream s;
1278 s << "Set rf gain " << val << ", " << noctl(cmd);
1279 set_trace(1, s.str().c_str());
1280
1281 }
1282
get_rf_gain()1283 int RIG_TT550::get_rf_gain()
1284 {
1285 return RFgain;
1286 }
1287
get_rf_min_max_step(int & min,int & max,int & step)1288 void RIG_TT550::get_rf_min_max_step(int &min, int &max, int &step)
1289 {
1290 min = 0;
1291 max = 100;
1292 step = 1;
1293 }
1294
set_line_out()1295 void RIG_TT550::set_line_out()
1296 {
1297 cmd = TT550setLINEOUT;
1298 cmd[1] = (0x3F) & (((100 - progStatus.tt550_line_out) * 63) / 100);
1299 if (cmd[1] == 0x0D) cmd[1] = 0x0E;
1300 sendCommand(cmd, 0);
1301
1302 stringstream s;
1303 s << "Set line out " << progStatus.tt550_line_out << ", " << noctl(cmd);
1304 set_trace(1, s.str().c_str());
1305 }
1306
set_agc_level()1307 void RIG_TT550::set_agc_level()
1308 {
1309 cmd = TT550setAGC;
1310 switch (progStatus.tt550_agc_level) {
1311 case 0 : cmd[1] = '1'; break;
1312 case 1 : cmd[1] = '2'; break;
1313 case 2 : cmd[1] = '3'; break;
1314 }
1315 sendCommand(cmd, 0);
1316
1317 stringstream s;
1318 s << "Set agc level " << progStatus.tt550_agc_level << ", " << noctl(cmd);
1319 set_trace(1, s.str().c_str());
1320 }
1321
set_cw_wpm()1322 void RIG_TT550::set_cw_wpm()
1323 {
1324 cmd = TT550setCWWPM;
1325 int duration = 7200 / progStatus.tt550_cw_wpm;
1326 int ditfactor = duration * progStatus.tt550_cw_weight;
1327 int spcfactor = duration * (2.0 - progStatus.tt550_cw_weight);
1328 int dahfactor = duration * 3;
1329 cmd[1] = 0xFF & (ditfactor >> 8);
1330 cmd[2] = 0xFF & ditfactor;
1331 cmd[3] = 0xFF & (dahfactor >> 8);
1332 cmd[4] = 0xFF & dahfactor;
1333 cmd[5] = 0xFF & (spcfactor >> 8);
1334 cmd[6] = 0xFF & spcfactor;
1335 sendCommand(cmd, 0);
1336
1337 stringstream s;
1338 s << "Set CW wpm " << progStatus.tt550_cw_wpm << ", " << noctl(cmd);
1339 set_trace(1, s.str().c_str());
1340 }
1341
set_cw_vol()1342 void RIG_TT550::set_cw_vol()
1343 {
1344 int val = progStatus.tt550_cw_vol;
1345 cmd = TT550setCWMONVOL;
1346 cmd[1] = 0xFF & (val * 255) / 100;
1347 if (cmd[1] == 0x0D) cmd[1] = 0x0E;
1348 sendCommand(cmd, 0);
1349
1350 stringstream s;
1351 s << "Set CW volume " << progStatus.tt550_cw_vol << ", " << noctl(cmd);
1352 set_trace(1, s.str().c_str());
1353 }
1354
set_cw_spot()1355 bool RIG_TT550::set_cw_spot()
1356 {
1357 int val = progStatus.tt550_cw_spot;
1358 cmd = TT550setCWSPOTLVL;
1359 cmd[1] = 0xFF & ((val * 255 ) / 100);
1360 if (!progStatus.tt550_spot_onoff) cmd[1] = 0;
1361 if (cmd[1] == 0x0D) cmd[1] = 0x0E;
1362 sendCommand(cmd, 0);
1363
1364 stringstream s;
1365 s << "Set CW spot " << progStatus.tt550_cw_spot << ", " << noctl(cmd);
1366 set_trace(1, s.str().c_str());
1367
1368 return true;
1369 }
1370
set_spot_onoff()1371 void RIG_TT550::set_spot_onoff()
1372 {
1373 set_cw_spot();
1374 }
1375
1376 // front panel Preamp control is hijacked for a spot control !
1377
set_preamp(int val)1378 void RIG_TT550::set_preamp(int val)
1379 {
1380 progStatus.tt550_spot_onoff = val;
1381 set_cw_spot();
1382 }
1383
get_preamp()1384 int RIG_TT550::get_preamp()
1385 {
1386 return progStatus.preamp;
1387 }
1388
set_cw_weight()1389 void RIG_TT550::set_cw_weight()
1390 {
1391 set_cw_wpm();
1392 }
1393
set_cw_qsk()1394 void RIG_TT550::set_cw_qsk()
1395 {
1396 cmd = TT550setCWQSK;
1397 cmd[2] = (0xFF) & (int)(progStatus.tt550_cw_qsk * 2);
1398 if (cmd[2] == 0x0D) cmd[2] = 0x0E;
1399 sendCommand(cmd, 0);
1400 }
1401
1402
enable_keyer()1403 void RIG_TT550::enable_keyer()
1404 {
1405 if (progStatus.tt550_enable_keyer)
1406 cmd = TT550setKEYER_ON;
1407 else
1408 cmd = TT550setKEYER_OFF;
1409 sendCommand(cmd, 0);
1410
1411 stringstream s;
1412 s << "Set enable keyer " << (progStatus.tt550_enable_keyer ? "ON" : "OFF") << ", " << noctl(cmd);
1413 set_trace(1, s.str().c_str());
1414 }
1415
1416
set_vox_onoff()1417 void RIG_TT550::set_vox_onoff()
1418 {
1419 cmd = TT550setVOX;
1420 cmd[1] = progStatus.vox_onoff ? '1' : '0';
1421 sendCommand(cmd, 0);
1422
1423 stringstream s;
1424 s << "Set vox " << (progStatus.vox_onoff ? "ON" : "OFF") << ", " << noctl(cmd);
1425 set_trace(1, s.str().c_str());
1426 }
1427
set_vox_gain()1428 void RIG_TT550::set_vox_gain()
1429 {
1430 cmd = TT550setVOXGAIN;
1431 cmd[2] = (0xFF) & (int)(progStatus.tt550_vox_gain * 2.55);
1432 if (cmd[2] == 0x0D) cmd[2] = 0x0E;
1433 sendCommand(cmd, 0);
1434
1435 stringstream s;
1436 s << "Set vox gain " << progStatus.tt550_vox_gain << ", " << noctl(cmd);
1437 set_trace(1, s.str().c_str());
1438 }
1439
set_vox_anti()1440 void RIG_TT550::set_vox_anti()
1441 {
1442 cmd = TT550setANTIVOX;
1443 cmd[2] = (0xFF) & (int)(progStatus.tt550_vox_anti * 2.55);
1444 if (cmd[2] == 0x0D) cmd[2] = 0x0E;
1445 sendCommand(cmd, 0);
1446
1447 stringstream s;
1448 s << "Set vox anti " << progStatus.tt550_vox_anti << ", " << noctl(cmd);
1449 set_trace(1, s.str().c_str());
1450 }
1451
set_vox_hang()1452 void RIG_TT550::set_vox_hang()
1453 {
1454 cmd = TT550setVOXHANG;
1455 cmd[2] = (0xFF) & (int)(progStatus.tt550_vox_hang * 2.55);
1456 if (cmd[2] == 0x0D) cmd[2] = 0x0E;
1457 sendCommand(cmd, 0);
1458
1459 stringstream s;
1460 s << "Set vox hang " << progStatus.tt550_vox_hang << ", " << noctl(cmd);
1461 set_trace(1, s.str().c_str());
1462 }
1463
set_aux_hang()1464 void RIG_TT550::set_aux_hang()
1465 {
1466 cmd = TT550setAUXHANG;
1467 cmd[2] = 0;
1468 sendCommand(cmd, 0);
1469
1470 stringstream s;
1471 s << "Set aux hang " << noctl(cmd);
1472 set_trace(1, s.str().c_str());
1473 }
1474
set_compression(int on,int val)1475 void RIG_TT550::set_compression(int on, int val)
1476 {
1477 cmd = TT550setSPEECH;
1478 cmd[1] = (0x7F) & (int)(progStatus.tt550_compression * 1.27);
1479 if (cmd[1] == 0x0D) cmd[1] = 0x0E;
1480 sendCommand(cmd, 0);
1481
1482 stringstream s;
1483 s << "Set compression " << progStatus.tt550_compression << ", " << noctl(cmd);
1484 set_trace(1, s.str().c_str());
1485 }
1486
set_auto_notch(int v)1487 void RIG_TT550::set_auto_notch(int v)
1488 {
1489 auto_notch = v;
1490 cmd = TT550setNRNOTCH;
1491 cmd[1] = '0';
1492 cmd[1] = noise_reduction ? '1' : '0';
1493 if (v)
1494 cmd[2] = '1';
1495 else
1496 cmd[2] = '0';
1497 sendCommand(cmd, 0);
1498
1499 stringstream s;
1500 s << "Set auto notch " << noctl(cmd);
1501 set_trace(1, s.str().c_str());
1502 }
1503
set_noise_reduction(int b)1504 void RIG_TT550::set_noise_reduction(int b)
1505 {
1506 noise_reduction = b;
1507 cmd = TT550setNRNOTCH;
1508 if (b)
1509 cmd[1] = '1';
1510 else
1511 cmd[1] = '0';
1512 cmd[2] = auto_notch ? '1' : '0';
1513 sendCommand(cmd, 0);
1514
1515 stringstream s;
1516 s << "Set noise reduction " << noctl(cmd);
1517 set_trace(1, s.str().c_str());
1518 }
1519
set_mic_gain(int v)1520 void RIG_TT550::set_mic_gain(int v)
1521 {
1522 progStatus.mic_gain = v;
1523 if (!progStatus.tt550_use_line_in) {
1524 cmd = TT550setMICLINE;
1525 cmd[2] = 0;
1526 cmd[3] = (unsigned char) v;
1527 sendCommand(cmd, 0);
1528
1529 stringstream s;
1530 s << "Set mic gain " << noctl(cmd);
1531 set_trace(1, s.str().c_str());
1532
1533 }
1534 }
1535
get_mic_gain()1536 int RIG_TT550::get_mic_gain()
1537 {
1538 return progStatus.mic_gain;
1539 }
1540
set_mic_line(int v)1541 void RIG_TT550::set_mic_line(int v)
1542 {
1543 if (progStatus.tt550_use_line_in) {
1544 cmd = TT550setMICLINE;
1545 cmd[2] = 1;
1546 cmd[3] = 0;//(unsigned char) v;
1547 sendCommand(cmd, 0);
1548
1549 stringstream s;
1550 s << "Set mic line " << noctl(cmd);
1551 set_trace(1, s.str().c_str());
1552 }
1553 }
1554
get_mic_min_max_step(int & min,int & max,int & step)1555 void RIG_TT550::get_mic_min_max_step(int &min, int &max, int &step)
1556 {
1557 min = 0;
1558 max = 15;
1559 step = 1;
1560 }
1561
set_power_control(double val)1562 void RIG_TT550::set_power_control(double val)
1563 {
1564 int ival = 0;
1565 if (def_mode == TT550_AM_MODE) {
1566 progStatus.tt550_AM_level = (int)val;
1567 cmd = TT550setAMCARRIER;
1568 ival = (val * .25 - 5) * 256 / 95;
1569 } else {
1570 progStatus.power_level = (int) val;
1571 cmd = TT550setPOWER;
1572 ival = (val - 5) * 256 / 95;
1573 }
1574 if (ival == 0x0d) ival++;
1575 if (ival < 5) ival = 5;
1576 if (ival > 255) ival = 255;
1577 cmd[1] = ival;
1578 sendCommand(cmd, 0);
1579
1580 stringstream s;
1581 s << "Set power control " << noctl(cmd);
1582 set_trace(1, s.str().c_str());
1583 }
1584
get_power_control()1585 int RIG_TT550::get_power_control()
1586 {
1587 return progStatus.power_level;
1588 }
1589
set_mon_vol()1590 void RIG_TT550::set_mon_vol()
1591 {
1592 cmd = TT550setMONVOL;
1593 cmd[1] = 0xFF & ((progStatus.tt550_mon_vol * 255) / 100);
1594 if (cmd[1] == 0x0D) cmd[1] = 0x0E;
1595 sendCommand(cmd, 0);
1596
1597 stringstream s;
1598 s << "Set mon volume " << progStatus.tt550_mon_vol << ", " << noctl(cmd);
1599 set_trace(1, s.str().c_str());
1600 }
1601
set_squelch_level()1602 void RIG_TT550::set_squelch_level()
1603 {
1604 cmd = TT550setSQUELCH;
1605 cmd[1] = 0xFF & ((progStatus.tt550_squelch_level * 255) / 100);
1606 if (cmd[1] == 0x0D) cmd[1] = 0x0E;
1607 sendCommand(cmd, 0);
1608
1609 stringstream s;
1610 s << "Set squelch level " << progStatus.tt550_squelch_level << ", " << noctl(cmd);
1611 set_trace(1, s.str().c_str());
1612 }
1613
set_nb_level()1614 void RIG_TT550::set_nb_level()
1615 {
1616 cmd = TT550setBLANKER;
1617 cmd[1] = progStatus.tt550_nb_level;
1618 sendCommand(cmd, 0);
1619
1620 stringstream s;
1621 s << "Set nb level " << progStatus.tt550_nb_level << ", " << noctl(cmd);
1622 set_trace(1, s.str().c_str());
1623 }
1624
set_noise(bool b)1625 void RIG_TT550::set_noise(bool b)
1626 {
1627 progStatus.noise = b;
1628 set_noise_reduction(b);
1629 }
1630
tuner_bypass()1631 void RIG_TT550::tuner_bypass()
1632 {
1633 }
1634
1635 // callbacks for tt550 transceiver
cb_tt550_line_out()1636 void cb_tt550_line_out()
1637 {
1638 pthread_mutex_lock(&mutex_serial);
1639 selrig->set_line_out();
1640 pthread_mutex_unlock(&mutex_serial);
1641 }
1642
cb_tt550_agc_level()1643 void cb_tt550_agc_level()
1644 {
1645 pthread_mutex_lock(&mutex_serial);
1646 selrig->set_agc_level();
1647 pthread_mutex_unlock(&mutex_serial);
1648 }
1649
cb_tt550_cw_wpm()1650 void cb_tt550_cw_wpm()
1651 {
1652 pthread_mutex_lock(&mutex_serial);
1653 selrig->set_cw_wpm();
1654 pthread_mutex_unlock(&mutex_serial);
1655 }
1656
cb_tt550_cw_vol()1657 void cb_tt550_cw_vol()
1658 {
1659 pthread_mutex_lock(&mutex_serial);
1660 selrig->set_cw_vol();
1661 pthread_mutex_unlock(&mutex_serial);
1662 }
1663
cb_tt550_cw_spot()1664 void cb_tt550_cw_spot()
1665 {
1666 pthread_mutex_lock(&mutex_serial);
1667 selrig->set_cw_spot();
1668 pthread_mutex_unlock(&mutex_serial);
1669 }
1670
cb_tt550_cw_weight()1671 void cb_tt550_cw_weight()
1672 {
1673 pthread_mutex_lock(&mutex_serial);
1674 selrig->set_cw_weight();
1675 pthread_mutex_unlock(&mutex_serial);
1676 }
1677
cb_tt550_enable_keyer()1678 void cb_tt550_enable_keyer()
1679 {
1680 pthread_mutex_lock(&mutex_serial);
1681 selrig->enable_keyer();
1682 pthread_mutex_unlock(&mutex_serial);
1683 }
1684
cb_tt550_spot_onoff()1685 void cb_tt550_spot_onoff()
1686 {
1687 pthread_mutex_lock(&mutex_serial);
1688 selrig->set_spot_onoff();
1689 pthread_mutex_unlock(&mutex_serial);
1690 }
1691
cb_tt550_vox_gain()1692 void cb_tt550_vox_gain()
1693 {
1694 pthread_mutex_lock(&mutex_serial);
1695 selrig->set_vox_gain();
1696 pthread_mutex_unlock(&mutex_serial);
1697 }
1698
cb_tt550_vox_anti()1699 void cb_tt550_vox_anti()
1700 {
1701 pthread_mutex_lock(&mutex_serial);
1702 selrig->set_vox_anti();
1703 pthread_mutex_unlock(&mutex_serial);
1704 }
1705
cb_tt550_vox_hang()1706 void cb_tt550_vox_hang()
1707 {
1708 pthread_mutex_lock(&mutex_serial);
1709 selrig->set_vox_hang();
1710 pthread_mutex_unlock(&mutex_serial);
1711 }
1712
cb_tt550_vox_onoff()1713 void cb_tt550_vox_onoff()
1714 {
1715 pthread_mutex_lock(&mutex_serial);
1716 selrig->set_vox_onoff();
1717 pthread_mutex_unlock(&mutex_serial);
1718 }
1719
cb_tt550_compression()1720 void cb_tt550_compression()
1721 {
1722 pthread_mutex_lock(&mutex_serial);
1723 selrig->set_compression(0,0);
1724 pthread_mutex_unlock(&mutex_serial);
1725 }
1726
cb_tt550_mon_vol()1727 void cb_tt550_mon_vol()
1728 {
1729 pthread_mutex_lock(&mutex_serial);
1730 selrig->set_mon_vol();
1731 pthread_mutex_unlock(&mutex_serial);
1732 }
1733
cb_tt550_tuner_bypass()1734 void cb_tt550_tuner_bypass()
1735 {
1736 pthread_mutex_lock(&mutex_serial);
1737 selrig->tuner_bypass();
1738 pthread_mutex_unlock(&mutex_serial);
1739 }
1740
cb_tt550_enable_xmtr()1741 void cb_tt550_enable_xmtr()
1742 {
1743 pthread_mutex_lock(&mutex_serial);
1744 selrig->enable_xmtr();
1745 pthread_mutex_unlock(&mutex_serial);
1746 }
1747
cb_tt550_enable_tloop()1748 void cb_tt550_enable_tloop()
1749 {
1750 pthread_mutex_lock(&mutex_serial);
1751 selrig->enable_tloop();
1752 pthread_mutex_unlock(&mutex_serial);
1753 }
1754
cb_tt550_nb_level()1755 void cb_tt550_nb_level()
1756 {
1757 pthread_mutex_lock(&mutex_serial);
1758 // progStatus.tt550_nb_level = cbo_tt550_nb_level->index();
1759 selrig->set_nb_level();
1760 pthread_mutex_unlock(&mutex_serial);
1761 }
1762
cb_tt550_use_line_in()1763 void cb_tt550_use_line_in()
1764 {
1765 pthread_mutex_lock(&mutex_serial);
1766 if (progStatus.tt550_use_line_in)
1767 selrig->set_mic_line(0);
1768 else
1769 selrig->set_mic_gain(progStatus.mic_gain);
1770 pthread_mutex_unlock(&mutex_serial);
1771 }
1772
cb_tt550_setXmtBW()1773 void cb_tt550_setXmtBW()
1774 {
1775 pthread_mutex_lock(&mutex_serial);
1776 selrig->set_bwA(selrig->bwA);
1777 pthread_mutex_unlock(&mutex_serial);
1778 }
1779
cb_tt550_cw_qsk()1780 void cb_tt550_cw_qsk()
1781 {
1782 pthread_mutex_lock(&mutex_serial);
1783 selrig->set_cw_qsk();
1784 pthread_mutex_unlock(&mutex_serial);
1785 }
1786
1787 // TT-550 / at-11 internal tuner i/o commands
at11_bypass()1788 void RIG_TT550::at11_bypass()
1789 {
1790 cmd = "$0\r";
1791 sendCommand(cmd, 0);
1792 LOG_INFO("%s", info(cmd));
1793 }
1794
at11_autotune()1795 void RIG_TT550::at11_autotune()
1796 {
1797 cmd = "$1\r";
1798 sendCommand(cmd, 0);
1799 LOG_INFO("%s", info(cmd));
1800 }
1801
at11_cap_up()1802 void RIG_TT550::at11_cap_up()
1803 {
1804 cmd = "$3\r";
1805 sendCommand(cmd, 0);
1806 LOG_INFO("%s", info(cmd));
1807 }
1808
at11_cap_dn()1809 void RIG_TT550::at11_cap_dn()
1810 {
1811 cmd = "$4\r";
1812 sendCommand(cmd, 0);
1813 LOG_INFO("%s", info(cmd));
1814 }
1815
at11_ind_up()1816 void RIG_TT550::at11_ind_up()
1817 {
1818 cmd = "$5\r";
1819 sendCommand(cmd, 0);
1820 LOG_INFO("%s", info(cmd));
1821 }
1822
at11_ind_dn()1823 void RIG_TT550::at11_ind_dn()
1824 {
1825 cmd = "$6\r";
1826 sendCommand(cmd, 0);
1827 LOG_INFO("%s", info(cmd));
1828 }
1829
at11_hiZ()1830 void RIG_TT550::at11_hiZ()
1831 {
1832 cmd = "$7\r";
1833 sendCommand(cmd, 0);
1834 LOG_INFO("%s", info(cmd));
1835 }
1836
at11_loZ()1837 void RIG_TT550::at11_loZ()
1838 {
1839 cmd = "$8\r";
1840 sendCommand(cmd, 0);
1841 LOG_INFO("%s", info(cmd));
1842 }
1843
1844 //======================================================================
1845 // data strings captured from TenTec Windows control program for Pegasus
1846 //======================================================================
1847
1848 /*
1849 Pegasus Control Program Startup, Query and Close Sequences
1850 ==========================================================
1851
1852 ========================= start program ======================================
1853 WRITE Length 3:
1854 58 58 0D "XX"
1855
1856 READ Length 2:
1857 0D 0D
1858 READ Length 14:
1859 20 20 52 41 44 49 4F 20 53 54 41 52 54 0D " RADIO START"
1860
1861 WRITE Length 3:
1862 3F 56 0D "?V" version?
1863 READ Length 13:
1864 56 45 52 20 31 32 39 31 2D 35 33 38 0D "VER 1291.538"
1865
1866 WRITE Length 7:
1867 4D 31 31 0D "M11" mode - USB / USB
1868 50 2B 0D "P+" power = 16.8 watts
1869
1870 WRITE Length 28:
1871 47 31 0D "G1" agc - slow
1872 4E 51 5C 0A A9 67 70 0D "N...." Receive tuning factor
1873 54 51 5C 0A A9 12 20 0D "T...." Transmit tuning factor
1874 57 0A 0D "W." Width 3000
1875 56 3E 0D "V." Volume 24
1876 4C 00 0D "L0" Line out - 0, full output
1877
1878 WRITE Length 3:
1879 50 2B 0D "P+" power = 16.8 watts
1880
1881 WRITE Length 3:
1882 4A 29 0D "J." sidetone volume = 16
1883
1884 WRITE Length 13:
1885 4F 31 01 00 0D "O1." select line in, gain factor = 1
1886 55 47 0F 0D "UG." Vox gain = 15
1887 55 48 0F 0D "UH." Vox hang = 15
1888
1889 WRITE Length 16:
1890 55 41 5D 0D "UA." Antivox = 36
1891 55 30 0D "U0" Vox OFF
1892 48 00 0D "H." Audio monitor volume = 0
1893 23 32 0D "#2" Disable 'T' loop
1894 23 31 0D "#1" Enable transmitter
1895
1896 WRITE Length 26:
1897 43 0A 0D "C." Transmit filter width = 3000
1898 23 36 0D "#6" Enable keyer
1899 53 00 0D "S." Squelch = 0, OFF
1900 52 0F 0D "R." UNKNOWN
1901 45 01 1F 03 5D 01 1F 0D "E...." Keyer timing
1902 44 00 0D "D." Noise blanker = 0, OFF
1903 59 00 0D "Y." Speech processor = 0, OFF
1904
1905 WRITE Length 8:
1906 55 51 00 0D "UQ." set CW QSK = 0..255
1907 55 54 00 0D "UT." set AUX TX HANG = 0..255 (aux T/R delay)
1908
1909 ============================ smeter query ======================================
1910 WRITE Length 3:
1911 3F 53 0D "?S" read smeter
1912 READ Length 6:
1913 53 30 39 31 42 0D "S...." smeter value
1914
1915 ============================== close program ====================================
1916
1917 WRITE Length 3:
1918 56 00 0D "V0" volume = ZERO
1919
1920 WRITE Length 3:
1921 4C 3F 0D "L." Line out = 63, MINIMUM
1922
1923
1924 unsigned char datastream[] = {
1925 0x21, 0x00, 0x01, 0x00, 0x0D,
1926 0x21, 0x00, 0x01, 0x00, 0x0D,
1927 0x21, 0x00, 0x01, 0x00, 0x0D,
1928 0x21, 0x00, 0x01, 0x00, 0x0D,
1929 0x21, 0x00, 0x01, 0x00, 0x0D,
1930 0x21, 0x00, 0x01, 0x00, 0x0D,
1931 0x21, 0x00, 0x01, 0x00, 0x0D,
1932 0x21, 0x00, 0x01, 0x00, 0x0D,
1933 0x21, 0x00, 0x01, 0x00, 0x0D,
1934 0x21, 0x00, 0x01, 0x00, 0x0D,
1935 0x21, 0x00, 0x01, 0x00, 0x0D,
1936 0x21, 0x00, 0x01, 0x00, 0x0D,
1937 0x21, 0x00, 0x01, 0x00, 0x0D,
1938 0x21, 0x00, 0x01, 0x00, 0x0D,
1939 0x21, 0x00, 0x01, 0x00, 0x0D,
1940 0x21, 0x00, 0x01, 0x00, 0x0D,
1941 0x21, 0x00, 0x01, 0x00, 0x0D,
1942 0x21, 0x00, 0x01, 0x00, 0x0D,
1943 0x21, 0x00, 0x01, 0x00, 0x0D,
1944 0x21, 0x00, 0x01, 0x00, 0x0D,
1945 0x21, 0x00, 0x01, 0x00, 0x0D,
1946 0x21, 0x00, 0x01, 0x00, 0x0D,
1947 0x21, 0x00, 0x01, 0x00, 0x0D,
1948 0x21, 0x00, 0x01, 0x00, 0x0D,
1949 0x21, 0x00, 0x01, 0x00, 0x0D,
1950 0x21, 0x00, 0x01, 0x00, 0x0D,
1951 0x21, 0x00, 0x01, 0x00, 0x0D,
1952 0x21, 0x00, 0x01, 0x00, 0x0D,
1953 0x21, 0x00, 0x01, 0x00, 0x0D,
1954 0x21, 0x00, 0x01, 0x00, 0x0D,
1955 0x21, 0x00, 0x01, 0x00, 0x0D,
1956 0x21, 0x00, 0x01, 0x00, 0x0D,
1957 0x21, 0x00, 0x01, 0x00, 0x0D,
1958 0x21, 0x00, 0x01, 0x00, 0x0D,
1959 0x21, 0x00, 0x01, 0x00, 0x0D,
1960 0x21, 0x00, 0x01, 0x00, 0x0D,
1961 0x21, 0x00, 0x01, 0x00, 0x0D,
1962 0x21, 0x00, 0x01, 0x00, 0x0D,
1963 0x21, 0x00, 0x01, 0x00, 0x0D,
1964 0x21, 0x00, 0x01, 0x00, 0x0D,
1965 0x21, 0x00, 0x01, 0x00, 0x0D,
1966 0x21, 0x00, 0x01, 0x00, 0x0D,
1967 0x21, 0x00, 0x01, 0x00, 0x0D,
1968 0x21, 0x00, 0x01, 0x00, 0x0D,
1969 0x21, 0x00, 0x01, 0x00, 0x0D,
1970 0x21, 0x00, 0x01, 0x00, 0x0D,
1971 0x21, 0x00, 0x01, 0x00, 0x0D,
1972 0x21, 0x00, 0x01, 0x00, 0x0D,
1973 0x21, 0x00, 0x01, 0x00, 0x0D,
1974 0x21, 0x00, 0x01, 0x00, 0x0D,
1975
1976 0x21, 0xFF, 0xFF, 0x00, 0x0D,
1977 0x21, 0xFF, 0xFF, 0x00, 0x0D,
1978 0x21, 0xFF, 0xFF, 0x00, 0x0D,
1979 0x21, 0xFF, 0xFF, 0x00, 0x0D,
1980 0x21, 0xFF, 0xFF, 0x00, 0x0D,
1981 0x21, 0xFF, 0xFF, 0x00, 0x0D,
1982 0x21, 0xFF, 0xFF, 0x00, 0x0D,
1983 0x21, 0xFF, 0xFF, 0x00, 0x0D,
1984 0x21, 0xFF, 0xFF, 0x00, 0x0D,
1985 0x21, 0xFF, 0xFF, 0x00, 0x0D,
1986 0x21, 0xFF, 0xFF, 0x00, 0x0D,
1987 0x21, 0xFF, 0xFF, 0x00, 0x0D,
1988 0x21, 0xFF, 0xFF, 0x00, 0x0D,
1989 0x21, 0xFF, 0xFF, 0x00, 0x0D,
1990 0x21, 0xFF, 0xFF, 0x00, 0x0D,
1991 0x21, 0xFF, 0xFF, 0x00, 0x0D,
1992 0x21, 0xFF, 0xFF, 0x00, 0x0D,
1993 0x21, 0xFF, 0xFF, 0x00, 0x0D,
1994 0x21, 0xFF, 0xFF, 0x00, 0x0D,
1995 0x21, 0xFF, 0xFF, 0x00, 0x0D,
1996 0x21, 0xFF, 0xFF, 0x00, 0x0D,
1997 0x21, 0xFF, 0xFF, 0x00, 0x0D,
1998 0x21, 0xFF, 0xFF, 0x00, 0x0D,
1999 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2000 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2001 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2002 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2003 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2004 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2005 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2006 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2007 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2008 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2009 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2010 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2011 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2012 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2013 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2014 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2015 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2016 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2017 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2018 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2019 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2020 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2021 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2022 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2023 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2024 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2025 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2026
2027 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2028 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2029 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2030 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2031 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2032 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2033 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2034 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2035 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2036 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2037 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2038 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2039 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2040 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2041 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2042 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2043 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2044 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2045 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2046 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2047 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2048 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2049 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2050 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2051 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2052 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2053 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2054 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2055 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2056 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2057 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2058 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2059 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2060 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2061 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2062 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2063 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2064 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2065 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2066 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2067 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2068 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2069 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2070 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2071 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2072 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2073 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2074 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2075 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2076 0x21, 0xFF, 0xFF, 0x00, 0x0D,
2077
2078 0x21, 0x00, 0x01, 0x00, 0x0D,
2079 0x21, 0x00, 0x01, 0x00, 0x0D,
2080 0x21, 0x00, 0x01, 0x00, 0x0D,
2081 0x21, 0x00, 0x01, 0x00, 0x0D,
2082 0x21, 0x00, 0x01, 0x00, 0x0D,
2083 0x21, 0x00, 0x01, 0x00, 0x0D,
2084 0x21, 0x00, 0x01, 0x00, 0x0D,
2085 0x21, 0x00, 0x01, 0x00, 0x0D,
2086 0x21, 0x00, 0x01, 0x00, 0x0D,
2087 0x21, 0x00, 0x01, 0x00, 0x0D,
2088 0x21, 0x00, 0x01, 0x00, 0x0D,
2089 0x21, 0x00, 0x01, 0x00, 0x0D,
2090 0x21, 0x00, 0x01, 0x00, 0x0D,
2091 0x21, 0x00, 0x01, 0x00, 0x0D,
2092 0x21, 0x00, 0x01, 0x00, 0x0D,
2093 0x21, 0x00, 0x01, 0x00, 0x0D,
2094 0x21, 0x00, 0x01, 0x00, 0x0D,
2095 0x21, 0x00, 0x01, 0x00, 0x0D,
2096 0x21, 0x00, 0x01, 0x00, 0x0D,
2097 0x21, 0x00, 0x01, 0x00, 0x0D,
2098 0x21, 0x00, 0x01, 0x00, 0x0D,
2099 0x21, 0x00, 0x01, 0x00, 0x0D,
2100 0x21, 0x00, 0x01, 0x00, 0x0D,
2101 0x21, 0x00, 0x01, 0x00, 0x0D,
2102 0x21, 0x00, 0x01, 0x00, 0x0D,
2103 0x21, 0x00, 0x01, 0x00, 0x0D,
2104 0x21, 0x00, 0x01, 0x00, 0x0D,
2105 0x21, 0x00, 0x01, 0x00, 0x0D,
2106 0x21, 0x00, 0x01, 0x00, 0x0D,
2107 0x21, 0x00, 0x01, 0x00, 0x0D,
2108 0x21, 0x00, 0x01, 0x00, 0x0D,
2109 0x21, 0x00, 0x01, 0x00, 0x0D,
2110 0x21, 0x00, 0x01, 0x00, 0x0D,
2111 0x21, 0x00, 0x01, 0x00, 0x0D,
2112 0x21, 0x00, 0x01, 0x00, 0x0D,
2113 0x21, 0x00, 0x01, 0x00, 0x0D,
2114 0x21, 0x00, 0x01, 0x00, 0x0D,
2115 0x21, 0x00, 0x01, 0x00, 0x0D,
2116 0x21, 0x00, 0x01, 0x00, 0x0D,
2117 0x21, 0x00, 0x01, 0x00, 0x0D,
2118 0x21, 0x00, 0x01, 0x00, 0x0D,
2119 0x21, 0x00, 0x01, 0x00, 0x0D,
2120 0x21, 0x00, 0x01, 0x00, 0x0D,
2121 0x21, 0x00, 0x01, 0x00, 0x0D,
2122 0x21, 0x00, 0x01, 0x00, 0x0D,
2123 0x21, 0x00, 0x01, 0x00, 0x0D,
2124 0x21, 0x00, 0x01, 0x00, 0x0D,
2125 0x21, 0x00, 0x01, 0x00, 0x0D,
2126 0x21, 0x00, 0x01, 0x00, 0x0D,
2127 0x21, 0x00, 0x01, 0x00, 0x0D,
2128
2129 0x80 };
2130
2131 */
2132