Add newer Set 2 RIT command to appropriate kenwood rigs

pull/345/head
Michael Black W9MDB 2020-06-21 15:44:01 -05:00
rodzic 3cb79b3bca
commit d95bcccc94
2 zmienionych plików z 38 dodań i 23 usunięć

Wyświetl plik

@ -744,6 +744,18 @@ int kenwood_open(RIG *rig)
}
}
if (RIG_IS_TS2000
|| RIG_IS_TS480
|| RIG_IS_TS590S
|| RIG_IS_TS590SG
|| RIG_IS_TS890S
|| RIG_IS_TS990S)
{
// rig has Set 2 RIT/XIT function
rig_debug(RIG_DEBUG_TRACE, "%s: rig has_rit2\n", __func__);
priv->has_rit2 = 1;
}
if (RIG_IS_TS590S)
{
/* we need the firmware version for these rigs to deal with f/w defects */
@ -1652,9 +1664,11 @@ int kenwood_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit)
int retval, i;
shortfreq_t curr_rit;
int diff;
struct kenwood_priv_data *priv = rig->state.priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s called: vfo=%s, rit=%ld\n", __func__,
rig_strvfo(vfo), rit);
rig_debug(RIG_DEBUG_VERBOSE, "%s called: vfo=%s, rit=%ld, has_rit2=%d\n",
__func__,
rig_strvfo(vfo), rit, priv->has_rit2);
retval = kenwood_get_rit(rig, vfo, &curr_rit);
@ -1663,28 +1677,32 @@ int kenwood_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit)
return retval;
}
rig_debug(RIG_DEBUG_VERBOSE, "%s get_rit=%ld\n", __func__, curr_rit);
if (rit == 0)
if (priv->has_rit2) // if backend shows it has the Set 2 command
{
return kenwood_transaction(rig, "RC", NULL, 0);
char cmd[10];
snprintf(cmd, sizeof(cmd) - 1, "R%c%05d", rit > 0 ? 'U' : 'D', (int)rit);
retval = kenwood_transaction(rig, cmd, NULL, 0);
}
retval = kenwood_transaction(rig, "RC", NULL, 0);
if (retval != RIG_OK)
else
{
return retval;
}
retval = kenwood_transaction(rig, "RC", NULL, 0);
snprintf(buf, sizeof(buf), "R%c", (rit > 0) ? 'U' : 'D');
if (retval != RIG_OK)
{
return retval;
}
diff = labs((rit + rit >= 0 ? 5 : -5) / 10); // round to nearest
rig_debug(RIG_DEBUG_TRACE, "%s: rit change loop=%d\n", __func__, diff);
if (rit == 0) { return RIG_OK; } // we're done here
for (i = 0; i < diff; i++)
{
retval = kenwood_transaction(rig, buf, NULL, 0);
snprintf(buf, sizeof(buf), "R%c", (rit > 0) ? 'U' : 'D');
diff = labs((rit + rit >= 0 ? 5 : -5) / 10); // round to nearest
rig_debug(RIG_DEBUG_TRACE, "%s: rit change loop=%d\n", __func__, diff);
for (i = 0; i < diff; i++)
{
retval = kenwood_transaction(rig, buf, NULL, 0);
}
}
return retval;

Wyświetl plik

@ -84,7 +84,7 @@ extern const struct confparams kenwood_cfg_params[];
#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_TS450S (rig->caps->rig_model == RIG_MODEL_TS450S)
#define RIG_IS_TS450S (rig->caps->rig_model == RIG_MODEL_TS450S)
#define RIG_IS_TS480 (rig->caps->rig_model == RIG_MODEL_TS480)
#define RIG_IS_TS590S (rig->caps->rig_model == RIG_MODEL_TS590S)
#define RIG_IS_TS590SG (rig->caps->rig_model == RIG_MODEL_TS590SG)
#define RIG_IS_TS690S (rig->caps->rig_model == RIG_MODEL_TS690S)
@ -120,13 +120,10 @@ struct kenwood_priv_data
int is_emulation; /* flag for TS-2000 emulations */
void *data; /* model specific data */
rmode_t curr_mode; /* used for is_emulation to avoid get_mode on VFOB */
// Boolean flags true when model is in use
int is_590s;
int is_590sg;
int is_950;
struct timespec cache_start;
char last_if_response[KENWOOD_MAX_BUF_LEN];
int poweron; /* to avoid powering on more than once */
int has_rit2; /* rig has set 2 rit command */
};