kopia lustrzana https://github.com/Hamlib/Hamlib
Add rig_get_vfo for IC9700 -- seems we can use x07 0Xd2 to determine main/sub vfo now
rodzic
14c535a01b
commit
474428082d
|
@ -335,7 +335,7 @@ const struct rig_caps ic7000_caps =
|
|||
.get_freq = icom_get_freq,
|
||||
.set_mode = icom_set_mode,
|
||||
.get_mode = icom_get_mode,
|
||||
.get_vfo = icom_get_vfo,
|
||||
// .get_vfo = icom_get_vfo,
|
||||
.set_vfo = icom_set_vfo,
|
||||
.set_ant = NULL, /*automatically set by rig depending band */
|
||||
.get_ant = NULL,
|
||||
|
|
|
@ -201,7 +201,7 @@ const struct rig_caps ic703_caps =
|
|||
.set_mode = icom_set_mode,
|
||||
.get_mode = icom_get_mode,
|
||||
.set_vfo = icom_set_vfo,
|
||||
.get_vfo = icom_get_vfo,
|
||||
// .get_vfo = icom_get_vfo,
|
||||
|
||||
.decode_event = icom_decode_event,
|
||||
.set_level = icom_set_level,
|
||||
|
|
|
@ -262,7 +262,7 @@ const struct rig_caps ic706_caps =
|
|||
.get_freq = icom_get_freq,
|
||||
.set_mode = icom_set_mode,
|
||||
.get_mode = icom_get_mode,
|
||||
.get_vfo = icom_get_vfo,
|
||||
// .get_vfo = icom_get_vfo,
|
||||
.set_vfo = icom_set_vfo,
|
||||
|
||||
.decode_event = icom_decode_event,
|
||||
|
@ -413,7 +413,7 @@ const struct rig_caps ic706mkii_caps =
|
|||
.get_freq = icom_get_freq,
|
||||
.set_mode = icom_set_mode,
|
||||
.get_mode = icom_get_mode,
|
||||
.get_vfo = icom_get_vfo,
|
||||
// .get_vfo = icom_get_vfo,
|
||||
.set_vfo = icom_set_vfo,
|
||||
|
||||
.decode_event = icom_decode_event,
|
||||
|
@ -610,7 +610,7 @@ const struct rig_caps ic706mkiig_caps =
|
|||
.get_freq = icom_get_freq,
|
||||
.set_mode = icom_set_mode,
|
||||
.get_mode = icom_get_mode,
|
||||
.get_vfo = icom_get_vfo,
|
||||
// .get_vfo = icom_get_vfo,
|
||||
.set_vfo = icom_set_vfo,
|
||||
|
||||
.decode_event = icom_decode_event,
|
||||
|
|
|
@ -461,7 +461,7 @@ const struct rig_caps ic7100_caps =
|
|||
.get_mode = icom_get_mode_with_data,
|
||||
.set_mode = icom_set_mode_with_data,
|
||||
|
||||
.get_vfo = icom_get_vfo,
|
||||
// .get_vfo = icom_get_vfo,
|
||||
.set_vfo = icom_set_vfo,
|
||||
.set_ant = icom_set_ant,
|
||||
.get_ant = icom_get_ant,
|
||||
|
|
|
@ -184,7 +184,7 @@ const struct rig_caps ic718_caps =
|
|||
.set_mode = icom_set_mode,
|
||||
.get_mode = icom_get_mode,
|
||||
.set_vfo = icom_set_vfo,
|
||||
.get_vfo = icom_get_vfo,
|
||||
// .get_vfo = icom_get_vfo,
|
||||
|
||||
.decode_event = icom_decode_event,
|
||||
.set_level = icom_set_level,
|
||||
|
|
|
@ -242,7 +242,7 @@ const struct rig_caps ic7200_caps =
|
|||
.set_mode = icom_set_mode_with_data,
|
||||
.get_mode = icom_get_mode_with_data,
|
||||
.set_vfo = icom_set_vfo,
|
||||
.get_vfo = icom_get_vfo,
|
||||
// .get_vfo = icom_get_vfo,
|
||||
.set_ant = NULL, /*automatically set by rig depending band */
|
||||
.get_ant = NULL,
|
||||
|
||||
|
|
|
@ -42,6 +42,8 @@ int ic7300_get_clock(RIG *rig, int *year, int *month, int *day,
|
|||
int *hour,
|
||||
int *min, int *sec, double *msec, int *utc_offset);
|
||||
|
||||
int ic9700_set_vfo(RIG *rig, vfo_t vfo);
|
||||
|
||||
|
||||
#define IC7300_ALL_RX_MODES (RIG_MODE_FM|RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_PKTLSB|RIG_MODE_PKTUSB|RIG_MODE_PKTFM|RIG_MODE_PKTAM)
|
||||
#define IC7300_1HZ_TS_MODES (RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_PKTLSB|RIG_MODE_PKTUSB|RIG_MODE_PKTFM|RIG_MODE_PKTAM)
|
||||
|
@ -369,6 +371,7 @@ static const struct icom_priv_caps IC7300_priv_caps =
|
|||
},
|
||||
},
|
||||
.extcmds = ic7300_extcmds, /* Custom op parameters */
|
||||
.x25_always = 1
|
||||
};
|
||||
|
||||
static const struct icom_priv_caps IC9700_priv_caps =
|
||||
|
@ -417,6 +420,7 @@ static const struct icom_priv_caps IC9700_priv_caps =
|
|||
},
|
||||
},
|
||||
.extcmds = ic9700_extcmds, /* Custom op parameters */
|
||||
.x25_always = 1
|
||||
};
|
||||
|
||||
static const struct icom_priv_caps IC705_priv_caps =
|
||||
|
@ -724,7 +728,7 @@ const struct rig_caps ic7300_caps =
|
|||
.get_freq = icom_get_freq,
|
||||
.set_mode = icom_set_mode_with_data,
|
||||
.get_mode = icom_get_mode_with_data,
|
||||
.get_vfo = icom_get_vfo,
|
||||
// .get_vfo = icom_get_vfo,
|
||||
.set_vfo = icom_set_vfo,
|
||||
.set_ant = NULL,
|
||||
.get_ant = NULL,
|
||||
|
@ -1042,7 +1046,7 @@ struct rig_caps ic9700_caps =
|
|||
.set_mode = icom_set_mode_with_data,
|
||||
.get_mode = icom_get_mode_with_data,
|
||||
.get_vfo = icom_get_vfo,
|
||||
.set_vfo = icom_set_vfo,
|
||||
.set_vfo = ic9700_set_vfo,
|
||||
.set_ant = NULL,
|
||||
.get_ant = NULL,
|
||||
|
||||
|
@ -1304,7 +1308,7 @@ const struct rig_caps ic705_caps =
|
|||
.get_freq = icom_get_freq,
|
||||
.set_mode = icom_set_mode_with_data,
|
||||
.get_mode = icom_get_mode_with_data,
|
||||
.get_vfo = icom_get_vfo,
|
||||
// .get_vfo = icom_get_vfo,
|
||||
.set_vfo = icom_set_vfo,
|
||||
.set_ant = NULL,
|
||||
.get_ant = NULL,
|
||||
|
@ -1693,3 +1697,27 @@ int ic9700_get_clock(RIG *rig, int *year, int *month, int *day, int *hour,
|
|||
|
||||
return retval;
|
||||
}
|
||||
|
||||
int ic9700_set_vfo(RIG *rig, vfo_t vfo)
|
||||
{
|
||||
ENTERFUNC;
|
||||
unsigned char ackbuf[MAXFRAMELEN];
|
||||
int ack_len = sizeof(ackbuf), retval;
|
||||
|
||||
if (vfo == RIG_VFO_A || vfo == RIG_VFO_MAIN)
|
||||
{
|
||||
retval = icom_transaction(rig, 0x07, 0xd0, NULL, 0, ackbuf, &ack_len);
|
||||
}
|
||||
else
|
||||
{
|
||||
retval = icom_transaction(rig, 0x07, 0xd1, NULL, 0, ackbuf, &ack_len);
|
||||
}
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: %s\n", __func__, rigerror(retval));
|
||||
return -retval;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
|
|
@ -248,7 +248,7 @@ const struct rig_caps ic7410_caps =
|
|||
.set_mode = icom_set_mode_with_data,
|
||||
.get_mode = icom_get_mode_with_data,
|
||||
.set_vfo = icom_set_vfo,
|
||||
.get_vfo = icom_get_vfo,
|
||||
// .get_vfo = icom_get_vfo,
|
||||
.set_ant = icom_set_ant,
|
||||
.get_ant = icom_get_ant,
|
||||
|
||||
|
|
|
@ -306,7 +306,7 @@ const struct rig_caps ic746_caps =
|
|||
.set_mode = icom_set_mode,
|
||||
.get_mode = icom_get_mode,
|
||||
.set_vfo = icom_set_vfo,
|
||||
.get_vfo = icom_get_vfo,
|
||||
// .get_vfo = icom_get_vfo,
|
||||
.set_ant = icom_set_ant,
|
||||
.get_ant = icom_get_ant,
|
||||
|
||||
|
@ -557,7 +557,7 @@ const struct rig_caps ic746pro_caps =
|
|||
.set_mode = icom_set_mode_with_data,
|
||||
.get_mode = icom_get_mode_with_data,
|
||||
.set_vfo = icom_set_vfo,
|
||||
.get_vfo = icom_get_vfo,
|
||||
// .get_vfo = icom_get_vfo,
|
||||
.set_ant = icom_set_ant,
|
||||
.get_ant = icom_get_ant,
|
||||
|
||||
|
|
|
@ -251,7 +251,7 @@ const struct rig_caps ic756_caps =
|
|||
.set_mode = icom_set_mode,
|
||||
.get_mode = icom_get_mode,
|
||||
.set_vfo = icom_set_vfo,
|
||||
.get_vfo = icom_get_vfo,
|
||||
// .get_vfo = icom_get_vfo,
|
||||
.set_ant = icom_set_ant,
|
||||
.get_ant = icom_get_ant,
|
||||
|
||||
|
@ -416,7 +416,7 @@ const struct rig_caps ic756pro_caps =
|
|||
.set_mode = icom_set_mode,
|
||||
.get_mode = icom_get_mode,
|
||||
.set_vfo = icom_set_vfo,
|
||||
.get_vfo = icom_get_vfo,
|
||||
// .get_vfo = icom_get_vfo,
|
||||
.set_ant = icom_set_ant,
|
||||
.get_ant = icom_get_ant,
|
||||
|
||||
|
@ -658,7 +658,7 @@ const struct rig_caps ic756pro2_caps =
|
|||
.set_mode = icom_set_mode_with_data,
|
||||
.get_mode = icom_get_mode_with_data,
|
||||
.set_vfo = icom_set_vfo,
|
||||
.get_vfo = icom_get_vfo,
|
||||
// .get_vfo = icom_get_vfo,
|
||||
.set_ant = icom_set_ant,
|
||||
.get_ant = icom_get_ant,
|
||||
|
||||
|
@ -1105,7 +1105,7 @@ const struct rig_caps ic756pro3_caps =
|
|||
.set_mode = icom_set_mode_with_data,
|
||||
.get_mode = icom_get_mode_with_data,
|
||||
.set_vfo = icom_set_vfo,
|
||||
.get_vfo = icom_get_vfo,
|
||||
// .get_vfo = icom_get_vfo,
|
||||
.set_ant = icom_set_ant,
|
||||
.get_ant = icom_get_ant,
|
||||
|
||||
|
|
|
@ -407,7 +407,7 @@ const struct rig_caps ic7600_caps =
|
|||
.set_mode = icom_set_mode_with_data,
|
||||
.get_mode = icom_get_mode_with_data,
|
||||
.set_vfo = icom_set_vfo,
|
||||
.get_vfo = icom_get_vfo,
|
||||
// .get_vfo = icom_get_vfo,
|
||||
.set_ant = icom_set_ant,
|
||||
.get_ant = icom_get_ant,
|
||||
|
||||
|
|
|
@ -544,7 +544,7 @@ const struct rig_caps ic7610_caps =
|
|||
.set_mode = icom_set_mode_with_data,
|
||||
.get_mode = icom_get_mode_with_data,
|
||||
.set_vfo = icom_set_vfo,
|
||||
.get_vfo = icom_get_vfo,
|
||||
// .get_vfo = icom_get_vfo,
|
||||
.set_ant = icom_set_ant,
|
||||
.get_ant = icom_get_ant,
|
||||
|
||||
|
|
|
@ -386,7 +386,7 @@ const struct rig_caps ic7700_caps =
|
|||
.set_mode = icom_set_mode_with_data,
|
||||
.get_mode = icom_get_mode_with_data,
|
||||
.set_vfo = icom_set_vfo,
|
||||
.get_vfo = icom_get_vfo,
|
||||
// .get_vfo = icom_get_vfo,
|
||||
.set_ant = icom_set_ant,
|
||||
.get_ant = icom_get_ant,
|
||||
|
||||
|
|
|
@ -291,7 +291,7 @@ const struct rig_caps ic7800_caps =
|
|||
.set_mode = icom_set_mode_with_data,
|
||||
.get_mode = icom_get_mode_with_data,
|
||||
.set_vfo = icom_set_vfo,
|
||||
.get_vfo = icom_get_vfo,
|
||||
// .get_vfo = icom_get_vfo,
|
||||
.set_ant = icom_set_ant,
|
||||
.get_ant = icom_get_ant,
|
||||
|
||||
|
|
|
@ -175,7 +175,7 @@ const struct rig_caps ic781_caps =
|
|||
.set_mode = icom_set_mode,
|
||||
.get_mode = icom_get_mode,
|
||||
.set_vfo = icom_set_vfo,
|
||||
.get_vfo = icom_get_vfo,
|
||||
// .get_vfo = icom_get_vfo,
|
||||
.set_split_vfo = icom_set_split_vfo,
|
||||
.set_split_freq = icom_set_split_freq,
|
||||
.get_split_freq = icom_get_split_freq,
|
||||
|
|
|
@ -437,7 +437,7 @@ const struct rig_caps ic785x_caps =
|
|||
.set_mode = icom_set_mode_with_data,
|
||||
.get_mode = icom_get_mode_with_data,
|
||||
.set_vfo = icom_set_vfo,
|
||||
.get_vfo = icom_get_vfo,
|
||||
// .get_vfo = icom_get_vfo,
|
||||
.set_ant = icom_set_ant,
|
||||
.get_ant = icom_get_ant,
|
||||
|
||||
|
|
|
@ -327,7 +327,7 @@ const struct rig_caps ic910_caps =
|
|||
.set_ptt = icom_set_ptt,
|
||||
.get_ptt = icom_get_ptt,
|
||||
.set_vfo = icom_set_vfo,
|
||||
.get_vfo = icom_get_vfo,
|
||||
// .get_vfo = icom_get_vfo,
|
||||
.get_ts = icom_get_ts,
|
||||
.set_ts = icom_set_ts,
|
||||
.get_func = ic910_get_func,
|
||||
|
|
|
@ -241,7 +241,7 @@ const struct rig_caps ic9100_caps =
|
|||
.set_mode = icom_set_mode_with_data,
|
||||
|
||||
.set_vfo = icom_set_vfo,
|
||||
.get_vfo = icom_get_vfo,
|
||||
// .get_vfo = icom_get_vfo,
|
||||
.set_ant = icom_set_ant,
|
||||
.get_ant = icom_get_ant,
|
||||
.get_ts = icom_get_ts,
|
||||
|
|
|
@ -467,7 +467,7 @@ const struct rig_caps icf8101_caps =
|
|||
.set_ptt = icf8101_set_ptt,
|
||||
.get_ptt = icf8101_get_ptt,
|
||||
.set_vfo = icom_set_vfo,
|
||||
.get_vfo = icom_get_vfo,
|
||||
// .get_vfo = icom_get_vfo,
|
||||
.get_ts = icom_get_ts,
|
||||
.set_ts = icom_set_ts,
|
||||
.get_func = icf8101_get_func,
|
||||
|
|
|
@ -869,8 +869,9 @@ static vfo_t icom_current_vfo(RIG *rig)
|
|||
vfo_t chkVFO = RIG_VFO_A;
|
||||
struct rig_state *rs = &rig->state;
|
||||
struct icom_priv_data *priv = (struct icom_priv_data *) rs->priv;
|
||||
struct icom_priv_caps *priv_caps = (struct icom_priv_caps*)rig->caps->priv;
|
||||
|
||||
if (priv->x25cmdfails <= 0) // these newer rigs get special treatment
|
||||
if (priv->x25cmdfails <= 0 || priv_caps->x25_always) // these newer rigs get special treatment
|
||||
{
|
||||
return icom_current_vfo_x25(rig);
|
||||
}
|
||||
|
@ -1512,6 +1513,7 @@ int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
int ack_len = sizeof(ackbuf);
|
||||
int civ_731_mode = 0; // even these rigs have 5-byte channels
|
||||
vfo_t vfo_save = rig->state.current_vfo;
|
||||
const struct icom_priv_caps *priv_caps = rig->caps->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called for %s, curr_vfo=%s\n", __func__,
|
||||
rig_strvfo(vfo), rig_strvfo(rig->state.current_vfo));
|
||||
|
@ -1631,7 +1633,7 @@ int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
|
||||
// we'll use 0x25 command to get unselected frequency
|
||||
// we have to assume current_vfo is accurate to determine what "other" means
|
||||
if (priv->x25cmdfails <= 0)
|
||||
if (priv->x25cmdfails <= 0 || priv_caps->x25_always)
|
||||
{
|
||||
int cmd2 = 0x25;
|
||||
int subcmd2 = 0x00;
|
||||
|
@ -2764,22 +2766,28 @@ int icom_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
|
|||
RETURNFUNC2(RIG_OK);
|
||||
}
|
||||
|
||||
#if 0
|
||||
// this seems to work but not for cqrlog and user twiddling VFO knob.
|
||||
// may be able to use twiddle but will disable for now
|
||||
/*
|
||||
* icom_get_vfo
|
||||
* Assumes rig!=NULL, rig->state.priv!=NULL
|
||||
* Only works on IC9700 so far
|
||||
*/
|
||||
int icom_get_vfo(RIG *rig, vfo_t *vfo)
|
||||
{
|
||||
*vfo = icom_current_vfo(rig);
|
||||
ENTERFUNC;
|
||||
unsigned char ackbuf[MAXFRAMELEN];
|
||||
int ack_len = sizeof(ackbuf), retval;
|
||||
retval = icom_transaction(rig, 0x07, 0xd2, NULL, 0, ackbuf, &ack_len);
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: %s\n", __func__, rigerror(retval));
|
||||
return -retval;
|
||||
}
|
||||
dump_hex(ackbuf, ack_len);
|
||||
if (ackbuf[2] == 0) *vfo = RIG_VFO_MAIN;
|
||||
else *vfo = RIG_VFO_SUB;
|
||||
|
||||
if (vfo == NULL) { RETURNFUNC(-RIG_EINTERNAL); }
|
||||
|
||||
RETURNFUNC2(RIG_OK);
|
||||
RETURNFUNC(RIG_OK);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* icom_set_vfo
|
||||
|
@ -2791,6 +2799,7 @@ int icom_set_vfo(RIG *rig, vfo_t vfo)
|
|||
int ack_len = sizeof(ackbuf), icvfo, retval;
|
||||
struct rig_state *rs = &rig->state;
|
||||
struct icom_priv_data *priv = (struct icom_priv_data *) rs->priv;
|
||||
const struct icom_priv_caps *priv_caps = rig->caps->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called vfo=%s\n", __func__, rig_strvfo(vfo));
|
||||
|
||||
|
@ -3044,6 +3053,8 @@ int icom_set_vfo(RIG *rig, vfo_t vfo)
|
|||
case RIG_VFO_OTHER:
|
||||
switch (rig->state.current_vfo)
|
||||
{
|
||||
case RIG_VFO_CURR:
|
||||
break; // no change needed
|
||||
case RIG_VFO_A:
|
||||
icvfo = vfo = RIG_VFO_B;
|
||||
break;
|
||||
|
@ -3082,7 +3093,7 @@ int icom_set_vfo(RIG *rig, vfo_t vfo)
|
|||
}
|
||||
|
||||
default:
|
||||
if (priv->x25cmdfails == 0)
|
||||
if (priv->x25cmdfails == 0 || priv_caps->x25_always)
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %s\n", __func__,
|
||||
rig_strvfo(vfo));
|
||||
|
||||
|
@ -9052,12 +9063,14 @@ int icom_process_async_frame(RIG *rig, size_t frame_length,
|
|||
freq_t freq = (freq_t) from_bcd(frame + 5, (priv->civ_731_mode ? 4 : 5) * 2);
|
||||
rig_fire_freq_event(rig, RIG_VFO_CURR, freq);
|
||||
|
||||
#if 0
|
||||
if (rs->use_cached_freq != 1)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s(%d): use_cached_freq turning on\n", __func__,
|
||||
__LINE__);
|
||||
rs->use_cached_freq = 1;
|
||||
rs->use_cached_freq = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -9072,7 +9085,7 @@ int icom_process_async_frame(RIG *rig, size_t frame_length,
|
|||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s(%d): use_cached_mode turning on\n", __func__,
|
||||
__LINE__);
|
||||
rs->use_cached_mode = 1;
|
||||
rs->use_cached_mode = 0;
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#define BACKEND_VER "20230512"
|
||||
#define BACKEND_VER "20230517"
|
||||
|
||||
#define ICOM_IS_ID31 rig_is_model(rig, RIG_MODEL_ID31)
|
||||
#define ICOM_IS_ID51 rig_is_model(rig, RIG_MODEL_ID51)
|
||||
|
@ -244,6 +244,7 @@ struct icom_priv_caps
|
|||
struct icom_spectrum_edge_frequency_range spectrum_edge_frequency_ranges[ICOM_MAX_SPECTRUM_FREQ_RANGES]; /*!< Icom spectrum scope edge frequencies, if supported by the rig. Last entry should have zeros in all fields. */
|
||||
struct cmdparams *extcmds; /*!< Pointer to extended operations array */
|
||||
int dualwatch_split; /*!< Rig supports dual watch for split ops -- e.g. ID-5100 */
|
||||
int x25_always; /*!< Means the rig should use 0x25 and 0x26 commands always */
|
||||
};
|
||||
|
||||
struct icom_priv_data
|
||||
|
@ -319,7 +320,7 @@ int icom_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width);
|
|||
int icom_get_mode_with_data(RIG *rig, vfo_t vfo, rmode_t *mode,
|
||||
pbwidth_t *width);
|
||||
int icom_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width);
|
||||
#if 0 // see icom_get_vfo in icom.c
|
||||
#if 1 // see icom_get_vfo in icom.c
|
||||
int icom_get_vfo(RIG *rig, vfo_t *vfo);
|
||||
#else
|
||||
#define icom_get_vfo NULL
|
||||
|
|
Ładowanie…
Reference in New Issue