Porównaj commity

...

6 Commity

Autor SHA1 Wiadomość Data
Michael Black 789d863f97
Merge pull request #1523 from GeoBaltz/rp7
Convert all cache references to pointers
2024-03-10 09:04:26 -05:00
George Baltz N3GB c7665cb7d1 All struct rig_cache referenced converted to pointers. 2024-03-09 21:23:01 -05:00
George Baltz N3GB aa0d83df95 Use pointers for all cache references in rigs/* 2024-03-09 14:25:59 -05:00
George Baltz N3GB 609065775c Update some of rigs/* to use pointer to cache
Issue #536
2024-03-08 21:00:19 -05:00
Mike Black W9MDB 5ab1122139 Add freq_skip for use with rigs that do not have targetable VFO
Hopefully this allows them to work with gpredict.
However...setting frequency on TX/RX transition could take up to 1 second depending on gpredict polling rate.
https://github.com/Hamlib/Hamlib/issues/1493
2024-03-08 17:09:47 -06:00
Mike Black W9MDB 24135bd7d7 Fix compile error for MUTEX_CHECK when HAVE_PTHREAD is false 2024-03-08 16:55:33 -06:00
26 zmienionych plików z 291 dodań i 230 usunięć

Wyświetl plik

@ -1429,6 +1429,13 @@ Can also use 1,2,3,4
.EX
Skips rig initialization -- useful when executing commands with rigctl to speed up things
.
.TP
.BR freq_skip " " 'skip'
.EX
When skip!=0 skips setting freq on TX_VFO when in RX and on RX_VFO when in TX -- for use with gpredict and rigs that do not have TARGETABLE_VFO
.
.SH READLINE
.
.SH READLINE
.
If

Wyświetl plik

@ -2850,6 +2850,7 @@ struct rig_state {
int dual_watch; /*!< Boolean DUAL_WATCH status */
int post_ptt_delay; /*!< delay after PTT to allow for relays and such */
struct timespec freq_event_elapsed;
int freq_skip; /*!< allow frequency skip for gpredict RX/TX freq set */
// New rig_state items go before this line ============================================
};

Wyświetl plik

@ -446,7 +446,7 @@ static int dummy_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
if (vfo == RIG_VFO_CURR) { vfo = priv->curr_vfo; }
if (vfo == RIG_VFO_CURR || vfo == RIG_VFO_TX) { vfo = vfo_fixup(rig, vfo, rig->state.cache.split); }
if (vfo == RIG_VFO_CURR || vfo == RIG_VFO_TX) { vfo = vfo_fixup(rig, vfo, CACHE(rig)->split); }
// if needed for testing enable this to emulate a rig with 100hz resolution
#if 0
@ -534,6 +534,7 @@ static int dummy_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
{
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
channel_t *curr = priv->curr;
struct rig_cache *cachep = CACHE(rig);
char buf[16];
ENTERFUNC;
@ -542,7 +543,7 @@ static int dummy_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s %s %s\n", __func__,
rig_strvfo(vfo), rig_strrmode(mode), buf);
vfo = vfo_fixup(rig, vfo, rig->state.cache.split);
vfo = vfo_fixup(rig, vfo, cachep->split);
if (vfo == RIG_VFO_CURR) { vfo = priv->curr_vfo; }
@ -587,7 +588,7 @@ static int dummy_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
RETURNFUNC(-RIG_EINVAL);
}
vfo = vfo_fixup(rig, vfo, rig->state.cache.split);
vfo = vfo_fixup(rig, vfo, cachep->split);
if (RIG_PASSBAND_NOCHANGE == width) { RETURNFUNC(RIG_OK); }
@ -1085,7 +1086,7 @@ static int dummy_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
if (tx_vfo == RIG_VFO_NONE || tx_vfo == RIG_VFO_CURR) { tx_vfo = priv->curr_vfo; }
if (tx_vfo == RIG_VFO_CURR || tx_vfo == RIG_VFO_TX) { tx_vfo = vfo_fixup(rig, vfo, rig->state.cache.split); }
if (tx_vfo == RIG_VFO_CURR || tx_vfo == RIG_VFO_TX) { tx_vfo = vfo_fixup(rig, vfo, CACHE(rig)->split); }
priv->split = split;
priv->tx_vfo = tx_vfo;

Wyświetl plik

@ -2218,12 +2218,13 @@ int ic9700_set_vfo(RIG *rig, vfo_t vfo)
int ack_len = sizeof(ackbuf);
int retval;
int vfo_is_main_or_sub = (vfo == RIG_VFO_MAIN) || (vfo == RIG_VFO_SUB);
struct rig_cache *cachep = CACHE(rig);
ENTERFUNC;
rig_debug(RIG_DEBUG_VERBOSE, "%s: vfo=%s\n", __func__, rig_strvfo(vfo));
if (rig->state.cache.satmode && !vfo_is_main_or_sub)
if (cachep->satmode && !vfo_is_main_or_sub)
{
// Translate VFO A/B to Main/Sub in satellite mode
if (vfo == RIG_VFO_A)
@ -2247,7 +2248,7 @@ int ic9700_set_vfo(RIG *rig, vfo_t vfo)
}
else if (vfo == RIG_VFO_B)
{
if (rig->state.cache.satmode)
if (cachep->satmode)
{
rig_debug(RIG_DEBUG_WARN, "%s: cannot switch to VFOB when in satmode\n",
__func__);
@ -2267,7 +2268,7 @@ int ic9700_set_vfo(RIG *rig, vfo_t vfo)
return retval;
}
if (rig->state.cache.satmode && vfo == RIG_VFO_MAIN_B)
if (cachep->satmode && vfo == RIG_VFO_MAIN_B)
{
rig_debug(RIG_DEBUG_WARN, "%s: cannot switch to VFOB when in satmode\n", __func__);
// we return RIG_OK anyways as this should just be a bad request
@ -2290,7 +2291,7 @@ int ic9700_set_vfo(RIG *rig, vfo_t vfo)
return retval;
}
if (rig->state.cache.satmode && vfo == RIG_VFO_SUB_B)
if (cachep->satmode && vfo == RIG_VFO_SUB_B)
{
rig_debug(RIG_DEBUG_WARN, "%s: cannot switch to VFOB when in satmode\n", __func__);
// we return RIG_OK anyways as this should just be a bad request

Wyświetl plik

@ -64,10 +64,10 @@ int ic821h_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
if (tx_vfo == RIG_VFO_MAIN)
{
rig->state.cache.satmode =
CACHE(rig)->satmode =
split; // we emulate satmode of other rigs since we apparently can't query
rig_debug(RIG_DEBUG_TRACE, "%s: tx_vfo==MAIN so assuming sat mode=%d\n",
__func__, rig->state.cache.satmode);
__func__, CACHE(rig)->satmode);
rig->state.tx_vfo = split == RIG_SPLIT_ON ? RIG_VFO_SUB : RIG_VFO_MAIN;
// the IC821 seems to be backwards in satmode -- setting Main select Sub and vice versa
retval = rig_set_vfo(rig, RIG_VFO_SUB);

Wyświetl plik

@ -934,7 +934,8 @@ static vfo_t icom_current_vfo(RIG *rig)
freq_t freq_current, freq_other, freq_current_2;
vfo_t vfo_current = RIG_VFO_NONE;
vfo_t vfo_check = RIG_VFO_A;
struct rig_state *rs = &rig->state;
struct rig_state *rs = STATE(rig);
struct rig_cache *cachep = CACHE(rig);
struct icom_priv_data *priv = rs->priv;
#if 0
@ -944,7 +945,7 @@ static vfo_t icom_current_vfo(RIG *rig)
// these newer rigs get special treatment
retval = icom_current_vfo_x25(rig, &vfo_current);
if (VFO_HAS_MAIN_SUB_ONLY || (VFO_HAS_MAIN_SUB_A_B_ONLY && rs->cache.satmode))
if (VFO_HAS_MAIN_SUB_ONLY || (VFO_HAS_MAIN_SUB_A_B_ONLY && cachep->satmode))
{
vfo_current = (vfo_current == RIG_VFO_A) ? RIG_VFO_MAIN : RIG_VFO_SUB;
}
@ -956,7 +957,7 @@ static vfo_t icom_current_vfo(RIG *rig)
}
#endif
if (rs->cache.ptt)
if (cachep->ptt)
{
// don't do this if transmitting -- XCHG would mess it up
return rs->current_vfo;
@ -1040,7 +1041,7 @@ static vfo_t icom_current_vfo(RIG *rig)
rig_set_freq(rig, RIG_VFO_CURR, freq_current);
}
if (VFO_HAS_MAIN_SUB_ONLY || (VFO_HAS_MAIN_SUB_A_B_ONLY && rs->cache.satmode))
if (VFO_HAS_MAIN_SUB_ONLY || (VFO_HAS_MAIN_SUB_A_B_ONLY && cachep->satmode))
{
vfo_current = (vfo_current == RIG_VFO_A) ? RIG_VFO_MAIN : RIG_VFO_SUB;
}
@ -1089,7 +1090,7 @@ int icom_rig_open(RIG *rig)
{
int retval, retval_echo, value;
int satmode = 0;
struct rig_state *rs = &rig->state;
struct rig_state *rs = STATE(rig);
hamlib_port_t *rp = RIGPORT(rig);
struct icom_priv_data *priv = (struct icom_priv_data *) rs->priv;
int retry_flag = 1;
@ -1560,7 +1561,7 @@ int icom_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
#if 0
if (rig->state.cache.ptt && (ICOM_IS_ID5100 || ICOM_IS_ID4100 || ICOM_IS_ID31
if (CACHE(rig)->ptt && (ICOM_IS_ID5100 || ICOM_IS_ID4100 || ICOM_IS_ID31
|| ICOM_IS_ID51))
{
rig_debug(RIG_DEBUG_TRACE, "%s(%d): ID55100 0x00\n", __func__, __LINE__);
@ -1720,7 +1721,7 @@ int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
}
// Fix VFO if the TX freq command is not available
if (rig->state.cache.split != RIG_SPLIT_OFF)
if (CACHE(rig)->split != RIG_SPLIT_OFF)
{
vfo = rs->tx_vfo;
}
@ -2895,7 +2896,8 @@ int icom_set_vfo(RIG *rig, vfo_t vfo)
{
unsigned char ackbuf[MAXFRAMELEN];
int ack_len = sizeof(ackbuf), icvfo, retval;
struct rig_state *rs = &rig->state;
struct rig_state *rs = STATE(rig);
struct rig_cache *cachep = CACHE(rig);
struct icom_priv_data *priv = (struct icom_priv_data *) rs->priv;
const struct icom_priv_caps *priv_caps = rig->caps->priv;
@ -2917,7 +2919,7 @@ int icom_set_vfo(RIG *rig, vfo_t vfo)
}
else if ((vfo == RIG_VFO_SUB) &&
(VFO_HAS_A_B_ONLY || (VFO_HAS_MAIN_SUB_A_B_ONLY
&& rig->state.cache.split == RIG_SPLIT_OFF && !rig->state.cache.satmode)))
&& cachep->split == RIG_SPLIT_OFF && !cachep->satmode)))
{
// if rig doesn't have Main/Sub
// or if rig has both Main/Sub and A/B -- e.g. 9700
@ -2934,22 +2936,22 @@ int icom_set_vfo(RIG *rig, vfo_t vfo)
rig_strvfo(vfo));
vfo = RIG_VFO_A;
if (VFO_HAS_A_B_ONLY && rig->state.cache.satmode) { vfo = RIG_VFO_B; }
if (VFO_HAS_A_B_ONLY && cachep->satmode) { vfo = RIG_VFO_B; }
else if (VFO_HAS_MAIN_SUB_ONLY) { vfo = RIG_VFO_SUB; }
else if (VFO_HAS_MAIN_SUB_A_B_ONLY && rig->state.cache.satmode) { vfo = RIG_VFO_SUB; }
else if (VFO_HAS_MAIN_SUB_A_B_ONLY && cachep->satmode) { vfo = RIG_VFO_SUB; }
}
else if ((vfo == RIG_VFO_A || vfo == RIG_VFO_MAIN) && VFO_HAS_DUAL)
{
rig_debug(RIG_DEBUG_TRACE, "%s: vfo line#%d vfo=%s, split=%d\n", __func__,
__LINE__, rig_strvfo(vfo), rig->state.cache.split);
__LINE__, rig_strvfo(vfo), cachep->split);
// If we're being asked for A/Main but we are a MainA/MainB rig change it
vfo = RIG_VFO_MAIN;
if (rig->state.cache.split == RIG_SPLIT_ON && !rig->state.cache.satmode) { vfo = RIG_VFO_A; }
if (cachep->split == RIG_SPLIT_ON && !cachep->satmode) { vfo = RIG_VFO_A; }
// Seems the IC821H reverses Main/Sub when in satmode
if (RIG_IS_IC821H && rig->state.cache.satmode) { vfo = RIG_VFO_SUB; }
if (RIG_IS_IC821H && cachep->satmode) { vfo = RIG_VFO_SUB; }
}
else if ((vfo == RIG_VFO_B || vfo == RIG_VFO_SUB) && VFO_HAS_DUAL)
{
@ -2959,14 +2961,14 @@ int icom_set_vfo(RIG *rig, vfo_t vfo)
vfo = RIG_VFO_SUB;
// If we're in satmode for rigs like IC9700 we want the 2nd VFO
if (rig->state.cache.satmode)
if (cachep->satmode)
{
vfo = RIG_VFO_SUB_A;
}
else if (rig->state.cache.split == RIG_SPLIT_ON) { vfo = RIG_VFO_B; }
else if (cachep->split == RIG_SPLIT_ON) { vfo = RIG_VFO_B; }
// Seems the IC821H reverses Main/Sub when in satmode
if (RIG_IS_IC821H && rig->state.cache.satmode) { vfo = RIG_VFO_MAIN; }
if (RIG_IS_IC821H && cachep->satmode) { vfo = RIG_VFO_MAIN; }
}
else if ((vfo == RIG_VFO_A || vfo == RIG_VFO_B) && !VFO_HAS_A_B
&& VFO_HAS_MAIN_SUB)
@ -2991,8 +2993,7 @@ int icom_set_vfo(RIG *rig, vfo_t vfo)
{
rig_debug(RIG_DEBUG_TRACE, "%s: VFO changing from %s to %s\n", __func__,
rig_strvfo(rig->state.current_vfo), rig_strvfo(vfo));
rig->state.cache.freqCurr =
0; // reset current frequency so set_freq works 1st time
cachep->freqCurr = 0; // reset current frequency so set_freq works 1st time
}
rig_debug(RIG_DEBUG_TRACE, "%s: line#%d\n", __func__, __LINE__);
@ -3011,8 +3012,8 @@ int icom_set_vfo(RIG *rig, vfo_t vfo)
icvfo = S_MAIN;
// If not split or satmode then we must want VFOA
if (VFO_HAS_MAIN_SUB_A_B_ONLY && rig->state.cache.split == RIG_SPLIT_OFF
&& !rig->state.cache.satmode) { icvfo = S_VFOA; }
if (VFO_HAS_MAIN_SUB_A_B_ONLY && cachep->split == RIG_SPLIT_OFF
&& !cachep->satmode) { icvfo = S_VFOA; }
rig_debug(RIG_DEBUG_TRACE, "%s: Main asked for, ended up with vfo=%s\n",
__func__, icvfo == S_MAIN ? "Main" : "VFOA");
@ -3023,11 +3024,11 @@ int icom_set_vfo(RIG *rig, vfo_t vfo)
icvfo = S_SUB;
// If split is on these rigs can only split on Main/VFOB
if (VFO_HAS_MAIN_SUB_A_B_ONLY && rig->state.cache.split != RIG_SPLIT_OFF) { icvfo = S_VFOB; }
if (VFO_HAS_MAIN_SUB_A_B_ONLY && cachep->split != RIG_SPLIT_OFF) { icvfo = S_VFOB; }
// If not split or satmode then we must want VFOB
if (VFO_HAS_MAIN_SUB_A_B_ONLY && rig->state.cache.split == RIG_SPLIT_OFF
&& !rig->state.cache.satmode) { icvfo = S_VFOB; }
if (VFO_HAS_MAIN_SUB_A_B_ONLY && cachep->split == RIG_SPLIT_OFF
&& !cachep->satmode) { icvfo = S_VFOB; }
rig_debug(RIG_DEBUG_TRACE, "%s: Sub asked for, ended up with vfo=%s\n",
__func__, icvfo == S_SUB ? "Sub" : "VFOB");
@ -3035,8 +3036,8 @@ int icom_set_vfo(RIG *rig, vfo_t vfo)
break;
case RIG_VFO_TX:
icvfo = (rig->state.cache.split != RIG_SPLIT_OFF) ? S_VFOB : S_VFOA;
vfo = (rig->state.cache.split != RIG_SPLIT_OFF) ? RIG_VFO_B : RIG_VFO_A;
icvfo = (cachep->split != RIG_SPLIT_OFF) ? S_VFOB : S_VFOA;
vfo = (cachep->split != RIG_SPLIT_OFF) ? RIG_VFO_B : RIG_VFO_A;
rig_debug(RIG_DEBUG_TRACE, "%s: RIG_VFO_TX changing vfo to %s\n", __func__,
rig_strvfo(vfo));
break;
@ -5437,29 +5438,28 @@ int icom_get_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t *rptr_offs)
*/
int icom_get_split_vfos(RIG *rig, vfo_t *rx_vfo, vfo_t *tx_vfo)
{
struct rig_state *rs;
struct rig_state *rs = STATE(rig);
struct rig_cache *cachep = CACHE(rig);
ENTERFUNC;
rs = (struct rig_state *) &rig->state;
// Initialize TX VFO if not done yet
if (rs->tx_vfo == RIG_VFO_NONE || rs->tx_vfo == RIG_VFO_CURR
|| rs->tx_vfo == RIG_VFO_TX)
{
if (rs->cache.split == RIG_SPLIT_OFF)
if (cachep->split == RIG_SPLIT_OFF)
{
rs->tx_vfo = rs->current_vfo;
}
else
{
rs->tx_vfo = vfo_fixup(rig, RIG_VFO_OTHER, rs->cache.split);
rs->tx_vfo = vfo_fixup(rig, RIG_VFO_OTHER, cachep->split);
}
}
if (VFO_HAS_A_B_ONLY)
{
if (rs->cache.split == RIG_SPLIT_OFF)
if (cachep->split == RIG_SPLIT_OFF)
{
*rx_vfo = *tx_vfo = rs->current_vfo;
}
@ -5470,11 +5470,11 @@ int icom_get_split_vfos(RIG *rig, vfo_t *rx_vfo, vfo_t *tx_vfo)
}
rig_debug(RIG_DEBUG_TRACE, "%s: VFO_HAS_A_B_ONLY, split=%d, rx=%s, tx=%s\n",
__func__, rs->cache.split, rig_strvfo(*rx_vfo), rig_strvfo(*tx_vfo));
__func__, cachep->split, rig_strvfo(*rx_vfo), rig_strvfo(*tx_vfo));
}
else if (VFO_HAS_MAIN_SUB_ONLY)
{
if (rs->cache.split == RIG_SPLIT_OFF)
if (cachep->split == RIG_SPLIT_OFF)
{
*rx_vfo = *tx_vfo = rs->current_vfo;
}
@ -5486,7 +5486,7 @@ int icom_get_split_vfos(RIG *rig, vfo_t *rx_vfo, vfo_t *tx_vfo)
rig_debug(RIG_DEBUG_TRACE,
"%s: VFO_HAS_MAIN_SUB_ONLY, split=%d, rx=%s, tx=%s\n",
__func__, rs->cache.split, rig_strvfo(*rx_vfo), rig_strvfo(*tx_vfo));
__func__, cachep->split, rig_strvfo(*rx_vfo), rig_strvfo(*tx_vfo));
}
else if (VFO_HAS_MAIN_SUB_A_B_ONLY)
{
@ -5505,7 +5505,7 @@ int icom_get_split_vfos(RIG *rig, vfo_t *rx_vfo, vfo_t *tx_vfo)
*rx_vfo = RIG_VFO_MAIN;
*tx_vfo = RIG_VFO_SUB;
}
else if (rs->cache.split == RIG_SPLIT_OFF)
else if (cachep->split == RIG_SPLIT_OFF)
{
*rx_vfo = *tx_vfo = rs->current_vfo;
}
@ -5517,7 +5517,7 @@ int icom_get_split_vfos(RIG *rig, vfo_t *rx_vfo, vfo_t *tx_vfo)
rig_debug(RIG_DEBUG_TRACE,
"%s: VFO_HAS_MAIN_SUB_A_B_ONLY, split=%d, rx=%s, tx=%s\n",
__func__, rs->cache.split, rig_strvfo(*rx_vfo), rig_strvfo(*tx_vfo));
__func__, cachep->split, rig_strvfo(*rx_vfo), rig_strvfo(*tx_vfo));
}
else
{
@ -5537,7 +5537,8 @@ int icom_get_split_vfos(RIG *rig, vfo_t *rx_vfo, vfo_t *tx_vfo)
*/
int icom_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
{
struct rig_state *rs = &rig->state;
struct rig_state *rs = STATE(rig);
struct rig_cache *cachep = CACHE(rig);
hamlib_port_t *rp = RIGPORT(rig);
struct icom_priv_data *priv = rs->priv;
const struct icom_priv_caps *priv_caps = rig->caps->priv;
@ -5551,11 +5552,11 @@ int icom_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
rig_strvfo(rs->current_vfo));
rig_debug(RIG_DEBUG_VERBOSE, "%s: satmode=%d, tx_vfo=%s\n", __func__,
rs->cache.satmode, rig_strvfo(rs->tx_vfo));
cachep->satmode, rig_strvfo(rs->tx_vfo));
if (vfo == RIG_VFO_TX)
{
if (rs->cache.satmode) { vfo = RIG_VFO_SUB; }
if (cachep->satmode) { vfo = RIG_VFO_SUB; }
else { vfo = rs->tx_vfo; }
}
@ -5637,7 +5638,7 @@ int icom_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
}
/* broken if user changes split on rig :( */
if (VFO_HAS_A_B_ONLY && rs->cache.split != RIG_SPLIT_OFF)
if (VFO_HAS_A_B_ONLY && cachep->split != RIG_SPLIT_OFF)
{
/* VFO A/B style rigs swap VFO on split Tx so we need to disable
split for certainty */
@ -5690,7 +5691,7 @@ int icom_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
{
// Then we return the VFO to the rx_vfo
rig_debug(RIG_DEBUG_TRACE, "%s: SATMODE split_on=%d rig so setting vfo to %s\n",
__func__, rs->cache.split, rig_strvfo(rx_vfo));
__func__, cachep->split, rig_strvfo(rx_vfo));
HAMLIB_TRACE;
@ -5710,7 +5711,7 @@ int icom_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
RETURNFUNC2(retval);
}
if (VFO_HAS_A_B_ONLY && rs->cache.split != RIG_SPLIT_OFF)
if (VFO_HAS_A_B_ONLY && cachep->split != RIG_SPLIT_OFF)
{
/* Re-enable split */
retval = icom_transaction(rig, C_CTL_SPLT, S_SPLT_ON, NULL, 0, ackbuf,
@ -5737,7 +5738,8 @@ int icom_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
*/
int icom_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq)
{
struct rig_state *rs = &rig->state;
struct rig_state *rs = STATE(rig);
struct rig_cache *cachep = CACHE(rig);
hamlib_port_t *rp = RIGPORT(rig);
struct icom_priv_data *priv = rs->priv;
const struct icom_priv_caps *priv_caps = rig->caps->priv;
@ -5845,7 +5847,7 @@ int icom_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq)
}
/* broken if user changes split on rig :( */
if (VFO_HAS_A_B_ONLY && rs->cache.split != RIG_SPLIT_OFF)
if (VFO_HAS_A_B_ONLY && cachep->split != RIG_SPLIT_OFF)
{
/* VFO A/B style rigs swap VFO on split Tx so we need to disable
split for certainty */
@ -5888,7 +5890,7 @@ int icom_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq)
RETURNFUNC2(retval);
}
if (VFO_HAS_A_B_ONLY && rs->cache.split != RIG_SPLIT_OFF)
if (VFO_HAS_A_B_ONLY && cachep->split != RIG_SPLIT_OFF)
{
/* Re-enable split */
retval = icom_transaction(rig, C_CTL_SPLT, S_SPLT_ON, NULL, 0, ackbuf,
@ -5911,7 +5913,8 @@ int icom_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq)
int icom_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode,
pbwidth_t tx_width)
{
struct rig_state *rs = &rig->state;
struct rig_state *rs = STATE(rig);
struct rig_cache *cachep = CACHE(rig);
struct icom_priv_data *priv = rs->priv;
unsigned char ackbuf[MAXFRAMELEN];
int ack_len = sizeof(ackbuf);
@ -5949,7 +5952,7 @@ int icom_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode,
}
/* broken if user changes split on rig :( */
if (VFO_HAS_A_B_ONLY && rs->cache.split != RIG_SPLIT_OFF)
if (VFO_HAS_A_B_ONLY && cachep->split != RIG_SPLIT_OFF)
{
/* VFO A/B style rigs swap VFO on split Tx so we need to disable
split for certainty */
@ -5994,7 +5997,7 @@ int icom_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode,
RETURNFUNC(retval);
}
if (VFO_HAS_A_B_ONLY && rs->cache.split != RIG_SPLIT_OFF)
if (VFO_HAS_A_B_ONLY && cachep->split != RIG_SPLIT_OFF)
{
/* Re-enable split */
retval = icom_transaction(rig, C_CTL_SPLT, S_SPLT_ON, NULL, 0, ackbuf,
@ -6056,7 +6059,7 @@ int icom_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode,
}
/* broken if user changes split on rig :( */
if (VFO_HAS_A_B_ONLY && rs->cache.split != RIG_SPLIT_OFF)
if (VFO_HAS_A_B_ONLY && CACHE(rig)->split != RIG_SPLIT_OFF)
{
/* VFO A/B style rigs swap VFO on split Tx so we need to disable
split for certainty */
@ -6099,7 +6102,7 @@ int icom_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode,
RETURNFUNC(retval);
}
if (VFO_HAS_A_B_ONLY && rs->cache.split != RIG_SPLIT_OFF)
if (VFO_HAS_A_B_ONLY && CACHE(rig)->split != RIG_SPLIT_OFF)
{
/* Re-enable split */
retval = icom_transaction(rig, C_CTL_SPLT, S_SPLT_ON, NULL, 0, ackbuf,
@ -6122,7 +6125,7 @@ int icom_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode,
int icom_set_split_freq_mode(RIG *rig, vfo_t vfo, freq_t tx_freq,
rmode_t tx_mode, pbwidth_t tx_width)
{
struct rig_state *rs = &rig->state;
struct rig_state *rs = STATE(rig);
struct icom_priv_data *priv = rs->priv;
unsigned char ackbuf[MAXFRAMELEN];
int ack_len = sizeof(ackbuf);
@ -6188,7 +6191,7 @@ int icom_set_split_freq_mode(RIG *rig, vfo_t vfo, freq_t tx_freq,
}
/* broken if user changes split on rig :( */
if (VFO_HAS_A_B && (split_assumed || rs->cache.split != RIG_SPLIT_OFF))
if (VFO_HAS_A_B && (split_assumed || CACHE(rig)->split != RIG_SPLIT_OFF))
{
/* VFO A/B style rigs swap VFO on split Tx so we need to disable
split for certainty */
@ -6230,7 +6233,7 @@ int icom_set_split_freq_mode(RIG *rig, vfo_t vfo, freq_t tx_freq,
rig_strvfo(rs->rx_vfo), rig_strvfo(rs->tx_vfo));
// if not asking for RIG_VFO_CURR we'll use the requested VFO in the function call as tx_vfo
if (rs->cache.split == RIG_SPLIT_OFF && vfo != RIG_VFO_CURR)
if (CACHE(rig)->split == RIG_SPLIT_OFF && vfo != RIG_VFO_CURR)
{
tx_vfo = vfo;
rig_debug(RIG_DEBUG_TRACE, "%s: split not on so using requested vfo=%s\n",
@ -6272,7 +6275,7 @@ int icom_set_split_freq_mode(RIG *rig, vfo_t vfo, freq_t tx_freq,
RETURNFUNC2(retval);
}
if (VFO_HAS_A_B && rs->cache.split != RIG_SPLIT_OFF)
if (VFO_HAS_A_B && CACHE(rig)->split != RIG_SPLIT_OFF)
{
/* Re-enable split */
retval = icom_transaction(rig, C_CTL_SPLT, S_SPLT_ON, NULL, 0, ackbuf,
@ -6296,7 +6299,7 @@ int icom_set_split_freq_mode(RIG *rig, vfo_t vfo, freq_t tx_freq,
int icom_get_split_freq_mode(RIG *rig, vfo_t vfo, freq_t *tx_freq,
rmode_t *tx_mode, pbwidth_t *tx_width)
{
struct rig_state *rs = &rig->state;
struct rig_state *rs = STATE(rig);
struct icom_priv_data *priv = rs->priv;
unsigned char ackbuf[MAXFRAMELEN];
int ack_len = sizeof(ackbuf);
@ -6349,7 +6352,7 @@ int icom_get_split_freq_mode(RIG *rig, vfo_t vfo, freq_t *tx_freq,
}
/* broken if user changes split on rig :( */
if (VFO_HAS_A_B_ONLY && rs->cache.split != RIG_SPLIT_OFF)
if (VFO_HAS_A_B_ONLY && CACHE(rig)->split != RIG_SPLIT_OFF)
{
/* VFO A/B style rigs swap VFO on split Tx so we need to disable
split for certainty */
@ -6397,7 +6400,7 @@ int icom_get_split_freq_mode(RIG *rig, vfo_t vfo, freq_t *tx_freq,
RETURNFUNC(retval);
}
if (VFO_HAS_A_B_ONLY && rs->cache.split != RIG_SPLIT_OFF)
if (VFO_HAS_A_B_ONLY && CACHE(rig)->split != RIG_SPLIT_OFF)
{
/* Re-enable split */
retval = icom_transaction(rig, C_CTL_SPLT, S_SPLT_ON, NULL, 0, ackbuf,
@ -6418,7 +6421,8 @@ int icom_get_split_freq_mode(RIG *rig, vfo_t vfo, freq_t *tx_freq,
*/
int icom_set_split_vfo(RIG *rig, vfo_t rx_vfo, split_t split, vfo_t tx_vfo)
{
struct rig_state *rs = &rig->state;
struct rig_state *rs = STATE(rig);
struct rig_cache *cachep = CACHE(rig);
const struct icom_priv_caps *priv_caps = rig->caps->priv;
unsigned char ackbuf[MAXFRAMELEN];
int ack_len = sizeof(ackbuf), retval;
@ -6443,7 +6447,7 @@ int icom_set_split_vfo(RIG *rig, vfo_t rx_vfo, split_t split, vfo_t tx_vfo)
rig_get_func(rig, RIG_VFO_CURR, RIG_FUNC_SATMODE, &satmode);
if ((tx_vfo == RIG_VFO_MAIN || tx_vfo == RIG_VFO_SUB)
&& !rig->state.cache.satmode)
&& !cachep->satmode)
{
rig_debug(RIG_DEBUG_VERBOSE,
"%s: requesting split for Main/Sub VFO and satmode is OFF so turning satmode ON\n",
@ -6453,7 +6457,7 @@ int icom_set_split_vfo(RIG *rig, vfo_t rx_vfo, split_t split, vfo_t tx_vfo)
RETURNFUNC2(retval);
}
else if ((tx_vfo == RIG_VFO_A || tx_vfo == RIG_VFO_B)
&& rig->state.cache.satmode)
&& cachep->satmode)
{
rig_debug(RIG_DEBUG_VERBOSE,
"%s: requesting split for VFO A/B and satmode is ON so turning satmode OFF\n",
@ -6461,7 +6465,7 @@ int icom_set_split_vfo(RIG *rig, vfo_t rx_vfo, split_t split, vfo_t tx_vfo)
rig_set_func(rig, RIG_VFO_CURR, RIG_FUNC_SATMODE, 0);
}
else if ((tx_vfo == RIG_VFO_MAIN || tx_vfo == RIG_VFO_SUB)
&& rig->state.cache.satmode && split == RIG_SPLIT_ON)
&& cachep->satmode && split == RIG_SPLIT_ON)
{
rig_debug(RIG_DEBUG_VERBOSE,
"%s: requesting split for Main/Sub VFO and rig is already in satmode so setting split on "
@ -6550,7 +6554,7 @@ int icom_get_split_vfo(RIG *rig, vfo_t rx_vfo, split_t *split, vfo_t *tx_vfo)
{
unsigned char splitbuf[MAXFRAMELEN];
int split_len, retval, satmode = 0;
struct rig_state *rs = &rig->state;
struct rig_state *rs = STATE(rig);
ENTERFUNC;
retval = icom_transaction(rig, C_CTL_SPLT, -1, NULL, 0,
@ -6605,7 +6609,7 @@ int icom_get_split_vfo(RIG *rig, vfo_t rx_vfo, split_t *split, vfo_t *tx_vfo)
}
// Update cache early for icom_get_split_vfos()
rs->cache.split = *split;
CACHE(rig)->split = *split;
icom_get_split_vfos(rig, &rs->rx_vfo, &rs->tx_vfo);
@ -6636,7 +6640,7 @@ int icom_mem_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
if (rig->state.current_vfo != RIG_VFO_MEM ||
!rig_has_vfo_op(rig, RIG_OP_XCHG))
{
*split = rig->state.cache.split; // we set this but still return ENAVAIL
*split = CACHE(rig)->split; // we set this but still return ENAVAIL
RETURNFUNC(-RIG_ENAVAIL);
}
@ -7021,7 +7025,7 @@ int icom_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
{
int satmode = status ? 1 : 0;
if (satmode != rig->state.cache.satmode)
if (satmode != CACHE(rig)->satmode)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s(%d): changed satmode=%d\n",
__func__, __LINE__, satmode);
@ -7037,7 +7041,7 @@ int icom_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
__func__, __LINE__, satmode);
}
rig->state.cache.satmode = satmode;
CACHE(rig)->satmode = satmode;
icom_satmode_fix(rig, satmode);
// Turning satmode ON/OFF can change the TX/RX VFOs
@ -7281,13 +7285,13 @@ int icom_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
}
else if (func == RIG_FUNC_SATMODE)
{
struct rig_state *rs = &rig->state;
struct rig_state *rs = STATE(rig);
struct icom_priv_data *priv = rs->priv;
int satmode = ackbuf[2 + fct_len];
*status = satmode;
if (satmode != rig->state.cache.satmode)
if (satmode != CACHE(rig)->satmode)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s(%d): changed satmode=%d\n",
__func__, __LINE__, satmode);
@ -7303,7 +7307,7 @@ int icom_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
__func__, __LINE__, satmode);
}
rig->state.cache.satmode = satmode;
CACHE(rig)->satmode = satmode;
icom_satmode_fix(rig, satmode);
}
else
@ -9381,8 +9385,8 @@ static int set_vfo_curr(RIG *rig, vfo_t vfo, vfo_t curr_vfo)
// only need to set vfo if it's changed
else if (rs->current_vfo != vfo)
{
if (!(VFO_HAS_MAIN_SUB_A_B_ONLY && rs->cache.split == RIG_SPLIT_OFF
&& !rs->cache.satmode
if (!(VFO_HAS_MAIN_SUB_A_B_ONLY && CACHE(rig)->split == RIG_SPLIT_OFF
&& !CACHE(rig)->satmode
&& vfo == RIG_VFO_SUB && rs->current_vfo == RIG_VFO_B))
{
rig_debug(RIG_DEBUG_TRACE, "%s: setting new vfo=%s\n", __func__,
@ -9698,11 +9702,12 @@ static void icom_set_x25x26_ability(RIG *rig, int status)
static int icom_get_vfo_number_x25x26(RIG *rig, vfo_t vfo)
{
int vfo_number = 0x00;
struct rig_cache *cachep = CACHE(rig);
// Rigs with *only* Main/Sub VFOs can directly address VFOs: 0 = Main, 1 = Sub
if (RIG_IS_IC7600 || RIG_IS_IC7610 || RIG_IS_IC7800 || RIG_IS_IC785X)
{
vfo_t actual_vfo = vfo_fixup(rig, vfo, rig->state.cache.split);
vfo_t actual_vfo = vfo_fixup(rig, vfo, cachep->split);
if (actual_vfo == RIG_VFO_CURR)
{
@ -9746,8 +9751,7 @@ static int icom_get_vfo_number_x25x26(RIG *rig, vfo_t vfo)
}
// The split VFO is active when transmitting in split mode
vfo_number = (rig->state.cache.split
&& rig->state.cache.ptt) ? !vfo_number : vfo_number;
vfo_number = (cachep->split && cachep->ptt) ? !vfo_number : vfo_number;
}
}

Wyświetl plik

@ -284,9 +284,9 @@ int id5100_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
else if ((vfo == RIG_VFOvfo == RIG_VFO_SUB
&& rs->dual_watch_main_sub == MAIN_ON_RIGHT)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s(%d): Sub/A vfo=%s\n", __func__, __LINE__,
rig_strvfo(vfo));
*freq = rig->state.cache.freqSubA;
rig_debug(RIG_DEBUG_VERBOSE, "%s(%d): Sub/A vfo=%s\n", __func__, __LINE__,
rig_strvfo(vfo));
*freq = CACHE(rig)->freqSubA;
int cache_ms_freq, cache_ms_mode, cache_ms_width;
pbwidth_t width;
freq_t tfreq;

Wyświetl plik

@ -934,6 +934,7 @@ static int x108g_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
unsigned char ackbuf[MAXFRAMELEN];
int ack_len = sizeof(ackbuf), rc;
int split_sc;
struct rig_cache *cachep = CACHE(rig);
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
@ -946,7 +947,7 @@ static int x108g_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
case RIG_SPLIT_ON:
split_sc = S_SPLT_ON;
if (rig->state.cache.split == RIG_SPLIT_OFF)
if (cachep->split == RIG_SPLIT_OFF)
{
/* ensure VFO A is Rx and VFO B is Tx as we assume that elsewhere */
if ((rig->state.vfo_list & (RIG_VFO_A | RIG_VFO_B)) == (RIG_VFO_A | RIG_VFO_B))
@ -973,7 +974,7 @@ static int x108g_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
return -RIG_ERJCTED;
}
rig->state.cache.split = split;
cachep->split = split;
return RIG_OK;
}
@ -988,12 +989,12 @@ static int x108g_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
int rc;
vfo_t rx_vfo, tx_vfo;
struct icom_priv_data *priv;
struct rig_state *rs;
struct rig_state *rs = STATE(rig);
struct rig_cache *cachep = CACHE(rig);
unsigned char ackbuf[MAXFRAMELEN];
int ack_len = sizeof(ackbuf);
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
rs = &rig->state;
priv = (struct icom_priv_data *)rs->priv;
/* This method works also in memory mode(RIG_VFO_MEM) */
@ -1014,7 +1015,7 @@ static int x108g_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
queries */
/* broken if user changes split on rig :( */
if ((rig->state.vfo_list & (RIG_VFO_A | RIG_VFO_B)) == (RIG_VFO_A | RIG_VFO_B)
&& rig->state.cache.split != RIG_SPLIT_OFF)
&& cachep->split != RIG_SPLIT_OFF)
{
/* VFO A/B style rigs swap VFO on split Tx so we need to disable
split for certainty */
@ -1041,7 +1042,7 @@ static int x108g_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
if (RIG_OK != (rc = icom_set_vfo(rig, rx_vfo))) { return rc; }
if ((rig->state.vfo_list & (RIG_VFO_A | RIG_VFO_B)) == (RIG_VFO_A | RIG_VFO_B)
&& rig->state.cache.split != RIG_SPLIT_OFF)
&& cachep->split != RIG_SPLIT_OFF)
{
/* Re-enable split */
rc = icom_transaction(rig, C_CTL_SPLT, S_SPLT_ON, NULL, 0, ackbuf, &ack_len);
@ -1064,12 +1065,12 @@ static int x108g_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode,
int rc;
vfo_t rx_vfo, tx_vfo;
struct icom_priv_data *priv;
struct rig_state *rs;
struct rig_state *rs = STATE(rig);
struct rig_cache *cachep = CACHE(rig);
unsigned char ackbuf[MAXFRAMELEN];
int ack_len = sizeof(ackbuf);
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
rs = &rig->state;
priv = (struct icom_priv_data *)rs->priv;
/* This method works also in memory mode(RIG_VFO_MEM) */
@ -1091,7 +1092,7 @@ static int x108g_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode,
queries */
/* broken if user changes split on rig :( */
if ((rig->state.vfo_list & (RIG_VFO_A | RIG_VFO_B)) == (RIG_VFO_A | RIG_VFO_B)
&& rig->state.cache.split != RIG_SPLIT_OFF)
&& cachep->split != RIG_SPLIT_OFF)
{
/* VFO A/B style rigs swap VFO on split Tx so we need to disable
split for certainty */
@ -1119,7 +1120,7 @@ static int x108g_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode,
if (RIG_OK != (rc = icom_set_vfo(rig, rx_vfo))) { return rc; }
if ((rig->state.vfo_list & (RIG_VFO_A | RIG_VFO_B)) == (RIG_VFO_A | RIG_VFO_B)
&& rig->state.cache.split != RIG_SPLIT_OFF)
&& cachep->split != RIG_SPLIT_OFF)
{
/* Re-enable split */
rc = icom_transaction(rig, C_CTL_SPLT, S_SPLT_ON, NULL, 0, ackbuf, &ack_len);

Wyświetl plik

@ -339,7 +339,7 @@ static int jst145_get_vfo(RIG *rig, vfo_t *vfo)
jst145_get_ptt(rig, RIG_VFO_A,
&ptt); // set priv->ptt to current transmit status
rig->state.cache.ptt = ptt;
CACHE(rig)->ptt = ptt;
ptt_retry:
@ -609,7 +609,7 @@ static int jst145_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
if (pttstatus[1] == '1') { *ptt = RIG_PTT_ON; }
else { *ptt = RIG_PTT_OFF; }
priv->ptt = rig->state.cache.ptt = *ptt;
priv->ptt = CACHE(rig)->ptt = *ptt;
return RIG_OK;
}

Wyświetl plik

@ -692,7 +692,7 @@ static int ts2000_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
return RIG_OK;
case RIG_LEVEL_STRENGTH:
if (rig->state.cache.ptt != RIG_PTT_OFF)
if (CACHE(rig)->ptt != RIG_PTT_OFF)
{
val->i = -9 * 6;
break;
@ -879,7 +879,7 @@ static int ts2000_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
int raw_value;
char read_vfo_num;
if (rig->state.cache.ptt == RIG_PTT_OFF)
if (CACHE(rig)->ptt == RIG_PTT_OFF)
{
val->f = 0;
break;

Wyświetl plik

@ -581,7 +581,7 @@ kenwood_ts480_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
return RIG_OK;
case RIG_LEVEL_STRENGTH:
if (rig->state.cache.ptt != RIG_PTT_OFF)
if (CACHE(rig)->ptt != RIG_PTT_OFF)
{
val->i = -9 * 6;
break;
@ -708,7 +708,7 @@ kenwood_ts480_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
{
int raw_value;
if (rig->state.cache.ptt == RIG_PTT_OFF)
if (CACHE(rig)->ptt == RIG_PTT_OFF)
{
val->f = 0;
break;
@ -2198,15 +2198,16 @@ int malachite_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
int malachite_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
{
int retval;
struct rig_cache *cachep = CACHE(rig);
ENTERFUNC;
rig_debug(RIG_DEBUG_TRACE, "%s: freqMainA=%g, freq=%g\n", __func__,
rig->state.cache.freqMainA, freq);
cachep->freqMainA, freq);
if ((rig->state.cache.freqMainA < 400000000 && freq >= 400000000)
|| (rig->state.cache.freqMainA >= 400000000 && freq < 400000000)
|| rig->state.cache.freqMainA == 0)
if ((cachep->freqMainA < 400000000 && freq >= 400000000)
|| (cachep->freqMainA >= 400000000 && freq < 400000000)
|| cachep->freqMainA == 0)
{
// Malachite has a bug where it takes two freq set to make it work
// under band changes -- so we just do this all the time

Wyświetl plik

@ -240,7 +240,7 @@ static int ts590_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
if (!sf_fails)
{
SNPRINTF(cmd, sizeof(cmd), "SF%d%011.0f%c", vfo == RIG_VFO_A ? 0 : 1,
vfo == RIG_VFO_A ? rig->state.cache.freqMainA : rig->state.cache.freqMainB,
vfo == RIG_VFO_A ? CACHE(rig)->freqMainA : CACHE(rig)->freqMainB,
c);
retval = kenwood_transaction(rig, cmd, NULL, 0);
}
@ -328,7 +328,7 @@ static int ts590_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
if (vfo == RIG_VFO_CURR) { vfo = rig->state.current_vfo; }
if (vfo == RIG_VFO_TX || vfo == RIG_VFO_RX) { vfo = vfo_fixup(rig, vfo, rig->state.cache.split); }
if (vfo == RIG_VFO_TX || vfo == RIG_VFO_RX) { vfo = vfo_fixup(rig, vfo, CACHE(rig)->split); }
retval = RIG_OK;
@ -875,7 +875,7 @@ static int ts590_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
return RIG_OK;
case RIG_LEVEL_STRENGTH:
if (rig->state.cache.ptt != RIG_PTT_OFF)
if (CACHE(rig)->ptt != RIG_PTT_OFF)
{
val->i = -9 * 6;
break;
@ -1022,7 +1022,7 @@ static int ts590_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
int raw_value;
if (rig->state.cache.ptt == RIG_PTT_OFF)
if (CACHE(rig)->ptt == RIG_PTT_OFF)
{
val->f = 0;
break;

Wyświetl plik

@ -914,7 +914,7 @@ int ft100_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
{
unsigned char cmd_index;
int split = rig->state.cache.split;
int split = CACHE(rig)->split;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
@ -971,8 +971,8 @@ int ft100_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
{
int ret;
int split = rig->state.cache.split;
int ptt = rig->state.cache.ptt;
int split = CACHE(rig)->split;
int ptt = CACHE(rig)->ptt;
FT100_METER_INFO ft100_meter;

Wyświetl plik

@ -4121,11 +4121,11 @@ static int ft1000_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
if (vfo == RIG_VFO_A)
{
*freq = rig->state.cache.freqMainA;
*freq = CACHE(rig)->freqMainA;
}
else
{
*freq = rig->state.cache.freqMainB;
*freq = CACHE(rig)->freqMainB;
}
return RIG_OK;
@ -4135,11 +4135,11 @@ static int ft1000_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
{
if (vfo == RIG_VFO_A)
{
*mode = rig->state.cache.modeMainA;
*mode = CACHE(rig)->modeMainA;
}
else
{
*mode = rig->state.cache.modeMainB;
*mode = CACHE(rig)->modeMainB;
}
return RIG_OK;
@ -4153,7 +4153,7 @@ static int ft1000_get_vfo(RIG *rig, vfo_t *vfo)
static int ft1000_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
{
*ptt = rig->state.cache.ptt;
*ptt = CACHE(rig)->ptt;
return RIG_OK;
}

Wyświetl plik

@ -932,11 +932,11 @@ static int ft1000mp_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
if (vfo == RIG_VFO_A)
{
*freq = rig->state.cache.freqMainA;
*freq = CACHE(rig)->freqMainA;
}
else
{
*freq = rig->state.cache.freqMainB;
*freq = CACHE(rig)->freqMainB;
}
return RIG_OK;
@ -1818,8 +1818,8 @@ static int ft1000mp_set_split_freq_mode(RIG *rig, vfo_t vfo, freq_t freq,
if (retval == RIG_OK)
{
rig->state.cache.freqMainB = freq;
rig->state.cache.modeMainB = mode;
CACHE(rig)->freqMainB = freq;
CACHE(rig)->modeMainB = mode;
}
RETURNFUNC(retval);
@ -1842,8 +1842,8 @@ static int ft1000mp_get_split_freq_mode(RIG *rig, vfo_t vfo, freq_t *freq,
if (retval == RIG_OK)
{
rig->state.cache.freqMainB = *freq;
rig->state.cache.modeMainB = *mode;
CACHE(rig)->freqMainB = *freq;
CACHE(rig)->modeMainB = *mode;
}
RETURNFUNC(retval);

Wyświetl plik

@ -298,7 +298,7 @@ int ft736_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if (vfo == RIG_VFO_A || vfo == RIG_VFO_MAIN) { *freq = rig->state.cache.freqMainA; }
if (vfo == RIG_VFO_A || vfo == RIG_VFO_MAIN) { *freq = CACHE(rig)->freqMainA; }
else { rig_get_cache_freq(rig, vfo, freq, NULL); }
return RIG_OK;

Wyświetl plik

@ -579,18 +579,19 @@ int ft747_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
int ft747_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
{
struct ft747_priv_data *p;
struct rig_cache *cachep = CACHE(rig);
freq_t f;
int ret;
rig_debug(RIG_DEBUG_VERBOSE,
"%s: called vfo=%s, freqMainA=%.0f, freqMainB=%.0f\n", __func__,
rig_strvfo(vfo), rig->state.cache.freqMainA, rig->state.cache.freqMainB);
rig_strvfo(vfo), cachep->freqMainA, cachep->freqMainB);
if (vfo == RIG_VFO_CURR) { vfo = rig->state.cache.vfo; }
if (vfo == RIG_VFO_CURR) { vfo = cachep->vfo; }
if (rig->state.cache.ptt == RIG_PTT_ON)
if (cachep->ptt == RIG_PTT_ON)
{
*freq = RIG_VFO_B ? rig->state.cache.freqMainB : rig->state.cache.freqMainA;
*freq = RIG_VFO_B ? cachep->freqMainB : cachep->freqMainA;
return RIG_OK;
}
@ -1005,7 +1006,7 @@ static int ft747_get_update_data(RIG *rig)
p = (struct ft747_priv_data *)rig->state.priv;
rigport = RIGPORT(rig);
if (rig->state.cache.ptt == RIG_PTT_ON
if (CACHE(rig)->ptt == RIG_PTT_ON
|| !rig_check_cache_timeout(&p->status_tv, FT747_CACHE_TIMEOUT))
{
return RIG_OK;

Wyświetl plik

@ -988,16 +988,17 @@ static int ft817_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
{
struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv;
freq_t f1 = 0, f2 = 0;
struct rig_cache *cachep = CACHE(rig);
int retries = RIGPORT(rig)->retry +
1; // +1 because, because 2 steps are needed even in best scenario
rig_debug(RIG_DEBUG_VERBOSE, "%s: called, vfo=%s, ptt=%d, split=%d\n", __func__,
rig_strvfo(vfo), rig->state.cache.ptt, rig->state.cache.split);
rig_strvfo(vfo), cachep->ptt, cachep->split);
// we can't query VFOB while in transmit and split mode
if (rig->state.cache.ptt && vfo == RIG_VFO_B && rig->state.cache.split)
if (cachep->ptt && vfo == RIG_VFO_B && cachep->split)
{
*freq = rig->state.cache.freqMainB;
*freq = cachep->freqMainB;
return RIG_OK;
}
@ -2127,7 +2128,7 @@ static int ft817_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
return n;
}
rig->state.cache.split = split;
CACHE(rig)->split = split;
return RIG_OK;

Wyświetl plik

@ -615,14 +615,14 @@ int ft857_get_vfo(RIG *rig, vfo_t *vfo)
// Some 857's cannot read so we'll just return the cached value if we've seen an error
if (ignore)
{
*vfo = rig->state.cache.vfo;
*vfo = CACHE(rig)->vfo;
return RIG_OK;
}
if (ft857_read_eeprom(rig, 0x0068, &c) < 0) /* get vfo status */
{
ignore = 1;
*vfo = rig->state.cache.vfo;
*vfo = CACHE(rig)->vfo;
return RIG_OK;
}

Wyświetl plik

@ -701,7 +701,7 @@ int ft990v12_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
else
{
// M0EZP: Uni use cache
// *freq = vfo == RIG_VFO_A ? rig->state.cache.freqMainA : rig->state.cache.freqMainB;
// *freq = vfo == RIG_VFO_A ? CACHE(rig)->freqMainA : CACHE(rig)->freqMainB;
return (RIG_OK);
}
}

Wyświetl plik

@ -458,7 +458,7 @@ ft991_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
return (rval);
}
if (rig->state.cache.freqMainB == tx_freq)
if (CACHE(rig)->freqMainB == tx_freq)
{
rig_debug(RIG_DEBUG_TRACE, "%s: freq %.0f already set on VFOB\n", __func__,
tx_freq);
@ -635,7 +635,7 @@ static int ft991_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode,
return -RIG_EINVAL;
}
if (rig->state.cache.modeMainB == tx_mode)
if (CACHE(rig)->modeMainB == tx_mode)
{
rig_debug(RIG_DEBUG_TRACE, "%s: mode %s already set on VFOB\n", __func__,
rig_strrmode(tx_mode));

Wyświetl plik

@ -936,17 +936,18 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
char target_vfo;
int err;
struct rig_caps *caps;
struct rig_cache *cachep = CACHE(rig);
struct newcat_priv_data *priv;
int special_60m = 0;
vfo_t vfo_mode;
ENTERFUNC;
if (newcat_60m_exception(rig, freq, rig->state.cache.modeMainA))
if (newcat_60m_exception(rig, freq, cachep->modeMainA))
{
// we don't try to set freq on 60m for some rigs since we must be in memory mode
// and we can't run split mode on 60M memory mode either
if (rig->state.cache.split == RIG_SPLIT_ON)
if (cachep->split == RIG_SPLIT_ON)
{
rig_set_split_vfo(rig, RIG_VFO_A, RIG_VFO_A, RIG_SPLIT_OFF);
}
@ -1029,16 +1030,16 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
// some rigs like FTDX101D cannot change non-TX vfo freq
// but they can change the TX vfo
if ((is_ftdx101d || is_ftdx101mp) && rig->state.cache.ptt == RIG_PTT_ON)
if ((is_ftdx101d || is_ftdx101mp) && cachep->ptt == RIG_PTT_ON)
{
rig_debug(RIG_DEBUG_TRACE, "%s: ftdx101 check vfo OK, vfo=%s, tx_vfo=%s\n",
__func__, rig_strvfo(vfo), rig_strvfo(rig->state.tx_vfo));
// when in split we can change VFOB but not VFOA
if (rig->state.cache.split == RIG_SPLIT_ON && target_vfo == '0') { return -RIG_ENTARGET; }
if (cachep->split == RIG_SPLIT_ON && target_vfo == '0') { return -RIG_ENTARGET; }
// when not in split we can't change VFOA at all
if (rig->state.cache.split == RIG_SPLIT_OFF && target_vfo == '0') { return -RIG_ENTARGET; }
if (cachep->split == RIG_SPLIT_OFF && target_vfo == '0') { return -RIG_ENTARGET; }
if (vfo != rig->state.tx_vfo) { return -RIG_ENTARGET; }
}
@ -1077,7 +1078,7 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
and select the correct VFO before setting the frequency
*/
// Plus we can't do the VFO swap if transmitting
if (target_vfo == '1' && rig->state.cache.ptt == RIG_PTT_ON) { RETURNFUNC(-RIG_ENTARGET); }
if (target_vfo == '1' && cachep->ptt == RIG_PTT_ON) { RETURNFUNC(-RIG_ENTARGET); }
SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "VS%c", cat_term);
@ -1147,7 +1148,7 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
if (newcat_valid_command(rig, "BS") && changing
&& !rig->state.disable_yaesu_bandselect
// remove the split check here -- hopefully works OK
//&& !rig->state.cache.split
//&& !cachep->split
// seems some rigs are problematic
// && !(is_ftdx3000 || is_ftdx3000dm)
// some rigs can't do BS command on 60M
@ -1331,8 +1332,8 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
// just drop through
}
rig_debug(RIG_DEBUG_ERR, "%s: is_ft991=%d, rig->state.cache.split=%d, vfo=%s\n",
__func__, is_ft991, rig->state.cache.split, rig_strvfo(vfo));
rig_debug(RIG_DEBUG_ERR, "%s: is_ft991=%d, CACHE(rig)->split=%d, vfo=%s\n",
__func__, is_ft991, cachep->split, rig_strvfo(vfo));
if (priv->band_index < 0) { priv->band_index = newcat_band_index(freq); }
@ -1340,7 +1341,7 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
// there are multiple bandstacks so we just use the 1st one
if (is_ft991 && vfo == RIG_VFO_A && priv->band_index != newcat_band_index(freq))
{
if (rig->state.cache.split)
if (cachep->split)
{
// FT991/991A bandstack does not work in split mode
// so for a VFOA change we stop split, change bands, change freq, enable split
@ -1493,16 +1494,17 @@ int newcat_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
int newcat_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
{
struct newcat_priv_data *priv;
struct rig_cache *cachep = CACHE(rig);
int err;
rmode_t tmode;
pbwidth_t twidth;
split_t split_save = rig->state.cache.split;
split_t split_save = cachep->split;
priv = (struct newcat_priv_data *)rig->state.priv;
ENTERFUNC;
if (newcat_60m_exception(rig, rig->state.cache.freqMainA, mode)) { RETURNFUNC(RIG_OK); } // we don't set mode in this case
if (newcat_60m_exception(rig, cachep->freqMainA, mode)) { RETURNFUNC(RIG_OK); } // we don't set mode in this case
if (!newcat_valid_command(rig, "MD"))
{
@ -1571,11 +1573,11 @@ int newcat_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
if (vfo == RIG_VFO_A || vfo == RIG_VFO_MAIN)
{
rig->state.cache.modeMainA = mode;
cachep->modeMainA = mode;
}
else
{
rig->state.cache.modeMainB = mode;
cachep->modeMainB = mode;
}
if (RIG_PASSBAND_NOCHANGE == width) { RETURNFUNC(err); }
@ -1705,7 +1707,7 @@ int newcat_set_vfo(RIG *rig, vfo_t vfo)
rig_strvfo(vfo));
// we can't change VFO while transmitting
if (rig->state.cache.ptt == RIG_PTT_ON) { RETURNFUNC(RIG_OK); }
if (CACHE(rig)->ptt == RIG_PTT_ON) { RETURNFUNC(RIG_OK); }
if (!newcat_valid_command(rig, command))
{
@ -2712,11 +2714,11 @@ int newcat_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode,
if (vfo == RIG_VFO_A || vfo == RIG_VFO_MAIN)
{
rig->state.cache.modeMainA = tx_mode;
CACHE(rig)->modeMainA = tx_mode;
}
else
{
rig->state.cache.modeMainB = tx_mode;
CACHE(rig)->modeMainB = tx_mode;
}
@ -2758,8 +2760,8 @@ int newcat_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
RETURNFUNC(err);
}
if (newcat_60m_exception(rig, rig->state.cache.freqMainA,
rig->state.cache.modeMainA))
if (newcat_60m_exception(rig, CACHE(rig)->freqMainA,
CACHE(rig)->modeMainA))
{
rig_debug(RIG_DEBUG_VERBOSE,
"%s: force set_split off since we're on 60M exception\n", __func__);
@ -4088,7 +4090,8 @@ static int band2rig(hamlib_band_t band)
int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
{
struct rig_state *state = &rig->state;
struct rig_state *state = STATE(rig);
struct rig_cache *cachep = CACHE(rig);
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
int err;
int i;
@ -4300,9 +4303,9 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
rmode_t exclude = RIG_MODE_CW | RIG_MODE_CWR | RIG_MODE_RTTY | RIG_MODE_RTTYR;
if ((rig->state.tx_vfo == RIG_VFO_A && (rig->state.cache.modeMainA & exclude))
|| (rig->state.tx_vfo == RIG_VFO_B && (rig->state.cache.modeMainB & exclude))
|| (rig->state.tx_vfo == RIG_VFO_C && (rig->state.cache.modeMainC & exclude)))
if ((rig->state.tx_vfo == RIG_VFO_A && (cachep->modeMainA & exclude))
|| (rig->state.tx_vfo == RIG_VFO_B && (cachep->modeMainB & exclude))
|| (rig->state.tx_vfo == RIG_VFO_C && (cachep->modeMainC & exclude)))
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: rig cannot set MG in CW/RTTY modes\n",
__func__);
@ -4906,7 +4909,7 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
if (is_ftdx101d || is_ftdx101mp)
{
rmode_t curmode = rig->state.current_vfo == RIG_VFO_A ?
rig->state.cache.modeMainA : rig->state.cache.modeMainB;
cachep->modeMainA : cachep->modeMainB;
float valf = val.f / level_info->step.f;
switch (curmode)
@ -4960,7 +4963,8 @@ 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)
{
struct rig_state *state = &rig->state;
struct rig_state *state = STATE(rig);
struct rig_cache *cachep = CACHE(rig);
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
int err;
int ret_data_len;
@ -5117,9 +5121,9 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
rmode_t exclude = RIG_MODE_CW | RIG_MODE_CWR | RIG_MODE_RTTY | RIG_MODE_RTTYR;
if ((rig->state.tx_vfo == RIG_VFO_A && (rig->state.cache.modeMainA & exclude))
|| (rig->state.tx_vfo == RIG_VFO_B && (rig->state.cache.modeMainB & exclude))
|| (rig->state.tx_vfo == RIG_VFO_C && (rig->state.cache.modeMainC & exclude)))
if ((rig->state.tx_vfo == RIG_VFO_A && (cachep->modeMainA & exclude))
|| (rig->state.tx_vfo == RIG_VFO_B && (cachep->modeMainB & exclude))
|| (rig->state.tx_vfo == RIG_VFO_C && (cachep->modeMainC & exclude)))
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: rig cannot read MG in CW/RTTY modes\n",
__func__);
@ -5502,7 +5506,7 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
if (is_ftdx101d || is_ftdx101mp)
{
rmode_t curmode = rig->state.current_vfo == RIG_VFO_A ?
rig->state.cache.modeMainA : rig->state.cache.modeMainB;
cachep->modeMainA : cachep->modeMainB;
switch (curmode)
{
@ -5544,7 +5548,7 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
if (is_ftdx101d || is_ftdx101mp)
{
rmode_t curmode = rig->state.current_vfo == RIG_VFO_A ?
rig->state.cache.modeMainA : rig->state.cache.modeMainB;
cachep->modeMainA : cachep->modeMainB;
switch (curmode)
{

Wyświetl plik

@ -220,6 +220,11 @@ static const struct confparams frontend_cfg_params[] =
"Multicast data UDP port for sending commands to rig",
"4532", RIG_CONF_NUMERIC, { .n = { 0, 1000000, 1 } }
},
{
TOK_FREQ_SKIP, "freq_skip", "Skip setting freq on non-active VFO",
"True enables skipping setting the TX_VFO when RX_VFO is receiving and skips RX_VFO when TX_VFO is transmitting",
"0", RIG_CONF_CHECKBUTTON, { }
},
{ RIG_CONF_END, NULL, }
};
@ -820,6 +825,15 @@ static int frontend_set_conf(RIG *rig, hamlib_token_t token, const char *val)
rs->multicast_cmd_port = val_i;
break;
case TOK_FREQ_SKIP:
if (1 != sscanf(val, "%ld", &val_i))
{
return -RIG_EINVAL;
}
rs->freq_skip = val_i != 0;
break;
default:
return -RIG_EINVAL;
}

Wyświetl plik

@ -187,6 +187,7 @@ const char hamlib_copyright[231] = /* hamlib 1.2 ABI specifies 231 bytes */
MUTEX(morse_mutex);
#ifdef HAVE_PTHREAD
// returns true if mutex is busy
int MUTEX_CHECK(pthread_mutex_t *m)
{
@ -199,6 +200,9 @@ int MUTEX_CHECK(pthread_mutex_t *m)
return trylock == EBUSY;
}
#else
#define MUTEX_CHECK(var) 0
#endif
/*
@ -1965,6 +1969,44 @@ static int twiddling(RIG *rig)
#include "band_changed.c"
// for rigs that do not have targetable VFO
// skip setting frequency on the non-active vfo
// this allow gpredict to work correctly on these rigs
// but we might have trou
static int skip_freq(RIG *rig, vfo_t vfo)
{
struct rig_cache *cachep = CACHE(rig);
int retval = 0;
// if option is not select do not skip
// WSJT-X needs set all the time....gpredict can skip
// This is due to their behavior...WSJT-X sets TX VFO before PTT
// gpredict needs to set Doppler all the time so causes VFO flashing on rigs without TARGETABLE_FREQ
if (rig->state.freq_skip == 0)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: not skipping set_freq on vfo %s\n", __func__, rig_strvfo(vfo));
return 0;
}
if (cachep->ptt && cachep->split
&& ((rig->caps->targetable_vfo & RIG_TARGETABLE_FREQ) == 0)
&& (vfo == RIG_VFO_RX || vfo == rig->state.rx_vfo))
{
rig_debug(RIG_DEBUG_VERBOSE,
"%s: skip setting frequency on RX vfo when PTT is on\n", __func__);
retval = 1;
}
if ((!cachep->ptt) && cachep->split
&& ((rig->caps->targetable_vfo & RIG_TARGETABLE_FREQ) == 0)
&& (vfo == RIG_VFO_TX || vfo == rig->state.tx_vfo))
{
rig_debug(RIG_DEBUG_VERBOSE,
"%s: skip setting frequency on TX vfo when PTT is not on\n", __func__);
retval = 1;
}
return retval;
}
/**
* \brief set the frequency of the target VFO
* \param rig The rig handle
@ -2070,22 +2112,6 @@ int rig_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
rig->state.twiddle_state = TWIDDLE_OFF;
}
if (cachep->ptt && cachep->split
&& ((rig->caps->targetable_vfo & RIG_TARGETABLE_FREQ) == 0)
&& (vfo == RIG_VFO_TX || vfo == rig->state.tx_vfo))
{
rig_debug(RIG_DEBUG_VERBOSE,
"%s: skip setting frequency on RX vfo when PTT is on\n", __func__);
}
if ((!cachep->ptt) && cachep->split
&& ((rig->caps->targetable_vfo & RIG_TARGETABLE_FREQ) == 0)
&& (vfo == RIG_VFO_RX || vfo == rig->state.rx_vfo))
{
rig_debug(RIG_DEBUG_VERBOSE,
"%s: skip setting frequency on TX vfo when PTT is not on\n", __func__);
}
caps = rig->caps;
if (rig->state.lo_freq != 0.0)
@ -2114,6 +2140,12 @@ int rig_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
vfo = vfo_save;
}
if (skip_freq(rig, vfo))
{
LOCK(0);
RETURNFUNC(RIG_OK);
}
if ((caps->targetable_vfo & RIG_TARGETABLE_FREQ)
|| vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo)
{

Wyświetl plik

@ -141,6 +141,8 @@
#define TOK_MULTICAST_CMD_ADDR TOKEN_FRONTEND(134)
/** \brief rig: Multicast command server UDP port, default 4532 */
#define TOK_MULTICAST_CMD_PORT TOKEN_FRONTEND(135)
/** \brief rig: Skip setting freq on opposite VFO when in split mode */
#define TOK_FREQ_SKIP TOKEN_FRONTEND(136)
/*
* rotator specific tokens

Wyświetl plik

@ -665,7 +665,7 @@ static rmode_t ts2000_get_mode()
{
rmode_t mode;
pbwidth_t width;
rig_get_mode(my_rig, vfo_fixup(my_rig, RIG_VFO_A, my_rig->state.cache.split),
rig_get_mode(my_rig, vfo_fixup(my_rig, RIG_VFO_A, CACHE(my_rig)->split),
&mode, &width);
kwidth = width;
#if 0
@ -802,8 +802,8 @@ static int handle_ts2000(void *arg)
int p13 = 0; // P13(1) Tone dummy value for now
int p14 = 0; // P14(2) Tone Freq dummy value for now
int p15 = 0; // P15(1) Shift status dummy value for now
int retval = rig_get_freq(my_rig, vfo_fixup(my_rig, RIG_VFO_A,
my_rig->state.cache.split), &freq);
int retval = rig_get_freq(my_rig, vfo_fixup(my_rig, RIG_VFO_A, CACHE(my_rig)->split),
&freq);
char response[64];
char *fmt =
// cppcheck-suppress *
@ -815,8 +815,8 @@ static int handle_ts2000(void *arg)
}
mode = ts2000_get_mode();
retval = rig_get_ptt(my_rig, vfo_fixup(my_rig, RIG_VFO_A,
my_rig->state.cache.split), &ptt);
retval = rig_get_ptt(my_rig, vfo_fixup(my_rig, RIG_VFO_A, CACHE(my_rig)->split),
&ptt);
if (retval != RIG_OK)
{
@ -900,8 +900,8 @@ static int handle_ts2000(void *arg)
freq_t freq = 0;
char response[32];
int retval = rig_get_freq(my_rig, vfo_fixup(my_rig, RIG_VFO_A,
my_rig->state.cache.split), &freq);
int retval = rig_get_freq(my_rig, vfo_fixup(my_rig, RIG_VFO_A, CACHE(my_rig)->split),
&freq);
if (retval != RIG_OK)
{
@ -917,8 +917,8 @@ static int handle_ts2000(void *arg)
{
char response[32];
freq_t freq = 0;
int retval = rig_get_freq(my_rig, vfo_fixup(my_rig, RIG_VFO_B,
my_rig->state.cache.split), &freq);
int retval = rig_get_freq(my_rig, vfo_fixup(my_rig, RIG_VFO_B, CACHE(my_rig)->split),
&freq);
if (retval != RIG_OK)
{
@ -941,7 +941,7 @@ static int handle_ts2000(void *arg)
{
char response[32];
rig_set_ptt(my_rig, vfo_fixup(my_rig, RIG_VFO_A, my_rig->state.cache.split), 0);
rig_set_ptt(my_rig, vfo_fixup(my_rig, RIG_VFO_A, CACHE(my_rig)->split), 0);
SNPRINTF(response, sizeof(response), "RX0;");
return write_block2((void *)__func__, &my_com, response, strlen(response));
}
@ -972,8 +972,7 @@ static int handle_ts2000(void *arg)
}
else if (strcmp(arg, "TX;") == 0)
{
return rig_set_ptt(my_rig, vfo_fixup(my_rig, RIG_VFO_A,
my_rig->state.cache.split), 1);
return rig_set_ptt(my_rig, vfo_fixup(my_rig, RIG_VFO_A, CACHE(my_rig)->split), 1);
}
else if (strcmp(arg, "AI0;") == 0)
{
@ -987,13 +986,11 @@ static int handle_ts2000(void *arg)
}
else if (strcmp(arg, "FR0;") == 0)
{
return rig_set_vfo(my_rig, vfo_fixup(my_rig, RIG_VFO_A,
my_rig->state.cache.split));
return rig_set_vfo(my_rig, vfo_fixup(my_rig, RIG_VFO_A, CACHE(my_rig)->split));
}
else if (strcmp(arg, "FR1;") == 0)
{
return rig_set_vfo(my_rig, vfo_fixup(my_rig, RIG_VFO_B,
my_rig->state.cache.split));
return rig_set_vfo(my_rig, vfo_fixup(my_rig, RIG_VFO_B, CACHE(my_rig)->split));
}
else if (strcmp(arg, "FR;") == 0)
{
@ -1013,8 +1010,8 @@ static int handle_ts2000(void *arg)
}
if (vfo == vfo_fixup(my_rig, RIG_VFO_A, my_rig->state.cache.split)) { nvfo = 0; }
else if (vfo == vfo_fixup(my_rig, RIG_VFO_B, my_rig->state.cache.split)) { nvfo = 1; }
if (vfo == vfo_fixup(my_rig, RIG_VFO_A, CACHE(my_rig)->split)) { nvfo = 0; }
else if (vfo == vfo_fixup(my_rig, RIG_VFO_B, CACHE(my_rig)->split)) { nvfo = 1; }
else
{
retval = -RIG_EPROTO;
@ -1029,7 +1026,7 @@ static int handle_ts2000(void *arg)
else if (strcmp(arg, "FT;") == 0)
{
char response[32];
vfo_t vfo, vfo_curr = vfo_fixup(my_rig, RIG_VFO_A, my_rig->state.cache.split);
vfo_t vfo, vfo_curr = vfo_fixup(my_rig, RIG_VFO_A, CACHE(my_rig)->split);
split_t split;
int nvfo = 0;
int retval = rig_get_split_vfo(my_rig, vfo_curr, &split, &vfo);
@ -1042,8 +1039,8 @@ static int handle_ts2000(void *arg)
}
if (vfo == vfo_fixup(my_rig, RIG_VFO_A, my_rig->state.cache.split)) { nvfo = 0; }
else if (vfo == vfo_fixup(my_rig, RIG_VFO_B, my_rig->state.cache.split)) { nvfo = 1; }
if (vfo == vfo_fixup(my_rig, RIG_VFO_A, CACHE(my_rig)->split)) { nvfo = 0; }
else if (vfo == vfo_fixup(my_rig, RIG_VFO_B, CACHE(my_rig)->split)) { nvfo = 1; }
else
{
retval = -RIG_EPROTO;
@ -1092,9 +1089,8 @@ static int handle_ts2000(void *arg)
{
char response[32];
int valA;
int retval = rig_get_func(my_rig, vfo_fixup(my_rig, RIG_VFO_A,
my_rig->state.cache.split), RIG_FUNC_AIP,
&valA);
int retval = rig_get_func(my_rig, vfo_fixup(my_rig, RIG_VFO_A, CACHE(my_rig)->split),
RIG_FUNC_AIP, &valA);
int valB;
if (retval != RIG_OK)
@ -1112,9 +1108,8 @@ static int handle_ts2000(void *arg)
return retval;
}
retval = rig_get_func(my_rig, vfo_fixup(my_rig, RIG_VFO_B,
my_rig->state.cache.split), RIG_FUNC_AIP,
&valB);
retval = rig_get_func(my_rig, vfo_fixup(my_rig, RIG_VFO_B, CACHE(my_rig)->split),
RIG_FUNC_AIP, &valB);
if (retval != RIG_OK)
{
@ -1139,8 +1134,8 @@ static int handle_ts2000(void *arg)
(char *)arg);
}
retval = rig_set_func(my_rig, vfo_fixup(my_rig, RIG_VFO_A,
my_rig->state.cache.split), RIG_FUNC_AIP, valA);
retval = rig_set_func(my_rig, vfo_fixup(my_rig, RIG_VFO_A, CACHE(my_rig)->split),
RIG_FUNC_AIP, valA);
if (retval != RIG_OK)
{
@ -1149,8 +1144,8 @@ static int handle_ts2000(void *arg)
return retval;
}
retval = rig_set_func(my_rig, vfo_fixup(my_rig, RIG_VFO_B,
my_rig->state.cache.split), RIG_FUNC_AIP, valB);
retval = rig_set_func(my_rig, vfo_fixup(my_rig, RIG_VFO_B, CACHE(my_rig)->split),
RIG_FUNC_AIP, valB);
if (retval != RIG_OK)
{
@ -1515,7 +1510,7 @@ static int handle_ts2000(void *arg)
}
else if (strcmp(arg, "DC;") == 0)
{
vfo_t vfo, vfo_curr = vfo_fixup(my_rig, RIG_VFO_A, my_rig->state.cache.split);
vfo_t vfo, vfo_curr = vfo_fixup(my_rig, RIG_VFO_A, CACHE(my_rig)->split);
split_t split;
char response[32];
int retval = rig_get_split_vfo(my_rig, vfo_curr, &split, &vfo);
@ -1534,7 +1529,7 @@ static int handle_ts2000(void *arg)
}
else if (strncmp(arg, "DC", 2) == 0)
{
vfo_t vfo_curr = vfo_fixup(my_rig, RIG_VFO_A, my_rig->state.cache.split);
vfo_t vfo_curr = vfo_fixup(my_rig, RIG_VFO_A, CACHE(my_rig)->split);
split_t split;
int isplit;
int retval;
@ -1565,15 +1560,13 @@ static int handle_ts2000(void *arg)
}
else if (strcmp(arg, "FT0;") == 0)
{
return rig_set_split_vfo(my_rig, vfo_fixup(my_rig, RIG_VFO_A,
my_rig->state.cache.split), vfo_fixup(my_rig,
RIG_VFO_A, my_rig->state.cache.split), 0);
return rig_set_split_vfo(my_rig, vfo_fixup(my_rig, RIG_VFO_A, CACHE(my_rig)->split),
vfo_fixup(my_rig, RIG_VFO_A, CACHE(my_rig)->split), 0);
}
else if (strcmp(arg, "FT1;") == 0)
{
return rig_set_split_vfo(my_rig, vfo_fixup(my_rig, RIG_VFO_B,
my_rig->state.cache.split), vfo_fixup(my_rig,
RIG_VFO_B, my_rig->state.cache.split), 0);
return rig_set_split_vfo(my_rig, vfo_fixup(my_rig, RIG_VFO_B, CACHE(my_rig)->split),
vfo_fixup(my_rig, RIG_VFO_B, CACHE(my_rig)->split), 0);
}
else if (strncmp(arg, "FA0", 3) == 0)
{
@ -1583,16 +1576,14 @@ static int handle_ts2000(void *arg)
if (mapa2b) { vfo = RIG_VFO_B; }
sscanf((char *)arg + 2, "%"SCNfreq, &freq);
return rig_set_freq(my_rig, vfo_fixup(my_rig, vfo,
my_rig->state.cache.split), freq);
return rig_set_freq(my_rig, vfo_fixup(my_rig, vfo, CACHE(my_rig)->split), freq);
}
else if (strncmp(arg, "FB0", 3) == 0)
{
freq_t freq;
sscanf((char *)arg + 2, "%"SCNfreq, &freq);
return rig_set_freq(my_rig, vfo_fixup(my_rig, RIG_VFO_B,
my_rig->state.cache.split), freq);
return rig_set_freq(my_rig, vfo_fixup(my_rig, RIG_VFO_B, CACHE(my_rig)->split), freq);
}
else if (strncmp(arg, "MD", 2) == 0)
{