kopia lustrzana https://github.com/Hamlib/Hamlib
Updates to the TH-D7A/E back end
Allow for these rigs echo of successful set commands, no command verification is requires nor necessary with TH style rigs. Change rig_open to not use teh IF command with TH style rigs as it is not supported and breaks communications for the next command. Send the correct command to disable auto-information mode on TH style rigs. Ensure the correct command terminator is sent with all commands to TH style rigs. Fix an issue with MEM mode selection in the TH-D7. Use the correct DCD detection command for the TH-D7.pull/345/head
rodzic
b2dce86e91
commit
06d130371c
|
@ -306,7 +306,7 @@ transaction_write:
|
||||||
/* XXX the if is temporary, until all invocations are fixed */
|
/* XXX the if is temporary, until all invocations are fixed */
|
||||||
if (cmdstr[len - 1] != ';' && cmdstr[len - 1] != '\r')
|
if (cmdstr[len - 1] != ';' && cmdstr[len - 1] != '\r')
|
||||||
{
|
{
|
||||||
cmd[len] = caps->cmdtrm;
|
cmd[len] = caps->cmdtrm[0];
|
||||||
len++;
|
len++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -662,7 +662,18 @@ int kenwood_init(RIG *rig)
|
||||||
priv = rig->state.priv;
|
priv = rig->state.priv;
|
||||||
|
|
||||||
memset(priv, 0x00, sizeof(struct kenwood_priv_data));
|
memset(priv, 0x00, sizeof(struct kenwood_priv_data));
|
||||||
strcpy(priv->verify_cmd, RIG_IS_XG3 ? ";" : "ID;");
|
if (RIG_IS_XG3)
|
||||||
|
{
|
||||||
|
priv->verify_cmd[0] = caps->cmdtrm[0];
|
||||||
|
priv->verify_cmd[1] ='\0';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
priv->verify_cmd[0] ='I';
|
||||||
|
priv->verify_cmd[1] ='D';
|
||||||
|
priv->verify_cmd[2] = caps->cmdtrm[0];
|
||||||
|
priv->verify_cmd[3] ='\0';
|
||||||
|
}
|
||||||
priv->split = RIG_SPLIT_OFF;
|
priv->split = RIG_SPLIT_OFF;
|
||||||
priv->trn_state = -1;
|
priv->trn_state = -1;
|
||||||
priv->curr_mode = 0;
|
priv->curr_mode = 0;
|
||||||
|
@ -697,6 +708,7 @@ int kenwood_cleanup(RIG *rig)
|
||||||
int kenwood_open(RIG *rig)
|
int kenwood_open(RIG *rig)
|
||||||
{
|
{
|
||||||
struct kenwood_priv_data *priv = rig->state.priv;
|
struct kenwood_priv_data *priv = rig->state.priv;
|
||||||
|
struct kenwood_priv_caps *caps = kenwood_caps(rig);
|
||||||
int err, i;
|
int err, i;
|
||||||
char *idptr;
|
char *idptr;
|
||||||
char id[KENWOOD_MAX_BUF_LEN];
|
char id[KENWOOD_MAX_BUF_LEN];
|
||||||
|
@ -799,7 +811,10 @@ int kenwood_open(RIG *rig)
|
||||||
|
|
||||||
/* here we know there is something that responds to FA but not
|
/* here we know there is something that responds to FA but not
|
||||||
to ID so use FA as the command verification command */
|
to ID so use FA as the command verification command */
|
||||||
strcpy(priv->verify_cmd, "FA;");
|
priv->verify_cmd[0] = F';
|
||||||
|
priv->verify_cmd[1] = A';
|
||||||
|
priv->verify_cmd[2] = caps->cmdtrm ;
|
||||||
|
priv->verify_cmd[3] = \0;
|
||||||
strcpy(id, "ID019"); /* fake a TS-2000 */
|
strcpy(id, "ID019"); /* fake a TS-2000 */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -862,19 +877,25 @@ int kenwood_open(RIG *rig)
|
||||||
kenwood_get_trn(rig, &priv->trn_state); /* ignore errors */
|
kenwood_get_trn(rig, &priv->trn_state); /* ignore errors */
|
||||||
/* Currently we cannot cope with AI mode so turn it off in
|
/* Currently we cannot cope with AI mode so turn it off in
|
||||||
case last client left it on */
|
case last client left it on */
|
||||||
kenwood_set_trn(rig, RIG_TRN_OFF); /* ignore status in case
|
if (priv->trn_state != RIG_TRN_OFF)
|
||||||
it's not supported */
|
|
||||||
// call get_split to fill in current split and tx_vfo status
|
|
||||||
retval = kenwood_get_split_vfo_if(rig, RIG_VFO_A, &split, &tx_vfo);
|
|
||||||
|
|
||||||
if (retval != RIG_OK)
|
|
||||||
{
|
{
|
||||||
rig_debug(RIG_DEBUG_ERR, "%s: %s\n", __func__, rigerror(retval));
|
kenwood_set_trn(rig, RIG_TRN_OFF); /* ignore status in case
|
||||||
|
it's not supported */
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!RIG_IS_THD74 && !RIG_IS_THD7A)
|
||||||
|
{
|
||||||
|
// call get_split to fill in current split and tx_vfo status
|
||||||
|
retval = kenwood_get_split_vfo_if(rig, RIG_VFO_A, &split, &tx_vfo);
|
||||||
|
if (retval != RIG_OK)
|
||||||
|
{
|
||||||
|
rig_debug(RIG_DEBUG_ERR, "%s: %s\n", __func__, rigerror(retval));
|
||||||
|
}
|
||||||
|
priv->tx_vfo = tx_vfo;
|
||||||
|
rig_debug(RIG_DEBUG_VERBOSE, "%s: priv->tx_vfo=%s\n", __func__,
|
||||||
|
rig_strvfo(priv->tx_vfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->tx_vfo = tx_vfo;
|
|
||||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: priv->tx_vfo=%s\n", __func__,
|
|
||||||
rig_strvfo(priv->tx_vfo));
|
|
||||||
return RIG_OK;
|
return RIG_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3402,6 +3423,7 @@ int kenwood_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd)
|
||||||
*/
|
*/
|
||||||
int kenwood_set_trn(RIG *rig, int trn)
|
int kenwood_set_trn(RIG *rig, int trn)
|
||||||
{
|
{
|
||||||
|
char buf[5];
|
||||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||||
|
|
||||||
switch (rig->caps->rig_model)
|
switch (rig->caps->rig_model)
|
||||||
|
@ -3410,9 +3432,9 @@ int kenwood_set_trn(RIG *rig, int trn)
|
||||||
return kenwood_transaction(rig, (trn == RIG_TRN_RIG) ? "AI2" : "AI0", NULL, 0);
|
return kenwood_transaction(rig, (trn == RIG_TRN_RIG) ? "AI2" : "AI0", NULL, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case RIG_MODEL_THD7A:
|
||||||
case RIG_MODEL_THD74:
|
case RIG_MODEL_THD74:
|
||||||
return kenwood_transaction(rig, (trn == RIG_TRN_RIG) ? "AI 1" : "AI 0", NULL,
|
return kenwood_transaction(rig, (trn == RIG_TRN_RIG) ? "AI 1" : "AI 0", buf, sizeof buf);
|
||||||
4);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -3443,7 +3465,7 @@ int kenwood_get_trn(RIG *rig, int *trn)
|
||||||
return -RIG_ENAVAIL;
|
return -RIG_ENAVAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RIG_IS_THD74)
|
if (RIG_IS_THD74 || RIG_IS_THD7A)
|
||||||
{
|
{
|
||||||
retval = kenwood_safe_transaction(rig, "AI", trnbuf, 6, 4);
|
retval = kenwood_safe_transaction(rig, "AI", trnbuf, 6, 4);
|
||||||
}
|
}
|
||||||
|
@ -3457,7 +3479,7 @@ int kenwood_get_trn(RIG *rig, int *trn)
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RIG_IS_THD74)
|
if (RIG_IS_THD74 || RIG_IS_THD7A)
|
||||||
{
|
{
|
||||||
*trn = trnbuf[3] != '0' ? RIG_TRN_RIG : RIG_TRN_OFF;
|
*trn = trnbuf[3] != '0' ? RIG_TRN_RIG : RIG_TRN_OFF;
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,6 +80,7 @@ extern const struct confparams kenwood_cfg_params[];
|
||||||
#define RIG_IS_HPSDR (rig->caps->rig_model == RIG_MODEL_HPSDR)
|
#define RIG_IS_HPSDR (rig->caps->rig_model == RIG_MODEL_HPSDR)
|
||||||
#define RIG_IS_K2 (rig->caps->rig_model == RIG_MODEL_K2)
|
#define RIG_IS_K2 (rig->caps->rig_model == RIG_MODEL_K2)
|
||||||
#define RIG_IS_K3 (rig->caps->rig_model == RIG_MODEL_K3)
|
#define RIG_IS_K3 (rig->caps->rig_model == RIG_MODEL_K3)
|
||||||
|
#define RIG_IS_THD7A (rig->caps->rig_model == RIG_MODEL_THD7A)
|
||||||
#define RIG_IS_THD74 (rig->caps->rig_model == RIG_MODEL_THD74)
|
#define RIG_IS_THD74 (rig->caps->rig_model == RIG_MODEL_THD74)
|
||||||
#define RIG_IS_TS2000 (rig->caps->rig_model == RIG_MODEL_TS2000)
|
#define RIG_IS_TS2000 (rig->caps->rig_model == RIG_MODEL_TS2000)
|
||||||
#define RIG_IS_TS50 (rig->caps->rig_model == RIG_MODEL_TS50)
|
#define RIG_IS_TS50 (rig->caps->rig_model == RIG_MODEL_TS50)
|
||||||
|
|
|
@ -245,7 +245,7 @@ th_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
||||||
// cppcheck-suppress *
|
// cppcheck-suppress *
|
||||||
sprintf(buf, "FQ %011"PRIll",%X", (int64_t) freq_sent, step);
|
sprintf(buf, "FQ %011"PRIll",%X", (int64_t) freq_sent, step);
|
||||||
|
|
||||||
return kenwood_transaction(rig, buf, NULL, 0);
|
return kenwood_transaction(rig, buf, buf, sizeof buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -293,7 +293,6 @@ int
|
||||||
th_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
th_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
||||||
{
|
{
|
||||||
char kmode, mdbuf[8];
|
char kmode, mdbuf[8];
|
||||||
int retval;
|
|
||||||
const struct kenwood_priv_caps *priv = (const struct kenwood_priv_caps *)
|
const struct kenwood_priv_caps *priv = (const struct kenwood_priv_caps *)
|
||||||
rig->caps->priv;
|
rig->caps->priv;
|
||||||
|
|
||||||
|
@ -338,14 +337,7 @@ th_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
||||||
|
|
||||||
sprintf(mdbuf, "MD %c", kmode);
|
sprintf(mdbuf, "MD %c", kmode);
|
||||||
|
|
||||||
retval = kenwood_transaction(rig, mdbuf, NULL, 0);
|
return kenwood_transaction(rig, mdbuf, mdbuf, sizeof mdbuf);
|
||||||
|
|
||||||
if (retval != RIG_OK)
|
|
||||||
{
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
return RIG_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -422,7 +414,8 @@ th_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
|
||||||
int
|
int
|
||||||
th_set_vfo(RIG *rig, vfo_t vfo)
|
th_set_vfo(RIG *rig, vfo_t vfo)
|
||||||
{
|
{
|
||||||
const char *cmd;
|
int retval;
|
||||||
|
char cmd[8];
|
||||||
|
|
||||||
rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__);
|
rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__);
|
||||||
|
|
||||||
|
@ -437,31 +430,24 @@ th_set_vfo(RIG *rig, vfo_t vfo)
|
||||||
/* set band */
|
/* set band */
|
||||||
if (vfo != RIG_VFO_MEM)
|
if (vfo != RIG_VFO_MEM)
|
||||||
{
|
{
|
||||||
int retval;
|
|
||||||
|
|
||||||
switch (vfo)
|
switch (vfo)
|
||||||
{
|
{
|
||||||
case RIG_VFO_A:
|
case RIG_VFO_A:
|
||||||
case RIG_VFO_VFO:
|
case RIG_VFO_VFO:
|
||||||
case RIG_VFO_MAIN:
|
case RIG_VFO_MAIN:
|
||||||
cmd = "BC 0";
|
strncpy (cmd, "BC 0", sizeof cmd);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RIG_VFO_B:
|
case RIG_VFO_B:
|
||||||
case RIG_VFO_SUB:
|
case RIG_VFO_SUB:
|
||||||
cmd = "BC 1";
|
strncpy (cmd, "BC 1", sizeof cmd);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return kenwood_wrong_vfo(__func__, vfo);
|
return kenwood_wrong_vfo(__func__, vfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
retval = kenwood_simple_transaction(rig, cmd, 5);
|
return kenwood_transaction(rig, cmd, cmd, sizeof cmd);
|
||||||
|
|
||||||
if (retval != RIG_OK)
|
|
||||||
{
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No "VMC" cmd on THD72A/THD74 */
|
/* No "VMC" cmd on THD72A/THD74 */
|
||||||
|
@ -477,23 +463,29 @@ th_set_vfo(RIG *rig, vfo_t vfo)
|
||||||
case RIG_VFO_A:
|
case RIG_VFO_A:
|
||||||
case RIG_VFO_VFO:
|
case RIG_VFO_VFO:
|
||||||
case RIG_VFO_MAIN:
|
case RIG_VFO_MAIN:
|
||||||
cmd = "VMC 0,0";
|
strncpy (cmd, "VMC 0,0", sizeof cmd);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RIG_VFO_B:
|
case RIG_VFO_B:
|
||||||
case RIG_VFO_SUB:
|
case RIG_VFO_SUB:
|
||||||
cmd = "VMC 1,0";
|
strncpy (cmd, "VMC 1,0", sizeof cmd);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RIG_VFO_MEM:
|
case RIG_VFO_MEM:
|
||||||
|
strncpy (cmd, "BC", sizeof cmd);
|
||||||
|
retval = kenwood_transaction (rig, cmd, cmd, sizeof cmd);
|
||||||
|
if (retval != RIG_OK)
|
||||||
|
{
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
if (rig->caps->rig_model == RIG_MODEL_THF7E ||
|
if (rig->caps->rig_model == RIG_MODEL_THF7E ||
|
||||||
rig->caps->rig_model == RIG_MODEL_THF6A)
|
rig->caps->rig_model == RIG_MODEL_THF6A)
|
||||||
{
|
{
|
||||||
cmd = "VMC 0,1";
|
snprintf (cmd, sizeof cmd, "VMC %c,1", cmd[3]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cmd = "VMC 0,2";
|
snprintf (cmd, sizeof cmd, "VMC %c,2", cmd[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -502,7 +494,7 @@ th_set_vfo(RIG *rig, vfo_t vfo)
|
||||||
return kenwood_wrong_vfo(__func__, vfo);
|
return kenwood_wrong_vfo(__func__, vfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
return kenwood_transaction(rig, cmd, NULL, 0);
|
return kenwood_transaction(rig, cmd, cmd, sizeof cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -636,7 +628,7 @@ th_get_vfo(RIG *rig, vfo_t *vfo)
|
||||||
int tm_set_vfo_bc2(RIG *rig, vfo_t vfo)
|
int tm_set_vfo_bc2(RIG *rig, vfo_t vfo)
|
||||||
{
|
{
|
||||||
struct kenwood_priv_data *priv = rig->state.priv;
|
struct kenwood_priv_data *priv = rig->state.priv;
|
||||||
char vfobuf[16], ackbuf[16];
|
char cmd[16];
|
||||||
int vfonum, txvfonum, vfomode = 0;
|
int vfonum, txvfonum, vfomode = 0;
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
|
@ -661,15 +653,15 @@ int tm_set_vfo_bc2(RIG *rig, vfo_t vfo)
|
||||||
|
|
||||||
case RIG_VFO_MEM:
|
case RIG_VFO_MEM:
|
||||||
/* get current band */
|
/* get current band */
|
||||||
sprintf(vfobuf, "BC");
|
snprintf(cmd, sizeof cmd, "BC");
|
||||||
retval = kenwood_transaction(rig, vfobuf, ackbuf, sizeof(ackbuf));
|
retval = kenwood_transaction(rig, cmd, cmd, sizeof cmd);
|
||||||
|
|
||||||
if (retval != RIG_OK)
|
if (retval != RIG_OK)
|
||||||
{
|
{
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
txvfonum = vfonum = ackbuf[3] - '0';
|
txvfonum = vfonum = cmd[3] - '0';
|
||||||
vfomode = 2;
|
vfomode = 2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -678,8 +670,8 @@ int tm_set_vfo_bc2(RIG *rig, vfo_t vfo)
|
||||||
return -RIG_EVFO;
|
return -RIG_EVFO;
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(vfobuf, "VMC %d,%d", vfonum, vfomode);
|
snprintf(cmd, sizeof cmd, "VMC %d,%d", vfonum, vfomode);
|
||||||
retval = kenwood_transaction(rig, vfobuf, NULL, 0);
|
retval = kenwood_transaction(rig, cmd, cmd, sizeof cmd);
|
||||||
|
|
||||||
if (retval != RIG_OK)
|
if (retval != RIG_OK)
|
||||||
{
|
{
|
||||||
|
@ -691,15 +683,8 @@ int tm_set_vfo_bc2(RIG *rig, vfo_t vfo)
|
||||||
return RIG_OK;
|
return RIG_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(vfobuf, "BC %d,%d", vfonum, txvfonum);
|
snprintf(cmd, sizeof cmd, "BC %d,%d", vfonum, txvfonum);
|
||||||
retval = kenwood_transaction(rig, vfobuf, NULL, 0);
|
return kenwood_transaction(rig, cmd, cmd, sizeof cmd);
|
||||||
|
|
||||||
if (retval != RIG_OK)
|
|
||||||
{
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
return RIG_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -752,15 +737,15 @@ int th_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t txvfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set VFO mode. To be done for TX vfo also? */
|
/* Set VFO mode. To be done for TX vfo also? */
|
||||||
sprintf(vfobuf, "VMC %d,0", vfonum);
|
snprintf (vfobuf, sizeof vfobuf, "VMC %d,0", vfonum);
|
||||||
retval = kenwood_transaction(rig, vfobuf, NULL, 0);
|
retval = kenwood_transaction(rig, vfobuf, vfobuf, sizeof vfobuf);
|
||||||
|
|
||||||
if (retval != RIG_OK)
|
if (retval != RIG_OK)
|
||||||
{
|
{
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(vfobuf, "BC %d,%d", vfonum, txvfonum);
|
snprintf (vfobuf, sizeof vfobuf, "BC %d,%d", vfonum, txvfonum);
|
||||||
retval = kenwood_transaction(rig, vfobuf, NULL, 0);
|
retval = kenwood_transaction(rig, vfobuf, NULL, 0);
|
||||||
|
|
||||||
if (retval != RIG_OK)
|
if (retval != RIG_OK)
|
||||||
|
@ -818,8 +803,9 @@ int th_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *txvfo)
|
||||||
int
|
int
|
||||||
th_set_trn(RIG *rig, int trn)
|
th_set_trn(RIG *rig, int trn)
|
||||||
{
|
{
|
||||||
return kenwood_transaction(rig, (trn == RIG_TRN_RIG) ? "AI 1" : "AI 0", NULL,
|
char buf[5];
|
||||||
0);
|
snprintf (buf, sizeof buf, "AI %c", RIG_TRN_RIG == trn ? '1' : '0');
|
||||||
|
return kenwood_transaction (rig, buf, buf, sizeof buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1411,7 +1397,7 @@ th_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone)
|
||||||
{
|
{
|
||||||
const struct rig_caps *caps;
|
const struct rig_caps *caps;
|
||||||
char tonebuf[16];
|
char tonebuf[16];
|
||||||
int i, retval;
|
int i;
|
||||||
|
|
||||||
rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__);
|
rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__);
|
||||||
|
|
||||||
|
@ -1431,15 +1417,8 @@ th_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone)
|
||||||
}
|
}
|
||||||
|
|
||||||
i += (i == 0) ? 1 : 2; /* Correct for TH-D7A index anomally */
|
i += (i == 0) ? 1 : 2; /* Correct for TH-D7A index anomally */
|
||||||
sprintf(tonebuf, "TN %02d", i);
|
snprintf (tonebuf, sizeof tonebuf, "TN %02d", i);
|
||||||
retval = kenwood_transaction(rig, tonebuf, NULL, 0);
|
return kenwood_transaction (rig, tonebuf, tonebuf, sizeof tonebuf);
|
||||||
|
|
||||||
if (retval != RIG_OK)
|
|
||||||
{
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
return RIG_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1496,7 +1475,7 @@ th_set_ctcss_sql(RIG *rig, vfo_t vfo, tone_t tone)
|
||||||
{
|
{
|
||||||
const struct rig_caps *caps;
|
const struct rig_caps *caps;
|
||||||
char tonebuf[16];
|
char tonebuf[16];
|
||||||
int i, retval;
|
int i;
|
||||||
|
|
||||||
rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__);
|
rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__);
|
||||||
|
|
||||||
|
@ -1516,15 +1495,8 @@ th_set_ctcss_sql(RIG *rig, vfo_t vfo, tone_t tone)
|
||||||
}
|
}
|
||||||
|
|
||||||
i += (i == 0) ? 1 : 2; /* Correct for TH-D7A index anomally */
|
i += (i == 0) ? 1 : 2; /* Correct for TH-D7A index anomally */
|
||||||
sprintf(tonebuf, "CTN %02d", i);
|
snprintf (tonebuf, sizeof tonebuf, "CTN %02d", i);
|
||||||
retval = kenwood_transaction(rig, tonebuf, NULL, 0);
|
return kenwood_transaction (rig, tonebuf, tonebuf, sizeof tonebuf);
|
||||||
|
|
||||||
if (retval != RIG_OK)
|
|
||||||
{
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
return RIG_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1593,7 +1565,8 @@ th_set_dcs_sql(RIG *rig, vfo_t vfo, tone_t code)
|
||||||
|
|
||||||
if (code == 0)
|
if (code == 0)
|
||||||
{
|
{
|
||||||
return kenwood_transaction(rig, "DCS 0", NULL, 0);
|
snprintf (codebuf, sizeof codebuf, "DCS 0");
|
||||||
|
return kenwood_transaction(rig, codebuf, codebuf, sizeof codebuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; caps->dcs_list[i] != 0; i++)
|
for (i = 0; caps->dcs_list[i] != 0; i++)
|
||||||
|
@ -1609,22 +1582,14 @@ th_set_dcs_sql(RIG *rig, vfo_t vfo, tone_t code)
|
||||||
return -RIG_EINVAL;
|
return -RIG_EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
retval = kenwood_transaction(rig, "DCS 1", NULL, 0);
|
snprintf (codebuf, sizeof codebuf, "DCS 1");
|
||||||
|
if ((retval = kenwood_transaction(rig, codebuf, codebuf, sizeof codebuf)) != RIG_OK)
|
||||||
if (retval != RIG_OK)
|
|
||||||
{
|
{
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(codebuf, "DCSN %04d", (i + 1) * 10);
|
snprintf(codebuf, sizeof codebuf, "DCSN %04d", (i + 1) * 10);
|
||||||
retval = kenwood_transaction(rig, codebuf, NULL, 0);
|
return kenwood_transaction (rig, codebuf, codebuf, sizeof codebuf);
|
||||||
|
|
||||||
if (retval != RIG_OK)
|
|
||||||
{
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
return RIG_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1730,7 +1695,7 @@ int
|
||||||
th_set_mem(RIG *rig, vfo_t vfo, int ch)
|
th_set_mem(RIG *rig, vfo_t vfo, int ch)
|
||||||
{
|
{
|
||||||
unsigned char vsel;
|
unsigned char vsel;
|
||||||
char membuf[10], ackbuf[10];
|
char membuf[10];
|
||||||
int retval;
|
int retval;
|
||||||
vfo_t tvfo;
|
vfo_t tvfo;
|
||||||
|
|
||||||
|
@ -1754,23 +1719,13 @@ th_set_mem(RIG *rig, vfo_t vfo, int ch)
|
||||||
return kenwood_wrong_vfo(__func__, vfo);
|
return kenwood_wrong_vfo(__func__, vfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
retval = rig_set_vfo(rig, RIG_VFO_MEM);
|
if ((retval = rig_set_vfo(rig, RIG_VFO_MEM)) != RIG_OK)
|
||||||
|
|
||||||
if (retval != RIG_OK)
|
|
||||||
{
|
{
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(membuf, "MC %c,%03i", vsel, ch);
|
snprintf (membuf, sizeof membuf, "MC %c,%03i", vsel, ch);
|
||||||
|
return kenwood_transaction (rig, membuf, membuf, sizeof membuf);
|
||||||
retval = kenwood_safe_transaction(rig, membuf, ackbuf, 10, 8);
|
|
||||||
|
|
||||||
if (retval != RIG_OK)
|
|
||||||
{
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
return RIG_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get mem works only when the display is
|
/* Get mem works only when the display is
|
||||||
|
@ -1844,9 +1799,9 @@ th_get_mem(RIG *rig, vfo_t vfo, int *ch)
|
||||||
int
|
int
|
||||||
th_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
|
th_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
|
||||||
{
|
{
|
||||||
|
char buf[3];
|
||||||
rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__);
|
rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__);
|
||||||
|
return kenwood_transaction(rig, (ptt == RIG_PTT_ON) ? "TX" : "RX", buf, sizeof buf);
|
||||||
return kenwood_transaction(rig, (ptt == RIG_PTT_ON) ? "TX" : "RX", NULL, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int th_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd)
|
int th_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd)
|
||||||
|
@ -2482,7 +2437,7 @@ int th_set_channel(RIG *rig, const channel_t *chan)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
retval = kenwood_transaction(rig, membuf, NULL, 0);
|
retval = kenwood_transaction(rig, membuf, membuf, sizeof membuf);
|
||||||
|
|
||||||
if (retval != RIG_OK)
|
if (retval != RIG_OK)
|
||||||
{
|
{
|
||||||
|
@ -2498,7 +2453,7 @@ int th_set_channel(RIG *rig, const channel_t *chan)
|
||||||
req[3 + strlen(mr_extra)] = '1';
|
req[3 + strlen(mr_extra)] = '1';
|
||||||
|
|
||||||
sprintf(membuf, "%s,%011"PRIll",%X", req, (int64_t)chan->tx_freq, step);
|
sprintf(membuf, "%s,%011"PRIll",%X", req, (int64_t)chan->tx_freq, step);
|
||||||
retval = kenwood_transaction(rig, membuf, NULL, 0);
|
retval = kenwood_transaction(rig, membuf, membuf, sizeof membuf);
|
||||||
|
|
||||||
if (retval != RIG_OK)
|
if (retval != RIG_OK)
|
||||||
{
|
{
|
||||||
|
@ -2519,7 +2474,7 @@ int th_set_channel(RIG *rig, const channel_t *chan)
|
||||||
sprintf(membuf, "MNA %s%03d,%s", mr_extra, channel_num, channel_desc);
|
sprintf(membuf, "MNA %s%03d,%s", mr_extra, channel_num, channel_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
retval = kenwood_transaction(rig, membuf, NULL, 0);
|
retval = kenwood_transaction(rig, membuf, membuf, sizeof membuf);
|
||||||
|
|
||||||
if (retval != RIG_OK)
|
if (retval != RIG_OK)
|
||||||
{
|
{
|
||||||
|
@ -2535,29 +2490,29 @@ int th_set_channel(RIG *rig, const channel_t *chan)
|
||||||
*/
|
*/
|
||||||
int th_set_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t option)
|
int th_set_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t option)
|
||||||
{
|
{
|
||||||
const char *cmd;
|
char cmd[6];
|
||||||
|
|
||||||
rig_debug(RIG_DEBUG_TRACE, "%s: ant = %d\n", __func__, ant);
|
rig_debug(RIG_DEBUG_TRACE, "%s: ant = %d\n", __func__, ant);
|
||||||
|
|
||||||
switch (ant)
|
switch (ant)
|
||||||
{
|
{
|
||||||
case RIG_ANT_1:
|
case RIG_ANT_1:
|
||||||
cmd = "ANT 0";
|
strncpy (cmd, "ANT 0", sizeof cmd);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RIG_ANT_2:
|
case RIG_ANT_2:
|
||||||
cmd = "ANT 1";
|
strncpy (cmd, "ANT 1", sizeof cmd);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RIG_ANT_3:
|
case RIG_ANT_3:
|
||||||
cmd = "ANT 2";
|
strncpy (cmd, "ANT 2", sizeof cmd);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return -RIG_EINVAL;
|
return -RIG_EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return kenwood_transaction(rig, cmd, NULL, 0);
|
return kenwood_transaction(rig, cmd, cmd, sizeof cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
#include "idx_builtin.h"
|
#include "idx_builtin.h"
|
||||||
|
|
||||||
#define TH_VER "20200212"
|
#define TH_VER "20200701"
|
||||||
|
|
||||||
extern int th_transaction (RIG *rig, const char *cmdstr, char *data, size_t datasize);
|
extern int th_transaction (RIG *rig, const char *cmdstr, char *data, size_t datasize);
|
||||||
extern int th_get_vfo_char(RIG *rig, vfo_t *vfo, char *vfoch);
|
extern int th_get_vfo_char(RIG *rig, vfo_t *vfo, char *vfoch);
|
||||||
|
|
|
@ -88,7 +88,7 @@ const struct rig_caps thd7a_caps =
|
||||||
.mfg_name = "Kenwood",
|
.mfg_name = "Kenwood",
|
||||||
.version = TH_VER ".0",
|
.version = TH_VER ".0",
|
||||||
.copyright = "LGPL",
|
.copyright = "LGPL",
|
||||||
.status = RIG_STATUS_ALPHA,
|
.status = RIG_STATUS_BETA,
|
||||||
.rig_type = RIG_TYPE_HANDHELD | RIG_FLAG_APRS | RIG_FLAG_TNC | RIG_FLAG_DXCLUSTER,
|
.rig_type = RIG_TYPE_HANDHELD | RIG_FLAG_APRS | RIG_FLAG_TNC | RIG_FLAG_DXCLUSTER,
|
||||||
.ptt_type = RIG_PTT_RIG,
|
.ptt_type = RIG_PTT_RIG,
|
||||||
.dcd_type = RIG_DCD_RIG,
|
.dcd_type = RIG_DCD_RIG,
|
||||||
|
@ -195,7 +195,7 @@ const struct rig_caps thd7a_caps =
|
||||||
.get_parm = th_get_parm,
|
.get_parm = th_get_parm,
|
||||||
.get_info = th_get_info,
|
.get_info = th_get_info,
|
||||||
|
|
||||||
.get_dcd = kenwood_get_dcd,
|
.get_dcd = th_get_dcd,
|
||||||
|
|
||||||
.decode_event = th_decode_event,
|
.decode_event = th_decode_event,
|
||||||
};
|
};
|
||||||
|
|
Ładowanie…
Reference in New Issue