Fix icom.c debug and --setvfo get freq

pull/149/head
Michael Black 2019-11-29 11:28:16 -06:00
rodzic a4c5b1b4e7
commit 471c2fa69f
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6599353EC683404D
2 zmienionych plików z 17 dodań i 5 usunięć

Wyświetl plik

@ -720,6 +720,7 @@ int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
// Pick the appropriate VFO when VFO_TX is requested // Pick the appropriate VFO when VFO_TX is requested
if (vfo == RIG_VFO_TX) if (vfo == RIG_VFO_TX)
{ {
rig_debug(RIG_DEBUG_TRACE,"%s: VFO_TX requested, vfo=%s\n",rig_strvfo(vfo));
if (priv->split_on) if (priv->split_on)
{ {
vfo = rig->state.vfo_list & RIG_VFO_B ? RIG_VFO_B : RIG_VFO_SUB; vfo = rig->state.vfo_list & RIG_VFO_B ? RIG_VFO_B : RIG_VFO_SUB;
@ -730,9 +731,11 @@ int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
} }
} }
retval = set_vfo_curr(rig,vfo,priv->curr_vfo);
// Pick the appropriate VFO when VFO_RX is requested // Pick the appropriate VFO when VFO_RX is requested
if (vfo == RIG_VFO_RX) if (vfo == RIG_VFO_RX)
{ {
rig_debug(RIG_DEBUG_TRACE,"%s: VFO_RX requested, vfo=%s\n",rig_strvfo(vfo));
vfo = rig->state.vfo_list & RIG_VFO_B ? RIG_VFO_A : RIG_VFO_MAIN; vfo = rig->state.vfo_list & RIG_VFO_B ? RIG_VFO_A : RIG_VFO_MAIN;
} }
@ -1428,6 +1431,15 @@ int icom_set_vfo(RIG *rig, vfo_t vfo)
struct icom_priv_data *priv = (struct icom_priv_data *)rs->priv; struct icom_priv_data *priv = (struct icom_priv_data *)rs->priv;
if ((vfo == RIG_VFO_A || vfo == RIG_VFO_B) && !VFO_HAS_A_B) {
rig_debug(RIG_DEBUG_ERR,"%s: Rig does not have VFO A/B?\n",__func__);
return -RIG_EINVAL;
}
if ((vfo == RIG_VFO_MAIN || vfo == RIG_VFO_MAIN) && !VFO_HAS_MAIN_SUB) {
rig_debug(RIG_DEBUG_ERR,"%s: Rig does not have VFO Main/Sub?\n",__func__);
return -RIG_EINVAL;
}
switch (vfo) switch (vfo)
{ {
case RIG_VFO_A: icvfo = S_VFOA; break; case RIG_VFO_A: icvfo = S_VFOA; break;
@ -1495,7 +1507,7 @@ int icom_set_vfo(RIG *rig, vfo_t vfo)
"len=%d\n", ackbuf[0], ack_len); "len=%d\n", ackbuf[0], ack_len);
return -RIG_ERJCTED; return -RIG_ERJCTED;
} }
priv->curr_vfo = vfo;
return RIG_OK; return RIG_OK;
} }
@ -5069,19 +5081,19 @@ static int set_vfo_curr(RIG *rig, vfo_t vfo, vfo_t curr_vfo)
// first time we will set default to VFOA // first time we will set default to VFOA
// So if you ask for frequency or such without setting VFO first you'll get VFOA // So if you ask for frequency or such without setting VFO first you'll get VFOA
if (priv->curr_vfo == RIG_VFO_NONE && vfo == RIG_VFO_CURR) { if (priv->curr_vfo == RIG_VFO_NONE && vfo == RIG_VFO_CURR) {
rig_debug(RIG_DEBUG_TRACE,"%s: setting default as VFOA\n"); rig_debug(RIG_DEBUG_TRACE,"%s: setting default as VFOA\n",__func__);
retval = rig_set_vfo(rig, RIG_VFO_A); // we'll default to VFOA in this case retval = rig_set_vfo(rig, RIG_VFO_A); // we'll default to VFOA in this case
if (retval != RIG_OK) return retval; if (retval != RIG_OK) return retval;
priv->curr_vfo = RIG_VFO_A; priv->curr_vfo = RIG_VFO_A;
} }
// 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 (priv->curr_vfo != RIG_VFO_NONE && vfo == RIG_VFO_CURR) {
rig_debug(RIG_DEBUG_TRACE,"%s: using curr_vfo=%s\n",rig_strvfo(priv->curr_vfo)); rig_debug(RIG_DEBUG_TRACE,"%s: using curr_vfo=%s\n",__func__,rig_strvfo(priv->curr_vfo));
vfo = priv->curr_vfo; vfo = priv->curr_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 (priv->curr_vfo != vfo) {
rig_debug(RIG_DEBUG_TRACE,"%s: setting new vfo=%s\n",rig_strvfo(vfo)); rig_debug(RIG_DEBUG_TRACE,"%s: setting new vfo=%s\n",__func__,rig_strvfo(vfo));
retval = rig_set_vfo(rig, vfo); retval = rig_set_vfo(rig, vfo);
priv->curr_vfo = vfo; priv->curr_vfo = vfo;
if (retval != RIG_OK) return retval; if (retval != RIG_OK) return retval;

Wyświetl plik

@ -30,7 +30,7 @@
#include <sys/time.h> #include <sys/time.h>
#endif #endif
#define BACKEND_VER "0.10" #define BACKEND_VER "0.11"
/* /*
* defines used by comp_cal_str in rig.c * defines used by comp_cal_str in rig.c