generic, ts850: implemented CTCSS TN command (reported not working for ts850,

should now be fixed)


git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2618 7ae35d74-ebe9-4afe-98af-79ac388436b8
Hamlib-1.2.9
Alessandro Zummo, IZ1PRB 2009-02-03 23:42:53 +00:00
rodzic e1c03296a4
commit 885c4109a8
3 zmienionych plików z 27 dodań i 26 usunięć

Wyświetl plik

@ -3,7 +3,7 @@
* Copyright (c) 2000-2009 by Stephane Fillod
* Copyright (C) 2009 Alessandro Zummo <a.zummo@towertech.it>
*
* $Id: kenwood.c,v 1.110 2009-02-03 23:22:58 azummo Exp $
* $Id: kenwood.c,v 1.111 2009-02-03 23:42:53 azummo Exp $
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
@ -121,6 +121,7 @@ rmode_t kenwood_mode_table[KENWOOD_MODE_TABLE_MAX] = {
/*
* 38 CTCSS sub-audible tones
*/
/* XXX 175000 here ? */
const tone_t kenwood38_ctcss_list[] = {
670, 719, 744, 770, 797, 825, 854, 885, 915, 948,
974, 1000, 1035, 1072, 1109, 1148, 1188, 1230, 1273, 1318,
@ -1278,6 +1279,26 @@ int kenwood_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone)
return kenwood_simple_cmd(rig, tonebuf);
}
int kenwood_set_ctcss_tone_tn(RIG *rig, vfo_t vfo, tone_t tone)
{
const struct rig_caps *caps = rig->caps;
char buf[6];
int i;
/* XXX 38 is a fixed constant */
for (i = 0; caps->ctcss_list[i] != 0 && i < 38; i++) {
if (tone == caps->ctcss_list[i])
break;
}
if (tone != caps->ctcss_list[i])
return -RIG_EINVAL;
sprintf(buf, "TN%02d", i + 1);
return kenwood_simple_cmd(rig, buf);
}
/*
* kenwood_get_ctcss_tone
* Assumes rig!=NULL, rig->state.priv!=NULL

Wyświetl plik

@ -2,7 +2,7 @@
* Hamlib Kenwood backend - main header
* Copyright (c) 2000-2009 by Stephane Fillod
*
* $Id: kenwood.h,v 1.50 2009-02-03 22:45:59 azummo Exp $
* $Id: kenwood.h,v 1.51 2009-02-03 23:42:53 azummo Exp $
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
@ -93,6 +93,7 @@ int kenwood_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val);
int kenwood_set_func(RIG *rig, vfo_t vfo, setting_t func, int status);
int kenwood_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status);
int kenwood_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone);
int kenwood_set_ctcss_tone_tn(RIG *rig, vfo_t vfo, tone_t tone);
int kenwood_get_ctcss_tone(RIG *rig, vfo_t vfo, tone_t *tone);
int kenwood_set_powerstat(RIG *rig, powerstat_t status);
int kenwood_get_powerstat(RIG *rig, powerstat_t *status);

Wyświetl plik

@ -2,7 +2,7 @@
* Hamlib Kenwood backend - TS850 description
* Copyright (c) 2000-2004 by Stephane Fillod
*
* $Id: ts850.c,v 1.31 2009-02-03 23:22:58 azummo Exp $
* $Id: ts850.c,v 1.32 2009-02-03 23:42:53 azummo Exp $
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
@ -71,7 +71,6 @@ static struct kenwood_priv_caps ts850_priv_caps = {
/* forward definitions */
static int ts850_set_rit(RIG * rig, vfo_t vfo, shortfreq_t rit);
static int ts850_set_xit(RIG * rig, vfo_t vfo, shortfreq_t rit);
static int ts850_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone);
static int ts850_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val);
static int ts850_set_channel (RIG * rig, const channel_t * chan);
@ -208,8 +207,8 @@ const struct rig_caps ts850_caps = {
.set_vfo = kenwood_set_vfo,
.get_vfo = kenwood_get_vfo_if,
.set_split_vfo = kenwood_set_split_vfo,
.set_ctcss_tone = ts850_set_ctcss_tone,
.get_ctcss_tone = kenwood_get_ctcss_tone,
.set_ctcss_tone = kenwood_set_ctcss_tone_tn,
.get_ctcss_tone = kenwood_get_ctcss_tone,
.get_ptt = kenwood_get_ptt,
.set_ptt = kenwood_set_ptt,
.set_func = kenwood_set_func,
@ -305,26 +304,6 @@ static char mode_to_char(rmode_t mode)
return(RIG_MODE_NONE);
}
int ts850_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone)
{
const struct rig_caps *caps;
char tonebuf[16];
int i;
caps = rig->caps;
for (i = 0; caps->ctcss_list[i] != 0 && i<38; i++) {
if (caps->ctcss_list[i] == tone)
break;
}
if (caps->ctcss_list[i] != tone)
return -RIG_EINVAL;
sprintf(tonebuf,"TN%03d", i+1);
return kenwood_simple_cmd(rig, tonebuf);
}
int ts850_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
{
char lvlbuf[50];