Fix Kenwood get_vfo function returning wrong VFO in split TX.

The Kenwood IF command, which is used to get the current VFO, returns
the TX VFO in transmit mode. The get_vfo function needs to return the
RX VFO to be consistent and useful elsewhere. The implementation now
swaps the returned VFO if the rig is in split mode and transmitting at
the time of the query.
Hamlib-3.0
Bill Somerville 2013-12-06 15:04:09 +00:00
rodzic c4d89f2797
commit 64863c80ff
1 zmienionych plików z 22 dodań i 15 usunięć

Wyświetl plik

@ -780,6 +780,10 @@ int kenwood_get_split_vfo_if(RIG *rig, vfo_t rxvfo, split_t *split, vfo_t *txvfo
/*
* kenwood_get_vfo_if using byte 31 of the IF information field
*
* Specifically this needs to return the RX VFO, the IF command tells
* us the TX VFO in split TX mode when transmitting so we need to swap
* results sometimes.
*/
int kenwood_get_vfo_if(RIG *rig, vfo_t *vfo)
{
@ -795,24 +799,27 @@ int kenwood_get_vfo_if(RIG *rig, vfo_t *vfo)
if (retval != RIG_OK)
return retval;
switch (priv->info[30]) {
case '0':
*vfo = RIG_VFO_A;
break;
int split_and_transmitting = '1' == priv->info[32] && '1' == priv->info[28];
case '1':
*vfo = RIG_VFO_B;
break;
switch (priv->info[30])
{
case '0':
*vfo = split_and_transmitting ? RIG_VFO_B : RIG_VFO_A;
break;
case '2':
*vfo = RIG_VFO_MEM;
break;
case '1':
*vfo = split_and_transmitting ? RIG_VFO_A : RIG_VFO_B;
break;
default:
rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %c\n",
__func__, priv->info[30]);
return -RIG_EPROTO;
}
case '2':
*vfo = RIG_VFO_MEM;
break;
default:
rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %c\n",
__func__, priv->info[30]);
return -RIG_EPROTO;
}
return RIG_OK;
}