Factor out TS-890S and TS-990S from kenwood_get_split_vfo_if()

Fix TS-890S to return correct VFO
More of issue #1380
pull/1630/head
George Baltz N3GB 2024-11-20 16:35:15 -05:00
rodzic 238344b0ce
commit c080ba7b82
3 zmienionych plików z 79 dodań i 27 usunięć

Wyświetl plik

@ -1675,7 +1675,7 @@ int kenwood_set_split(RIG *rig, vfo_t vfo, split_t split, vfo_t txvfo)
}
/* IF TB
/* IF
* Gets split VFO status from kenwood_get_if()
*
*/
@ -1694,30 +1694,6 @@ int kenwood_get_split_vfo_if(RIG *rig, vfo_t rxvfo, split_t *split,
RETURNFUNC(-RIG_EINVAL);
}
if (RIG_IS_TS990S || RIG_IS_TS890S)
{
char buf[4];
if (RIG_OK == (retval = kenwood_safe_transaction(rig, "TB", buf, sizeof(buf),
3)))
{
if ('1' == buf[2])
{
*split = RIG_SPLIT_ON;
*txvfo = RIG_VFO_SUB;
priv->tx_vfo = rs->tx_vfo = *txvfo;
}
else
{
*split = RIG_SPLIT_OFF;
*txvfo = RIG_VFO_MAIN;
priv->tx_vfo = rs->tx_vfo = *txvfo;
}
}
RETURNFUNC(retval);
}
retval = kenwood_get_if(rig);
if (retval != RIG_OK)

Wyświetl plik

@ -466,6 +466,50 @@ static int ts890_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
return RIG_OK;
}
/*
* Gets split VFO status
*
*/
static int ts890s_get_split_vfo(RIG *rig, vfo_t rxvfo, split_t *split,
vfo_t *txvfo)
{
char buf[4];
int retval;
vfo_t tvfo;
struct rig_state *rs = STATE(rig);
struct kenwood_priv_data *priv = rs->priv;
if (RIG_OK == (retval = kenwood_safe_transaction(rig, "FT", buf, sizeof(buf),
3)))
{
if ('0' == buf[2])
{
tvfo = RIG_VFO_A;
}
else if ('1' == buf[2])
{
tvfo = RIG_VFO_B;
}
else if ('3' == buf[2])
{
tvfo = RIG_VFO_MEM;
}
else
{
rig_debug(RIG_DEBUG_ERR, "%s: Unknown VFO - %s\n", __func__, buf);
return -RIG_EPROTO;
}
*txvfo = priv->tx_vfo = rs->tx_vfo = tvfo;
// Now get split status
retval = kenwood_safe_transaction(rig, "TB", buf, sizeof buf, 3);
if (RIG_OK != retval) {return retval;}
*split = priv->split = buf[2] == '1';
}
return retval;
}
static struct kenwood_priv_caps ts890s_priv_caps =
{
@ -626,7 +670,7 @@ struct rig_caps ts890s_caps =
.set_vfo = kenwood_set_vfo,
.get_vfo = kenwood_get_vfo_if,
.set_split_vfo = kenwood_set_split_vfo,
.get_split_vfo = kenwood_get_split_vfo_if,
.get_split_vfo = ts890s_get_split_vfo,
.set_ctcss_tone = kenwood_set_ctcss_tone_tn,
.get_ctcss_tone = kenwood_get_ctcss_tone,
.set_ctcss_sql = kenwood_set_ctcss_sql,

Wyświetl plik

@ -88,6 +88,7 @@
/* prototypes */
static int ts990s_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val);
static int ts990s_get_split_vfo(RIG *rig, vfo_t rxvfo, split_t *split, vfo_t *txvfo);
static rmode_t ts990s_mode_table[KENWOOD_MODE_TABLE_MAX] =
{
@ -352,7 +353,7 @@ struct rig_caps ts990s_caps =
.set_vfo = kenwood_set_vfo_main_sub,
.get_vfo = kenwood_get_vfo_main_sub,
.set_split_vfo = kenwood_set_split_vfo,
.get_split_vfo = kenwood_get_split_vfo_if,
.get_split_vfo = ts990s_get_split_vfo,
.set_ctcss_tone = kenwood_set_ctcss_tone_tn,
.get_ctcss_tone = kenwood_get_ctcss_tone,
.set_ctcss_sql = kenwood_set_ctcss_sql,
@ -761,3 +762,34 @@ int ts990s_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
return retval;
}
/*
* Gets split VFO status
*
*/
static int ts990s_get_split_vfo(RIG *rig, vfo_t rxvfo, split_t *split,
vfo_t *txvfo)
{
char buf[4];
int retval;
struct rig_state *rs = STATE(rig);
struct kenwood_priv_data *priv = rs->priv;
if (RIG_OK == (retval = kenwood_safe_transaction(rig, "TB", buf, sizeof(buf),
3)))
{
if ('1' == buf[2])
{
*split = RIG_SPLIT_ON;
*txvfo = RIG_VFO_SUB;
}
else
{
*split = RIG_SPLIT_OFF;
*txvfo = RIG_VFO_MAIN;
}
priv->tx_vfo = rs->tx_vfo = *txvfo;
}
return retval;
}