Disallow set_split_vfo when ptt is active

https://github.com/Hamlib/Hamlib/issues/844
pull/846/head
Mike Black W9MDB 2021-10-28 09:44:57 -05:00
rodzic ab0d25ce3b
commit db9cd44bcf
1 zmienionych plików z 13 dodań i 2 usunięć

Wyświetl plik

@ -2670,6 +2670,7 @@ pbwidth_t HAMLIB_API rig_passband_wide(RIG *rig, rmode_t mode)
RETURNFUNC(0); RETURNFUNC(0);
} }
//#define BUILTINFUNC 1
/** /**
* \brief set the current VFO * \brief set the current VFO
@ -4238,14 +4239,18 @@ int HAMLIB_API rig_set_split_mode(RIG *rig,
tx_vfo = vfo; tx_vfo = vfo;
} }
if (caps->set_mode && (caps->targetable_vfo & RIG_TARGETABLE_MODE)) // if mode is not targetable than we don't need to set VFOB mode
int modefixed = !(caps->targetable_vfo & RIG_TARGETABLE_MODE);
if (modefixed) vfo = RIG_VFO_A;
if ((caps->set_mode && (caps->targetable_vfo & RIG_TARGETABLE_MODE)))
{ {
TRACE; rig_debug(RIG_DEBUG_VERBOSE, "%s: mode targetable\n", __func__);
retcode = caps->set_mode(rig, tx_vfo, tx_mode, tx_width); retcode = caps->set_mode(rig, tx_vfo, tx_mode, tx_width);
RETURNFUNC(retcode); RETURNFUNC(retcode);
} }
rig_debug(RIG_DEBUG_VERBOSE, "%s: mode not targetable\n", __func__);
if (caps->set_vfo) if (caps->set_vfo)
{ {
TRACE; TRACE;
@ -4652,6 +4657,12 @@ int HAMLIB_API rig_set_split_vfo(RIG *rig,
RETURNFUNC(-RIG_ENAVAIL); RETURNFUNC(-RIG_ENAVAIL);
} }
if (rig->state.cache.ptt)
{
rig_debug(RIG_DEBUG_WARN, "%s: cannot execute when PTT is on\n", __func__);
return RIG_OK;
}
// We fix up vfos for non-satmode rigs only // We fix up vfos for non-satmode rigs only
if (rig->caps->has_get_func & RIG_FUNC_SATMODE) if (rig->caps->has_get_func & RIG_FUNC_SATMODE)
{ {