Changed y command to now use mandatory antenna argument

Put a looplimit on icom_get_ant_count trying to get autodetect to work
Changes to icom_get_ant_count to try and get this working
Added dummy antenna # args to rigs that don't care i.e. only have 1 antenna
pull/193/head
Michael Black 2020-02-02 08:38:10 -06:00
rodzic 12e93dd603
commit 7e8938ae65
27 zmienionych plików z 93 dodań i 52 usunięć

Wyświetl plik

@ -540,9 +540,9 @@ void Rig::setAnt(value_t option, ant_t ant, vfo_t vfo)
CHECK_RIG(rig_set_ant(theRig, vfo, ant, option));
}
ant_t Rig::getAnt(value_t &option, ant_t &ant, vfo_t vfo)
ant_t Rig::getAnt(value_t &option, ant_t ant, ant_t &ant_curr, vfo_t vfo)
{
CHECK_RIG( rig_get_ant(theRig, vfo, &ant, &option) );
CHECK_RIG( rig_get_ant(theRig, vfo, ant, &ant_curr, &option) );
return ant;
}

Wyświetl plik

@ -1346,13 +1346,13 @@ static int dummy_set_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t option)
}
static int dummy_get_ant(RIG *rig, vfo_t vfo, ant_t *ant, value_t *option)
static int dummy_get_ant(RIG *rig, vfo_t vfo, ant_t ant, ant_t *ant_curr, value_t *option)
{
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
channel_t *curr = priv->curr;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
*ant = curr->ant;
rig_debug(RIG_DEBUG_VERBOSE, "%s called, ant=0x%02x\n", __func__, ant);
*ant_curr = curr->ant;
option->i = priv->ant_option;
return RIG_OK;

Wyświetl plik

@ -1768,7 +1768,7 @@ static int netrigctl_set_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t option)
}
static int netrigctl_get_ant(RIG *rig, vfo_t vfo, ant_t *ant, value_t *option)
static int netrigctl_get_ant(RIG *rig, vfo_t vfo, ant_t ant, ant_t *ant_curr, value_t *option)
{
int ret, len;
char cmd[CMD_MAX];
@ -1781,7 +1781,12 @@ static int netrigctl_get_ant(RIG *rig, vfo_t vfo, ant_t *ant, value_t *option)
if (ret != RIG_OK) { return ret; }
len = sprintf(cmd, "y%s\n", vfostr);
if (ant == RIG_ANT_CURR) {
len = sprintf(cmd, "y%s\n", vfostr);
}
else {
len = sprintf(cmd, "y%s %d\n", vfostr, ant);
}
ret = netrigctl_transaction(rig, cmd, len, buf);
@ -1791,7 +1796,7 @@ static int netrigctl_get_ant(RIG *rig, vfo_t vfo, ant_t *ant, value_t *option)
}
rig_debug(RIG_DEBUG_TRACE, "%s: buf='%s'\n", __func__, buf);
ret = sscanf(buf, "%d\n", ant);
ret = sscanf(buf, "%d\n", ant_curr);
if (ret != 1)
{
@ -1799,6 +1804,16 @@ static int netrigctl_get_ant(RIG *rig, vfo_t vfo, ant_t *ant, value_t *option)
ret);
}
if (ant != RIG_ANT_CURR) {
ret = sscanf(buf, "%d\n", &option->i);
}
if (ret != 1)
{
rig_debug(RIG_DEBUG_ERR, "%s: expected 1 option integer in '%s', got %d\n", __func__, buf,
ret);
}
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1);
if (ret <= 0)

Wyświetl plik

@ -660,7 +660,7 @@ typedef enum {
/**
* \brief Antenna number
*/
typedef int ant_t;
typedef unsigned int ant_t;
#define RIG_ANT_NONE 0
#define RIG_ANT_N(n) ((ant_t)1<<(n))
@ -670,6 +670,8 @@ typedef int ant_t;
#define RIG_ANT_4 RIG_ANT_N(3)
#define RIG_ANT_5 RIG_ANT_N(4)
#define RIG_ANT_CURR RIG_ANT_N(31)
#define RIG_ANT_MAX 32
@ -1147,7 +1149,7 @@ struct channel {
int channel_num; /*!< Channel number */
int bank_num; /*!< Bank number */
vfo_t vfo; /*!< VFO */
int ant; /*!< Selected antenna */
ant_t ant; /*!< Selected antenna */
freq_t freq; /*!< Receive frequency */
rmode_t mode; /*!< Receive mode */
pbwidth_t width; /*!< Receive passband width associated with mode */
@ -1569,7 +1571,7 @@ struct rig_caps {
int (*reset)(RIG *rig, reset_t reset);
int (*set_ant)(RIG *rig, vfo_t vfo, ant_t ant, value_t option);
int (*get_ant)(RIG *rig, vfo_t vfo, ant_t *ant, value_t *option);
int (*get_ant)(RIG *rig, vfo_t vfo, ant_t ant, ant_t *ant_curr, value_t *option);
int (*set_level)(RIG *rig, vfo_t vfo, setting_t level, value_t val);
int (*get_level)(RIG *rig, vfo_t vfo, setting_t level, value_t *val);
@ -2156,7 +2158,8 @@ rig_set_ant HAMLIB_PARAMS((RIG *rig,
extern HAMLIB_EXPORT(int)
rig_get_ant HAMLIB_PARAMS((RIG *rig,
vfo_t vfo,
ant_t *ant,
ant_t ant,
ant_t *ant_curr,
value_t *option));
extern HAMLIB_EXPORT(setting_t)

Wyświetl plik

@ -157,7 +157,7 @@ public:
shortfreq_t getXit(vfo_t vfo = RIG_VFO_CURR);
void setAnt(value_t option, ant_t ant, vfo_t vfo = RIG_VFO_CURR);
ant_t getAnt(value_t &option, ant_t &ant, vfo_t vfo = RIG_VFO_CURR);
ant_t getAnt(value_t &option, ant_t ant, ant_t &ant_curr, vfo_t vfo = RIG_VFO_CURR);
void sendDtmf(const char *digits, vfo_t vfo = RIG_VFO_CURR);
int recvDtmf(char *digits, vfo_t vfo = RIG_VFO_CURR);

Wyświetl plik

@ -504,7 +504,7 @@ int drake_set_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t option)
* drake_get_ant
* Assumes rig!=NULL
*/
int drake_get_ant(RIG *rig, vfo_t vfo, ant_t *ant, value_t *option)
int drake_get_ant(RIG *rig, vfo_t vfo, ant_t dummy, ant_t *ant, value_t *option)
{
int mdbuf_len, retval;
char mdbuf[BUFSZ];

Wyświetl plik

@ -39,7 +39,7 @@ int drake_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width);
int drake_init(RIG *rig);
int drake_cleanup(RIG *rig);
int drake_set_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t option);
int drake_get_ant(RIG *rig, vfo_t vfo, ant_t *ant, value_t *option);
int drake_get_ant(RIG *rig, vfo_t vfo, ant_t dummy, ant_t *ant, value_t *option);
int drake_set_mem(RIG *rig, vfo_t vfo, int ch);
int drake_get_mem(RIG *rig, vfo_t vfo, int *ch);
int drake_set_chan(RIG *rig, const channel_t *chan);

Wyświetl plik

@ -2875,7 +2875,7 @@ int elad_set_ant_no_ack(RIG *rig, vfo_t vfo, ant_t ant)
/*
* get the aerial/antenna in use
*/
int elad_get_ant(RIG *rig, vfo_t vfo, ant_t *ant, value_t *option)
int elad_get_ant(RIG *rig, vfo_t vfo, ant_t dummy, ant_t *ant, value_t *option)
{
char ackbuf[8];
int offs;

Wyświetl plik

@ -140,7 +140,7 @@ int elad_reset(RIG *rig, reset_t reset);
int elad_send_morse(RIG *rig, vfo_t vfo, const char *msg);
int elad_set_ant (RIG * rig, vfo_t vfo, ant_t ant, value_t option);
int elad_set_ant_no_ack(RIG * rig, vfo_t vfo, ant_t ant);
int elad_get_ant (RIG * rig, vfo_t vfo, ant_t * ant, value_t *option);
int elad_get_ant (RIG * rig, vfo_t vfo, ant_t dummy, ant_t * ant, value_t *option);
int elad_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt);
int elad_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt);
int elad_set_ptt_safe(RIG *rig, vfo_t vfo, ptt_t ptt);

Wyświetl plik

@ -612,7 +612,7 @@ icom_init(RIG *rig)
priv->tx_vfo = RIG_VFO_NONE;
priv->rx_vfo = RIG_VFO_NONE;
priv->curr_vfo = RIG_VFO_NONE;
//priv_caps->antack_len = 0;
priv_caps->ant_count = -1;
retval = rig_get_func(rig, RIG_VFO_CURR, RIG_FUNC_SATMODE, &satmode);
rig_debug(RIG_DEBUG_VERBOSE, "%s: satmode=%d\n", __func__, satmode);
@ -5296,23 +5296,28 @@ int icom_set_bank(RIG *rig, vfo_t vfo, int bank)
}
/* gets the number of antennas detected by querying them until it fails */
/* assumes priv_caps->ant_count is set to -1, otherwise will not be queried */
/* so one can set ant_count in the rig priv_caps to bypass this check */
static int icom_get_ant_count(RIG *rig)
{
struct icom_priv_caps *priv_caps = (struct icom_priv_caps *)
rig->caps->priv;
// we only need to do this once if we haven't done it yet
if (priv_caps->ant_count == 0) {
if (priv_caps->ant_count == -1) {
ant_t tmp_ant=0;
int ant = 0;
value_t tmp_option;
int retval;
int looplimit = 0;
priv_caps->ant_count = 0;
do {
retval = rig_get_ant(rig, RIG_VFO_CURR, &tmp_ant, &tmp_option);
retval = rig_get_ant(rig, RIG_VFO_CURR, rig_idx2setting(ant), &tmp_ant, &tmp_option);
if (retval == RIG_OK) {
++priv_caps->ant_count;
rig_debug(RIG_DEBUG_TRACE,"%s: found ant#%d\n", __func__, priv_caps->ant_count);
++tmp_ant;
++ant;
}
} while(retval == RIG_OK);
} while(retval == RIG_OK && ++looplimit < 10);
}
rig_debug(RIG_DEBUG_TRACE,"%s: ant_count=%d\n", __func__, priv_caps->ant_count);
return priv_caps->ant_count;
@ -5366,8 +5371,9 @@ int icom_set_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t option)
if (priv_caps->antack_len == 0) { // we need to find out the antack_len
ant_t tmp_ant;
int ant = 0;
value_t tmp_option;
retval = rig_get_ant(rig, vfo, &tmp_ant, &tmp_option);
retval = rig_get_ant(rig, vfo, ant, &tmp_ant, &tmp_option);
if (retval != RIG_OK) {
rig_debug(RIG_DEBUG_ERR,"%s: rig_get_ant error: %s \n", __func__, rigerror(retval));
return retval;
@ -5429,14 +5435,29 @@ int icom_set_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t option)
* Assumes rig!=NULL, rig->state.priv!=NULL
* only meaningfull for HF
*/
int icom_get_ant(RIG *rig, vfo_t vfo, ant_t *ant, value_t *option)
int icom_get_ant(RIG *rig, vfo_t vfo, ant_t ant, ant_t *ant_curr, value_t *option)
{
unsigned char ackbuf[MAXFRAMELEN];
int ack_len = sizeof(ackbuf), retval;
struct icom_priv_caps *priv_caps = (struct icom_priv_caps *) rig->caps->priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
retval = icom_transaction(rig, C_CTL_ANT, -1, NULL, 0, ackbuf, &ack_len);
rig_debug(RIG_DEBUG_VERBOSE, "%s called, ant=0x%02x\n", __func__, ant);
if (priv_caps->ant_count == -1) {
icom_get_ant_count(rig);
}
if (ant == RIG_ANT_CURR) {
retval = icom_transaction(rig, C_CTL_ANT, -1, NULL, 0, ackbuf, &ack_len);
}
else if (priv_caps->ant_count > 0) {
retval = icom_transaction(rig, C_CTL_ANT, rig_setting2idx(ant), NULL, 0, ackbuf, &ack_len);
}
else {
rig_debug(RIG_DEBUG_ERR,"%s: asking for non-current antenna and ant_count==0?\n", __func__);
return -RIG_EINVAL;
}
if (retval != RIG_OK)
{
@ -5458,7 +5479,7 @@ int icom_get_ant(RIG *rig, vfo_t vfo, ant_t *ant, value_t *option)
return -RIG_ERJCTED;
}
*ant = ackbuf[1];
*ant_curr = ackbuf[1];
// Note: with IC756/IC-756Pro/IC-7800 and more, ackbuf[2] deals with [RX ANT]
// Hopefully any ack_len=3 can fit in the option field

Wyświetl plik

@ -255,7 +255,7 @@ int icom_get_conf(RIG *rig, token_t token, char *val);
int icom_set_powerstat(RIG *rig, powerstat_t status);
int icom_get_powerstat(RIG *rig, powerstat_t *status);
int icom_set_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t option);
int icom_get_ant(RIG *rig, vfo_t vfo, ant_t *ant, value_t *option);
int icom_get_ant(RIG *rig, vfo_t vfo, ant_t ant, ant_t *ant_curr, value_t *option);
int icom_decode_event(RIG *rig);
int icom_power2mW(RIG *rig, unsigned int *mwpower, float power, freq_t freq,
rmode_t mode);

Wyświetl plik

@ -445,7 +445,7 @@ int ic10_set_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t option)
* ic10_get_ant
* Assumes rig!=NULL, ptt!=NULL
*/
int ic10_get_ant(RIG *rig, vfo_t vfo, ant_t *ant, value_t *option)
int ic10_get_ant(RIG *rig, vfo_t vfo, ant_t dummy, ant_t *ant, value_t *option)
{
char infobuf[50];
int info_len, retval;

Wyświetl plik

@ -33,7 +33,7 @@ int ic10_get_split_vfo(RIG *rig, vfo_t vfo , split_t *split, vfo_t *txvfo);
int ic10_get_freq(RIG *rig, vfo_t vfo, freq_t *freq);
int ic10_set_freq(RIG *rig, vfo_t vfo, freq_t freq);
int ic10_set_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t option);
int ic10_get_ant(RIG *rig, vfo_t vfo, ant_t *ant, value_t *option);
int ic10_get_ant(RIG *rig, vfo_t vfo, ant_t dummy, ant_t *ant, value_t *option);
int ic10_set_func(RIG *rig, vfo_t vfo, setting_t func, int status);
int ic10_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status);
int ic10_set_parm(RIG *rig, setting_t parm, value_t val);

Wyświetl plik

@ -3095,7 +3095,7 @@ int kenwood_set_ant_no_ack(RIG *rig, vfo_t vfo, ant_t ant, value_t option)
/*
* get the aerial/antenna in use
*/
int kenwood_get_ant(RIG *rig, vfo_t vfo, ant_t *ant, value_t *option)
int kenwood_get_ant(RIG *rig, vfo_t vfo, ant_t dummy, ant_t *ant, value_t *option)
{
char ackbuf[8];
int offs;

Wyświetl plik

@ -159,7 +159,7 @@ int kenwood_reset(RIG *rig, reset_t reset);
int kenwood_send_morse(RIG *rig, vfo_t vfo, const char *msg);
int kenwood_set_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t option);
int kenwood_set_ant_no_ack(RIG *rig, vfo_t vfo, ant_t ant, value_t option);
int kenwood_get_ant(RIG *rig, vfo_t vfo, ant_t *ant, value_t *option);
int kenwood_get_ant(RIG *rig, vfo_t vfo, ant_t dummy, ant_t *ant, value_t *option);
int kenwood_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt);
int kenwood_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt);
int kenwood_set_ptt_safe(RIG *rig, vfo_t vfo, ptt_t ptt);

Wyświetl plik

@ -2552,7 +2552,7 @@ int th_set_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t option)
/*
* get the aerial/antenna in use
*/
int th_get_ant(RIG *rig, vfo_t vfo, ant_t *ant, value_t *option)
int th_get_ant(RIG *rig, vfo_t vfo, ant_t dummy, ant_t *ant, value_t *option)
{
char buf[8];
int retval;

Wyświetl plik

@ -63,7 +63,7 @@ extern int th_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd);
extern int th_get_channel(RIG *rig, channel_t *chan);
extern int th_set_channel(RIG *rig, const channel_t *chan);
extern int th_set_ant (RIG * rig, vfo_t vfo, ant_t ant, value_t option);
extern int th_get_ant (RIG * rig, vfo_t vfo, ant_t * ant, value_t *option);
extern int th_get_ant (RIG * rig, vfo_t vfo, ant_t dummy, ant_t * ant, value_t *option);
extern int th_reset(RIG *rig, reset_t reset);
extern int th_scan(RIG *rig, vfo_t vfo, scan_t scan, int ch);

Wyświetl plik

@ -54,7 +54,7 @@ static int elektor507_set_level(RIG *rig, vfo_t vfo, setting_t level,
static int elektor507_get_level(RIG *rig, vfo_t vfo, setting_t level,
value_t *val);
static int elektor507_set_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t option);
static int elektor507_get_ant(RIG *rig, vfo_t vfo, ant_t *ant, value_t *option);
static int elektor507_get_ant(RIG *rig, vfo_t vfo, ant_t dummy, ant_t *ant, value_t *option);
static int elektor507_set_conf(RIG *rig, token_t token, const char *val);
static int elektor507_get_conf(RIG *rig, token_t token, char *val);
@ -1191,7 +1191,7 @@ int elektor507_set_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t option)
return (ret != 0) ? -RIG_EIO : RIG_OK;
}
int elektor507_get_ant(RIG *rig, vfo_t vfo, ant_t *ant, value_t *option)
int elektor507_get_ant(RIG *rig, vfo_t vfo, ant_t dummy, ant_t *ant, value_t *option)
{
struct elektor507_priv_data *priv = (struct elektor507_priv_data *)
rig->state.priv;

Wyświetl plik

@ -751,7 +751,7 @@ int ra37xx_set_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t option)
return ra37xx_transaction(rig, buf, NULL, NULL);
}
int ra37xx_get_ant(RIG *rig, vfo_t vfo, ant_t *ant, value_t *option)
int ra37xx_get_ant(RIG *rig, vfo_t vfo, ant_t dummy, ant_t *ant, value_t *option)
{
char buf[BUFSZ];
int retval, buflen, ra_ant;

Wyświetl plik

@ -77,7 +77,7 @@ int ra37xx_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val);
int ra37xx_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val);
const char* ra37xx_get_info(RIG *rig);
int ra37xx_set_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t option);
int ra37xx_get_ant(RIG *rig, vfo_t vfo, ant_t *ant, value_t *option);
int ra37xx_get_ant(RIG *rig, vfo_t vfo, ant_t dummy, ant_t *ant, value_t *option);
int ra37xx_set_mem(RIG *rig, vfo_t vfo, int ch);
int ra37xx_get_mem(RIG *rig, vfo_t vfo, int *ch);
int ra37xx_scan(RIG *rig, vfo_t vfo, scan_t scan, int ch);

Wyświetl plik

@ -2116,7 +2116,7 @@ int tt565_set_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t option)
*
* \sa tt565_set_ant
*/
int tt565_get_ant(RIG *rig, vfo_t vfo, ant_t *ant, value_t *option)
int tt565_get_ant(RIG *rig, vfo_t vfo, ant_t dummy, ant_t *ant, value_t *option)
{
char respbuf[TT565_BUFSIZE];
int resp_len, retval;

Wyświetl plik

@ -78,7 +78,7 @@ static int tt565_send_morse(RIG *rig, vfo_t vfo, const char *msg);
static int tt565_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status);
static int tt565_set_func(RIG *rig, vfo_t vfo, setting_t func, int status);
static int tt565_set_ant(RIG * rig, vfo_t vfo, ant_t ant, value_t option);
static int tt565_get_ant(RIG *rig, vfo_t vfo, ant_t *ant, value_t *option);
static int tt565_get_ant(RIG *rig, vfo_t vfo, ant_t dummy, ant_t *ant, value_t *option);
/** \brief Orion private data */
struct tt565_priv_data {

Wyświetl plik

@ -2450,7 +2450,7 @@ int newcat_set_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t option)
}
int newcat_get_ant(RIG *rig, vfo_t vfo, ant_t *ant, value_t *option)
int newcat_get_ant(RIG *rig, vfo_t vfo, ant_t dummy, ant_t *ant, value_t *option)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
int err;

Wyświetl plik

@ -146,7 +146,7 @@ int newcat_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width);
int newcat_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt);
int newcat_get_ptt(RIG * rig, vfo_t vfo, ptt_t * ptt);
int newcat_set_ant(RIG * rig, vfo_t vfo, ant_t ant, value_t option);
int newcat_get_ant(RIG * rig, vfo_t vfo, ant_t * ant, value_t * option);
int newcat_get_ant(RIG * rig, vfo_t vfo, ant_t dummy, ant_t * ant, value_t * option);
int newcat_set_level(RIG * rig, vfo_t vfo, setting_t level, value_t val);
int newcat_get_level(RIG * rig, vfo_t vfo, setting_t level, value_t * val);
int newcat_set_func(RIG * rig, vfo_t vfo, setting_t func, int status);

Wyświetl plik

@ -447,7 +447,7 @@ static int generic_save_channel(RIG *rig, channel_t *chan)
if (mem_cap->ant)
{
rig_get_ant(rig, RIG_VFO_CURR, &chan->ant, &vdummy);
rig_get_ant(rig, RIG_VFO_CURR, RIG_ANT_CURR, &chan->ant, &vdummy);
}
if (mem_cap->tuning_step)

Wyświetl plik

@ -3551,7 +3551,7 @@ int HAMLIB_API rig_set_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t option)
*
* \sa rig_set_ant()
*/
int HAMLIB_API rig_get_ant(RIG *rig, vfo_t vfo, ant_t *ant, value_t *option)
int HAMLIB_API rig_get_ant(RIG *rig, vfo_t vfo, ant_t ant, ant_t *ant_curr, value_t *option)
{
const struct rig_caps *caps;
int retcode, rc2;
@ -3559,7 +3559,7 @@ int HAMLIB_API rig_get_ant(RIG *rig, vfo_t vfo, ant_t *ant, value_t *option)
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
if (CHECK_RIG_ARG(rig) || !ant)
if (CHECK_RIG_ARG(rig) || !ant_curr)
{
return -RIG_EINVAL;
}
@ -3575,7 +3575,7 @@ int HAMLIB_API rig_get_ant(RIG *rig, vfo_t vfo, ant_t *ant, value_t *option)
|| vfo == RIG_VFO_CURR
|| vfo == rig->state.current_vfo)
{
return caps->get_ant(rig, vfo, ant, option);
return caps->get_ant(rig, vfo, ant, ant_curr, option);
}
if (!caps->set_vfo)
@ -3591,7 +3591,7 @@ int HAMLIB_API rig_get_ant(RIG *rig, vfo_t vfo, ant_t *ant, value_t *option)
return retcode;
}
retcode = caps->get_ant(rig, vfo, ant, option);
retcode = caps->get_ant(rig, vfo, ant, ant_curr, option);
/* try and revert even if we had an error above */
rc2 = caps->set_vfo(rig, curr_vfo);

Wyświetl plik

@ -287,7 +287,7 @@ static struct test_table test_list[] =
{ 'Z', "set_xit", ACTION(set_xit), ARG_IN, "XIT" },
{ 'z', "get_xit", ACTION(get_xit), ARG_OUT, "XIT" },
{ 'Y', "set_ant", ACTION(set_ant), ARG_IN, "Antenna", "Option" },
{ 'y', "get_ant", ACTION(get_ant), ARG_OUT, "Antenna", "Option" },
{ 'y', "get_ant", ACTION(get_ant), ARG_IN1 | ARG_OUT2 |ARG_NOVFO, "Antenna", "Antenna", "Option" },
{ 0x87, "set_powerstat", ACTION(set_powerstat), ARG_IN | ARG_NOVFO, "Power Status" },
{ 0x88, "get_powerstat", ACTION(get_powerstat), ARG_OUT | ARG_NOVFO, "Power Status" },
{ 0x89, "send_dtmf", ACTION(send_dtmf), ARG_IN, "Digits" },
@ -3949,22 +3949,24 @@ declare_proto_rig(set_ant)
declare_proto_rig(get_ant)
{
int status;
ant_t ant;
ant_t ant, ant_curr;
value_t option;
status = rig_get_ant(rig, vfo, &ant, &option);
// CHKSCN1ARG(sscanf(arg1, "%d", &ant));
if (arg1) sscanf(arg1, "%d", &ant);
status = rig_get_ant(rig, vfo, ant, &ant_curr, &option);
if (status != RIG_OK)
{
return status;
}
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
{
fprintf(fout, "%s: ", cmd->arg1);
}
fprintf(fout, "%d%c", rig_setting2idx(ant), resp_sep);
fprintf(fout, "%d%c", rig_setting2idx(ant_curr), resp_sep);
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
{