Change yaesu newcat_get_rit to use "OI" instead of vfo swapping

Change yaesu newcat_set_rit to do vfo swap if needed
https://github.com/Hamlib/Hamlib/issues/430
pull/435/head
Michael Black W9MDB 2020-11-02 17:21:20 -06:00
rodzic 51b4e0966c
commit 072cd6107f
2 zmienionych plików z 40 dodań i 4 usunięć

Wyświetl plik

@ -1735,12 +1735,29 @@ int newcat_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo)
int newcat_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
int vfo_swap = 0;
vfo_t oldvfo;
int ret;
if (!newcat_valid_command(rig, "RT"))
{
return -RIG_ENAVAIL;
}
if (rig->state.current_vfo != vfo)
{
oldvfo = rig->state.current_vfo;
ret = newcat_set_vfo(rig, vfo);
if (ret != RIG_OK)
{
rig_debug(RIG_DEBUG_ERR, "%s: error setting vfo=%s\n", __func__,
rig_strvfo(vfo));
}
vfo_swap = 1;
}
if (rit > rig->caps->max_rit)
{
rit = rig->caps->max_rit; /* + */
@ -1766,7 +1783,20 @@ int newcat_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit)
labs(rit), cat_term);
}
return newcat_set_cmd(rig);
ret = newcat_set_cmd(rig);
if (vfo_swap)
{
newcat_set_vfo(rig, oldvfo);
if (ret != RIG_OK)
{
rig_debug(RIG_DEBUG_ERR, "%s: error setting vfo=%s\n", __func__,
rig_strvfo(vfo));
}
}
return ret;
}
@ -1776,8 +1806,14 @@ int newcat_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit)
char *retval;
int err;
int offset = 0;
char *cmd = "IF";
if (!newcat_valid_command(rig, "IF"))
if (vfo == RIG_VFO_B || vfo == RIG_VFO_SUB)
{
cmd = "OI";
}
if (!newcat_valid_command(rig, cmd))
{
return -RIG_ENAVAIL;
}
@ -1786,7 +1822,7 @@ int newcat_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit)
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "%s%c", "IF", cat_term);
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "%s%c", cmd, cat_term);
rig_debug(RIG_DEBUG_TRACE, "%s: cmd_str = %s\n", __func__, priv->cmd_str);

Wyświetl plik

@ -50,7 +50,7 @@
typedef char ncboolean;
/* shared function version */
#define NEWCAT_VER "20201029"
#define NEWCAT_VER "20201102"
/* Hopefully large enough for future use, 128 chars plus '\0' */
#define NEWCAT_DATA_LEN 129