kopia lustrzana https://github.com/Hamlib/Hamlib
Check split argument in dummy_get_split_mode() and fix the test
rodzic
df6ddedf63
commit
bc25855f48
|
@ -51,13 +51,13 @@ class TestClass:
|
|||
info = rig.get_info()
|
||||
assert isinstance(info, str)
|
||||
|
||||
assert rig.set_split_vfo(-600000, Hamlib.RIG_VFO_A) is None
|
||||
assert rig.get_split_vfo(Hamlib.RIG_VFO_TX) == [-600000, 1]
|
||||
assert rig.set_split_vfo(5000000, Hamlib.RIG_VFO_B) is None
|
||||
assert rig.get_split_vfo(Hamlib.RIG_VFO_TX) == [5000000, 2]
|
||||
assert rig.set_split_vfo(5000000, Hamlib.RIG_VFO_CURR) is None
|
||||
assert rig.get_split_vfo() == [5000000, 1]
|
||||
assert rig.get_split_vfo(Hamlib.RIG_VFO_CURR) == [5000000, 1]
|
||||
assert rig.set_split_vfo(Hamlib.RIG_SPLIT_OFF, Hamlib.RIG_VFO_A) is None
|
||||
assert rig.get_split_vfo(Hamlib.RIG_VFO_TX) == [Hamlib.RIG_SPLIT_OFF, Hamlib.RIG_VFO_A]
|
||||
assert rig.set_split_vfo(Hamlib.RIG_SPLIT_ON, Hamlib.RIG_VFO_B) is None
|
||||
assert rig.get_split_vfo(Hamlib.RIG_VFO_TX) == [Hamlib.RIG_SPLIT_ON, Hamlib.RIG_VFO_B]
|
||||
assert rig.set_split_vfo(Hamlib.RIG_SPLIT_OFF, Hamlib.RIG_VFO_CURR) is None
|
||||
assert rig.get_split_vfo() == [Hamlib.RIG_SPLIT_OFF, Hamlib.RIG_VFO_B]
|
||||
assert rig.get_split_vfo(Hamlib.RIG_VFO_CURR) == [Hamlib.RIG_SPLIT_OFF, Hamlib.RIG_VFO_B]
|
||||
|
||||
# FIXME should use a RIG_ANT_* constant but it isn't available in the bindings
|
||||
RIG_ANT_UNKNOWN = 1<<30
|
||||
|
|
|
@ -1114,11 +1114,25 @@ static int dummy_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
|
|||
rig_debug(RIG_DEBUG_VERBOSE, "%s: split=%d, vfo=%s, tx_vfo=%s\n",
|
||||
__func__, split, rig_strvfo(vfo), rig_strvfo(tx_vfo));
|
||||
|
||||
switch (split)
|
||||
{
|
||||
case RIG_SPLIT_OFF:
|
||||
priv->split = RIG_SPLIT_OFF;
|
||||
break;
|
||||
|
||||
case RIG_SPLIT_ON:
|
||||
priv->split = RIG_SPLIT_ON;
|
||||
break;
|
||||
|
||||
default:
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: unsupported split %d", __func__, split);
|
||||
RETURNFUNC(-RIG_EINVAL);
|
||||
}
|
||||
|
||||
if (tx_vfo == RIG_VFO_NONE || tx_vfo == RIG_VFO_CURR) { tx_vfo = priv->curr_vfo; }
|
||||
|
||||
if (tx_vfo == RIG_VFO_CURR || tx_vfo == RIG_VFO_TX) { tx_vfo = vfo_fixup(rig, vfo, CACHE(rig)->split); }
|
||||
|
||||
priv->split = split;
|
||||
priv->tx_vfo = tx_vfo;
|
||||
|
||||
RETURNFUNC(RIG_OK);
|
||||
|
|
Ładowanie…
Reference in New Issue