TM-D700: fix set_vfo, plus some more caps

th_set_freq: finer freq setting
th_set_chan: allow inexact tuning_step


git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2975 7ae35d74-ebe9-4afe-98af-79ac388436b8
Hamlib-1.2.13
Stéphane Fillod, F8CFE 2010-09-08 08:28:39 +00:00
rodzic d812fdb6df
commit 28844e674f
2 zmienionych plików z 75 dodań i 13 usunięć

Wyświetl plik

@ -158,7 +158,7 @@ th_decode_event (RIG *rig)
return RIG_OK; return RIG_OK;
} }
int static int
kenwood_wrong_vfo(const char *func, vfo_t vfo) kenwood_wrong_vfo(const char *func, vfo_t vfo)
{ {
rig_debug(RIG_DEBUG_ERR, "%s: Unsupported VFO: %d\n", func, vfo); rig_debug(RIG_DEBUG_ERR, "%s: Unsupported VFO: %d\n", func, vfo);
@ -180,8 +180,8 @@ th_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
if (vfo != RIG_VFO_CURR && vfo != rig->state.current_vfo) if (vfo != RIG_VFO_CURR && vfo != rig->state.current_vfo)
return kenwood_wrong_vfo(__func__, vfo); return kenwood_wrong_vfo(__func__, vfo);
/* Step needs to be at least 10kHz on higher band */ /* Step needs to be at least 10kHz on higher band, otherwise 5 kHz */
step = freq >= MHz(470) ? 4 : 1; step = freq >= MHz(470) ? 4 : 0;
sprintf(buf, "FQ %011"PRIll",%X", (int64_t) freq, step); sprintf(buf, "FQ %011"PRIll",%X", (int64_t) freq, step);
@ -272,7 +272,7 @@ th_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
int int
th_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) th_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
{ {
char vch, buf[ACKBUF_LEN]; char buf[ACKBUF_LEN];
int retval; int retval;
const struct kenwood_priv_caps *priv=(const struct kenwood_priv_caps *)rig->caps->priv; const struct kenwood_priv_caps *priv=(const struct kenwood_priv_caps *)rig->caps->priv;
@ -281,8 +281,6 @@ th_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
if (vfo != RIG_VFO_CURR && vfo != rig->state.current_vfo) if (vfo != RIG_VFO_CURR && vfo != rig->state.current_vfo)
return kenwood_wrong_vfo(__func__, vfo); return kenwood_wrong_vfo(__func__, vfo);
vch = '0';
retval = kenwood_safe_transaction(rig, "MD", buf, sizeof(buf), 5); retval = kenwood_safe_transaction(rig, "MD", buf, sizeof(buf), 5);
if (retval != RIG_OK) if (retval != RIG_OK)
return retval; return retval;
@ -1442,8 +1440,7 @@ int th_set_channel(RIG *rig, const channel_t *chan)
channel_num = chan->channel_num; channel_num = chan->channel_num;
for (step=0; rig->state.tuning_steps[step].ts!=0;step++) for (step=0; rig->state.tuning_steps[step].ts!=0;step++)
if (chan->tuning_step<=rig->state.tuning_steps[step].ts)
if (chan->tuning_step==rig->state.tuning_steps[step].ts)
break; break;
switch (chan->rptr_shift) { switch (chan->rptr_shift) {

Wyświetl plik

@ -28,6 +28,7 @@
#include <hamlib/rig.h> #include <hamlib/rig.h>
#include "kenwood.h" #include "kenwood.h"
#include "th.h" #include "th.h"
#include "tones.h"
#define TMD700_MODES (RIG_MODE_FM|RIG_MODE_AM) #define TMD700_MODES (RIG_MODE_FM|RIG_MODE_AM)
@ -39,6 +40,7 @@
RIG_FUNC_MON| \ RIG_FUNC_MON| \
RIG_FUNC_SQL| \ RIG_FUNC_SQL| \
RIG_FUNC_TONE| \ RIG_FUNC_TONE| \
RIG_FUNC_TBURST| \
RIG_FUNC_REV| \ RIG_FUNC_REV| \
RIG_FUNC_LOCK| \ RIG_FUNC_LOCK| \
RIG_FUNC_ARO) RIG_FUNC_ARO)
@ -49,7 +51,8 @@
RIG_LEVEL_RF|\ RIG_LEVEL_RF|\
RIG_LEVEL_MICGAIN) RIG_LEVEL_MICGAIN)
#define TMD700_PARMS (RIG_PARM_BACKLIGHT) #define TMD700_PARMS (RIG_PARM_BACKLIGHT|\
RIG_PARM_APO)
#define TMD700_VFO_OP (RIG_OP_UP|RIG_OP_DOWN) #define TMD700_VFO_OP (RIG_OP_UP|RIG_OP_DOWN)
@ -68,6 +71,8 @@ static struct kenwood_priv_caps tmd700_priv_caps = {
.mode_table = tmd700_mode_table, .mode_table = tmd700_mode_table,
}; };
static int tmd700_set_vfo (RIG *rig, vfo_t vfo);
/* /*
* TM-D700 rig capabilities. * TM-D700 rig capabilities.
@ -110,7 +115,7 @@ const struct rig_caps tmd700_caps = {
}, },
.parm_gran = {}, .parm_gran = {},
.ctcss_list = kenwood38_ctcss_list, .ctcss_list = kenwood38_ctcss_list,
.dcs_list = NULL, .dcs_list = common_dcs_list,
.preamp = { RIG_DBLST_END, }, .preamp = { RIG_DBLST_END, },
.attenuator = { RIG_DBLST_END, }, .attenuator = { RIG_DBLST_END, },
.max_rit = Hz(0), .max_rit = Hz(0),
@ -157,7 +162,6 @@ const struct rig_caps tmd700_caps = {
RIG_FRNG_END, RIG_FRNG_END,
}, /* tx range */ }, /* tx range */
/* TBC */
.tuning_steps = { .tuning_steps = {
{TMD700_MODES,kHz(5)}, {TMD700_MODES,kHz(5)},
{TMD700_MODES,kHz(6.25)}, {TMD700_MODES,kHz(6.25)},
@ -185,7 +189,7 @@ const struct rig_caps tmd700_caps = {
.get_freq = th_get_freq, .get_freq = th_get_freq,
.set_mode = th_set_mode, .set_mode = th_set_mode,
.get_mode = th_get_mode, .get_mode = th_get_mode,
.set_vfo = th_set_vfo, .set_vfo = tmd700_set_vfo,
.get_vfo = th_get_vfo, .get_vfo = th_get_vfo,
.set_ctcss_tone = th_set_ctcss_tone, .set_ctcss_tone = th_set_ctcss_tone,
.get_ctcss_tone = th_get_ctcss_tone, .get_ctcss_tone = th_get_ctcss_tone,
@ -196,14 +200,75 @@ const struct rig_caps tmd700_caps = {
.set_trn = th_set_trn, .set_trn = th_set_trn,
.get_trn = th_get_trn, .get_trn = th_get_trn,
.set_func = th_set_func,
.get_func = th_get_func, .get_func = th_get_func,
.set_level = th_set_level,
.get_level = th_get_level, .get_level = th_get_level,
.set_parm = th_set_parm,
.get_parm = th_get_parm, .get_parm = th_get_parm,
.get_info = th_get_info, .get_info = th_get_info,
.get_dcd = th_get_dcd, .get_dcd = th_get_dcd,
.set_ptt = th_set_ptt,
.vfo_op = th_vfo_op,
.decode_event = th_decode_event, .decode_event = th_decode_event,
}; };
/* --------------------------------------------------------------------- */
int tmd700_set_vfo (RIG *rig, vfo_t vfo)
{
char vfobuf[16], ackbuf[16];
int retval;
size_t ack_len;
rig_debug(RIG_DEBUG_TRACE, "%s: called %d\n", __func__,vfo);
switch (vfo) {
case RIG_VFO_A:
case RIG_VFO_VFO:
sprintf(vfobuf, "VMC 0,0");
break;
case RIG_VFO_B:
sprintf(vfobuf, "VMC 1,0");
break;
case RIG_VFO_MEM:
sprintf(vfobuf, "BC");
ack_len=16;
retval = kenwood_transaction(rig, vfobuf, strlen(vfobuf), ackbuf, &ack_len);
if (retval != RIG_OK) return retval;
sprintf(vfobuf, "VMC %c,2",ackbuf[3]);
break;
default:
rig_debug(RIG_DEBUG_ERR, "%s: Unsupported VFO %d\n", __func__, vfo);
return -RIG_EVFO;
}
ack_len=0;
retval = kenwood_transaction(rig, vfobuf, strlen(vfobuf), ackbuf, &ack_len);
if (retval != RIG_OK) {
rig_debug(RIG_DEBUG_ERR, "%s: bad return \n", __func__);
return retval;
}
switch (vfo) {
case RIG_VFO_A:
case RIG_VFO_VFO:
sprintf(vfobuf, "BC 0,0");
break;
case RIG_VFO_B:
sprintf(vfobuf, "BC 1,1");
break;
case RIG_VFO_MEM:
return RIG_OK;
default:
return RIG_OK;
}
retval = kenwood_cmd(rig, vfobuf);
if (retval != RIG_OK)
return retval;
return RIG_OK;
}
/* end of file */ /* end of file */