Fix RIT in kenwood.c -- default to 10Hz steps if rig step setting works

https://github.com/Hamlib/Hamlib/issues/677
pull/680/head
Mike Black W9MDB 2021-04-23 23:37:44 -05:00
rodzic 1d79b9e01c
commit 0a4e0dbdfb
2 zmienionych plików z 18 dodań i 40 usunięć

Wyświetl plik

@ -782,18 +782,6 @@ int kenwood_open(RIG *rig)
"%s: no response to get_id from rig...continuing anyways.\n", __func__);
}
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 */
@ -1733,11 +1721,10 @@ 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, has_rit2=%d\n",
rig_debug(RIG_DEBUG_VERBOSE, "%s called: vfo=%s, rit=%ld\n",
__func__,
rig_strvfo(vfo), rit, priv->has_rit2);
rig_strvfo(vfo), rit);
retval = kenwood_get_rit(rig, vfo, &curr_rit);
@ -1746,32 +1733,24 @@ int kenwood_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit)
RETURNFUNC(retval);
}
if (priv->has_rit2) // if backend shows it has the Set 2 command
// we'll set the rigs that have a rit step setting to 10Hz steps
retval = kenwood_transaction(rig, "RC;RU00010", NULL, 0);
if (retval != RIG_OK)
{
char cmd[15]; // length required to make Apple-gcc happy (unicode-proof).
snprintf(cmd, sizeof(cmd) - 1, "R%c%05d", rit > 0 ? 'U' : 'D', abs((int)rit));
retval = kenwood_transaction(rig, cmd, NULL, 0);
RETURNFUNC(retval);
}
else
if (rit == 0) { RETURNFUNC(RIG_OK); } // we're done here
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, "RC", NULL, 0);
if (retval != RIG_OK)
{
RETURNFUNC(retval);
}
if (rit == 0) { RETURNFUNC(RIG_OK); } // we're done here
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);
}
retval = kenwood_transaction(rig, buf, NULL, 0);
}
RETURNFUNC(retval);

Wyświetl plik

@ -28,7 +28,7 @@
#include "token.h"
#include "misc.h"
#define BACKEND_VER "20210406"
#define BACKEND_VER "20210423"
#define EOM_KEN ';'
#define EOM_TH '\r'
@ -133,7 +133,6 @@ struct kenwood_priv_data
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 */
int ag_format; /* which AG command is being used...see LEVEL_AF in kenwood.c*/
int micgain_min, micgain_max; /* varies by rig so we figure it out automagically */
int is_k2;