SF Patches item #1397439

Submitted By: Ken Prox (kprox)

Initial Comment:
Here is a patch for the Ten-Tec RX-320(d).

1) IF shift (Pass Band Tuning) like the xclass version.
2) CW beat frequency adjustment.
3) Inverted AF adjustment such that up is increasing volume.
4) Recompute and re-send frequency with CWBFO and PBT adjustment.


git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2055 7ae35d74-ebe9-4afe-98af-79ac388436b8
This commit is contained in:
Stéphane Fillod, F8CFE 2006-01-09 21:14:40 +00:00
parent d3293f0117
commit eef19dfd49
3 changed files with 68 additions and 29 deletions

View File

@ -2,7 +2,7 @@
* Hamlib TenTenc backend - RX-320 PC-Radio description
* Copyright (c) 2001-2004 by Stephane Fillod
*
* $Id: rx320.c,v 1.7 2004-06-14 21:12:14 fillods Exp $
* $Id: rx320.c,v 1.8 2006-01-09 21:14:40 fillods 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
@ -34,7 +34,7 @@
#define RX320_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB)
/* TODO: LINEOUT */
#define RX320_LEVELS (RIG_LEVEL_AGC|RIG_LEVEL_AF|RIG_LEVEL_RAWSTR)
#define RX320_LEVELS (RIG_LEVEL_AGC|RIG_LEVEL_AF|RIG_LEVEL_IF|RIG_LEVEL_RAWSTR|RIG_LEVEL_CWPITCH)
#define RX320_VFO (RIG_VFO_A)
@ -59,9 +59,9 @@ const struct rig_caps rx320_caps = {
.rig_model = RIG_MODEL_RX320,
.model_name = "RX-320",
.mfg_name = "Ten-Tec",
.version = "0.2",
.version = "0.3",
.copyright = "LGPL",
.status = RIG_STATUS_UNTESTED,
.status = RIG_STATUS_BETA,
.rig_type = RIG_TYPE_PCRECEIVER,
.ptt_type = RIG_PTT_NONE,
.dcd_type = RIG_DCD_NONE,
@ -84,8 +84,10 @@ const struct rig_caps rx320_caps = {
.has_get_parm = RIG_PARM_NONE,
.has_set_parm = RIG_PARM_NONE,
.level_gran = {
[LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 99999 } },
[LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 10000 } },
[LVL_AF] = { .step = { .f = 1.0/64 } },
[LVL_IF] = { .min = { .i = -2000 }, .max = { .i = 2000 }, .step = { .i = 10} },
[LVL_CWPITCH] = { .min = { .i = 0}, .max = { .i = 2000 }, .step = { .i = 100} }
},
.parm_gran = {},
.ctcss_list = NULL,
@ -94,7 +96,7 @@ const struct rig_caps rx320_caps = {
.attenuator = { RIG_DBLST_END },
.max_rit = Hz(0),
.max_xit = Hz(0),
.max_ifshift = Hz(0),
.max_ifshift = kHz(2),
.targetable_vfo = 0,
.transceive = RIG_TRN_OFF,
.bank_qty = 0,
@ -117,9 +119,22 @@ const struct rig_caps rx320_caps = {
},
/* mode/filter list, remember: order matters! */
.filters = {
{RIG_MODE_SSB|RIG_MODE_CW, kHz(2.5)},
{RIG_MODE_AM, kHz(6)},
RIG_FLT_END,
{RIG_MODE_CW, 300},
{RIG_MODE_CW, 450},
{RIG_MODE_CW, 600},
{RIG_MODE_CW, 750},
{RIG_MODE_CW, 900},
{RIG_MODE_CW, kHz(1.2)},
{RIG_MODE_SSB|RIG_MODE_CW, kHz(1.5)},
{RIG_MODE_SSB|RIG_MODE_CW, kHz(1.8)},
{RIG_MODE_SSB|RIG_MODE_CW, kHz(2.1)},
{RIG_MODE_AM|RIG_MODE_SSB|RIG_MODE_CW, kHz(2.4)},
{RIG_MODE_AM|RIG_MODE_SSB|RIG_MODE_CW, kHz(3.0)},
{RIG_MODE_AM|RIG_MODE_SSB|RIG_MODE_CW, kHz(4.2)},
{RIG_MODE_AM|RIG_MODE_SSB|RIG_MODE_CW, kHz(5.1)},
{RIG_MODE_AM|RIG_MODE_SSB|RIG_MODE_CW, kHz(6)},
{RIG_MODE_AM|RIG_MODE_SSB|RIG_MODE_CW, kHz(8)},
RIG_FLT_END,
},
.str_cal = RX320_STR_CAL,

View File

@ -2,7 +2,7 @@
* Hamlib Tentec backend - main file
* Copyright (c) 2001-2005 by Stephane Fillod
*
* $Id: tentec.c,v 1.15 2005-04-10 21:47:14 fillods Exp $
* $Id: tentec.c,v 1.16 2006-01-09 21:14:40 fillods 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
@ -110,10 +110,11 @@ int tentec_init(RIG *rig)
/*
* set arbitrary initial status
*/
priv->freq = MHz(145);
priv->freq = MHz(10);
priv->mode = RIG_MODE_AM;
priv->width = kHz(6);
priv->cwbfo = 0;
priv->pbt = 0;
priv->cwbfo = 1000;
priv->agc = 0.5; /* medium */
priv->lnvol = priv->spkvol = 0.0; /* mute */
@ -167,19 +168,21 @@ int tentec_trx_open(RIG *rig)
static void tentec_tuning_factor_calc(RIG *rig)
{
struct tentec_priv_data *priv;
double tfreq, adjtfreq, mcor, fcor;
double tfreq, adjtfreq, mcor, fcor, cwbfo;
priv = (struct tentec_priv_data *)rig->state.priv;
switch (priv->mode) {
cwbfo = 0.0;
switch (priv->mode) {
case RIG_MODE_AM:
case RIG_MODE_FM:
mcor=0; break;
mcor=0.0; break;
case RIG_MODE_CW:
case RIG_MODE_LSB:
mcor=-1; break;
mcor=-1.0; cwbfo = (double)priv->cwbfo; break;
case RIG_MODE_LSB:
mcor=-1.0; break;
case RIG_MODE_USB:
mcor=1; break;
mcor=1.0; break;
default:
rig_debug(RIG_DEBUG_BUG,
"tentec_tuning_factor_calc: invalid mode!\n");
@ -188,15 +191,14 @@ static void tentec_tuning_factor_calc(RIG *rig)
tfreq = priv->freq/(double)MHz(1);
fcor = priv->width/2.0+200;
adjtfreq = tfreq - 0.00125 + (mcor*((fcor+priv->cwbfo)/1000000));
adjtfreq = tfreq - 0.00125 + (mcor*((fcor + (double)priv->pbt)/1000000.0));
priv->ctf = floor(adjtfreq*400);
priv->ftf = floor(((adjtfreq*400) - priv->ctf)*2500*5.46);
priv->ctf = floor(adjtfreq*400.0);
priv->ftf = floor(((adjtfreq*400.0) - priv->ctf) * 2500.0 * 5.46);
priv->ctf += 18000;
priv->btf = floor((fcor + priv->cwbfo + 8000)*2.73);
priv->btf = floor((fcor + (double)priv->pbt + cwbfo + 8000.0) * 2.73);
}
/*
* tentec_set_freq
* assumes rig!=NULL, rig->state.priv!=NULL
@ -353,16 +355,29 @@ int tentec_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
if (retval == RIG_OK)
priv->agc = val.i;
return retval;
case RIG_LEVEL_AF:
/* FIXME: support also separate Lineout setting
* -> need to create RIG_LEVEL_LINEOUT ?
*/
cmd_len = sprintf(cmdbuf, "C\x7f%c" EOM, (int)(val.f*63));
cmd_len = sprintf(cmdbuf, "C\x7f%c" EOM, (int)((1.0 - val.f) * 63.0));
retval = write_block(&rs->rigport, cmdbuf, cmd_len);
if (retval == RIG_OK)
priv->lnvol = priv->spkvol = val.f;
return retval;
case RIG_LEVEL_IF:
priv->pbt = val.i;
retval = tentec_set_freq(rig, vfo, priv->freq);
return retval;
case RIG_LEVEL_CWPITCH:
priv->cwbfo = val.i;
if(priv->mode == RIG_MODE_CW) {
retval = tentec_set_freq(rig, vfo, priv->freq);
}
return retval;
default:
rig_debug(RIG_DEBUG_ERR,"Unsupported set_level %d\n", level);
return -RIG_EINVAL;
@ -414,6 +429,14 @@ int tentec_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
val->f = priv->spkvol;
break;
case RIG_LEVEL_IF:
val->i = priv->pbt;
break;
case RIG_LEVEL_CWPITCH:
val->i = priv->cwbfo;
break;
default:
rig_debug(RIG_DEBUG_ERR,"Unsupported get_level %d\n", level);
return -RIG_EINVAL;
@ -435,9 +458,9 @@ const char *tentec_get_info(RIG *rig)
/*
* protocol version
*/
firmware_len = 7;
firmware_len = 10;
retval = tentec_transaction (rig, "?" EOM, 2, buf, &firmware_len);
if (retval != RIG_OK || firmware_len != 7) {
if ( (retval != RIG_OK) || (firmware_len > 10) ) {
rig_debug(RIG_DEBUG_ERR,"tentec_get_info: ack NG, len=%d\n",
firmware_len);
return NULL;

View File

@ -2,7 +2,7 @@
* Hamlib Tentec backend - main header
* Copyright (c) 2001-2004 by Stephane Fillod
*
* $Id: tentec.h,v 1.9 2004-05-26 21:30:13 fillods Exp $
* $Id: tentec.h,v 1.10 2006-01-09 21:14:40 fillods 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
@ -29,7 +29,8 @@ struct tentec_priv_data {
rmode_t mode; /* detection mode */
freq_t freq; /* tuned frequency */
pbwidth_t width; /* filter bandwidth in Hz */
int cwbfo; /* BFO frequency: 0 [0-2000Hz] */
int cwbfo; /* BFO frequency: 1000 [0-2000Hz] */
int pbt; /* Passband Tuning, IF shift: 0 [-2000Hz to 2000Hz] */
float lnvol; /* line-out volume: 30 [0..63] */
float spkvol; /* speaker volume: 30 [0..63] */
int agc; /* AGC: medium */