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
22 #include "DELTA-II.h"
23
24 //=============================================================================
25 // TT-535
26
27 const char RIG_TT535name_[] = "DELTA-II";
28
29 const char *RIG_TT535modes_[] = {
30 "LSB", "USB", "AM", "CW", "FM", NULL};
31 static const char RIG_TT535_mode_type[] = {'L', 'U', 'U', 'L', 'U'};
32
RIG_TT535()33 RIG_TT535::RIG_TT535() {
34 name_ = RIG_TT535name_;
35 modes_ = RIG_TT535modes_;
36 comm_baudrate = BR1200;
37 stopbits = 1;
38 comm_retries = 2;
39 comm_wait = 10;
40 comm_timeout = 50;
41 comm_echo = true;
42 comm_rtscts = false;
43 comm_rtsplus = false;
44 comm_dtrplus = true;
45 comm_catptt = false;
46 comm_rtsptt = false;
47 comm_dtrptt = false;
48 modeA = 1;
49 bwA = 0;
50
51 has_mode_control = true;
52 // has_ptt_control = true;
53
54 pre_to[2] = ok[3] = bad[3] = pre_fm[3] = 0x01;
55
56 };
57
adjust_bandwidth(int m)58 int RIG_TT535::adjust_bandwidth(int m)
59 {
60 return 0;
61 }
62
check()63 bool RIG_TT535::check()
64 {
65 return true;
66 }
67
get_vfoA()68 unsigned long int RIG_TT535::get_vfoA ()
69 {
70 return freqA;
71 }
72
73
set_vfoA(unsigned long int freq)74 void RIG_TT535::set_vfoA (unsigned long int freq)
75 {
76 freqA = freq;
77 cmd = pre_to;
78 cmd += '\x05';
79 cmd.append( to_bcd_be( freq, 8 ) );
80 cmd.append( post );
81 int ret = sendCommand(cmd);
82 if (ret != 6)
83 checkresponse();
84 }
85
set_vfoB(unsigned long int freq)86 void RIG_TT535::set_vfoB (unsigned long int freq)
87 {
88 freqB = freq;
89 cmd = pre_to;
90 cmd += '\x05';
91 cmd.append( to_bcd_be( freq, 8 ) );
92 cmd.append( post );
93 if (sendCommand(cmd) != 6)
94 checkresponse();
95 }
96
get_vfoB()97 unsigned long int RIG_TT535::get_vfoB ()
98 {
99 return freqB;
100 }
101
102 // ditto on CAT PTT
103 /*
104 void RIG_TT535::set_PTT_control(int val)
105 {
106 cmd = pre_to;
107 cmd += '\x16';
108 cmd += val ? '\x01' : '\x02';
109 cmd.append( post );
110 sendICcommand(cmd,6);
111 checkresponse(6);
112 }
113 */
114
set_modeA(int md)115 void RIG_TT535::set_modeA(int md)
116 {
117 modeA = md;
118 cmd = pre_to;
119 cmd += '\x06';
120 cmd += modeA;
121 cmd.append(post);
122 if (sendCommand(cmd) != 6)
123 checkresponse();
124 }
125
126 // same with get mode
get_modeA()127 int RIG_TT535::get_modeA()
128 {
129 // cmd = pre_to;
130 // cmd += '\x04';
131 // cmd.append(post);
132 // if( sendICcommand (cmd, 8 )) {
133 // modeA = replystr[5];
134 // bwA = replystr[6];
135 // }
136 return modeA;
137 }
138
139
set_modeB(int md)140 void RIG_TT535::set_modeB(int md)
141 {
142 modeB = md;
143 cmd = pre_to;
144 cmd += '\x06';
145 cmd += modeB;
146 cmd.append(post);
147 if (sendCommand(cmd) != 6)
148 checkresponse();
149 }
150
151 // same with get mode
get_modeB()152 int RIG_TT535::get_modeB()
153 {
154 return modeB;
155 }
156
157
get_modetype(int n)158 int RIG_TT535::get_modetype(int n)
159 {
160 return RIG_TT535_mode_type[n];
161 }
162
163
164