Bug fixes and slope tuning support for the TS-850.

Thanks to Rob Frohne, KL7NA


git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2205 7ae35d74-ebe9-4afe-98af-79ac388436b8
Hamlib-1.2.7
Nate Bargmann, N0NB 2007-08-18 12:55:46 +00:00
rodzic 21857f4164
commit e904578f5a
5 zmienionych plików z 698 dodań i 609 usunięć

Wyświetl plik

@ -2,7 +2,7 @@
* Hamlib Interface - API header
* Copyright (c) 2000-2005 by Stephane Fillod and Frank Singleton
*
* $Id: rig.h,v 1.121 2007-02-28 08:52:49 mardigras Exp $
* $Id: rig.h,v 1.122 2007-08-18 12:55:46 n0nb 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
@ -605,6 +605,8 @@ enum rig_level_e {
RIG_LEVEL_VOXGAIN = (1<<21),/*!< VOX gain level, arg float [0.0 .. 1.0] */
RIG_LEVEL_VOXDELAY = RIG_LEVEL_VOX, /*!< VOX delay, arg int (tenth of seconds) */
RIG_LEVEL_ANTIVOX = (1<<22),/*!< anti-VOX level, arg float [0.0 .. 1.0] */
RIG_LEVEL_SLOPE_LOW = (1<<23),/*!<Slope tune, low frequency cut, */
RIG_LEVEL_SLOPE_HIGH = (1<<24),/*!<Slope tune, high frequency cut, */
//RIG_LEVEL_LINEOUT = (1<<23),/*!< Lineout Volume, arg float [0.0 .. 1.0] */
/*!< These ones are not settable */
@ -612,7 +614,7 @@ enum rig_level_e {
RIG_LEVEL_SQLSTAT = (1<<27),/*!< SQL status, arg int (open=1/closed=0). Deprecated, use get_dcd instead */
RIG_LEVEL_SWR = (1<<28),/*!< SWR, arg float [0.0..infinite] */
RIG_LEVEL_ALC = (1<<29),/*!< ALC, arg float */
RIG_LEVEL_STRENGTH = (1<<30) /*!< Effective (calibrated) signal strength relative to S9, arg int (dB) */
RIG_LEVEL_STRENGTH =(1<<30) /*!< Effective (calibrated) signal strength relative to S9, arg int (dB) */
/*RIG_LEVEL_BWC = (1<<31)*/ /*!< Bandwidth Control, arg int (Hz) */
};
@ -733,8 +735,8 @@ typedef enum {
RIG_MODE_FAX = (1<<15),/*!< Facsimile Mode */
RIG_MODE_SAM = (1<<16),/*!< Synchronous AM double sideband */
RIG_MODE_SAL = (1<<17),/*!< Synchronous AM lower sideband */
RIG_MODE_SAH = (1<<18) /*!< Synchronous AM upper (higher) sideband */
RIG_MODE_SAH = (1<<18), /*!< Synchronous AM upper (higher) sideband */
RIG_MODE_DSB = (1<<19) /*!< Double sideband suppressed carrier */
} rmode_t;
/** \brief macro for backends, no to be used by rig_set_mode et al. */

Wyświetl plik

@ -2,7 +2,7 @@
* Hamlib Kenwood backend - main file
* Copyright (c) 2000-2005 by Stephane Fillod and others
*
* $Id: kenwood.c,v 1.93 2006-04-10 18:00:38 pa4tu Exp $
* $Id: kenwood.c,v 1.94 2007-08-18 12:55:46 n0nb 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
@ -167,7 +167,7 @@ transaction_write:
return RIG_OK; /* don't want a reply */
}
memset(data,0,*datasize);
memset(data,0,(*datasize)-1);
retval = read_string(&rs->rigport, data, *datasize, cmdtrm, strlen(cmdtrm));
if (retval < 0) {
if (retry_read++ < rig->state.rigport.retry)
@ -626,6 +626,22 @@ int kenwood_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
level_len = sprintf(levelbuf, "RA00;");
break;
case RIG_LEVEL_SLOPE_HIGH:
if(val.i>20 || val.i < 0)
return -RIG_EINVAL;
ack_len=0;
level_len = sprintf(levelbuf,"SH%02d;",(val.i));
return kenwood_transaction (rig, levelbuf, level_len, ackbuf, &ack_len);
break;
case RIG_LEVEL_SLOPE_LOW:
if(val.i>20 || val.i < 0)
return -RIG_EINVAL;
ack_len=0;
level_len = sprintf(levelbuf,"SL%02d;",(val.i));
return kenwood_transaction (rig, levelbuf, level_len, ackbuf, &ack_len);
break;
default:
rig_debug(RIG_DEBUG_ERR,"Unsupported set_level %d", level);
return -RIG_EINVAL;
@ -701,7 +717,7 @@ int kenwood_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
/* Frontend expects: -54 = S0, 0 = S9 */
if (level==RIG_LEVEL_STRENGTH)
val->i = (val->i * 4) - 54;
val->i = (val->i * 4) - 54; // There is a better way of doing this with a calibration table. See ts850.c.
break;
case RIG_LEVEL_ATT:
@ -754,6 +770,23 @@ int kenwood_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
else if (agclevel < 170) val->i = 2;
else if (agclevel <= 255) val->i = 3;
return ret;
case RIG_LEVEL_SLOPE_LOW:
lvl_len = 50;
retval = kenwood_transaction (rig, "SL;", 3, lvlbuf, &lvl_len);
if (retval != RIG_OK)
return retval;
lvlbuf[4]='\0';
val->i=atoi(&lvlbuf[2]);
break;
case RIG_LEVEL_SLOPE_HIGH:
lvl_len = 50;
retval = kenwood_transaction (rig, "SH;", 3, lvlbuf, &lvl_len);
if (retval != RIG_OK)
return retval;
lvlbuf[4]='\0';
val->i=atoi(&lvlbuf[2]);
break;
case RIG_LEVEL_PREAMP:
case RIG_LEVEL_IF:

Wyświetl plik

@ -1,24 +1,24 @@
/*
* Hamlib Kenwood backend - TS850 description
* Copyright (c) 2000-2004 by Stephane Fillod
*
* $Id: ts850.c,v 1.22 2006-03-26 08:01:20 pa4tu 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
* 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.
*
*/
* Hamlib Kenwood backend - TS850 description
* Copyright (c) 2000-2004 by Stephane Fillod
*
* $Id: ts850.c,v 1.23 2007-08-18 12:55:46 n0nb 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
* 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"
@ -30,6 +30,7 @@
#include <math.h>
#include <hamlib/rig.h>
#include <cal.h>
#include "kenwood.h"
@ -39,20 +40,28 @@
#define TS850_FUNC_ALL (RIG_FUNC_AIP|RIG_FUNC_LOCK)
#define TS850_LEVEL_GET (RIG_LEVEL_SWR|RIG_LEVEL_COMP|RIG_LEVEL_ALC|RIG_LEVEL_CWPITCH|RIG_LEVEL_RAWSTR|RIG_LEVEL_STRENGTH)
#define TS850_LEVEL_SET (RIG_LEVEL_CWPITCH)
#define TS850_LEVEL_GET (RIG_LEVEL_SWR|RIG_LEVEL_COMP|RIG_LEVEL_ALC|RIG_LEVEL_CWPITCH|RIG_LEVEL_RAWSTR|RIG_LEVEL_STRENGTH|RIG_LEVEL_SLOPE_LOW|RIG_LEVEL_SLOPE_HIGH)
#define TS850_LEVEL_SET (RIG_LEVEL_CWPITCH|RIG_LEVEL_SLOPE_LOW|RIG_LEVEL_SLOPE_HIGH)
#define TS850_VFO (RIG_VFO_A|RIG_VFO_B)
#define TS850_VFO_OPS (RIG_OP_UP|RIG_OP_DOWN)
#define TS850_CHANNEL_CAPS \
.freq=1,\
.mode=1,\
.tx_freq=1,\
.tx_mode=1,\
.split=1,\
.ctcss_tone=1
freq=1,\
mode=1,\
tx_freq=1,\
tx_mode=1,\
split=1,\
ctcss_tone=1
#define TS850_STR_CAL { 4, \
{ \
{ 0, -54 }, \
{ 15, 0 }, \
{ 22,30 }, \
{ 30, 66}, \
} }
static const struct kenwood_priv_caps ts850_priv_caps = {
@ -74,63 +83,63 @@ static int ts850_get_channel (RIG * rig, channel_t * chan);
static int ts850_set_channel (RIG * rig, const channel_t * chan);
/*
* ts850 rig capabilities.
* Notice that some rigs share the same functions.
* Also this struct is READONLY!
*/
* ts850 rig capabilities.
* Notice that some rigs share the same functions.
* Also this struct is READONLY!
*/
const struct rig_caps ts850_caps = {
.rig_model = RIG_MODEL_TS850,
.model_name = "TS-850",
.mfg_name = "Kenwood",
.version = BACKEND_VER ".0",
.copyright = "LGPL",
.status = RIG_STATUS_BETA,
.rig_type = RIG_TYPE_TRANSCEIVER,
.ptt_type = RIG_PTT_RIG,
.dcd_type = RIG_DCD_RIG,
.port_type = RIG_PORT_SERIAL,
.serial_rate_min = 4800,
.serial_rate_max = 4800,
.serial_data_bits = 8,
.serial_stop_bits = 2,
.serial_parity = RIG_PARITY_NONE,
.serial_handshake = RIG_HANDSHAKE_HARDWARE,
.write_delay = 0,
.post_write_delay = 300,
.timeout = 1000,
.retry = 3,
.rig_model = RIG_MODEL_TS850,
.model_name = "TS-850",
.mfg_name = "Kenwood",
.version = BACKEND_VER ".0",
.copyright = "LGPL",
.status = RIG_STATUS_BETA,
.rig_type = RIG_TYPE_TRANSCEIVER,
.ptt_type = RIG_PTT_RIG,
.dcd_type = RIG_DCD_RIG,
.port_type = RIG_PORT_SERIAL,
.serial_rate_min = 4800,
.serial_rate_max = 4800,
.serial_data_bits = 8,
.serial_stop_bits = 2,
.serial_parity = RIG_PARITY_NONE,
.serial_handshake = RIG_HANDSHAKE_HARDWARE,
.write_delay = 0,
.post_write_delay = 100,
.timeout = 480000, // When you tune a Kenwood, the reply is delayed until you stop.
.retry = 0,
.has_get_func = TS850_FUNC_ALL,
.has_set_func = TS850_FUNC_ALL,
.has_get_level = TS850_LEVEL_GET,
.has_set_level = TS850_LEVEL_SET,
.has_get_parm = RIG_PARM_NONE,
.has_set_parm = RIG_PARM_NONE,
.level_gran = {},
.parm_gran = {},
.ctcss_list = kenwood38_ctcss_list,
.dcs_list = NULL,
.preamp = { RIG_DBLST_END, },
.attenuator = { RIG_DBLST_END, },
.max_rit = kHz(1.27),
.max_xit = kHz(1.27),
.max_ifshift = Hz(0),
.vfo_ops=TS850_VFO_OPS,
.targetable_vfo = RIG_TARGETABLE_FREQ,
.transceive = RIG_TRN_RIG,
.bank_qty = 0,
.chan_desc_sz = 3,
.chan_list = {
.has_get_func = TS850_FUNC_ALL,
.has_set_func = TS850_FUNC_ALL,
.has_get_level = TS850_LEVEL_GET,
.has_set_level = TS850_LEVEL_SET,
.has_get_parm = RIG_PARM_NONE,
.has_set_parm = RIG_PARM_NONE,
.level_gran = {},
.parm_gran = {},
.ctcss_list = kenwood38_ctcss_list,
.dcs_list = NULL,
.preamp = { RIG_DBLST_END, },
.attenuator = { RIG_DBLST_END, },
.max_rit = kHz(1.27),
.max_xit = kHz(1.27),
.max_ifshift = Hz(0),
.vfo_ops=TS850_VFO_OPS,
.targetable_vfo = RIG_TARGETABLE_FREQ,
.transceive = RIG_TRN_RIG,
.bank_qty = 0,
.chan_desc_sz = 3,
.chan_list = {
{ 0, 89, RIG_MTYPE_MEM ,{TS850_CHANNEL_CAPS}},
{ 90, 99, RIG_MTYPE_EDGE ,{TS850_CHANNEL_CAPS}},
RIG_CHAN_END,
},
.rx_range_list1 = {
.rx_range_list1 = {
{kHz(100),MHz(30),TS850_ALL_MODES,-1,-1,TS850_VFO},
RIG_FRNG_END,
}, /* rx range */
.tx_range_list1 = {
.tx_range_list1 = {
{kHz(1810),kHz(1850),TS850_OTHER_TX_MODES,W(5),W(100),TS850_VFO}, /* 100W class */
{kHz(1810),kHz(1850),TS850_AM_TX_MODES,W(2),W(40),TS850_VFO}, /* 40W class */
{kHz(3500),kHz(3800),TS850_OTHER_TX_MODES,W(5),W(100),TS850_VFO},
@ -152,11 +161,11 @@ const struct rig_caps ts850_caps = {
RIG_FRNG_END,
},
.rx_range_list2 = {
.rx_range_list2 = {
{kHz(100),MHz(30),TS850_ALL_MODES,-1,-1,TS850_VFO},
RIG_FRNG_END,
}, /* rx range */
.tx_range_list2 = {
.tx_range_list2 = {
{kHz(1800),MHz(2)-1,TS850_OTHER_TX_MODES,W(5),W(100),TS850_VFO}, /* 100W class */
{kHz(1800),MHz(2)-1,TS850_AM_TX_MODES,W(2),W(40),TS850_VFO}, /* 40W class */
{kHz(3500),MHz(4)-1,TS850_OTHER_TX_MODES,W(5),W(100),TS850_VFO},
@ -177,12 +186,12 @@ const struct rig_caps ts850_caps = {
{MHz(28),kHz(29700),TS850_AM_TX_MODES,W(2),W(40),TS850_VFO},
RIG_FRNG_END,
}, /* tx range */
.tuning_steps = {
.tuning_steps = {
{TS850_ALL_MODES,0}, /* any tuning step */
RIG_TS_END,
},
/* mode/filter list, remember: order matters! */
.filters = {
.filters = {
{TS850_ALL_MODES, kHz(12)},
{TS850_ALL_MODES, kHz(6)},
{TS850_ALL_MODES, kHz(2.7)},
@ -190,38 +199,39 @@ const struct rig_caps ts850_caps = {
{TS850_ALL_MODES, Hz(250)},
RIG_FLT_END,
},
.priv = (void *)&ts850_priv_caps,
.str_cal = TS850_STR_CAL,
.priv = (void *)&ts850_priv_caps,
.set_freq = kenwood_set_freq,
.get_freq = kenwood_get_freq,
.set_rit = ts850_set_rit,
.get_rit = kenwood_get_rit,
.set_xit = ts850_set_xit,
.get_xit = kenwood_get_xit,
.set_mode = ts850_set_mode,
.get_mode = ts850_get_mode,
.set_vfo = kenwood_set_vfo,
.get_vfo = kenwood_get_vfo,
.set_split_vfo = kenwood_set_split_vfo,
.set_ctcss_tone = ts850_set_ctcss_tone,
.get_ctcss_tone = kenwood_get_ctcss_tone,
.get_ptt = kenwood_get_ptt,
.set_ptt = kenwood_set_ptt,
.set_func = ts850_set_func,
.get_func = ts850_get_func,
.set_level = ts850_set_level,
.get_level = ts850_get_level,
.vfo_op = kenwood_vfo_op,
.set_mem = kenwood_set_mem,
.get_mem = ts850_get_mem,
.get_channel = ts850_get_channel,
.set_channel = ts850_set_channel,
.set_trn = kenwood_set_trn
.set_freq = kenwood_set_freq,
.get_freq = kenwood_get_freq,
.set_rit = ts850_set_rit,
.get_rit = kenwood_get_rit,
.set_xit = ts850_set_xit,
.get_xit = kenwood_get_xit,
.set_mode = ts850_set_mode,
.get_mode = ts850_get_mode,
.set_vfo = kenwood_set_vfo,
.get_vfo = kenwood_get_vfo,
.set_split_vfo = kenwood_set_split_vfo,
.set_ctcss_tone = ts850_set_ctcss_tone,
.get_ctcss_tone = kenwood_get_ctcss_tone,
.get_ptt = kenwood_get_ptt,
.set_ptt = kenwood_set_ptt,
.set_func = ts850_set_func,
.get_func = ts850_get_func,
.set_level = ts850_set_level,
.get_level = ts850_get_level,
.vfo_op = kenwood_vfo_op,
.set_mem = kenwood_set_mem,
.get_mem = ts850_get_mem,
.get_channel = ts850_get_channel,
.set_channel = ts850_set_channel,
.set_trn = kenwood_set_trn
};
/*
* Function definitions below
*/
* Function definitions below
*/
int ts850_set_rit(RIG * rig, vfo_t vfo, shortfreq_t rit)
{
@ -244,7 +254,7 @@ int ts850_set_rit(RIG * rig, vfo_t vfo, shortfreq_t rit)
info_len = 0;
retval = kenwood_transaction(rig, "RC;", 3, infobuf, &info_len);
for (i = 0; i < abs(rint(rit/10)); i++)
for (i = 0; i < abs(rint(rit/20)); i++)
{
info_len = 0;
retval = kenwood_transaction(rig, buf, len, infobuf, &info_len);
@ -274,7 +284,7 @@ int ts850_set_xit(RIG * rig, vfo_t vfo, shortfreq_t xit)
c = 'D';
len = sprintf(buf, "R%c;", c);
for (i = 0; i < abs(rint(xit/10)); i++)
for (i = 0; i < abs(rint(xit/20)); i++)
{
info_len = 0;
retval = kenwood_transaction(rig, buf, len, infobuf, &info_len);
@ -284,8 +294,8 @@ int ts850_set_xit(RIG * rig, vfo_t vfo, shortfreq_t xit)
}
/*
* modes in use by the "MD" command
*/
* modes in use by the "MD" command
*/
#define MD_NONE '0'
#define MD_LSB '1'
#define MD_USB '2'
@ -305,7 +315,7 @@ int ts850_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
info_len = 50;
retval = kenwood_transaction (rig, "IF;", 3, infobuf, &info_len)
;
;
if (retval != RIG_OK)
return retval;
@ -331,7 +341,7 @@ int ts850_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
info_len = 50;
retval = kenwood_transaction (rig, "FL;", 3, infobuf, &info_len)
;
;
if (retval != RIG_OK)
return retval;
@ -411,7 +421,7 @@ int ts850_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
mdbuf_len = sprintf(mdbuf, "FL010009;");
else
if(width <= Hz(500))
mdbuf_len = sprintf(mdbuf, "FL009007;");
mdbuf_len = sprintf(mdbuf, "FL009009;");
else
if(width <= kHz(2.7))
mdbuf_len = sprintf(mdbuf, "FL007007;");
@ -471,7 +481,6 @@ int ts850_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
rig_debug(RIG_DEBUG_ERR,"Unsupported set_func %#x", func);
return -RIG_EINVAL;
}
return RIG_OK;
}
@ -518,18 +527,26 @@ int ts850_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
return -RIG_EINVAL;
switch (level) {
case RIG_LEVEL_STRENGTH:
case RIG_LEVEL_RAWSTR:
lvl_len = 50;
retval = kenwood_transaction (rig, "SM;", 3, lvlbuf, &lvl_len);
if (retval != RIG_OK)
return retval;
lvlbuf[6]='\0';
val->i=atoi(&lvlbuf[2]);
if(level==RIG_LEVEL_STRENGTH)
val->i = (val->i * 4) - 54;
break;
case RIG_LEVEL_STRENGTH:
lvl_len = 50;
retval = kenwood_transaction (rig, "SM;", 3, lvlbuf, &lvl_len);
if (retval != RIG_OK)
return retval;
lvlbuf[6]='\0';
val->i=atoi(&lvlbuf[2]);
//val->i = (val->i * 4) - 54; Old approximate way of doing it.
val->i = (int)rig_raw2val(val->i,&rig->caps->str_cal);
break;
case RIG_LEVEL_SWR:
lvl_len = 0;
retval = kenwood_transaction (rig, "RM1;", 4, lvlbuf, &lvl_len);
@ -539,7 +556,6 @@ int ts850_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
retval = kenwood_transaction (rig, "RM;", 3, lvlbuf, &lvl_len);
if (retval != RIG_OK)
return retval;
lvlbuf[7]='\0';
i=atoi(&lvlbuf[3]);
if(i == 30)
@ -547,48 +563,65 @@ int ts850_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
else
val->f = 60.0/(30.0-(float)i)-1.0;
break;
case RIG_LEVEL_COMP:
lvl_len = 0;
retval = kenwood_transaction (rig, "RM2;", 4, lvlbuf, &lvl_len);
if (retval != RIG_OK)
return retval;
lvl_len = 50;
retval = kenwood_transaction (rig, "RM;", 4, lvlbuf, &lvl_len);
retval = kenwood_transaction (rig, "RM;", 3, lvlbuf, &lvl_len);
if (retval != RIG_OK)
return retval;
lvlbuf[7]='\0';
val->f=(float)atoi(&lvlbuf[3])/30.0;
break;
case RIG_LEVEL_ALC:
lvl_len = 0;
retval = kenwood_transaction (rig, "RM3;", 4, lvlbuf, &lvl_len);
if (retval != RIG_OK)
return retval;
lvl_len = 50;
retval = kenwood_transaction (rig, "RM;", 4, lvlbuf, &lvl_len);
retval = kenwood_transaction (rig, "RM;", 3, lvlbuf, &lvl_len);
if (retval != RIG_OK)
return retval;
lvlbuf[7]='\0';
val->f=(float)atoi(&lvlbuf[3])/30.0;
break;
case RIG_LEVEL_CWPITCH:
lvl_len = 25;
retval = kenwood_transaction (rig, "PT;", 3, lvlbuf, &lvl_len);
if (retval != RIG_OK)
return retval;
lvlbuf[4]='\0';
val->i=atoi(&lvlbuf[2]);
val->i=(val->i-8)*50+800;
break;
default:
rig_debug(RIG_DEBUG_ERR,"Unsupported get_level %d", level);
return -RIG_EINVAL;
}
case RIG_LEVEL_SLOPE_LOW:
lvl_len = 50;
retval = kenwood_transaction (rig, "SL;", 3, lvlbuf, &lvl_len);
if (retval != RIG_OK)
return retval;
lvlbuf[4]='\0';
val->i=atoi(&lvlbuf[2]);
break;
return RIG_OK;
case RIG_LEVEL_SLOPE_HIGH:
lvl_len = 50;
retval = kenwood_transaction (rig, "SH;", 3, lvlbuf, &lvl_len);
if (retval != RIG_OK)
return retval;
lvlbuf[4]='\0';
val->i=atoi(&lvlbuf[2]);
break;
default:
return kenwood_get_level (rig, vfo, level, val);
}
return retval; // Never gets here.
}
int ts850_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
@ -597,16 +630,36 @@ int ts850_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
int lvl_len;
size_t ack_len;
if(level != RIG_LEVEL_CWPITCH)
return -RIG_EINVAL;
switch (level) {
case RIG_LEVEL_CWPITCH:
if(val.i>1000 || val.i<400)
return -RIG_EINVAL;
ack_len=0;
lvl_len = sprintf(lvlbuf,"PT%02d;",(val.i/50)-8);
return kenwood_transaction (rig, lvlbuf, lvl_len, ackbuf, &ack_len);
break;
case RIG_LEVEL_SLOPE_HIGH:
if(val.i>20 || val.i < 0)
return -RIG_EINVAL;
ack_len=0;
lvl_len = sprintf(lvlbuf,"SH%02d;",(val.i));
return kenwood_transaction (rig, lvlbuf, lvl_len, ackbuf, &ack_len);
break;
case RIG_LEVEL_SLOPE_LOW:
if(val.i>20 || val.i < 0)
return -RIG_EINVAL;
ack_len=0;
lvl_len = sprintf(lvlbuf,"SL%02d;",(val.i));
return kenwood_transaction (rig, lvlbuf, lvl_len, ackbuf, &ack_len);
break;
default:
return kenwood_set_level (rig, vfo, level, val);
}
return RIG_OK; /* never reached */
}
int ts850_get_mem(RIG *rig, vfo_t vfo, int *ch)
@ -617,7 +670,7 @@ int ts850_get_mem(RIG *rig, vfo_t vfo, int *ch)
info_len = 50;
retval = kenwood_transaction (rig, "IF;", 3, infobuf, &info_len)
;
;
if (retval != RIG_OK)
return retval;

Wyświetl plik

@ -16,7 +16,7 @@
* Hamlib Interface - func/level/parm
* Copyright (c) 2000-2006 by Stephane Fillod
*
* $Id: settings.c,v 1.8 2006-10-15 00:27:52 aa6e Exp $
* $Id: settings.c,v 1.9 2007-08-18 12:55:46 n0nb 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
@ -146,9 +146,10 @@ int HAMLIB_API rig_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
* Special case(frontend emulation): calibrated S-meter reading
*/
if (level == RIG_LEVEL_STRENGTH &&
(caps->has_get_level & RIG_LEVEL_STRENGTH) == 0 &&
(caps->has_get_level & RIG_LEVEL_STRENGTH) &&
rig_has_get_level(rig,RIG_LEVEL_RAWSTR)) {
value_t rawstr;
retcode = rig_get_level(rig, vfo, RIG_LEVEL_RAWSTR, &rawstr);
if (retcode != RIG_OK)

Wyświetl plik

@ -231,11 +231,11 @@ Get func status.
Set level/value:
PREAMP, ATT, VOX, AF, RF, SQL, IF, APF, NR, PBT_IN,
PBT_OUT, CWPITCH, RFPOWER, MICGAIN, KEYSPD, NOTCHF, COMP,
AGC, BKINDL, BAL, METER, VOXGAIN, ANTIVOX. Plus "extra" levels.
AGC, BKINDL, BAL, METER, VOXGAIN, ANTIVOX. SLOPE_LOW, SLOPE_HIGH, Plus "extra" levels.
.TP
.B l, get_level
Get level value: also
SWR, ALC, STRENGTH, RAWSTR.
SWR, ALC, STRENGTH, RAWSTR, SLOPE_LOW, SLOPE_HIGH.
.TP
.B P, set_parm
Set parm/value: