Fix get_ant RIG_ANT_CURR logic

pull/224/head
Michael Black 2020-02-12 07:20:34 -06:00
rodzic 48a89e72a7
commit 49aa7d00a7
3 zmienionych plików z 16 dodań i 4 usunięć

Wyświetl plik

@ -668,7 +668,11 @@ Option depends on rig..for Icom it probably sets the RX only flag. See your manu
Get
.RI \(aq Antenna \(aq
.IP
Number is 1-based antenna# (\(oq1\(cq, \(oq2\(cq, \(oq3\(cq, ...).
A value of 0 for Antenna will return the current TX antenna
.IP
> 0 is 1-based antenna# (\(oq1\(cq, \(oq2\(cq, \(oq3\(cq, ...).
.IP
Option returned depends on rig..for Icom is likely the RX only flag.
.

Wyświetl plik

@ -1038,7 +1038,7 @@ typedef struct freq_range_list {
int low_power; /*!< Lower RF power in mW, -1 for no power (ie. rx list) */
int high_power; /*!< Higher RF power in mW, -1 for no power (ie. rx list) */
vfo_t vfo; /*!< VFO list equipped with this range */
ant_t ant; /*!< Antenna list equipped with this range, 0 means all */
ant_t ant; /*!< Antenna list equipped with this range, 0 means all, RIG_ANT_CURR means dedicated to certain bands and automatically switches */
} freq_range_t;
#define RIG_FRNG_END {Hz(0),Hz(0),RIG_MODE_NONE,0,0,RIG_VFO_NONE}

Wyświetl plik

@ -5453,8 +5453,16 @@ int icom_get_ant(RIG *rig, vfo_t vfo, ant_t ant, ant_t *ant_curr, value_t *optio
rig_debug(RIG_DEBUG_VERBOSE, "%s called, ant=0x%02x\n", __func__, ant);
ant = rig_setting2idx(ant);
if (ant >= priv_caps->ant_count) return -RIG_EINVAL;
if (ant != RIG_ANT_CURR)
{
ant = rig_setting2idx(ant);
if (ant >= priv_caps->ant_count)
{
rig_debug(RIG_DEBUG_ERR, "%s: ant index=%d > ant_count=%d\n", __func__, ant, priv_caps->ant_count);
return -RIG_EINVAL;
}
}
// Should be able to use just C_CTL_ANT for 1 or 2 antennas hopefully
if (ant == RIG_ANT_CURR || priv_caps->ant_count <= 2) {
retval = icom_transaction(rig, C_CTL_ANT, -1, NULL, 0, ackbuf, &ack_len);
}