2001-11-09 15:44:38 +00:00
|
|
|
/*
|
|
|
|
* Hamlib Kenwood backend - TH-F7 description
|
2009-06-01 16:51:41 +00:00
|
|
|
* Copyright (c) 2001-2009 by Stephane Fillod
|
2001-11-09 15:44:38 +00:00
|
|
|
*
|
2009-02-03 23:22:58 +00:00
|
|
|
* $Id: thf7.c,v 1.17 2009-02-03 23:22:58 azummo Exp $
|
2001-11-09 15:44:38 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Library General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2 of
|
|
|
|
* the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2003-10-01 19:32:04 +00:00
|
|
|
#include <stdlib.h>
|
2008-05-04 21:27:26 +00:00
|
|
|
#include <string.h>
|
2003-10-01 19:32:04 +00:00
|
|
|
|
2001-11-09 15:44:38 +00:00
|
|
|
#include <hamlib/rig.h>
|
2009-06-01 16:51:41 +00:00
|
|
|
#include "tones.h"
|
2001-11-09 15:44:38 +00:00
|
|
|
#include "kenwood.h"
|
|
|
|
#include "th.h"
|
|
|
|
|
2008-05-04 21:27:26 +00:00
|
|
|
#define THF7_MODES_TX (RIG_MODE_FM)
|
|
|
|
#define THF7_HIGH_MODES (RIG_MODE_FM|RIG_MODE_AM|RIG_MODE_WFM)
|
|
|
|
#define THF7_ALL_MODES (THF7_HIGH_MODES|RIG_MODE_SSB|RIG_MODE_CW)
|
2001-11-09 15:44:38 +00:00
|
|
|
|
2008-05-04 21:27:26 +00:00
|
|
|
#define THF7_FUNC_ALL (RIG_FUNC_TONE|RIG_FUNC_TSQL|RIG_FUNC_TBURST| \
|
|
|
|
RIG_FUNC_ARO|RIG_FUNC_LOCK|RIG_FUNC_BC)
|
2001-11-09 15:44:38 +00:00
|
|
|
|
|
|
|
|
2008-05-04 21:27:26 +00:00
|
|
|
/*
|
|
|
|
* How increadible, there's no RIG_LEVEL_STRENGTH!
|
|
|
|
*/
|
|
|
|
#define THF7_LEVEL_ALL (RIG_LEVEL_SQL|RIG_LEVEL_RFPOWER|RIG_LEVEL_ATT|RIG_LEVEL_BALANCE)
|
|
|
|
|
|
|
|
#define THF7_PARMS (RIG_PARM_APO|RIG_PARM_BEEP|RIG_PARM_BACKLIGHT|RIG_PARM_KEYLIGHT)
|
2003-03-24 23:08:28 +00:00
|
|
|
|
2001-11-09 15:44:38 +00:00
|
|
|
#define THF7_VFO_OP (RIG_OP_UP|RIG_OP_DOWN)
|
|
|
|
|
2008-05-04 21:27:26 +00:00
|
|
|
#define THF7_ANTS (RIG_ANT_1|RIG_ANT_2)
|
|
|
|
|
|
|
|
/*
|
|
|
|
* TODO: * scan_group can only be get. scan_group=channel_num%50;
|
|
|
|
*/
|
|
|
|
#define THF7_CHANNEL_CAPS \
|
|
|
|
TH_CHANNEL_CAPS,\
|
|
|
|
.flags=1, \
|
|
|
|
.dcs_code=1, \
|
|
|
|
.dcs_sql=1,
|
|
|
|
|
|
|
|
#define THF7_CHANNEL_CAPS_WO_LO \
|
|
|
|
TH_CHANNEL_CAPS,\
|
|
|
|
.dcs_code=1, \
|
|
|
|
.dcs_sql=1,
|
|
|
|
|
|
|
|
/* CTCSS 01..42 */
|
|
|
|
static const tone_t thf7_ctcss_list[] = {
|
|
|
|
670, 693, 719, 744, 770, 797, 825, 854, 885, 915,
|
|
|
|
948, 974, 1000, 1035, 1072, 1109, 1148, 1188, 1230, 1273,
|
|
|
|
1318, 1365, 1413, 1462, 1514, 1567, 1622, 1679, 1738, 1799,
|
|
|
|
1862, 1928, 2035, 2065, 2107, 2181, 2257, 2291, 2336, 2418,
|
|
|
|
2503, 2541,
|
|
|
|
0
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
static rmode_t thf7_mode_table[KENWOOD_MODE_TABLE_MAX] = {
|
|
|
|
[0] = RIG_MODE_FM,
|
|
|
|
[1] = RIG_MODE_WFM,
|
|
|
|
[2] = RIG_MODE_AM,
|
|
|
|
[3] = RIG_MODE_LSB,
|
|
|
|
[4] = RIG_MODE_USB,
|
|
|
|
[5] = RIG_MODE_CW
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2001-11-09 15:44:38 +00:00
|
|
|
/*
|
2008-05-04 21:27:26 +00:00
|
|
|
* Band A & B
|
2001-11-09 15:44:38 +00:00
|
|
|
*/
|
2008-05-04 21:27:26 +00:00
|
|
|
#define THF7_VFO (RIG_VFO_A|RIG_VFO_B)
|
2001-11-09 15:44:38 +00:00
|
|
|
|
2009-01-28 23:30:59 +00:00
|
|
|
static struct kenwood_priv_caps thf7_priv_caps = {
|
2002-08-16 17:43:02 +00:00
|
|
|
.cmdtrm = EOM_TH, /* Command termination character */
|
2008-05-04 21:27:26 +00:00
|
|
|
.mode_table = thf7_mode_table,
|
2002-01-07 17:43:21 +00:00
|
|
|
};
|
|
|
|
|
2008-05-04 21:27:26 +00:00
|
|
|
static int thf7e_init(RIG *rig);
|
|
|
|
static int thf7e_open(RIG *rig);
|
|
|
|
static int thf7_set_vfo (RIG *rig, vfo_t vfo);
|
|
|
|
static int thf7_get_vfo (RIG *rig, vfo_t *vfo);
|
|
|
|
|
2001-11-09 15:44:38 +00:00
|
|
|
/*
|
2008-05-04 21:27:26 +00:00
|
|
|
* TH-F7E rig capabilities.
|
2003-08-15 01:05:40 +00:00
|
|
|
*
|
2008-05-04 21:27:26 +00:00
|
|
|
* Manual: http://www.k6may.com/KenwoodTHF6Tip1.shtml
|
2001-11-09 15:44:38 +00:00
|
|
|
*/
|
|
|
|
const struct rig_caps thf7e_caps = {
|
2002-08-16 17:43:02 +00:00
|
|
|
.rig_model = RIG_MODEL_THF7E,
|
|
|
|
.model_name = "TH-F7E",
|
|
|
|
.mfg_name = "Kenwood",
|
2005-04-03 20:23:19 +00:00
|
|
|
.version = TH_VER,
|
2002-08-16 17:43:02 +00:00
|
|
|
.copyright = "LGPL",
|
2008-05-04 21:27:26 +00:00
|
|
|
.status = RIG_STATUS_BETA,
|
2002-08-16 17:43:02 +00:00
|
|
|
.rig_type = RIG_TYPE_HANDHELD,
|
|
|
|
.ptt_type = RIG_PTT_RIG,
|
|
|
|
.dcd_type = RIG_DCD_RIG,
|
|
|
|
.port_type = RIG_PORT_SERIAL,
|
|
|
|
.serial_rate_min = 9600,
|
|
|
|
.serial_rate_max = 9600,
|
|
|
|
.serial_data_bits = 8,
|
|
|
|
.serial_stop_bits = 1,
|
|
|
|
.serial_parity = RIG_PARITY_NONE,
|
|
|
|
.serial_handshake = RIG_HANDSHAKE_NONE,
|
|
|
|
.write_delay = 0,
|
|
|
|
.post_write_delay = 0,
|
2008-05-04 21:27:26 +00:00
|
|
|
.timeout = 500,
|
2002-08-16 17:43:02 +00:00
|
|
|
.retry = 3,
|
|
|
|
|
|
|
|
.has_get_func = THF7_FUNC_ALL,
|
|
|
|
.has_set_func = THF7_FUNC_ALL,
|
|
|
|
.has_get_level = THF7_LEVEL_ALL,
|
|
|
|
.has_set_level = RIG_LEVEL_SET(THF7_LEVEL_ALL),
|
2003-03-24 23:08:28 +00:00
|
|
|
.has_get_parm = THF7_PARMS,
|
2008-05-04 21:27:26 +00:00
|
|
|
.has_set_parm = THF7_PARMS,
|
2004-03-21 18:25:54 +00:00
|
|
|
.level_gran = {
|
|
|
|
[LVL_SQL] = { .min = { .i = 0 }, .max = { .i = 5 } },
|
|
|
|
[LVL_RFPOWER] = { .min = { .i = 3 }, .max = { .i = 0 } },
|
|
|
|
},
|
2002-08-16 17:43:02 +00:00
|
|
|
.parm_gran = {},
|
2008-05-04 21:27:26 +00:00
|
|
|
.ctcss_list = thf7_ctcss_list,
|
2009-06-01 16:51:41 +00:00
|
|
|
.dcs_list = common_dcs_list,
|
2002-08-16 17:43:02 +00:00
|
|
|
.preamp = { RIG_DBLST_END, },
|
|
|
|
.attenuator = { 20, RIG_DBLST_END, },
|
|
|
|
.max_rit = Hz(0),
|
|
|
|
.max_xit = Hz(0),
|
|
|
|
.max_ifshift = Hz(0),
|
|
|
|
.vfo_ops = THF7_VFO_OP,
|
|
|
|
.targetable_vfo = RIG_TARGETABLE_FREQ,
|
2008-05-04 21:27:26 +00:00
|
|
|
.transceive = RIG_TRN_RIG, /* TBC */
|
2002-08-16 17:43:02 +00:00
|
|
|
.bank_qty = 0,
|
2008-05-04 21:27:26 +00:00
|
|
|
.chan_desc_sz = 8,
|
2002-08-16 17:43:02 +00:00
|
|
|
|
|
|
|
|
2008-05-04 21:27:26 +00:00
|
|
|
.chan_list = {
|
|
|
|
{ 0, 399, RIG_MTYPE_MEM , {THF7_CHANNEL_CAPS}}, /* normal MEM */
|
|
|
|
{ 400,409, RIG_MTYPE_EDGE, {THF7_CHANNEL_CAPS}}, /* L0-L9 lower scan limit */
|
|
|
|
{ 410,419, RIG_MTYPE_EDGE, {THF7_CHANNEL_CAPS}}, /* U0-U9 upper scan limit */
|
|
|
|
{ 420,429, RIG_MTYPE_MEM, {THF7_CHANNEL_CAPS}}, /* I0-I9 info */
|
|
|
|
{ 430,431, RIG_MTYPE_PRIO, {THF7_CHANNEL_CAPS}}, /* PR0,PR1 priority */
|
|
|
|
{ 432,434, RIG_MTYPE_CALL, {THF7_CHANNEL_CAPS_WO_LO}}, /* Call (for each ham band) */
|
|
|
|
{ 435,449, RIG_MTYPE_BAND, {THF7_CHANNEL_CAPS_WO_LO}}, /* VFO */
|
|
|
|
/* 3 A-band VFO */
|
|
|
|
/* 11 B-band VFO */
|
|
|
|
/* TODO: 10 DTMF */
|
2001-11-09 15:44:38 +00:00
|
|
|
RIG_CHAN_END,
|
2008-05-04 21:27:26 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
.rx_range_list1 = {
|
|
|
|
/* RIG_ANT_2 is internal bar antenna */
|
|
|
|
{MHz(144),MHz(146),THF7_MODES_TX,-1,-1,RIG_VFO_A,RIG_ANT_1},
|
|
|
|
{kHz(430),MHz(440),THF7_MODES_TX,-1,-1,RIG_VFO_A,RIG_ANT_1},
|
|
|
|
{kHz(100),MHz(470),THF7_ALL_MODES,-1,-1,RIG_VFO_B, RIG_ANT_1|RIG_ANT_2},
|
|
|
|
{MHz(470),GHz(1.3),THF7_HIGH_MODES,-1,-1,RIG_VFO_B,RIG_ANT_1},
|
|
|
|
RIG_FRNG_END
|
|
|
|
},
|
|
|
|
.tx_range_list1 = {
|
|
|
|
/* power actually depends on DC power supply */
|
|
|
|
{MHz(144),MHz(146),THF7_MODES_TX,W(0.05),W(5),RIG_VFO_A,RIG_ANT_1},
|
|
|
|
{MHz(430),MHz(440),THF7_MODES_TX,W(0.05),W(5),RIG_VFO_A,RIG_ANT_1},
|
|
|
|
RIG_FRNG_END
|
|
|
|
},
|
|
|
|
|
|
|
|
/* region 2 is TH-F6A */
|
|
|
|
.rx_range_list2 = { RIG_FRNG_END, },
|
2002-08-16 17:43:02 +00:00
|
|
|
.tx_range_list2 = { RIG_FRNG_END, },
|
2008-05-04 21:27:26 +00:00
|
|
|
|
2002-08-16 17:43:02 +00:00
|
|
|
.tuning_steps = {
|
2008-05-04 21:27:26 +00:00
|
|
|
/* This table is ordered according to protocol, from '0' to 'b' */
|
|
|
|
/* The steps are not available on every band/frequency limit 470MHz */
|
|
|
|
{THF7_ALL_MODES,kHz(5)},
|
|
|
|
{THF7_ALL_MODES,kHz(6.25)},
|
|
|
|
{THF7_ALL_MODES,kHz(8.33)},
|
|
|
|
{THF7_ALL_MODES,kHz(9)},
|
|
|
|
{THF7_ALL_MODES,kHz(10)},
|
|
|
|
{THF7_ALL_MODES,kHz(12.5)},
|
|
|
|
{THF7_ALL_MODES,kHz(15)},
|
|
|
|
{THF7_ALL_MODES,kHz(20)},
|
|
|
|
{THF7_ALL_MODES,kHz(25)},
|
|
|
|
{THF7_ALL_MODES,kHz(30)},
|
|
|
|
{THF7_ALL_MODES,kHz(50)},
|
|
|
|
{THF7_ALL_MODES,kHz(100)},
|
2001-11-09 15:44:38 +00:00
|
|
|
RIG_TS_END,
|
|
|
|
},
|
2008-05-04 21:27:26 +00:00
|
|
|
|
2001-11-09 15:44:38 +00:00
|
|
|
/* mode/filter list, remember: order matters! */
|
2002-08-16 17:43:02 +00:00
|
|
|
.filters = {
|
2008-05-04 21:27:26 +00:00
|
|
|
/* real width to be checked (missing specs) */
|
|
|
|
{RIG_MODE_FM, kHz(12)},
|
|
|
|
{RIG_MODE_FM, kHz(6)}, /* narrow FM */
|
|
|
|
{RIG_MODE_AM, kHz(9)},
|
|
|
|
{RIG_MODE_WFM, kHz(150)}, /* or 230? */
|
|
|
|
{RIG_MODE_SSB|RIG_MODE_CW, kHz(3)},
|
2001-11-09 15:44:38 +00:00
|
|
|
RIG_FLT_END,
|
|
|
|
},
|
2002-08-16 17:43:02 +00:00
|
|
|
.priv = (void *)&thf7_priv_caps,
|
|
|
|
|
2008-05-04 21:27:26 +00:00
|
|
|
.rig_init = thf7e_init,
|
Several Kenwood patches from Alessandro Zummo, azummo-lists@towertech.it
Among the changes:
I finally had the time to build the CAT interface for my TS450 and
discovered a couple of new commands.
MX; MX0; MX1; is used to activate the AIP function
FL; FLXXXYYY; is used to set the filters.
I made a perl script to try every possible two-letters command. If
amyone is interested, at their own risk, just ask.
I've then modified and optimized the kenwood driver:
- moved MD_ defined to .h
- added init/cleanup
- ts450_get_mode -> kenwood_get_mode_if
- support reading memory channel freq within kenwood_get_freq
- added kenwood_safe_transaction as an helper with result len check
- added kenwood_get_if
- added get_level for RIG_LEVEL_CWPITCH
- set/get for RIG_FUNC_AIP
- replaced ts140/680 get_mode and get_freq
- removed the delay on the ts450. it works just fine without it.
=============================
the attached patch requires the first one I sent and
addresses a few remaining issues
- converted 8 spaces to tabs
- added kenwood_mode_table
- added kenwood_simple_transaction helper func
- use kenwood2rmode and rmode2kenwood where possible
- some code cleanup
- use kenwood_safe/simple_transaction where possible
- added kenwood_get_mem_if (ts140,ts450,ts680,ts690,ts850)
- added kenwood_get_channel (ts450,ts850)
- added FUNC_FINE_STEP (commented out, we have no more func slots)
- added LEVEL_CWPITCH (set)
- no reason to have ts850_set_func, ts850_set_level
- ... ts480_get/set_ant, ts480_set_func
- ... ts570_set/get_ant, ts570_get_channel, ts570_get_rit
- ... ts680_set_func
- ... ts790_get_mode, ts790_get_vfo
this patch is a bit more extensive and tested only on the TS450.
feedback will be appreciated.
where I removed code I took care to verify that the generic
code in kenwood.c worked in the same way.
git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2591 7ae35d74-ebe9-4afe-98af-79ac388436b8
2009-01-23 03:24:42 +00:00
|
|
|
.rig_cleanup = kenwood_cleanup,
|
2008-05-04 21:27:26 +00:00
|
|
|
.rig_open = thf7e_open,
|
|
|
|
|
2002-08-16 17:43:02 +00:00
|
|
|
.set_freq = th_set_freq,
|
|
|
|
.get_freq = th_get_freq,
|
|
|
|
.set_mode = th_set_mode,
|
|
|
|
.get_mode = th_get_mode,
|
2008-05-04 21:27:26 +00:00
|
|
|
.set_vfo = thf7_set_vfo,
|
|
|
|
.get_vfo = thf7_get_vfo,
|
2002-08-16 17:43:02 +00:00
|
|
|
.set_ctcss_tone = th_set_ctcss_tone,
|
|
|
|
.get_ctcss_tone = th_get_ctcss_tone,
|
|
|
|
.set_ptt = kenwood_set_ptt,
|
|
|
|
.get_dcd = kenwood_get_dcd,
|
|
|
|
.vfo_op = kenwood_vfo_op,
|
|
|
|
.set_mem = th_set_mem,
|
|
|
|
.get_mem = th_get_mem,
|
|
|
|
|
2008-05-04 21:27:26 +00:00
|
|
|
.set_trn = th_set_trn, /* TBC */
|
|
|
|
.get_trn = th_get_trn, /* TBC */
|
|
|
|
.decode_event = th_decode_event, /* TBC */
|
|
|
|
|
|
|
|
.set_func = th_set_func,
|
2002-08-16 17:43:02 +00:00
|
|
|
.get_func = th_get_func,
|
2008-05-04 21:27:26 +00:00
|
|
|
.set_level = th_set_level,
|
2002-08-16 17:43:02 +00:00
|
|
|
.get_level = th_get_level,
|
2003-03-24 23:08:28 +00:00
|
|
|
.get_parm = th_get_parm,
|
2002-08-16 17:43:02 +00:00
|
|
|
.get_info = th_get_info,
|
|
|
|
|
2008-05-04 21:27:26 +00:00
|
|
|
|
|
|
|
.set_channel = th_set_channel,
|
|
|
|
.get_channel = th_get_channel,
|
|
|
|
.set_ant = th_set_ant,
|
|
|
|
.get_ant = th_get_ant,
|
2001-11-09 15:44:38 +00:00
|
|
|
};
|
|
|
|
|
2008-05-04 21:27:26 +00:00
|
|
|
#define ACKBUF_LEN 64
|
|
|
|
|
|
|
|
int thf7e_init(RIG *rig)
|
|
|
|
{
|
|
|
|
rig->state.itu_region = RIG_ITU_REGION1;
|
Several Kenwood patches from Alessandro Zummo, azummo-lists@towertech.it
Among the changes:
I finally had the time to build the CAT interface for my TS450 and
discovered a couple of new commands.
MX; MX0; MX1; is used to activate the AIP function
FL; FLXXXYYY; is used to set the filters.
I made a perl script to try every possible two-letters command. If
amyone is interested, at their own risk, just ask.
I've then modified and optimized the kenwood driver:
- moved MD_ defined to .h
- added init/cleanup
- ts450_get_mode -> kenwood_get_mode_if
- support reading memory channel freq within kenwood_get_freq
- added kenwood_safe_transaction as an helper with result len check
- added kenwood_get_if
- added get_level for RIG_LEVEL_CWPITCH
- set/get for RIG_FUNC_AIP
- replaced ts140/680 get_mode and get_freq
- removed the delay on the ts450. it works just fine without it.
=============================
the attached patch requires the first one I sent and
addresses a few remaining issues
- converted 8 spaces to tabs
- added kenwood_mode_table
- added kenwood_simple_transaction helper func
- use kenwood2rmode and rmode2kenwood where possible
- some code cleanup
- use kenwood_safe/simple_transaction where possible
- added kenwood_get_mem_if (ts140,ts450,ts680,ts690,ts850)
- added kenwood_get_channel (ts450,ts850)
- added FUNC_FINE_STEP (commented out, we have no more func slots)
- added LEVEL_CWPITCH (set)
- no reason to have ts850_set_func, ts850_set_level
- ... ts480_get/set_ant, ts480_set_func
- ... ts570_set/get_ant, ts570_get_channel, ts570_get_rit
- ... ts680_set_func
- ... ts790_get_mode, ts790_get_vfo
this patch is a bit more extensive and tested only on the TS450.
feedback will be appreciated.
where I removed code I took care to verify that the generic
code in kenwood.c worked in the same way.
git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2591 7ae35d74-ebe9-4afe-98af-79ac388436b8
2009-01-23 03:24:42 +00:00
|
|
|
return kenwood_init(rig);
|
2008-05-04 21:27:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int thf7e_open(RIG *rig)
|
|
|
|
{
|
|
|
|
/* TH-F7E is Region 1 only.
|
|
|
|
* Region 2 is supported by TH-F6A
|
|
|
|
*/
|
|
|
|
if (rig->state.itu_region != RIG_ITU_REGION1)
|
|
|
|
return -RIG_ECONF;
|
|
|
|
return RIG_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
thf7_set_vfo (RIG *rig, vfo_t vfo)
|
|
|
|
{
|
|
|
|
char vfobuf[16], ackbuf[ACKBUF_LEN];
|
|
|
|
int retval;
|
|
|
|
size_t ack_len;
|
|
|
|
|
2009-02-03 23:22:58 +00:00
|
|
|
rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__);
|
2008-05-04 21:27:26 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* The band must be active before selecting VFO or MEM.
|
|
|
|
* The dilemma is whether MEM should be applied to Band A or Band B.
|
|
|
|
* Remember, not all bands have the same capability
|
|
|
|
* TODO: if (RIG_VFO_MEM) query current band with BC, then do appropriate VMC
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (vfo != RIG_VFO_MEM) {
|
|
|
|
switch (vfo) {
|
|
|
|
case RIG_VFO_A:
|
|
|
|
case RIG_VFO_VFO:
|
|
|
|
case RIG_VFO_MAIN:
|
Several Kenwood patches from Alessandro Zummo, azummo-lists@towertech.it
Among the changes:
I finally had the time to build the CAT interface for my TS450 and
discovered a couple of new commands.
MX; MX0; MX1; is used to activate the AIP function
FL; FLXXXYYY; is used to set the filters.
I made a perl script to try every possible two-letters command. If
amyone is interested, at their own risk, just ask.
I've then modified and optimized the kenwood driver:
- moved MD_ defined to .h
- added init/cleanup
- ts450_get_mode -> kenwood_get_mode_if
- support reading memory channel freq within kenwood_get_freq
- added kenwood_safe_transaction as an helper with result len check
- added kenwood_get_if
- added get_level for RIG_LEVEL_CWPITCH
- set/get for RIG_FUNC_AIP
- replaced ts140/680 get_mode and get_freq
- removed the delay on the ts450. it works just fine without it.
=============================
the attached patch requires the first one I sent and
addresses a few remaining issues
- converted 8 spaces to tabs
- added kenwood_mode_table
- added kenwood_simple_transaction helper func
- use kenwood2rmode and rmode2kenwood where possible
- some code cleanup
- use kenwood_safe/simple_transaction where possible
- added kenwood_get_mem_if (ts140,ts450,ts680,ts690,ts850)
- added kenwood_get_channel (ts450,ts850)
- added FUNC_FINE_STEP (commented out, we have no more func slots)
- added LEVEL_CWPITCH (set)
- no reason to have ts850_set_func, ts850_set_level
- ... ts480_get/set_ant, ts480_set_func
- ... ts570_set/get_ant, ts570_get_channel, ts570_get_rit
- ... ts680_set_func
- ... ts790_get_mode, ts790_get_vfo
this patch is a bit more extensive and tested only on the TS450.
feedback will be appreciated.
where I removed code I took care to verify that the generic
code in kenwood.c worked in the same way.
git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2591 7ae35d74-ebe9-4afe-98af-79ac388436b8
2009-01-23 03:24:42 +00:00
|
|
|
sprintf(vfobuf, "BC 0%c", EOM_TH);
|
2008-05-04 21:27:26 +00:00
|
|
|
break;
|
|
|
|
case RIG_VFO_B:
|
|
|
|
case RIG_VFO_SUB:
|
Several Kenwood patches from Alessandro Zummo, azummo-lists@towertech.it
Among the changes:
I finally had the time to build the CAT interface for my TS450 and
discovered a couple of new commands.
MX; MX0; MX1; is used to activate the AIP function
FL; FLXXXYYY; is used to set the filters.
I made a perl script to try every possible two-letters command. If
amyone is interested, at their own risk, just ask.
I've then modified and optimized the kenwood driver:
- moved MD_ defined to .h
- added init/cleanup
- ts450_get_mode -> kenwood_get_mode_if
- support reading memory channel freq within kenwood_get_freq
- added kenwood_safe_transaction as an helper with result len check
- added kenwood_get_if
- added get_level for RIG_LEVEL_CWPITCH
- set/get for RIG_FUNC_AIP
- replaced ts140/680 get_mode and get_freq
- removed the delay on the ts450. it works just fine without it.
=============================
the attached patch requires the first one I sent and
addresses a few remaining issues
- converted 8 spaces to tabs
- added kenwood_mode_table
- added kenwood_simple_transaction helper func
- use kenwood2rmode and rmode2kenwood where possible
- some code cleanup
- use kenwood_safe/simple_transaction where possible
- added kenwood_get_mem_if (ts140,ts450,ts680,ts690,ts850)
- added kenwood_get_channel (ts450,ts850)
- added FUNC_FINE_STEP (commented out, we have no more func slots)
- added LEVEL_CWPITCH (set)
- no reason to have ts850_set_func, ts850_set_level
- ... ts480_get/set_ant, ts480_set_func
- ... ts570_set/get_ant, ts570_get_channel, ts570_get_rit
- ... ts680_set_func
- ... ts790_get_mode, ts790_get_vfo
this patch is a bit more extensive and tested only on the TS450.
feedback will be appreciated.
where I removed code I took care to verify that the generic
code in kenwood.c worked in the same way.
git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2591 7ae35d74-ebe9-4afe-98af-79ac388436b8
2009-01-23 03:24:42 +00:00
|
|
|
sprintf(vfobuf, "BC 1%c", EOM_TH);
|
2008-05-04 21:27:26 +00:00
|
|
|
break;
|
|
|
|
default:
|
2009-02-03 23:22:58 +00:00
|
|
|
rig_debug(RIG_DEBUG_ERR, "%s: Unsupported BC VFO %d\n", __func__, vfo);
|
2008-05-04 21:27:26 +00:00
|
|
|
return -RIG_EVFO;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* wait for response, otherwise next issued command may fail */
|
|
|
|
ack_len = ACKBUF_LEN-1;
|
|
|
|
retval = kenwood_transaction(rig, vfobuf, strlen(vfobuf), ackbuf, &ack_len);
|
|
|
|
if (retval != RIG_OK)
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (vfo) {
|
|
|
|
case RIG_VFO_VFO:
|
|
|
|
case RIG_VFO_MAIN:
|
|
|
|
case RIG_VFO_A:
|
Several Kenwood patches from Alessandro Zummo, azummo-lists@towertech.it
Among the changes:
I finally had the time to build the CAT interface for my TS450 and
discovered a couple of new commands.
MX; MX0; MX1; is used to activate the AIP function
FL; FLXXXYYY; is used to set the filters.
I made a perl script to try every possible two-letters command. If
amyone is interested, at their own risk, just ask.
I've then modified and optimized the kenwood driver:
- moved MD_ defined to .h
- added init/cleanup
- ts450_get_mode -> kenwood_get_mode_if
- support reading memory channel freq within kenwood_get_freq
- added kenwood_safe_transaction as an helper with result len check
- added kenwood_get_if
- added get_level for RIG_LEVEL_CWPITCH
- set/get for RIG_FUNC_AIP
- replaced ts140/680 get_mode and get_freq
- removed the delay on the ts450. it works just fine without it.
=============================
the attached patch requires the first one I sent and
addresses a few remaining issues
- converted 8 spaces to tabs
- added kenwood_mode_table
- added kenwood_simple_transaction helper func
- use kenwood2rmode and rmode2kenwood where possible
- some code cleanup
- use kenwood_safe/simple_transaction where possible
- added kenwood_get_mem_if (ts140,ts450,ts680,ts690,ts850)
- added kenwood_get_channel (ts450,ts850)
- added FUNC_FINE_STEP (commented out, we have no more func slots)
- added LEVEL_CWPITCH (set)
- no reason to have ts850_set_func, ts850_set_level
- ... ts480_get/set_ant, ts480_set_func
- ... ts570_set/get_ant, ts570_get_channel, ts570_get_rit
- ... ts680_set_func
- ... ts790_get_mode, ts790_get_vfo
this patch is a bit more extensive and tested only on the TS450.
feedback will be appreciated.
where I removed code I took care to verify that the generic
code in kenwood.c worked in the same way.
git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2591 7ae35d74-ebe9-4afe-98af-79ac388436b8
2009-01-23 03:24:42 +00:00
|
|
|
sprintf(vfobuf, "VMC 0,0%c", EOM_TH);
|
2008-05-04 21:27:26 +00:00
|
|
|
break;
|
|
|
|
case RIG_VFO_SUB:
|
|
|
|
case RIG_VFO_B:
|
Several Kenwood patches from Alessandro Zummo, azummo-lists@towertech.it
Among the changes:
I finally had the time to build the CAT interface for my TS450 and
discovered a couple of new commands.
MX; MX0; MX1; is used to activate the AIP function
FL; FLXXXYYY; is used to set the filters.
I made a perl script to try every possible two-letters command. If
amyone is interested, at their own risk, just ask.
I've then modified and optimized the kenwood driver:
- moved MD_ defined to .h
- added init/cleanup
- ts450_get_mode -> kenwood_get_mode_if
- support reading memory channel freq within kenwood_get_freq
- added kenwood_safe_transaction as an helper with result len check
- added kenwood_get_if
- added get_level for RIG_LEVEL_CWPITCH
- set/get for RIG_FUNC_AIP
- replaced ts140/680 get_mode and get_freq
- removed the delay on the ts450. it works just fine without it.
=============================
the attached patch requires the first one I sent and
addresses a few remaining issues
- converted 8 spaces to tabs
- added kenwood_mode_table
- added kenwood_simple_transaction helper func
- use kenwood2rmode and rmode2kenwood where possible
- some code cleanup
- use kenwood_safe/simple_transaction where possible
- added kenwood_get_mem_if (ts140,ts450,ts680,ts690,ts850)
- added kenwood_get_channel (ts450,ts850)
- added FUNC_FINE_STEP (commented out, we have no more func slots)
- added LEVEL_CWPITCH (set)
- no reason to have ts850_set_func, ts850_set_level
- ... ts480_get/set_ant, ts480_set_func
- ... ts570_set/get_ant, ts570_get_channel, ts570_get_rit
- ... ts680_set_func
- ... ts790_get_mode, ts790_get_vfo
this patch is a bit more extensive and tested only on the TS450.
feedback will be appreciated.
where I removed code I took care to verify that the generic
code in kenwood.c worked in the same way.
git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2591 7ae35d74-ebe9-4afe-98af-79ac388436b8
2009-01-23 03:24:42 +00:00
|
|
|
sprintf(vfobuf, "VMC 1,0%c", EOM_TH);
|
2008-05-04 21:27:26 +00:00
|
|
|
break;
|
|
|
|
case RIG_VFO_MEM:
|
Several Kenwood patches from Alessandro Zummo, azummo-lists@towertech.it
Among the changes:
I finally had the time to build the CAT interface for my TS450 and
discovered a couple of new commands.
MX; MX0; MX1; is used to activate the AIP function
FL; FLXXXYYY; is used to set the filters.
I made a perl script to try every possible two-letters command. If
amyone is interested, at their own risk, just ask.
I've then modified and optimized the kenwood driver:
- moved MD_ defined to .h
- added init/cleanup
- ts450_get_mode -> kenwood_get_mode_if
- support reading memory channel freq within kenwood_get_freq
- added kenwood_safe_transaction as an helper with result len check
- added kenwood_get_if
- added get_level for RIG_LEVEL_CWPITCH
- set/get for RIG_FUNC_AIP
- replaced ts140/680 get_mode and get_freq
- removed the delay on the ts450. it works just fine without it.
=============================
the attached patch requires the first one I sent and
addresses a few remaining issues
- converted 8 spaces to tabs
- added kenwood_mode_table
- added kenwood_simple_transaction helper func
- use kenwood2rmode and rmode2kenwood where possible
- some code cleanup
- use kenwood_safe/simple_transaction where possible
- added kenwood_get_mem_if (ts140,ts450,ts680,ts690,ts850)
- added kenwood_get_channel (ts450,ts850)
- added FUNC_FINE_STEP (commented out, we have no more func slots)
- added LEVEL_CWPITCH (set)
- no reason to have ts850_set_func, ts850_set_level
- ... ts480_get/set_ant, ts480_set_func
- ... ts570_set/get_ant, ts570_get_channel, ts570_get_rit
- ... ts680_set_func
- ... ts790_get_mode, ts790_get_vfo
this patch is a bit more extensive and tested only on the TS450.
feedback will be appreciated.
where I removed code I took care to verify that the generic
code in kenwood.c worked in the same way.
git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2591 7ae35d74-ebe9-4afe-98af-79ac388436b8
2009-01-23 03:24:42 +00:00
|
|
|
sprintf(vfobuf, "VMC 0,1%c", EOM_TH);
|
2008-05-04 21:27:26 +00:00
|
|
|
break;
|
|
|
|
default:
|
2009-02-03 23:22:58 +00:00
|
|
|
rig_debug(RIG_DEBUG_ERR, "%s: Unsupported VFO %d\n", __func__, vfo);
|
2008-05-04 21:27:26 +00:00
|
|
|
return -RIG_EVFO;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* wait for response, otherwise next issued command may fail */
|
|
|
|
ack_len = ACKBUF_LEN-1;
|
|
|
|
retval = kenwood_transaction(rig, vfobuf, strlen(vfobuf), ackbuf, &ack_len);
|
|
|
|
if (retval != RIG_OK)
|
|
|
|
return retval;
|
|
|
|
|
|
|
|
return RIG_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
thf7_get_vfo (RIG *rig, vfo_t *vfo)
|
|
|
|
{
|
|
|
|
char cmdbuf[16], ackbuf[ACKBUF_LEN],vfoc;
|
|
|
|
int retval;
|
|
|
|
size_t ack_len;
|
|
|
|
|
2009-02-03 23:22:58 +00:00
|
|
|
rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__);
|
2008-05-04 21:27:26 +00:00
|
|
|
|
|
|
|
ack_len=ACKBUF_LEN;
|
Several Kenwood patches from Alessandro Zummo, azummo-lists@towertech.it
Among the changes:
I finally had the time to build the CAT interface for my TS450 and
discovered a couple of new commands.
MX; MX0; MX1; is used to activate the AIP function
FL; FLXXXYYY; is used to set the filters.
I made a perl script to try every possible two-letters command. If
amyone is interested, at their own risk, just ask.
I've then modified and optimized the kenwood driver:
- moved MD_ defined to .h
- added init/cleanup
- ts450_get_mode -> kenwood_get_mode_if
- support reading memory channel freq within kenwood_get_freq
- added kenwood_safe_transaction as an helper with result len check
- added kenwood_get_if
- added get_level for RIG_LEVEL_CWPITCH
- set/get for RIG_FUNC_AIP
- replaced ts140/680 get_mode and get_freq
- removed the delay on the ts450. it works just fine without it.
=============================
the attached patch requires the first one I sent and
addresses a few remaining issues
- converted 8 spaces to tabs
- added kenwood_mode_table
- added kenwood_simple_transaction helper func
- use kenwood2rmode and rmode2kenwood where possible
- some code cleanup
- use kenwood_safe/simple_transaction where possible
- added kenwood_get_mem_if (ts140,ts450,ts680,ts690,ts850)
- added kenwood_get_channel (ts450,ts850)
- added FUNC_FINE_STEP (commented out, we have no more func slots)
- added LEVEL_CWPITCH (set)
- no reason to have ts850_set_func, ts850_set_level
- ... ts480_get/set_ant, ts480_set_func
- ... ts570_set/get_ant, ts570_get_channel, ts570_get_rit
- ... ts680_set_func
- ... ts790_get_mode, ts790_get_vfo
this patch is a bit more extensive and tested only on the TS450.
feedback will be appreciated.
where I removed code I took care to verify that the generic
code in kenwood.c worked in the same way.
git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2591 7ae35d74-ebe9-4afe-98af-79ac388436b8
2009-01-23 03:24:42 +00:00
|
|
|
/* XXX */
|
|
|
|
retval = kenwood_transaction (rig, "BC\r", 3, ackbuf, &ack_len);
|
2008-05-04 21:27:26 +00:00
|
|
|
if (retval != RIG_OK)
|
|
|
|
return retval;
|
|
|
|
|
|
|
|
if (ack_len < 4 ) {
|
2009-02-03 23:22:58 +00:00
|
|
|
rig_debug(RIG_DEBUG_ERR, "%s: Unexpected reply '%s'\n", __func__, ackbuf);
|
2008-05-04 21:27:26 +00:00
|
|
|
return -RIG_ERJCTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
vfoc=ackbuf[3];
|
|
|
|
switch (vfoc) {
|
|
|
|
case '0': *vfo = RIG_VFO_A; break;
|
|
|
|
case '1': *vfo = RIG_VFO_B; break;
|
|
|
|
default:
|
2009-02-03 23:22:58 +00:00
|
|
|
rig_debug(RIG_DEBUG_ERR, "%s: Unexpected VFO value '%c'\n", __func__, ackbuf[3]);
|
2008-05-04 21:27:26 +00:00
|
|
|
return -RIG_EVFO;
|
|
|
|
}
|
|
|
|
|
Several Kenwood patches from Alessandro Zummo, azummo-lists@towertech.it
Among the changes:
I finally had the time to build the CAT interface for my TS450 and
discovered a couple of new commands.
MX; MX0; MX1; is used to activate the AIP function
FL; FLXXXYYY; is used to set the filters.
I made a perl script to try every possible two-letters command. If
amyone is interested, at their own risk, just ask.
I've then modified and optimized the kenwood driver:
- moved MD_ defined to .h
- added init/cleanup
- ts450_get_mode -> kenwood_get_mode_if
- support reading memory channel freq within kenwood_get_freq
- added kenwood_safe_transaction as an helper with result len check
- added kenwood_get_if
- added get_level for RIG_LEVEL_CWPITCH
- set/get for RIG_FUNC_AIP
- replaced ts140/680 get_mode and get_freq
- removed the delay on the ts450. it works just fine without it.
=============================
the attached patch requires the first one I sent and
addresses a few remaining issues
- converted 8 spaces to tabs
- added kenwood_mode_table
- added kenwood_simple_transaction helper func
- use kenwood2rmode and rmode2kenwood where possible
- some code cleanup
- use kenwood_safe/simple_transaction where possible
- added kenwood_get_mem_if (ts140,ts450,ts680,ts690,ts850)
- added kenwood_get_channel (ts450,ts850)
- added FUNC_FINE_STEP (commented out, we have no more func slots)
- added LEVEL_CWPITCH (set)
- no reason to have ts850_set_func, ts850_set_level
- ... ts480_get/set_ant, ts480_set_func
- ... ts570_set/get_ant, ts570_get_channel, ts570_get_rit
- ... ts680_set_func
- ... ts790_get_mode, ts790_get_vfo
this patch is a bit more extensive and tested only on the TS450.
feedback will be appreciated.
where I removed code I took care to verify that the generic
code in kenwood.c worked in the same way.
git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2591 7ae35d74-ebe9-4afe-98af-79ac388436b8
2009-01-23 03:24:42 +00:00
|
|
|
sprintf(cmdbuf,"VMC %c%c",vfoc, EOM_TH);
|
2008-05-04 21:27:26 +00:00
|
|
|
ack_len=ACKBUF_LEN;
|
|
|
|
retval = kenwood_transaction (rig, cmdbuf, strlen(cmdbuf), ackbuf, &ack_len);
|
|
|
|
if (retval != RIG_OK)
|
|
|
|
return retval;
|
|
|
|
|
|
|
|
if (ack_len < 8 ) {
|
2009-02-03 23:22:58 +00:00
|
|
|
rig_debug(RIG_DEBUG_ERR, "%s: Unexpected reply '%s'\n", __func__, ackbuf);
|
2008-05-04 21:27:26 +00:00
|
|
|
return -RIG_ERJCTED;
|
|
|
|
}
|
|
|
|
switch(ackbuf[6]) {
|
|
|
|
case '0' :
|
|
|
|
case '3' : /* Fine Step Enable */
|
|
|
|
break;
|
|
|
|
case '1' : /* MR */
|
|
|
|
case '2' : /* CALL */
|
|
|
|
case '4' : /* INFO */
|
|
|
|
*vfo = RIG_VFO_MEM;
|
|
|
|
break;
|
|
|
|
default:
|
2009-02-03 23:22:58 +00:00
|
|
|
rig_debug(RIG_DEBUG_ERR, "%s: Unexpected VFO value '%c'\n", __func__, ackbuf[6]);
|
2008-05-04 21:27:26 +00:00
|
|
|
return -RIG_EVFO;
|
|
|
|
}
|
|
|
|
|
|
|
|
return RIG_OK;
|
|
|
|
}
|
|
|
|
|