~ubuntu-branches/ubuntu/wily/flrig/wily

« back to all changes in this revision

Viewing changes to .pc/0001-License-Declaration.patch/src/rigs/TS140.cxx

  • Committer: Package Import Robot
  • Author(s): Kamal Mostafa
  • Date: 2014-10-25 11:17:10 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20141025111710-n32skgya3l9u1brw
Tags: 1.3.17-1
* New upstream release (Closes: #761839)
* Debian Standards-Version: 3.9.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * TS140 drivers
3
 
 * 
4
 
 * a part of flrig
5
 
 * 
6
 
 * Copyright 2009, Dave Freese, W1HKJ
7
 
 * 
8
 
 */
9
 
 
10
 
#include "TS140.h"
11
 
 
12
 
const char TS140name_[] = "TS140";
13
 
 
14
 
const char *TS140modes_[] = {
15
 
                "LSB", "USB", "CW", "FM", "AM", "CWN", NULL};
16
 
static const char TS140_mode_type[] =
17
 
        {'L', 'U', 'U', 'U', 'U', 'U'};
18
 
 
19
 
RIG_TS140::RIG_TS140() {
20
 
// base class values    
21
 
        name_ = TS140name_;
22
 
        modes_ = TS140modes_;
23
 
        bandwidths_ = NULL;
24
 
        comm_baudrate = BR9600;
25
 
        stopbits = 2;
26
 
        comm_retries = 2;
27
 
        comm_wait = 5;
28
 
        comm_timeout = 50;
29
 
        comm_rtscts = true;
30
 
        comm_rtsplus = false;
31
 
        comm_dtrplus = false;
32
 
        comm_catptt = true;
33
 
        comm_rtsptt = false;
34
 
        comm_dtrptt = false;
35
 
        modeA = 1;
36
 
        bwA = 2;
37
 
 
38
 
        has_mode_control =
39
 
        has_ptt_control = true;
40
 
 
41
 
        has_attenuator_control =
42
 
        has_preamp_control =
43
 
        has_power_control =
44
 
        has_volume_control =
45
 
        has_bandwidth_control =
46
 
        has_micgain_control =
47
 
        has_notch_control =
48
 
        has_ifshift_control =
49
 
        has_tune_control =
50
 
        has_swr_control = false;
51
 
 
52
 
        precision = 10;
53
 
        ndigits = 7;
54
 
 
55
 
}
56
 
 
57
 
/*
58
 
========================================================================
59
 
        frequency & mode data are contained in the IF; response
60
 
                IFaaaaaaaaaaaXXXXXbbbbbcdXeefghjklmmX;
61
 
                12345678901234567890123456789012345678
62
 
                01234567890123456789012345678901234567 byte #
63
 
                where:
64
 
                        aaaaaaaaaaa => decimal value of vfo frequency
65
 
                        bbbbb => rit/xit frequency
66
 
                        c => rit off/on
67
 
                        d => xit off/on
68
 
                        e => memory channel
69
 
                        f => tx/rx
70
 
                        g => mode
71
 
                        h => function
72
 
                        j => scan off/on
73
 
                        k => split off /on
74
 
                        l => tone off /on
75
 
                        m => tone number
76
 
                        X => unused characters
77
 
                 
78
 
        Test output from Minicom to IF; command          
79
 
 
80
 
        IF00014070000      -00300        000200;
81
 
 
82
 
        0001000 is vfoA in LSB
83
 
        0002000 is vfoA in USB
84
 
        0003000 CW
85
 
        0004000 FM
86
 
        0005000 AM
87
 
        0007000 CWN     (dont have narrow filter however)
88
 
        0002100 VFOB in USB
89
 
        0002001 VFOA in USB SPILT
90
 
        0012000 PTT on in USB
91
 
========================================================================
92
 
*/ 
93
 
 
94
 
long RIG_TS140::get_vfoA ()
95
 
{
96
 
        cmd = "IF;";
97
 
        int ret = sendCommand(cmd);
98
 
        if (ret < 38) return freqA;
99
 
 
100
 
        long f = 0;
101
 
        for (size_t n = 2; n < 13; n++)
102
 
                f = f*10 + replybuff[ret - 38 + n] - '0';
103
 
        freqA = f;
104
 
        return freqA;
105
 
}
106
 
 
107
 
void RIG_TS140::set_vfoA (long freq)
108
 
{
109
 
        freqA = freq;
110
 
        cmd = "FA00000000000;";
111
 
        for (int i = 12; i > 1; i--) {
112
 
                cmd[i] += freq % 10;
113
 
                freq /= 10;
114
 
        }
115
 
        sendCommand(cmd, 0);
116
 
}
117
 
 
118
 
// Tranceiver PTT on/off
119
 
void RIG_TS140::set_PTT_control(int val)
120
 
{
121
 
        if (val) sendCommand("TX;", 0);
122
 
        else     sendCommand("RX;", 0);
123
 
}
124
 
 
125
 
int RIG_TS140::get_modetype(int n)
126
 
{
127
 
        return TS140_mode_type[n];
128
 
}
129
 
 
130
 
void RIG_TS140::set_modeA(int val)
131
 
{
132
 
        if (val == 5) val++;
133
 
        cmd = "MD0;";
134
 
        cmd[2] = '1' + (val % 10);
135
 
        sendCommand(cmd, 0);
136
 
}
137
 
 
138
 
int RIG_TS140::get_modeA()
139
 
{
140
 
        modeA = 0;
141
 
        cmd = "IF;";
142
 
        int ret = sendCommand(cmd);
143
 
        if (ret < 38) return modeA;
144
 
 
145
 
        int md = replybuff[ret - 38 + 29] - '1';
146
 
        if (md < 0) md = 0;
147
 
        if (md > 5) md = 5;
148
 
        modeA = md;
149
 
 
150
 
        return modeA;
151
 
}