pull/345/head
DL1YCF 2020-06-14 14:24:52 +02:00
commit cd0c0402cd
10 zmienionych plików z 84 dodań i 78 usunięć

Wyświetl plik

@ -28,7 +28,7 @@
#include <sys/time.h> #include <sys/time.h>
#endif #endif
#define BACKEND_VER "20200510" #define BACKEND_VER "20200613"
#define EOM "\r" #define EOM "\r"
#define TRUE 1 #define TRUE 1

Wyświetl plik

@ -2743,8 +2743,8 @@ extern HAMLIB_EXPORT(int) rig_set_vfo_opt(RIG *rig, int status);
// cppcheck-suppress * // cppcheck-suppress *
#include <unistd.h> typedef unsigned long rig_useconds_t;
extern HAMLIB_EXPORT(int) hl_usleep(useconds_t msec); extern HAMLIB_EXPORT(int) hl_usleep(rig_useconds_t msec);
//! @endcond //! @endcond

Wyświetl plik

@ -422,7 +422,7 @@ const struct rig_caps ic9700_caps =
RIG_MODEL(RIG_MODEL_IC9700), RIG_MODEL(RIG_MODEL_IC9700),
.model_name = "IC-9700", .model_name = "IC-9700",
.mfg_name = "Icom", .mfg_name = "Icom",
.version = BACKEND_VER ".0", .version = BACKEND_VER ".1",
.copyright = "LGPL", .copyright = "LGPL",
.status = RIG_STATUS_STABLE, .status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER, .rig_type = RIG_TYPE_TRANSCEIVER,
@ -460,7 +460,7 @@ const struct rig_caps ic9700_caps =
.max_rit = Hz(9999), .max_rit = Hz(9999),
.max_xit = Hz(9999), .max_xit = Hz(9999),
.max_ifshift = Hz(0), .max_ifshift = Hz(0),
.targetable_vfo = RIG_TARGETABLE_FREQ, .targetable_vfo = 0,
.vfo_ops = IC9700_VFO_OPS, .vfo_ops = IC9700_VFO_OPS,
.scan_ops = IC9700_SCAN_OPS, .scan_ops = IC9700_SCAN_OPS,
.transceive = RIG_TRN_RIG, .transceive = RIG_TRN_RIG,

Wyświetl plik

@ -621,7 +621,7 @@ icom_init(RIG *rig)
priv->no_xchg = priv_caps->no_xchg; priv->no_xchg = priv_caps->no_xchg;
priv->tx_vfo = RIG_VFO_NONE; priv->tx_vfo = RIG_VFO_NONE;
priv->rx_vfo = RIG_VFO_NONE; priv->rx_vfo = RIG_VFO_NONE;
priv->curr_vfo = RIG_VFO_NONE; rig->state.current_vfo = RIG_VFO_NONE;
rig_debug(RIG_DEBUG_TRACE, "%s: done\n", __func__); rig_debug(RIG_DEBUG_TRACE, "%s: done\n", __func__);
@ -804,10 +804,9 @@ icom_rig_close(RIG *rig)
int icom_set_default_vfo(RIG *rig) int icom_set_default_vfo(RIG *rig)
{ {
int retval; int retval;
struct icom_priv_data *priv = (struct icom_priv_data *) rig->state.priv;
rig_debug(RIG_DEBUG_TRACE, "%s: called, curr_vfo=%s\n", __func__, rig_debug(RIG_DEBUG_TRACE, "%s: called, curr_vfo=%s\n", __func__,
rig_strvfo(priv->curr_vfo)); rig_strvfo(rig->state.current_vfo));
if (VFO_HAS_MAIN_SUB_A_B_ONLY) if (VFO_HAS_MAIN_SUB_A_B_ONLY)
{ {
@ -827,7 +826,7 @@ int icom_set_default_vfo(RIG *rig)
return retval; return retval;
} }
priv->curr_vfo = RIG_VFO_MAIN; rig->state.current_vfo = RIG_VFO_MAIN;
return RIG_OK; return RIG_OK;
} }
@ -836,7 +835,7 @@ int icom_set_default_vfo(RIG *rig)
rig_debug(RIG_DEBUG_TRACE, "%s: setting default as MAIN\n", rig_debug(RIG_DEBUG_TRACE, "%s: setting default as MAIN\n",
__func__); __func__);
retval = rig_set_vfo(rig, RIG_VFO_MAIN); // we'll default to Main in this case retval = rig_set_vfo(rig, RIG_VFO_MAIN); // we'll default to Main in this case
priv->curr_vfo = RIG_VFO_MAIN; rig->state.current_vfo = RIG_VFO_MAIN;
} }
else if (VFO_HAS_A_B) else if (VFO_HAS_A_B)
{ {
@ -844,15 +843,15 @@ int icom_set_default_vfo(RIG *rig)
__func__); __func__);
retval = rig_set_vfo(rig, retval = rig_set_vfo(rig,
RIG_VFO_A); // we'll default to VFOA for all others RIG_VFO_A); // we'll default to VFOA for all others
priv->curr_vfo = RIG_VFO_A; rig->state.current_vfo = RIG_VFO_A;
} }
else else
{ {
// we don't have any VFO selection // we don't have any VFO selection
rig_debug(RIG_DEBUG_TRACE, "%s: setting default as VFO_CURR\n", rig_debug(RIG_DEBUG_TRACE, "%s: Unknown VFO setup so setting default as VFOA\n",
__func__); __func__);
priv->curr_vfo = RIG_VFO_A; rig->state.current_vfo = RIG_VFO_A;
retval = RIG_OK; retval = RIG_OK;
} }
@ -860,6 +859,7 @@ int icom_set_default_vfo(RIG *rig)
{ {
return retval; return retval;
} }
rig_debug(RIG_DEBUG_TRACE, "%s: curr_vfo now %s\n", __func__, rig_strvfo(rig->state.current_vfo));
return RIG_OK; return RIG_OK;
} }
@ -916,21 +916,21 @@ int icom_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
rs = &rig->state; rs = &rig->state;
priv = (struct icom_priv_data *) rs->priv; priv = (struct icom_priv_data *) rs->priv;
if (priv->curr_vfo == RIG_VFO_NONE && vfo == RIG_VFO_CURR) if (rig->state.current_vfo == RIG_VFO_NONE && vfo == RIG_VFO_CURR)
{ {
icom_set_default_vfo(rig); icom_set_default_vfo(rig);
} }
if (vfo == RIG_VFO_CURR) if (vfo == RIG_VFO_CURR)
{ {
vfo = priv->curr_vfo; vfo = rig->state.current_vfo;
rig_debug(RIG_DEBUG_TRACE, "%s: currVFO asked for so vfo set to %s\n", __func__, rig_debug(RIG_DEBUG_TRACE, "%s: currVFO asked for so vfo set to %s\n", __func__,
rig_strvfo(vfo)); rig_strvfo(vfo));
} }
rig_debug(RIG_DEBUG_TRACE, "%s: set_vfo_curr=%s\n", __func__, rig_debug(RIG_DEBUG_TRACE, "%s: set_vfo_curr=%s\n", __func__,
rig_strvfo(priv->curr_vfo)); rig_strvfo(rig->state.current_vfo));
retval = set_vfo_curr(rig, vfo, priv->curr_vfo); retval = set_vfo_curr(rig, vfo, rig->state.current_vfo);
if (retval != RIG_OK) if (retval != RIG_OK)
{ {
@ -1032,9 +1032,9 @@ int icom_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
case RIG_VFO_SUB_B: case RIG_VFO_SUB_B:
case RIG_VFO_B: priv->vfob_freq = freq; break; case RIG_VFO_B: priv->vfob_freq = freq; break;
case RIG_VFO_MAIN: priv->sub_freq = freq; break; case RIG_VFO_MAIN: priv->main_freq = freq; break;
case RIG_VFO_SUB: priv->main_freq = freq; break; case RIG_VFO_SUB: priv->sub_freq = freq; break;
case RIG_VFO_CURR: break; case RIG_VFO_CURR: break;
@ -1114,7 +1114,7 @@ int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
if (vfo == RIG_VFO_CURR) if (vfo == RIG_VFO_CURR)
{ {
vfo = priv->curr_vfo; vfo = rig->state.current_vfo;
if (vfo == RIG_VFO_NONE) { vfo = RIG_VFO_A; } if (vfo == RIG_VFO_NONE) { vfo = RIG_VFO_A; }
@ -1125,7 +1125,7 @@ int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
#endif #endif
retval = set_vfo_curr(rig, vfo, priv->curr_vfo); retval = set_vfo_curr(rig, vfo, rig->state.current_vfo);
if (retval != RIG_OK) if (retval != RIG_OK)
{ {
@ -1137,7 +1137,7 @@ int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
#if 0 #if 0
// Pick the appropriate VFO when VFO_RX or VFO_TX is requested // Pick the appropriate VFO when VFO_RX or VFO_TX is requested
if (vfo == RIG_VFO_RX && priv->curr_vfo) if (vfo == RIG_VFO_RX && rig->state.current_vfo)
{ {
vfo = vfo_fixup(rig, vfo); vfo = vfo_fixup(rig, vfo);
rig_debug(RIG_DEBUG_TRACE, "%s: vfo_fixup vfo=%s\n", __func__, rig_strvfo(vfo)); rig_debug(RIG_DEBUG_TRACE, "%s: vfo_fixup vfo=%s\n", __func__, rig_strvfo(vfo));
@ -1167,7 +1167,7 @@ int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
rig_debug(RIG_DEBUG_VERBOSE, "%s: using vfo=%s\n", __func__, rig_debug(RIG_DEBUG_VERBOSE, "%s: using vfo=%s\n", __func__,
rig_strvfo(vfo)); rig_strvfo(vfo));
if (priv->curr_vfo == RIG_VFO_NONE) if (rig->state.current_vfo == RIG_VFO_NONE)
{ {
retval = rig_set_vfo(rig, vfo); retval = rig_set_vfo(rig, vfo);
@ -1229,14 +1229,20 @@ int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
switch (vfo) switch (vfo)
{ {
case RIG_VFO_MAIN_A:
case RIG_VFO_SUB_A:
case RIG_VFO_A: priv->vfoa_freq = *freq; break; case RIG_VFO_A: priv->vfoa_freq = *freq; break;
case RIG_VFO_MAIN_B:
case RIG_VFO_SUB_B:
case RIG_VFO_B: priv->vfob_freq = *freq; break; case RIG_VFO_B: priv->vfob_freq = *freq; break;
case RIG_VFO_MAIN: priv->main_freq = *freq; break; case RIG_VFO_MAIN: priv->main_freq = *freq; break;
case RIG_VFO_SUB: priv->sub_freq = *freq; break; case RIG_VFO_SUB: priv->sub_freq = *freq; break;
case RIG_VFO_CURR: break;
default: default:
rig_debug(RIG_DEBUG_ERR, "%s: unknown VFO? VFO=%s\n", __func__, rig_debug(RIG_DEBUG_ERR, "%s: unknown VFO? VFO=%s\n", __func__,
rig_strvfo(vfo)); rig_strvfo(vfo));
@ -1946,7 +1952,7 @@ int icom_set_vfo(RIG *rig, vfo_t vfo)
if (vfo == RIG_VFO_CURR) if (vfo == RIG_VFO_CURR)
{ {
rig_debug(RIG_DEBUG_TRACE, "%s: Asking for currVFO, currVFO=%s\n", __func__, rig_debug(RIG_DEBUG_TRACE, "%s: Asking for currVFO, currVFO=%s\n", __func__,
rig_strvfo(priv->curr_vfo)); rig_strvfo(rig->state.current_vfo));
return RIG_OK; return RIG_OK;
} }
@ -1997,10 +2003,10 @@ int icom_set_vfo(RIG *rig, vfo_t vfo)
rig_debug(RIG_DEBUG_TRACE, "%s: debug#1\n", __func__); rig_debug(RIG_DEBUG_TRACE, "%s: debug#1\n", __func__);
if (vfo != priv->curr_vfo) if (vfo != rig->state.current_vfo)
{ {
rig_debug(RIG_DEBUG_TRACE, "%s: VFO changing from %s to %s\n", __func__, rig_debug(RIG_DEBUG_TRACE, "%s: VFO changing from %s to %s\n", __func__,
rig_strvfo(priv->curr_vfo), rig_strvfo(vfo)); rig_strvfo(rig->state.current_vfo), rig_strvfo(vfo));
priv->curr_freq = 0; // reset curr_freq so set_freq works 1st time priv->curr_freq = 0; // reset curr_freq so set_freq works 1st time
} }
@ -2057,7 +2063,7 @@ int icom_set_vfo(RIG *rig, vfo_t vfo)
return -RIG_ERJCTED; return -RIG_ERJCTED;
} }
priv->curr_vfo = vfo; rig->state.current_vfo = vfo;
return RIG_OK; return RIG_OK;
case RIG_VFO_MEM: case RIG_VFO_MEM:
@ -2076,7 +2082,7 @@ int icom_set_vfo(RIG *rig, vfo_t vfo)
return -RIG_ERJCTED; return -RIG_ERJCTED;
} }
priv->curr_vfo = vfo; rig->state.current_vfo = vfo;
return RIG_OK; return RIG_OK;
case RIG_VFO_MAIN_A: // we need to select Main before setting VFO case RIG_VFO_MAIN_A: // we need to select Main before setting VFO
@ -2096,7 +2102,7 @@ int icom_set_vfo(RIG *rig, vfo_t vfo)
return -RIG_ERJCTED; return -RIG_ERJCTED;
} }
priv->curr_vfo = vfo; rig->state.current_vfo = vfo;
return RIG_OK; return RIG_OK;
break; break;
@ -2118,7 +2124,7 @@ int icom_set_vfo(RIG *rig, vfo_t vfo)
return -RIG_ERJCTED; return -RIG_ERJCTED;
} }
priv->curr_vfo = vfo; rig->state.current_vfo = vfo;
return RIG_OK; return RIG_OK;
break; break;
@ -2146,9 +2152,8 @@ int icom_set_vfo(RIG *rig, vfo_t vfo)
return -RIG_ERJCTED; return -RIG_ERJCTED;
} }
priv->curr_vfo = vfo;
rig->state.current_vfo = vfo; rig->state.current_vfo = vfo;
rig_debug(RIG_DEBUG_TRACE, "%s: debug#5\n", __func__); rig_debug(RIG_DEBUG_TRACE, "%s: debug#5 curr_vfo=%s\n", __func__, rig_strvfo(rig->state.current_vfo));
return RIG_OK; return RIG_OK;
} }
@ -3826,7 +3831,7 @@ int icom_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
rs = &rig->state; rs = &rig->state;
priv = (struct icom_priv_data *) rs->priv; priv = (struct icom_priv_data *) rs->priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: curr_vfo=%s\n", __func__, rig_debug(RIG_DEBUG_VERBOSE, "%s: curr_vfo=%s\n", __func__,
rig_strvfo(priv->curr_vfo)); rig_strvfo(rig->state.current_vfo));
rig_debug(RIG_DEBUG_VERBOSE, "%s: satmode=%d, subvfo=%s\n", __func__, rig_debug(RIG_DEBUG_VERBOSE, "%s: satmode=%d, subvfo=%s\n", __func__,
rig->state.cache.satmode, rig_strvfo(priv->tx_vfo)); rig->state.cache.satmode, rig_strvfo(priv->tx_vfo));
@ -3841,7 +3846,7 @@ int icom_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
if (rig->state.cache.satmode && vfo == RIG_VFO_TX) { vfo = RIG_VFO_SUB; } if (rig->state.cache.satmode && vfo == RIG_VFO_TX) { vfo = RIG_VFO_SUB; }
if (priv->curr_vfo == RIG_VFO_NONE) if (rig->state.current_vfo == RIG_VFO_NONE)
{ {
retval = icom_set_default_vfo(rig); retval = icom_set_default_vfo(rig);
@ -4031,7 +4036,7 @@ int icom_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq)
rs = &rig->state; rs = &rig->state;
priv = (struct icom_priv_data *) rs->priv; priv = (struct icom_priv_data *) rs->priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: curr_vfo=%s\n", __func__, rig_debug(RIG_DEBUG_VERBOSE, "%s: curr_vfo=%s\n", __func__,
rig_strvfo(priv->curr_vfo)); rig_strvfo(rig->state.current_vfo));
if (rig->caps->rig_model == RIG_MODEL_IC910) if (rig->caps->rig_model == RIG_MODEL_IC910)
@ -4055,9 +4060,9 @@ int icom_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq)
} }
rig_debug(RIG_DEBUG_VERBOSE, "%s curr_vfo=%s\n", __func__, rig_debug(RIG_DEBUG_VERBOSE, "%s curr_vfo=%s\n", __func__,
rig_strvfo(priv->curr_vfo)); rig_strvfo(rig->state.current_vfo));
if (priv->curr_vfo == RIG_VFO_NONE) if (rig->state.current_vfo == RIG_VFO_NONE)
{ {
icom_set_default_vfo(rig); icom_set_default_vfo(rig);
} }
@ -4436,13 +4441,13 @@ int icom_set_split_freq_mode(RIG *rig, vfo_t vfo, freq_t tx_freq,
rig_debug(RIG_DEBUG_VERBOSE, "%s called vfo=%s\n", __func__, rig_debug(RIG_DEBUG_VERBOSE, "%s called vfo=%s\n", __func__,
rig_strvfo(vfo)); rig_strvfo(vfo));
rig_debug(RIG_DEBUG_VERBOSE, "%s: curr_vfo=%s\n", __func__, rig_debug(RIG_DEBUG_VERBOSE, "%s: curr_vfo=%s\n", __func__,
rig_strvfo(priv->curr_vfo)); rig_strvfo(rig->state.current_vfo));
// If the user is asking to set split on VFO_CURR we'll assume split mode // If the user is asking to set split on VFO_CURR we'll assume split mode
// WSJT-X calls this function before turning on split mode // WSJT-X calls this function before turning on split mode
if (vfo == RIG_VFO_CURR) { split_assumed = 1; } if (vfo == RIG_VFO_CURR) { split_assumed = 1; }
if (priv->curr_vfo == RIG_VFO_NONE) if (rig->state.current_vfo == RIG_VFO_NONE)
{ {
icom_set_default_vfo(rig); icom_set_default_vfo(rig);
} }
@ -4694,11 +4699,11 @@ int icom_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
rig_debug(RIG_DEBUG_VERBOSE, rig_debug(RIG_DEBUG_VERBOSE,
"%s called vfo='%s', split=%d, tx_vfo=%s, curr_vfo=%s\n", __func__, "%s called vfo='%s', split=%d, tx_vfo=%s, curr_vfo=%s\n", __func__,
rig_strvfo(vfo), split, rig_strvfo(tx_vfo), rig_strvfo(priv->curr_vfo)); rig_strvfo(vfo), split, rig_strvfo(tx_vfo), rig_strvfo(rig->state.current_vfo));
if (vfo == RIG_VFO_CURR) if (vfo == RIG_VFO_CURR)
{ {
vfo = priv->curr_vfo; vfo = rig->state.current_vfo;
} }
// This should automaticaly switch between satmode on/off based on the requested split vfo // This should automaticaly switch between satmode on/off based on the requested split vfo
@ -4707,7 +4712,7 @@ int icom_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
if ((tx_vfo == RIG_VFO_SUB || tx_vfo == RIG_VFO_MAIN) if ((tx_vfo == RIG_VFO_SUB || tx_vfo == RIG_VFO_MAIN)
&& !rig->state.cache.satmode) && !rig->state.cache.satmode)
{ {
rig_debug(RIG_DEBUG_VERBOSE, "%s: VFO_SUB and satmode is off so turning on\n", rig_debug(RIG_DEBUG_VERBOSE, "%s: VFO_SUB and satmode is off so turning satmode on\n",
__func__); __func__);
rig_set_func(rig, RIG_VFO_CURR, RIG_FUNC_SATMODE, 1); rig_set_func(rig, RIG_VFO_CURR, RIG_FUNC_SATMODE, 1);
rig->state.cache.satmode = 1; rig->state.cache.satmode = 1;
@ -4716,7 +4721,7 @@ int icom_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
else if ((tx_vfo == RIG_VFO_A || tx_vfo == RIG_VFO_B) else if ((tx_vfo == RIG_VFO_A || tx_vfo == RIG_VFO_B)
&& rig->state.cache.satmode) && rig->state.cache.satmode)
{ {
rig_debug(RIG_DEBUG_VERBOSE, "%s: VFO_B and satmode is on so turning off\n", rig_debug(RIG_DEBUG_VERBOSE, "%s: VFO_B and satmode is on so turning satmode off\n",
__func__); __func__);
rig_set_func(rig, RIG_VFO_CURR, RIG_FUNC_SATMODE, 0); rig_set_func(rig, RIG_VFO_CURR, RIG_FUNC_SATMODE, 0);
rig->state.cache.satmode = 0; rig->state.cache.satmode = 0;
@ -4878,7 +4883,7 @@ int icom_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
priv->split_on = RIG_SPLIT_ON == split; priv->split_on = RIG_SPLIT_ON == split;
if (vfo_final != RIG_VFO_NONE && vfo_final != priv->curr_vfo) if (vfo_final != RIG_VFO_NONE && vfo_final != rig->state.current_vfo)
{ {
rig_debug(RIG_DEBUG_TRACE, "%s: vfo_final set %s\n", __func__, rig_debug(RIG_DEBUG_TRACE, "%s: vfo_final set %s\n", __func__,
rig_strvfo(vfo_final)); rig_strvfo(vfo_final));
@ -4893,7 +4898,7 @@ int icom_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
rig_debug(RIG_DEBUG_VERBOSE, rig_debug(RIG_DEBUG_VERBOSE,
"%s: vfo=%s curr_vfo=%s rx_vfo=%s tx_vfo=%s split=%d\n", "%s: vfo=%s curr_vfo=%s rx_vfo=%s tx_vfo=%s split=%d\n",
__func__, rig_strvfo(vfo), rig_strvfo(priv->curr_vfo), rig_strvfo(priv->rx_vfo), __func__, rig_strvfo(vfo), rig_strvfo(rig->state.current_vfo), rig_strvfo(priv->rx_vfo),
rig_strvfo(priv->tx_vfo), split); rig_strvfo(priv->tx_vfo), split);
return RIG_OK; return RIG_OK;
} }
@ -7138,7 +7143,7 @@ int icom_get_freq_range(RIG *rig)
return RIG_OK; return RIG_OK;
} }
// Sets rig vfo && priv->curr_vfo to default VFOA, or current vfo, or the vfo requested // Sets rig vfo && rig->state.current_vfo to default VFOA, or current vfo, or the vfo requested
static int set_vfo_curr(RIG *rig, vfo_t vfo, vfo_t curr_vfo) static int set_vfo_curr(RIG *rig, vfo_t vfo, vfo_t curr_vfo)
{ {
int retval; int retval;
@ -7150,8 +7155,8 @@ static int set_vfo_curr(RIG *rig, vfo_t vfo, vfo_t curr_vfo)
if (vfo == RIG_VFO_CURR) if (vfo == RIG_VFO_CURR)
{ {
rig_debug(RIG_DEBUG_TRACE, "%s: Asking for currVFO, currVFO=%s\n", __func__, rig_debug(RIG_DEBUG_TRACE, "%s: Asking for currVFO, currVFO=%s\n", __func__,
rig_strvfo(priv->curr_vfo)); rig_strvfo(rig->state.current_vfo));
vfo = priv->curr_vfo; vfo = rig->state.current_vfo;
} }
if (vfo == RIG_VFO_MAIN && VFO_HAS_A_B_ONLY) if (vfo == RIG_VFO_MAIN && VFO_HAS_A_B_ONLY)
@ -7170,22 +7175,22 @@ static int set_vfo_curr(RIG *rig, vfo_t vfo, vfo_t curr_vfo)
/* This method works also in memory mode(RIG_VFO_MEM) */ /* This method works also in memory mode(RIG_VFO_MEM) */
// first time we will set default to VFOA or Main as // first time we will set default to VFOA or Main as
// So if you ask for frequency or such without setting VFO first you'll get Main/VFOA // So if you ask for frequency or such without setting VFO first you'll get Main/VFOA
if (priv->curr_vfo == RIG_VFO_NONE && vfo == RIG_VFO_CURR) if (rig->state.current_vfo == RIG_VFO_NONE && vfo == RIG_VFO_CURR)
{ {
icom_set_default_vfo(rig); icom_set_default_vfo(rig);
} }
// asking for vfo_curr so give it to them // asking for vfo_curr so give it to them
else if (priv->curr_vfo != RIG_VFO_NONE && vfo == RIG_VFO_CURR) else if (rig->state.current_vfo != RIG_VFO_NONE && vfo == RIG_VFO_CURR)
{ {
rig_debug(RIG_DEBUG_TRACE, "%s: using curr_vfo=%s\n", __func__, rig_debug(RIG_DEBUG_TRACE, "%s: using curr_vfo=%s\n", __func__,
rig_strvfo(priv->curr_vfo)); rig_strvfo(rig->state.current_vfo));
vfo = priv->curr_vfo; vfo = rig->state.current_vfo;
} }
// only need to set vfo if it's changed // only need to set vfo if it's changed
else if (priv->curr_vfo != vfo) else if (rig->state.current_vfo != vfo)
{ {
if (!(VFO_HAS_MAIN_SUB_A_B_ONLY && !priv->split_on && !rig->state.cache.satmode if (!(VFO_HAS_MAIN_SUB_A_B_ONLY && !priv->split_on && !rig->state.cache.satmode
&& vfo == RIG_VFO_SUB && priv->curr_vfo == RIG_VFO_B)) && vfo == RIG_VFO_SUB && rig->state.current_vfo == RIG_VFO_B))
{ {
rig_debug(RIG_DEBUG_TRACE, "%s: setting new vfo=%s\n", __func__, rig_debug(RIG_DEBUG_TRACE, "%s: setting new vfo=%s\n", __func__,
rig_strvfo(vfo)); rig_strvfo(vfo));
@ -7195,13 +7200,11 @@ static int set_vfo_curr(RIG *rig, vfo_t vfo, vfo_t curr_vfo)
{ {
return retval; return retval;
} }
priv->curr_vfo = vfo;
} }
} }
rig_debug(RIG_DEBUG_TRACE, "%s: curr_vfo now=%s\n", __func__, rig_debug(RIG_DEBUG_TRACE, "%s: curr_vfo now=%s\n", __func__,
rig_strvfo(priv->curr_vfo)); rig_strvfo(rig->state.current_vfo));
rig->state.current_vfo = vfo; rig->state.current_vfo = vfo;

Wyświetl plik

@ -31,7 +31,7 @@
#include <sys/time.h> #include <sys/time.h>
#endif #endif
#define BACKEND_VER "20200612" #define BACKEND_VER "20200613"
/* /*
* defines used by comp_cal_str in rig.c * defines used by comp_cal_str in rig.c
@ -179,9 +179,8 @@ struct icom_priv_data
int split_on; /* record split state */ int split_on; /* record split state */
pltstate_t *pltstate; /* only on optoscan */ pltstate_t *pltstate; /* only on optoscan */
int serial_USB_echo_off; /* USB is not set to echo */ int serial_USB_echo_off; /* USB is not set to echo */
/* we track vfos internallhy for use with different functions like split */ /* we track vfos internally for use with different functions like split */
/* this allows queries using CURR_VFO and Main/Sub to behave */ /* this allows queries using CURR_VFO and Main/Sub to behave */
vfo_t curr_vfo;
vfo_t rx_vfo; vfo_t rx_vfo;
vfo_t tx_vfo; vfo_t tx_vfo;
freq_t curr_freq; // our current freq depending on which vfo is selected freq_t curr_freq; // our current freq depending on which vfo is selected

Wyświetl plik

@ -52,7 +52,6 @@
struct xg3_priv_data struct xg3_priv_data
{ {
/* current vfo already in rig_state ? */ /* current vfo already in rig_state ? */
vfo_t curr_vfo;
vfo_t last_vfo; vfo_t last_vfo;
ptt_t ptt; ptt_t ptt;
powerstat_t powerstat; powerstat_t powerstat;
@ -107,9 +106,9 @@ const struct rig_caps xg3_caps =
RIG_MODEL(RIG_MODEL_XG3), RIG_MODEL(RIG_MODEL_XG3),
.model_name = "XG3", .model_name = "XG3",
.mfg_name = "Elecraft", .mfg_name = "Elecraft",
.version = "20191218.0", .version = "20200613.0",
.copyright = "LGPL", .copyright = "LGPL",
.status = RIG_STATUS_BETA, .status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER, .rig_type = RIG_TYPE_TRANSCEIVER,
.ptt_type = RIG_PTT_RIG, .ptt_type = RIG_PTT_RIG,
.dcd_type = RIG_DCD_RIG, .dcd_type = RIG_DCD_RIG,
@ -193,7 +192,7 @@ int xg3_init(RIG *rig)
// Tried set_trn to turn transceiver on/off but turning it on isn't enabled in hamlib for some reason // Tried set_trn to turn transceiver on/off but turning it on isn't enabled in hamlib for some reason
// So we use PTT instead // So we use PTT instead
// rig->state.transceive = RIG_TRN_RIG; // this allows xg3_set_trn to be called // rig->state.transceive = RIG_TRN_RIG; // this allows xg3_set_trn to be called
priv->curr_vfo = RIG_VFO_A; rig->state.current_vfo = RIG_VFO_A;
priv->last_vfo = RIG_VFO_A; priv->last_vfo = RIG_VFO_A;
priv->ptt = RIG_PTT_ON; priv->ptt = RIG_PTT_ON;
priv->powerstat = RIG_POWER_ON; priv->powerstat = RIG_POWER_ON;
@ -334,8 +333,6 @@ int xg3_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
*/ */
int xg3_get_vfo(RIG *rig, vfo_t *vfo) int xg3_get_vfo(RIG *rig, vfo_t *vfo)
{ {
struct xg3_priv_data *priv = (struct xg3_priv_data *)rig->state.priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
if (!vfo) if (!vfo)
@ -343,7 +340,7 @@ int xg3_get_vfo(RIG *rig, vfo_t *vfo)
return -RIG_EINVAL; return -RIG_EINVAL;
} }
*vfo = priv->curr_vfo; // VFOA or MEM *vfo = rig->state.current_vfo; // VFOA or MEM
return RIG_OK; return RIG_OK;
} }
@ -352,8 +349,6 @@ int xg3_get_vfo(RIG *rig, vfo_t *vfo)
*/ */
int xg3_set_vfo(RIG *rig, vfo_t vfo) int xg3_set_vfo(RIG *rig, vfo_t vfo)
{ {
struct xg3_priv_data *priv = (struct xg3_priv_data *)rig->state.priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
if (!vfo) if (!vfo)
@ -365,7 +360,7 @@ int xg3_set_vfo(RIG *rig, vfo_t vfo)
// We don't actually set the vfo on the XG3 // We don't actually set the vfo on the XG3
// But we need this so we can set frequencies on the band buttons // But we need this so we can set frequencies on the band buttons
priv->curr_vfo = vfo; rig->state.current_vfo = vfo;
return RIG_OK; return RIG_OK;
} }

Wyświetl plik

@ -100,7 +100,7 @@ extern HAMLIB_EXPORT(void) rig_force_cache_timeout(struct timeval *tv);
extern HAMLIB_EXPORT(setting_t) rig_idx2setting(int i); extern HAMLIB_EXPORT(setting_t) rig_idx2setting(int i);
extern HAMLIB_EXPORT(int) hl_usleep(useconds_t usec); extern HAMLIB_EXPORT(int) hl_usleep(rig_useconds_t usec);
extern HAMLIB_EXPORT(double) elapsed_ms(struct timespec *start, int start_flag); extern HAMLIB_EXPORT(double) elapsed_ms(struct timespec *start, int start_flag);

Wyświetl plik

@ -586,6 +586,7 @@ int HAMLIB_API rig_open(RIG *rig)
&net3, &net4, &net5, &port) == 6; &net3, &net4, &net5, &port) == 6;
is_network |= sscanf(rs->rigport.pathname, "%u:%u:%u:%u:%u:%u:%u:%u:%u", &net1, is_network |= sscanf(rs->rigport.pathname, "%u:%u:%u:%u:%u:%u:%u:%u:%u", &net1,
&net2, &net3, &net4, &net5, &net6, &net7, &net8, &port) == 9; &net2, &net3, &net4, &net5, &net6, &net7, &net8, &port) == 9;
// if we haven't met one of the condition above then we must have a hostname // if we haven't met one of the condition above then we must have a hostname
if (!is_network && (token = strtok_r(rs->rigport.pathname, ":", &strtokp))) if (!is_network && (token = strtok_r(rs->rigport.pathname, ":", &strtokp)))
{ {
@ -596,7 +597,7 @@ int HAMLIB_API rig_open(RIG *rig)
{ {
rig_debug(RIG_DEBUG_TRACE, "%s: token2=%s\n", __func__, token); rig_debug(RIG_DEBUG_TRACE, "%s: token2=%s\n", __func__, token);
if (sscanf(token, "%d", &port)) { is_network |= 1; } if (sscanf(token, "%u", &port)) { is_network |= 1; }
} }
} }
@ -1292,10 +1293,14 @@ int HAMLIB_API rig_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
return RIG_OK; // would be better as error but other software won't handle errors return RIG_OK; // would be better as error but other software won't handle errors
} }
rig_debug(RIG_DEBUG_TRACE, "%s: TARGETABLE_FREQ vfo=%s\n", __func__,
rig_strvfo(vfo));
retcode = caps->set_freq(rig, vfo, freq); retcode = caps->set_freq(rig, vfo, freq);
} }
else else
{ {
rig_debug(RIG_DEBUG_TRACE, "%s: not a TARGETABLE_FREQ vfo=%s\n", __func__,
rig_strvfo(vfo));
int rc2; int rc2;
vfo_t curr_vfo; vfo_t curr_vfo;
@ -2894,7 +2899,8 @@ int HAMLIB_API rig_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
int retcode, rc2; int retcode, rc2;
vfo_t curr_vfo, tx_vfo; vfo_t curr_vfo, tx_vfo;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); rig_debug(RIG_DEBUG_VERBOSE, "%s called vfo=%s, curr_vfo=%s\n", __func__,
rig_strvfo(vfo), rig_strvfo(rig->state.current_vfo));
if (CHECK_RIG_ARG(rig)) if (CHECK_RIG_ARG(rig))
{ {
@ -2998,7 +3004,7 @@ int HAMLIB_API rig_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
int HAMLIB_API rig_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq) int HAMLIB_API rig_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq)
{ {
const struct rig_caps *caps; const struct rig_caps *caps;
int retcode, rc2; int retcode = -RIG_EPROTO, rc2;
vfo_t save_vfo, tx_vfo; vfo_t save_vfo, tx_vfo;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
@ -3042,10 +3048,11 @@ int HAMLIB_API rig_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq)
if (caps->set_vfo) if (caps->set_vfo)
{ {
// if the underlying rig has OP_XCHC we don't need to set VFO // if the underlying rig has OP_XCHG we don't need to set VFO
if (!rig_has_vfo_op(rig, RIG_OP_XCHG)) if (!rig_has_vfo_op(rig, RIG_OP_XCHG))
{ {
retcode = caps->set_vfo(rig, tx_vfo); retcode = caps->set_vfo(rig, tx_vfo);
return retcode;
} }
} }
else if (rig_has_vfo_op(rig, RIG_OP_TOGGLE) && caps->vfo_op) else if (rig_has_vfo_op(rig, RIG_OP_TOGGLE) && caps->vfo_op)

Wyświetl plik

@ -50,7 +50,7 @@ extern "C" {
// In order to stop the usleep warnings in cppcheck we provide our own interface // In order to stop the usleep warnings in cppcheck we provide our own interface
// So this will use system usleep or our usleep depending on availability of nanosleep // So this will use system usleep or our usleep depending on availability of nanosleep
// This version of usleep can handle > 1000000 usec values // This version of usleep can handle > 1000000 usec values
int hl_usleep(useconds_t usec) int hl_usleep(rig_useconds_t usec)
{ {
int retval = 0; int retval = 0;
@ -85,12 +85,13 @@ unsigned int sleep(unsigned int secs)
} }
#if 0
/** /**
* \brief microsecond sleep * \brief microsecond sleep
* \param usec is microseconds to sleep * \param usec is microseconds to sleep
* This does not have the same 1000000 limit as POSIX usleep * This does not have the same 1000000 limit as POSIX usleep
*/ */
int usleep(useconds_t usec) int usleep(rig_useconds_t usec)
{ {
int retval; int retval;
unsigned long sec = usec / 1000000ul; unsigned long sec = usec / 1000000ul;
@ -106,6 +107,7 @@ int usleep(useconds_t usec)
return 0; return 0;
} }
#endif
#endif // HAVE_NANOSLEEP #endif // HAVE_NANOSLEEP
#ifdef __cplusplus #ifdef __cplusplus

Wyświetl plik

@ -28,7 +28,7 @@
__BEGIN_DECLS __BEGIN_DECLS
/* Hamlib internal use, see rig.c */ /* Hamlib internal use, see rig.c */
int hl_usleep(useconds_t usec); int hl_usleep(rig_useconds_t usec);
__END_DECLS __END_DECLS