Fix rig_set_split problem on Kenwood rigs

https://github.com/Hamlib/Hamlib/issues/872
Hamlib-4.4
Mike Black W9MDB 2021-11-19 16:19:18 -06:00
rodzic 050826bb44
commit 4b3bbabc5d
2 zmienionych plików z 24 dodań i 6 usunięć

Wyświetl plik

@ -49,6 +49,8 @@ struct netrigctl_priv_data
{ {
vfo_t vfo_curr; vfo_t vfo_curr;
int rigctld_vfo_mode; int rigctld_vfo_mode;
vfo_t rx_vfo;
vfo_t tx_vfo;
}; };
int netrigctl_get_vfo_mode(RIG *rig) int netrigctl_get_vfo_mode(RIG *rig)
@ -120,6 +122,8 @@ static int netrigctl_vfostr(RIG *rig, char *vfostr, int len, vfo_t vfo)
if (vfo == RIG_VFO_NONE) { vfo = RIG_VFO_A; } if (vfo == RIG_VFO_NONE) { vfo = RIG_VFO_A; }
} }
else if (vfo == RIG_VFO_RX) vfo = priv->rx_vfo;
else if (vfo == RIG_VFO_TX) vfo = priv->tx_vfo;
rig_debug(RIG_DEBUG_TRACE, "%s: vfo_opt=%d\n", __func__, rig->state.vfo_opt); rig_debug(RIG_DEBUG_TRACE, "%s: vfo_opt=%d\n", __func__, rig->state.vfo_opt);
@ -262,6 +266,8 @@ static int netrigctl_open(RIG *rig)
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
priv = (struct netrigctl_priv_data *)rig->state.priv; priv = (struct netrigctl_priv_data *)rig->state.priv;
priv->rx_vfo = RIG_VFO_A;
priv->tx_vfo = RIG_VFO_B;
len = sprintf(cmd, "\\chk_vfo\n"); len = sprintf(cmd, "\\chk_vfo\n");
ret = netrigctl_transaction(rig, cmd, len, buf); ret = netrigctl_transaction(rig, cmd, len, buf);
@ -621,7 +627,10 @@ static int netrigctl_open(RIG *rig)
rs->mode_list |= rs->tx_range_list[i].modes; rs->mode_list |= rs->tx_range_list[i].modes;
rs->vfo_list |= rs->tx_range_list[i].vfo; rs->vfo_list |= rs->tx_range_list[i].vfo;
} }
if (rs->vfo_list == 0) rs->vfo_list = RIG_VFO_A|RIG_VFO_B; if (rs->vfo_list == 0) {
rig_debug(RIG_DEBUG_VERBOSE, "%s: vfo_list empty, defaulting to A/B\n", __func__);
rs->vfo_list = RIG_VFO_A|RIG_VFO_B;
}
if (prot_ver == 0) { return RIG_OK; } if (prot_ver == 0) { return RIG_OK; }
@ -2570,7 +2579,7 @@ struct rig_caps netrigctl_caps =
RIG_MODEL(RIG_MODEL_NETRIGCTL), RIG_MODEL(RIG_MODEL_NETRIGCTL),
.model_name = "NET rigctl", .model_name = "NET rigctl",
.mfg_name = "Hamlib", .mfg_name = "Hamlib",
.version = "20211107.0", .version = "20211118.0",
.copyright = "LGPL", .copyright = "LGPL",
.status = RIG_STATUS_STABLE, .status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_OTHER, .rig_type = RIG_TYPE_OTHER,

Wyświetl plik

@ -4266,7 +4266,7 @@ int HAMLIB_API rig_set_split_mode(RIG *rig,
{ {
const struct rig_caps *caps; const struct rig_caps *caps;
int retcode, rc2; int retcode, rc2;
vfo_t curr_vfo, tx_vfo; vfo_t curr_vfo, tx_vfo, rx_vfo;
ELAPSED1; ELAPSED1;
ENTERFUNC; ENTERFUNC;
@ -4303,12 +4303,15 @@ int HAMLIB_API rig_set_split_mode(RIG *rig,
/* Use previously setup TxVFO */ /* Use previously setup TxVFO */
if (vfo == RIG_VFO_CURR || vfo == RIG_VFO_TX) if (vfo == RIG_VFO_CURR || vfo == RIG_VFO_TX)
{ {
TRACE;
tx_vfo = rig->state.tx_vfo; tx_vfo = rig->state.tx_vfo;
} }
else else
{ {
TRACE;
tx_vfo = vfo; tx_vfo = vfo;
} }
rig_debug(RIG_DEBUG_VERBOSE, "%s: curr_vfo=%s, tx_vfo=%s\n", __func__, rig_strvfo(curr_vfo), rig_strvfo(tx_vfo));
if (caps->set_mode && (caps->targetable_vfo & RIG_TARGETABLE_MODE)) if (caps->set_mode && (caps->targetable_vfo & RIG_TARGETABLE_MODE))
{ {
@ -4320,7 +4323,13 @@ int HAMLIB_API rig_set_split_mode(RIG *rig,
// some rigs exhibit undesirable flashing when swapping vfos in split // some rigs exhibit undesirable flashing when swapping vfos in split
// so we turn it off, do our thing, and turn split back on // so we turn it off, do our thing, and turn split back on
rig_set_split_vfo(rig,RIG_VFO_CURR, RIG_SPLIT_OFF, RIG_VFO_CURR); rx_vfo = RIG_VFO_A;
if (vfo == RIG_VFO_CURR && tx_vfo == RIG_VFO_B) rx_vfo = RIG_VFO_A;
else if (vfo == RIG_VFO_CURR && tx_vfo == RIG_VFO_A) rx_vfo = RIG_VFO_B;
else if (vfo == RIG_VFO_CURR && tx_vfo == RIG_VFO_MAIN) rx_vfo = RIG_VFO_SUB;
else if (vfo == RIG_VFO_CURR && tx_vfo == RIG_VFO_SUB) rx_vfo = RIG_VFO_MAIN;
rig_debug(RIG_DEBUG_VERBOSE, "%s: rx_vfo=%s, tx_vfo=%s\n", __func__, rig_strvfo(rx_vfo), rig_strvfo(tx_vfo));
rig_set_split_vfo(rig,rx_vfo, RIG_SPLIT_OFF, rx_vfo);
if (caps->set_vfo) if (caps->set_vfo)
{ {
TRACE; TRACE;
@ -4360,7 +4369,7 @@ int HAMLIB_API rig_set_split_mode(RIG *rig,
if (caps->set_vfo) if (caps->set_vfo)
{ {
TRACE; TRACE;
rc2 = caps->set_vfo(rig, curr_vfo); rc2 = caps->set_vfo(rig, rx_vfo);
} }
else else
{ {
@ -4372,7 +4381,7 @@ int HAMLIB_API rig_set_split_mode(RIG *rig,
/* return the first error code */ /* return the first error code */
retcode = rc2; retcode = rc2;
} }
rig_set_split_vfo(rig,RIG_VFO_CURR, RIG_SPLIT_ON, RIG_VFO_CURR); rig_set_split_vfo(rig,rx_vfo, RIG_SPLIT_ON, tx_vfo);
ELAPSED2; ELAPSED2;
RETURNFUNC(retcode); RETURNFUNC(retcode);