pull/281/head
Michael Black W9MDB 2020-05-27 12:23:08 -05:00
rodzic 87a83ffbb1
commit 677ccac4bc
11 zmienionych plików z 183 dodań i 120 usunięć

Wyświetl plik

@ -385,15 +385,19 @@ static int dummy_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
channel_t *curr = priv->curr;
char fstr[20];
if (vfo == RIG_VFO_CURR) vfo = priv->curr_vfo;
if (vfo == RIG_VFO_CURR) { vfo = priv->curr_vfo; }
usleep(CMDSLEEP);
sprintf_freq(fstr, freq);
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s %s\n", __func__,
rig_strvfo(vfo), fstr);
curr->freq = freq;
if (vfo == RIG_VFO_A) priv->freq_vfoa = freq;
else if (vfo == RIG_VFO_B) priv->freq_vfob = freq;
rig_debug(RIG_DEBUG_TRACE, "%s: freq_vfoa=%.0f, freq_vfob=%.0f\n", __func__, priv->freq_vfoa, priv->freq_vfob);
if (vfo == RIG_VFO_A) { priv->freq_vfoa = freq; }
else if (vfo == RIG_VFO_B) { priv->freq_vfob = freq; }
rig_debug(RIG_DEBUG_TRACE, "%s: freq_vfoa=%.0f, freq_vfob=%.0f\n", __func__,
priv->freq_vfoa, priv->freq_vfob);
return RIG_OK;
}
@ -402,11 +406,14 @@ static int dummy_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
{
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
if (vfo == RIG_VFO_CURR) vfo = priv->curr_vfo;
if (vfo == RIG_VFO_CURR) { vfo = priv->curr_vfo; }
usleep(CMDSLEEP);
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__, rig_strvfo(vfo));
if (vfo == RIG_VFO_A) *freq = priv->freq_vfoa;
else if (vfo == RIG_VFO_B) *freq = priv->freq_vfob;
if (vfo == RIG_VFO_A) { *freq = priv->freq_vfoa; }
else if (vfo == RIG_VFO_B) { *freq = priv->freq_vfob; }
rig_debug(RIG_DEBUG_TRACE, "%s: freq=%.0f\n", __func__, *freq);
return RIG_OK;
}

Wyświetl plik

@ -121,7 +121,8 @@ static int netrigctl_vfostr(RIG *rig, char *vfostr, int len, vfo_t vfo)
if (vfo == RIG_VFO_CURR)
{
vfo = priv->vfo_curr;
if (vfo == RIG_VFO_NONE) vfo = RIG_VFO_A;
if (vfo == RIG_VFO_NONE) { vfo = RIG_VFO_A; }
}
rig_debug(RIG_DEBUG_TRACE, "%s: vfo_opt=%d\n", __func__, rig->state.vfo_opt);
@ -201,8 +202,10 @@ static int netrigctl_open(RIG *rig)
rig_debug(RIG_DEBUG_WARN, "%s: chk_vfo error: %s\n", __func__,
rigerror(ret));
}
else {
rig_debug(RIG_DEBUG_ERR, "%s: unknown return from netrigctl_transaction=%d\n", __func__, ret);
else
{
rig_debug(RIG_DEBUG_ERR, "%s: unknown return from netrigctl_transaction=%d\n",
__func__, ret);
}
rig_debug(RIG_DEBUG_VERBOSE, "%s: vfo_mode=%d\n", __func__,
@ -595,7 +598,7 @@ static int netrigctl_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
#endif
ret = netrigctl_transaction(rig, cmd, len, buf);
rig_debug(RIG_DEBUG_TRACE, "%s: cmd=%s\n", __func__, strtok(cmd,"\r\n"));
rig_debug(RIG_DEBUG_TRACE, "%s: cmd=%s\n", __func__, strtok(cmd, "\r\n"));
if (ret > 0)
{
@ -617,7 +620,8 @@ static int netrigctl_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
char vfotmp[16];
#endif
rig_debug(RIG_DEBUG_VERBOSE, "%s called, vfo=%s, freq=%.0f\n", __func__, rig_strvfo(vfo), *freq);
rig_debug(RIG_DEBUG_VERBOSE, "%s called, vfo=%s, freq=%.0f\n", __func__,
rig_strvfo(vfo), *freq);
ret = netrigctl_vfostr(rig, vfostr, sizeof(vfostr), vfo);
@ -627,7 +631,8 @@ static int netrigctl_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
ret = netrigctl_transaction(rig, cmd, len, buf);
rig_debug(RIG_DEBUG_TRACE, "%s: cmd=%s, reply=%s\n", __func__, strtok(cmd,"\r\n"), buf);
rig_debug(RIG_DEBUG_TRACE, "%s: cmd=%s, reply=%s\n", __func__, strtok(cmd,
"\r\n"), buf);
if (ret <= 0)
{
@ -2187,10 +2192,12 @@ static int netrigctl_set_vfo_opt(RIG *rig, int status)
sprintf(cmdbuf, "\\set_vfo_opt %d\n", status);
ret = netrigctl_transaction(rig, cmdbuf, strlen(cmdbuf), buf);
if (ret > 0)
{
return -RIG_EPROTO;
}
rig->state.vfo_opt = status;
return RIG_OK;
}

Wyświetl plik

@ -308,13 +308,17 @@ static int ic910_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
{
*freq = origfreq;
}
else if (RIG_VFO_TX == vfo) {
vfo = priv->tx_vfo;
rig_debug(RIG_DEBUG_VERBOSE, "%s: VFO_TX asked for so vfo=%s\n", __func__, rig_strvfo(vfo));
else if (RIG_VFO_TX == vfo)
{
vfo = priv->tx_vfo;
rig_debug(RIG_DEBUG_VERBOSE, "%s: VFO_TX asked for so vfo=%s\n", __func__,
rig_strvfo(vfo));
}
else if (RIG_VFO_RX == vfo) {
vfo = priv->rx_vfo;
rig_debug(RIG_DEBUG_VERBOSE, "%s: VFO_RX asked for so vfo=%s\n", __func__, rig_strvfo(vfo));
else if (RIG_VFO_RX == vfo)
{
vfo = priv->rx_vfo;
rig_debug(RIG_DEBUG_VERBOSE, "%s: VFO_RX asked for so vfo=%s\n", __func__,
rig_strvfo(vfo));
}
else { retval = -RIG_EVFO; }

Wyświetl plik

@ -1974,9 +1974,10 @@ int icom_set_vfo(RIG *rig, vfo_t vfo)
else if (vfo == RIG_VFO_TX)
{
vfo = RIG_VFO_A;
if (VFO_HAS_A_B_ONLY && rig->state.cache.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;
if (VFO_HAS_A_B_ONLY && rig->state.cache.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; }
}
if ((vfo == RIG_VFO_A || vfo == RIG_VFO_B) && !VFO_HAS_A_B && VFO_HAS_MAIN_SUB)
@ -1995,7 +1996,9 @@ int icom_set_vfo(RIG *rig, vfo_t vfo)
__func__);
return -RIG_EINVAL;
}
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)
{
rig_debug(RIG_DEBUG_TRACE, "%s: VFO changing from %s to %s\n", __func__,
@ -2003,7 +2006,8 @@ rig_debug(RIG_DEBUG_TRACE,"%s: debug#1\n", __func__);
priv->curr_freq = 0; // reset curr_freq so set_freq works 1st time
}
rig_debug(RIG_DEBUG_TRACE,"%s: debug#2\n", __func__);
rig_debug(RIG_DEBUG_TRACE, "%s: debug#2\n", __func__);
switch (vfo)
{
case RIG_VFO_A:
@ -2127,10 +2131,10 @@ rig_debug(RIG_DEBUG_TRACE,"%s: debug#2\n", __func__);
return -RIG_EINVAL;
}
rig_debug(RIG_DEBUG_TRACE,"%s: debug#3\n", __func__);
rig_debug(RIG_DEBUG_TRACE, "%s: debug#3\n", __func__);
retval = icom_transaction(rig, C_SET_VFO, icvfo, NULL, 0,
ackbuf, &ack_len);
rig_debug(RIG_DEBUG_TRACE,"%s: debug#4\n", __func__);
rig_debug(RIG_DEBUG_TRACE, "%s: debug#4\n", __func__);
if (retval != RIG_OK)
{
@ -2146,7 +2150,7 @@ rig_debug(RIG_DEBUG_TRACE,"%s: debug#4\n", __func__);
priv->curr_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\n", __func__);
return RIG_OK;
}
@ -3733,23 +3737,31 @@ int icom_get_split_vfos(RIG *rig, vfo_t *rx_vfo, vfo_t *tx_vfo)
if (VFO_HAS_A_B_ONLY)
{
*rx_vfo = *tx_vfo = RIG_VFO_A;
if (priv->split_on) {
*rx_vfo = RIG_VFO_A;
*tx_vfo = RIG_VFO_B; /* rig doesn't enforce this but
*rx_vfo = *tx_vfo = RIG_VFO_A;
if (priv->split_on)
{
*rx_vfo = RIG_VFO_A;
*tx_vfo = RIG_VFO_B; /* rig doesn't enforce this but
convention is needed here */
}
rig_debug(RIG_DEBUG_TRACE, "%s: VFO_HAS_A_B_ONLY, split=%d, rx=%s, tx=%s\n", __func__,
}
rig_debug(RIG_DEBUG_TRACE, "%s: VFO_HAS_A_B_ONLY, split=%d, rx=%s, tx=%s\n",
__func__,
priv->split_on, rig_strvfo(*rx_vfo), rig_strvfo(*tx_vfo));
}
else if (VFO_HAS_MAIN_SUB_ONLY)
{
*rx_vfo = *tx_vfo = RIG_VFO_MAIN;
if (priv->split_on) {
*rx_vfo = RIG_VFO_MAIN;
*tx_vfo = RIG_VFO_SUB;
}
rig_debug(RIG_DEBUG_TRACE, "%s: VFO_HAS_MAIN_SUB_ONLY, split=%d, rx=%s, tx=%s\n",
*rx_vfo = *tx_vfo = RIG_VFO_MAIN;
if (priv->split_on)
{
*rx_vfo = RIG_VFO_MAIN;
*tx_vfo = RIG_VFO_SUB;
}
rig_debug(RIG_DEBUG_TRACE,
"%s: VFO_HAS_MAIN_SUB_ONLY, split=%d, rx=%s, tx=%s\n",
__func__, priv->split_on, rig_strvfo(*rx_vfo), rig_strvfo(*tx_vfo));
}
else if (VFO_HAS_MAIN_SUB_A_B_ONLY)
@ -4659,8 +4671,9 @@ int icom_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
rig->state.cache.satmode = 1;
priv->tx_vfo = RIG_VFO_SUB;
}
else if ((tx_vfo == RIG_VFO_B && rig->state.cache.satmode) || (tx_vfo == RIG_VFO_A
&& rig->state.cache.satmode))
else if ((tx_vfo == RIG_VFO_B && rig->state.cache.satmode)
|| (tx_vfo == RIG_VFO_A
&& rig->state.cache.satmode))
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: VFO_B and satmode is on so turning off\n",
__func__);
@ -4668,12 +4681,14 @@ int icom_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
rig->state.cache.satmode = 0;
priv->tx_vfo = RIG_VFO_B;
}
else if (tx_vfo == RIG_VFO_SUB && rig->state.cache.satmode && split==1)
else if (tx_vfo == RIG_VFO_SUB && rig->state.cache.satmode && split == 1)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: rig in satmode so setting split on is redundant and will create error...returning OK\n", __func__);
// we'll return OK anyways as this is a split mode
// and gpredict wants to see the OK response here
return RIG_OK; // we'll return OK anyways as this is a split mode
rig_debug(RIG_DEBUG_VERBOSE,
"%s: rig in satmode so setting split on is redundant and will create error...returning OK\n",
__func__);
// we'll return OK anyways as this is a split mode
// and gpredict wants to see the OK response here
return RIG_OK; // we'll return OK anyways as this is a split mode
}
switch (split)
@ -7123,18 +7138,20 @@ 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 (priv->curr_vfo != vfo)
{
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)) {
rig_debug(RIG_DEBUG_TRACE, "%s: setting new vfo=%s\n", __func__,
rig_strvfo(vfo));
retval = rig_set_vfo(rig, vfo);
if (retval != RIG_OK)
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))
{
return retval;
}
rig_debug(RIG_DEBUG_TRACE, "%s: setting new vfo=%s\n", __func__,
rig_strvfo(vfo));
retval = rig_set_vfo(rig, vfo);
priv->curr_vfo = vfo;
}
if (retval != RIG_OK)
{
return retval;
}
priv->curr_vfo = vfo;
}
}
rig_debug(RIG_DEBUG_TRACE, "%s: curr_vfo now=%s\n", __func__,

Wyświetl plik

@ -421,7 +421,7 @@ const struct rig_caps ftdx101d_caps =
.max_xit = Hz(9999),
.max_ifshift = Hz(1000),
.vfo_ops = FTDX5000_VFO_OPS,
.targetable_vfo = RIG_TARGETABLE_FREQ|RIG_TARGETABLE_MODE,
.targetable_vfo = RIG_TARGETABLE_FREQ | RIG_TARGETABLE_MODE,
.transceive = RIG_TRN_OFF, /* May enable later as the 5000 has an Auto Info command */
.bank_qty = 0,
.chan_desc_sz = 0,

Wyświetl plik

@ -750,7 +750,7 @@ int newcat_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
/* FT9000 RIG_TARGETABLE_MODE (mode and width) */
/* FT2000 mode only */
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
{
priv->cmd_str[2] = (RIG_VFO_B == vfo) ? '1' : '0';
}
@ -808,7 +808,7 @@ int newcat_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
return err;
}
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
{
main_sub_vfo = RIG_VFO_B == vfo ? '1' : '0';
}
@ -1163,7 +1163,7 @@ int newcat_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t rptr_shift)
return err;
}
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
{
main_sub_vfo = RIG_VFO_B == vfo ? '1' : '0';
}
@ -1216,7 +1216,7 @@ int newcat_get_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t *rptr_shift)
return err;
}
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
{
main_sub_vfo = (RIG_VFO_B == vfo) ? '1' : '0';
}
@ -1882,7 +1882,7 @@ int newcat_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone)
return err;
}
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
{
main_sub_vfo = (RIG_VFO_B == vfo) ? '1' : '0';
}
@ -1941,7 +1941,7 @@ int newcat_get_ctcss_tone(RIG *rig, vfo_t vfo, tone_t *tone)
return err;
}
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
{
main_sub_vfo = (RIG_VFO_B == vfo) ? '1' : '0';
}
@ -2336,7 +2336,7 @@ int newcat_set_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t option)
return err;
}
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
{
main_sub_vfo = RIG_VFO_B == vfo ? '1' : '0';
}
@ -2428,7 +2428,7 @@ int newcat_get_ant(RIG *rig, vfo_t vfo, ant_t dummy, value_t *option,
return err;
}
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
{
main_sub_vfo = (RIG_VFO_B == vfo) ? '1' : '0';
}
@ -2495,7 +2495,7 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
return err;
}
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
{
main_sub_vfo = (RIG_VFO_B == vfo) ? '1' : '0';
}
@ -2578,7 +2578,7 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "IS0%+.4d%c", val.i,
cat_term); /* problem with %+04d */
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE && !is_ft2000)
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE && !is_ft2000)
{
priv->cmd_str[2] = main_sub_vfo;
}
@ -2685,7 +2685,7 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "PA00%c", cat_term);
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE && !is_ft2000)
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE && !is_ft2000)
{
priv->cmd_str[2] = main_sub_vfo;
}
@ -2704,7 +2704,7 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
if (strlen(priv->cmd_str) != 0)
{
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
{
priv->cmd_str[2] = main_sub_vfo;
}
@ -2724,7 +2724,7 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RA00%c", cat_term);
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE && !is_ft2000)
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE && !is_ft2000)
{
priv->cmd_str[2] = main_sub_vfo;
}
@ -2743,7 +2743,7 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
if (strlen(priv->cmd_str) != 0)
{
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
{
priv->cmd_str[2] = main_sub_vfo;
}
@ -2802,7 +2802,7 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RL0%02d%c", fpf, cat_term);
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE && !is_ft2000)
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE && !is_ft2000)
{
priv->cmd_str[2] = main_sub_vfo;
}
@ -2852,7 +2852,7 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
val.i = 3000;
}
}
else if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
else if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
{
if (val.i < 1)
{
@ -2901,7 +2901,7 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
val.i = 3000;
}
}
else if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
else if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
{
if (val.i < 0)
{
@ -2977,7 +2977,7 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "BP01%03d%c", val.i, cat_term);
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE && !is_ft9000)
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE && !is_ft9000)
{
priv->cmd_str[2] = main_sub_vfo;
}
@ -3016,7 +3016,7 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
return err;
}
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
{
main_sub_vfo = (RIG_VFO_B == vfo) ? '1' : '0';
}
@ -3040,7 +3040,7 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "PA0%c", cat_term);
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
{
priv->cmd_str[2] = main_sub_vfo;
}
@ -3075,7 +3075,7 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "IS0%c", cat_term);
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
{
priv->cmd_str[2] = main_sub_vfo;
}
@ -3126,7 +3126,7 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RA0%c", cat_term);
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
{
priv->cmd_str[2] = main_sub_vfo;
}
@ -3160,7 +3160,7 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RL0%c", cat_term);
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
{
priv->cmd_str[2] = main_sub_vfo;
}
@ -3227,7 +3227,7 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
return -RIG_ENAVAIL;
}
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RM09%c", cat_term);
}
@ -3244,7 +3244,7 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
return -RIG_ENAVAIL;
}
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RM07%c", cat_term);
}
@ -3279,7 +3279,7 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "BP01%c", cat_term);
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
{
priv->cmd_str[2] = main_sub_vfo;
}
@ -3494,7 +3494,7 @@ int newcat_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
return err;
}
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
{
main_sub_vfo = (RIG_VFO_B == vfo) ? '1' : '0';
}
@ -3510,7 +3510,7 @@ int newcat_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "BC0%d%c", status ? 1 : 0,
cat_term);
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE && !is_ft2000)
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE && !is_ft2000)
{
priv->cmd_str[2] = main_sub_vfo;
}
@ -3526,7 +3526,7 @@ int newcat_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "BP00%03d%c", status ? 1 : 0,
cat_term);
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE && !is_ft2000)
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE && !is_ft2000)
{
priv->cmd_str[2] = main_sub_vfo;
}
@ -3665,7 +3665,7 @@ int newcat_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "BC0%c", cat_term);
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
{
priv->cmd_str[2] = main_sub_vfo;
}
@ -3680,7 +3680,7 @@ int newcat_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "BP00%c", cat_term);
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
{
priv->cmd_str[2] = main_sub_vfo;
}
@ -4065,7 +4065,7 @@ int newcat_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
return err;
}
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
{
main_sub_vfo = (RIG_VFO_B == vfo) ? '1' : '0';
}
@ -4939,7 +4939,7 @@ int newcat_set_narrow(RIG *rig, vfo_t vfo, ncboolean narrow)
return err;
}
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
{
main_sub_vfo = (RIG_VFO_B == vfo) ? '1' : '0';
}
@ -4984,7 +4984,7 @@ int newcat_get_narrow(RIG *rig, vfo_t vfo, ncboolean *narrow)
return err;
}
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
{
main_sub_vfo = (RIG_VFO_B == vfo) ? '1' : '0';
}
@ -5037,7 +5037,7 @@ int newcat_set_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
return err;
}
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE && !is_ft2000)
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE && !is_ft2000)
{
main_sub_vfo = (RIG_VFO_B == vfo) ? '1' : '0';
}
@ -5700,7 +5700,7 @@ int newcat_get_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t *width)
return err;
}
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)
{
main_sub_vfo = (RIG_VFO_B == vfo) ? '1' : '0';
}

Wyświetl plik

@ -1364,7 +1364,8 @@ int HAMLIB_API rig_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
// If we're in vfo_mode then rigctld will do any VFO swapping we need
if ((caps->targetable_vfo & RIG_TARGETABLE_FREQ)
|| vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo || rig->state.vfo_opt == 1)
|| vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo
|| rig->state.vfo_opt == 1)
{
retcode = caps->get_freq(rig, vfo, freq);
@ -1795,7 +1796,7 @@ int HAMLIB_API rig_set_vfo(RIG *rig, vfo_t vfo)
int retcode;
freq_t curr_freq;
rig_debug(RIG_DEBUG_VERBOSE, "%s called vfo=%s\n", __func__,rig_strvfo(vfo));
rig_debug(RIG_DEBUG_VERBOSE, "%s called vfo=%s\n", __func__, rig_strvfo(vfo));
if (CHECK_RIG_ARG(rig))
{
@ -1803,38 +1804,54 @@ int HAMLIB_API rig_set_vfo(RIG *rig, vfo_t vfo)
}
// make sure we are asking for a VFO that the rig actually has
if ((vfo == RIG_VFO_A || vfo == RIG_VFO_B) && !VFO_HAS_A_B) {
rig_debug(RIG_DEBUG_ERR, "%s: rig does not have %s\n", __func__, rig_strvfo(vfo));
return -RIG_EINVAL;
if ((vfo == RIG_VFO_A || vfo == RIG_VFO_B) && !VFO_HAS_A_B)
{
rig_debug(RIG_DEBUG_ERR, "%s: rig does not have %s\n", __func__,
rig_strvfo(vfo));
return -RIG_EINVAL;
}
if ((vfo == RIG_VFO_MAIN || vfo == RIG_VFO_SUB) && !VFO_HAS_MAIN_SUB)
{
rig_debug(RIG_DEBUG_ERR, "%s: rig does not have %s\n", __func__, rig_strvfo(vfo));
return -RIG_EINVAL;
rig_debug(RIG_DEBUG_ERR, "%s: rig does not have %s\n", __func__,
rig_strvfo(vfo));
return -RIG_EINVAL;
}
if (vfo == RIG_VFO_RX)
{
vfo = RIG_VFO_A;
if (VFO_HAS_MAIN_SUB_ONLY) vfo = RIG_VFO_MAIN;
if (VFO_HAS_MAIN_SUB_A_B_ONLY) vfo = RIG_VFO_MAIN;
if (VFO_HAS_MAIN_SUB_ONLY) { vfo = RIG_VFO_MAIN; }
if (VFO_HAS_MAIN_SUB_A_B_ONLY) { vfo = RIG_VFO_MAIN; }
}
if (vfo == RIG_VFO_TX)
{
split_t split = 0;
// get split if we can -- it will default to off otherwise
// maybe split/satmode/vfo/freq/mode can be cached for rigs
// maybe split/satmode/vfo/freq/mode can be cached for rigs
// that don't have read capability or get_vfo like Icom?
// Icom's lack of get_vfo is problematic in this respect
// If we cache vfo or others than twiddling the rig may cause problems
rig_get_split(rig,vfo,&split);
rig_get_split(rig, vfo, &split);
int satmode = rig->state.cache.satmode;
vfo = RIG_VFO_A;
if (split) vfo = RIG_VFO_B;
if (VFO_HAS_MAIN_SUB_ONLY && !split && !satmode) vfo = RIG_VFO_MAIN;
if (VFO_HAS_MAIN_SUB_ONLY && (split || satmode)) vfo = RIG_VFO_SUB;
if (VFO_HAS_MAIN_SUB_A_B_ONLY && split) vfo = RIG_VFO_B;
if (VFO_HAS_MAIN_SUB_A_B_ONLY && satmode) vfo = RIG_VFO_SUB;
rig_debug(RIG_DEBUG_TRACE, "%s: RIG_VFO_TX changed to %s, split=%d, satmode=%d\n", __func__, rig_strvfo(vfo), split, satmode);
if (split) { vfo = RIG_VFO_B; }
if (VFO_HAS_MAIN_SUB_ONLY && !split && !satmode) { vfo = RIG_VFO_MAIN; }
if (VFO_HAS_MAIN_SUB_ONLY && (split || satmode)) { vfo = RIG_VFO_SUB; }
if (VFO_HAS_MAIN_SUB_A_B_ONLY && split) { vfo = RIG_VFO_B; }
if (VFO_HAS_MAIN_SUB_A_B_ONLY && satmode) { vfo = RIG_VFO_SUB; }
rig_debug(RIG_DEBUG_TRACE,
"%s: RIG_VFO_TX changed to %s, split=%d, satmode=%d\n", __func__,
rig_strvfo(vfo), split, satmode);
}
caps = rig->caps;
@ -1868,11 +1885,12 @@ int HAMLIB_API rig_set_vfo(RIG *rig, vfo_t vfo)
// we only get the freq if we set the vfo OK
if (retcode == RIG_OK && caps->get_freq)
{
if (caps->get_freq) {
if (caps->get_freq)
{
retcode = caps->get_freq(rig, vfo, &curr_freq);
rig_debug(RIG_DEBUG_TRACE, "%s: retcode from rig_get_freq = %s\n", __func__,
rigerror(retcode));
}
rigerror(retcode));
}
}
@ -2077,6 +2095,7 @@ int HAMLIB_API rig_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
case RIG_PTT_SERIAL_RTS:
rig_debug(RIG_DEBUG_ERR, "%s: PTT RTS\n", __func__);
/* when the PTT port is not the control port we want to free the
port when PTT is reset and seize the port when PTT is set,
this allows limited sharing of the PTT port between
@ -2147,7 +2166,9 @@ int HAMLIB_API rig_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
rig->state.cache.ptt = ptt;
elapsed_ms(&rig->state.cache.time_ptt, ELAPSED_SET);
if (retcode != RIG_OK) rig_debug(RIG_DEBUG_ERR, "%s: return code=%d\n", __func__, retcode);
if (retcode != RIG_OK) { rig_debug(RIG_DEBUG_ERR, "%s: return code=%d\n", __func__, retcode); }
return retcode;
}
@ -4916,6 +4937,7 @@ int HAMLIB_API rig_set_vfo_opt(RIG *rig, int status)
{
return -RIG_ENAVAIL;
}
return rig->caps->set_vfo_opt(rig, status);
}

Wyświetl plik

@ -273,7 +273,8 @@ int main(int argc, char *argv[])
rig_set_debug(verbose);
rig_debug(RIG_DEBUG_VERBOSE, "ampctl %s\nLast commit was %s\n", hamlib_version, HAMLIBDATETIME);
rig_debug(RIG_DEBUG_VERBOSE, "ampctl %s\nLast commit was %s\n", hamlib_version,
HAMLIBDATETIME);
rig_debug(RIG_DEBUG_VERBOSE, "%s",
"Report bugs to <hamlib-developer@lists.sourceforge.net>\n\n");

Wyświetl plik

@ -71,8 +71,10 @@ int main()
if (my_rig->caps->rig_model == RIG_MODEL_NETRIGCTL)
{
status = rig_set_vfo_opt(my_rig, 1);
if (status != RIG_OK) { printf("set_vfo_opt failed?? Err=%s\n", rigerror(status)); }
}
status = rig_get_freq(my_rig, RIG_VFO_CURR, &freq);
/* Main VFO frequency */
@ -143,6 +145,7 @@ int main()
rig_close(my_rig);
int loops = 1;
while (loops--)
{
retcode = rig_open(my_rig);

Wyświetl plik

@ -320,7 +320,7 @@ static struct test_table test_list[] =
{ '3', "dump_conf", ACTION(dump_conf), ARG_NOVFO },
{ 0x8f, "dump_state", ACTION(dump_state), ARG_OUT | ARG_NOVFO },
{ 0xf0, "chk_vfo", ACTION(chk_vfo), ARG_NOVFO, "ChkVFO" }, /* rigctld only--check for VFO mode */
{ 0xf2, "set_vfo_opt", ACTION(set_vfo_opt), ARG_NOVFO|ARG_IN, "Status" }, /* turn vfo option on/off */
{ 0xf2, "set_vfo_opt", ACTION(set_vfo_opt), ARG_NOVFO | ARG_IN, "Status" }, /* turn vfo option on/off */
{ 0xf1, "halt", ACTION(halt), ARG_NOVFO }, /* rigctld only--halt the daemon */
{ 0x8c, "pause", ACTION(pause), ARG_IN, "Seconds" },
{ 0x00, "", NULL },
@ -768,7 +768,7 @@ int rigctl_parse(RIG *my_rig, FILE *fin, FILE *fout, char *argv[], int argc,
}
my_rig->state.vfo_opt = *vfo_opt;
rig_debug(RIG_DEBUG_ERR, "%s: vfo_opt=%d\n", __func__, *vfo_opt);
rig_debug(RIG_DEBUG_ERR, "%s: vfo_opt=%d\n", __func__, *vfo_opt);
if (cmd == 'Q' || cmd == 'q')
{
@ -1650,6 +1650,7 @@ int rigctl_parse(RIG *my_rig, FILE *fin, FILE *fout, char *argv[], int argc,
p3 ? p3 : "");
rig_debug(RIG_DEBUG_TRACE, "%s: vfo_opt=%d\n", __func__, *vfo_opt);
if (retcode == RIG_EIO)
{
rig_debug(RIG_DEBUG_ERR, "%s: RIG_EIO?\n", __func__);
@ -4523,11 +4524,11 @@ declare_proto_rig(set_vfo_opt)
{
int opt = 0;
char cmdbuf[16];
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__ );
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
CHKSCN1ARG(sscanf(arg1, "%d", &opt));
*vfo_opt = rig->state.vfo_opt = opt;
sprintf(cmdbuf, "( %d\n", opt);
write_block(&rig->state.rigport, cmdbuf , strlen(cmdbuf));
write_block(&rig->state.rigport, cmdbuf, strlen(cmdbuf));
return RIG_OK;
}

Wyświetl plik

@ -299,7 +299,8 @@ int main(int argc, char *argv[])
rig_set_debug(verbose);
rig_debug(RIG_DEBUG_VERBOSE, "rotctl %s\nLast commit was %s\n", hamlib_version, HAMLIBDATETIME);
rig_debug(RIG_DEBUG_VERBOSE, "rotctl %s\nLast commit was %s\n", hamlib_version,
HAMLIBDATETIME);
rig_debug(RIG_DEBUG_VERBOSE, "%s",
"Report bugs to <hamlib-developer@lists.sourceforge.net>\n\n");