diff --git a/rigs/icom/ic7000.c b/rigs/icom/ic7000.c index 6d1aab267..f6aaefdf2 100644 --- a/rigs/icom/ic7000.c +++ b/rigs/icom/ic7000.c @@ -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, diff --git a/rigs/icom/ic703.c b/rigs/icom/ic703.c index 0e9097539..1fce2a41a 100644 --- a/rigs/icom/ic703.c +++ b/rigs/icom/ic703.c @@ -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, diff --git a/rigs/icom/ic706.c b/rigs/icom/ic706.c index 761898a99..fef2775fc 100644 --- a/rigs/icom/ic706.c +++ b/rigs/icom/ic706.c @@ -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, diff --git a/rigs/icom/ic7100.c b/rigs/icom/ic7100.c index c0931aa12..43e747c57 100644 --- a/rigs/icom/ic7100.c +++ b/rigs/icom/ic7100.c @@ -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, diff --git a/rigs/icom/ic718.c b/rigs/icom/ic718.c index 0bc024745..cca211556 100644 --- a/rigs/icom/ic718.c +++ b/rigs/icom/ic718.c @@ -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, diff --git a/rigs/icom/ic7200.c b/rigs/icom/ic7200.c index 2a93f39a9..9b964552a 100644 --- a/rigs/icom/ic7200.c +++ b/rigs/icom/ic7200.c @@ -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, diff --git a/rigs/icom/ic7300.c b/rigs/icom/ic7300.c index 7a5a1c03a..f87a683a2 100644 --- a/rigs/icom/ic7300.c +++ b/rigs/icom/ic7300.c @@ -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; +} diff --git a/rigs/icom/ic7410.c b/rigs/icom/ic7410.c index 5c48dc0f7..3100397dc 100644 --- a/rigs/icom/ic7410.c +++ b/rigs/icom/ic7410.c @@ -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, diff --git a/rigs/icom/ic746.c b/rigs/icom/ic746.c index 2231987b9..d96309651 100644 --- a/rigs/icom/ic746.c +++ b/rigs/icom/ic746.c @@ -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, diff --git a/rigs/icom/ic756.c b/rigs/icom/ic756.c index 7b420c55c..70ce3bcaa 100644 --- a/rigs/icom/ic756.c +++ b/rigs/icom/ic756.c @@ -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, diff --git a/rigs/icom/ic7600.c b/rigs/icom/ic7600.c index 94f350439..9b9e84fdd 100644 --- a/rigs/icom/ic7600.c +++ b/rigs/icom/ic7600.c @@ -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, diff --git a/rigs/icom/ic7610.c b/rigs/icom/ic7610.c index bbb626d24..fbd6d0b39 100644 --- a/rigs/icom/ic7610.c +++ b/rigs/icom/ic7610.c @@ -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, diff --git a/rigs/icom/ic7700.c b/rigs/icom/ic7700.c index 5b8050193..7c0f1b431 100644 --- a/rigs/icom/ic7700.c +++ b/rigs/icom/ic7700.c @@ -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, diff --git a/rigs/icom/ic7800.c b/rigs/icom/ic7800.c index 4d214be16..0f74ff5f6 100644 --- a/rigs/icom/ic7800.c +++ b/rigs/icom/ic7800.c @@ -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, diff --git a/rigs/icom/ic781.c b/rigs/icom/ic781.c index a9c5ecb6f..3811c0ecc 100644 --- a/rigs/icom/ic781.c +++ b/rigs/icom/ic781.c @@ -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, diff --git a/rigs/icom/ic785x.c b/rigs/icom/ic785x.c index 4842fe597..51c47813a 100644 --- a/rigs/icom/ic785x.c +++ b/rigs/icom/ic785x.c @@ -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, diff --git a/rigs/icom/ic910.c b/rigs/icom/ic910.c index 00f932d32..0005b3df7 100644 --- a/rigs/icom/ic910.c +++ b/rigs/icom/ic910.c @@ -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, diff --git a/rigs/icom/ic9100.c b/rigs/icom/ic9100.c index e0a9afc1c..eb191d5d7 100644 --- a/rigs/icom/ic9100.c +++ b/rigs/icom/ic9100.c @@ -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, diff --git a/rigs/icom/icf8101.c b/rigs/icom/icf8101.c index 05fc82729..f705308d9 100644 --- a/rigs/icom/icf8101.c +++ b/rigs/icom/icf8101.c @@ -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, diff --git a/rigs/icom/icom.c b/rigs/icom/icom.c index 690559211..d48418030 100644 --- a/rigs/icom/icom.c +++ b/rigs/icom/icom.c @@ -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; diff --git a/rigs/icom/icom.h b/rigs/icom/icom.h index 531f67d93..4e16ed76e 100644 --- a/rigs/icom/icom.h +++ b/rigs/icom/icom.h @@ -35,7 +35,7 @@ #include #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