Allow rig_set_split_mode to skip setting if mode already set

https://github.com/Hamlib/Hamlib/issues/1056
pull/1068/head
Mike Black W9MDB 2022-06-07 08:33:18 -05:00
rodzic 3b8f52d03d
commit ce99f4c75d
2 zmienionych plików z 21 dodań i 1 usunięć

Wyświetl plik

@ -141,7 +141,7 @@ const struct rig_caps ft991_caps =
RIG_MODEL(RIG_MODEL_FT991),
.model_name = "FT-991",
.mfg_name = "Yaesu",
.version = NEWCAT_VER ".11",
.version = NEWCAT_VER ".12",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER,
@ -412,6 +412,12 @@ ft991_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
return (rval);
}
if (rig->state.cache.freqMainB == tx_freq)
{
rig_debug(RIG_DEBUG_TRACE, "%s: freq %.0f already set on VFOB\n", __func__, tx_freq);
return RIG_OK;
}
if (is_split == RIG_SPLIT_OFF)
{
rval = newcat_set_tx_vfo(rig, RIG_VFO_B);
@ -582,6 +588,12 @@ static int ft991_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode,
return -RIG_EINVAL;
}
if (rig->state.cache.modeMainB == tx_mode)
{
rig_debug(RIG_DEBUG_TRACE, "%s: mode %s already set on VFOB\n", __func__, rig_strrmode(tx_mode));
return RIG_OK;
}
err = ft991_get_tx_split(rig, &is_split);
if (err != RIG_OK)

Wyświetl plik

@ -4149,6 +4149,14 @@ int HAMLIB_API rig_set_split_mode(RIG *rig,
RETURNFUNC(-RIG_EINVAL);
}
// we check both VFOs are in the same tx mode -- the we can ignore
// this could be make more intelligent but this should cover all cases where we can skip this
if (tx_mode == rig->state.cache.modeMainA && tx_mode == rig->state.cache.modeMainB)
{
rig_debug(RIG_DEBUG_TRACE, "%s: mode already %s so no change required\n", __func__, rig_strrmode(tx_mode));
return RIG_OK;
}
// do not mess with mode while PTT is on
if (rig->state.cache.ptt)
{