Add RIG_PASSBAND_NOCHANGE as possible set_{split_,split_freq_,}mode argument

This change  allows the set_mode  functions to leave the  rig passband
unchanged  if required.  For the  few rigs  that do  not have  explcit
passband width control either current state is read and rewritten or a
"normal" width  is chosen e.g. select  a normal width when  there is a
choice like CW and CW-NARROW.
Hamlib-3.1
Bill Somerville 2016-04-09 14:13:49 +01:00
rodzic 22218fed79
commit 222ad74de7
59 zmienionych plików z 900 dodań i 605 usunięć

Wyświetl plik

@ -2962,10 +2962,12 @@ int adat_set_mode(RIG *pRig, vfo_t vfo, rmode_t mode, pbwidth_t width)
pPriv->nRIGMode = mode; pPriv->nRIGMode = mode;
nRC = adat_vfo_rnr2anr(vfo, &(pPriv->nCurrentVFO)); nRC = adat_vfo_rnr2anr(vfo, &(pPriv->nCurrentVFO));
if (width != RIG_PASSBAND_NOCHANGE) {
if (width == RIG_PASSBAND_NORMAL) if (width == RIG_PASSBAND_NORMAL)
width = rig_passband_normal(pRig, mode); width = rig_passband_normal(pRig, mode);
pPriv->nWidth = width; pPriv->nWidth = width;
}
nRC = adat_transaction(pRig, &adat_cmd_list_set_mode); nRC = adat_transaction(pRig, &adat_cmd_list_set_mode);
} }

Wyświetl plik

@ -292,6 +292,8 @@ int alinco_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
if (retval != RIG_OK) if (retval != RIG_OK)
return retval; return retval;
if (width == RIG_PASSBAND_NOCHANGE) return retval;
/* /*
* TODO: please DX77 owners, check this, I'm not sure * TODO: please DX77 owners, check this, I'm not sure
* which passband is default! * which passband is default!

Wyświetl plik

@ -311,6 +311,7 @@ int format8k_mode(RIG *rig, char *buf, rmode_t mode, pbwidth_t width)
case s_kHz(12): aormode = AR8K_WAM; break; case s_kHz(12): aormode = AR8K_WAM; break;
case s_kHz(3): aormode = AR8K_NAM; break; case s_kHz(3): aormode = AR8K_NAM; break;
case RIG_PASSBAND_NOCHANGE: aormode = AR8K_AM; break;
default: default:
rig_debug(RIG_DEBUG_ERR, rig_debug(RIG_DEBUG_ERR,
"%s: unsupported passband %d %d\n", "%s: unsupported passband %d %d\n",
@ -336,6 +337,7 @@ int format8k_mode(RIG *rig, char *buf, rmode_t mode, pbwidth_t width)
case s_kHz(12): aormode = AR8K_NFM; break; case s_kHz(12): aormode = AR8K_NFM; break;
case s_kHz(9): aormode = AR8K_SFM; break; case s_kHz(9): aormode = AR8K_SFM; break;
case RIG_PASSBAND_NOCHANGE: aormode = AR8K_NFM; break;
default: default:
rig_debug(RIG_DEBUG_ERR, rig_debug(RIG_DEBUG_ERR,
"%s: unsupported passband %d %d\n", "%s: unsupported passband %d %d\n",

Wyświetl plik

@ -379,9 +379,14 @@ int ar3030_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
return -RIG_EINVAL; return -RIG_EINVAL;
} }
if (width != RIG_PASSBAND_NOCHANGE) {
mdbuf_len = sprintf(mdbuf, "%c" EOM, aormode);
}
else {
mdbuf_len = sprintf(mdbuf, "%dB%c" EOM, mdbuf_len = sprintf(mdbuf, "%dB%c" EOM,
width < rig_passband_normal(rig,mode) ? 1 : 0, width < rig_passband_normal(rig,mode) ? 1 : 0,
aormode); aormode);
}
retval = ar3030_transaction (rig, mdbuf, mdbuf_len, NULL, NULL); retval = ar3030_transaction (rig, mdbuf, mdbuf_len, NULL, NULL);
return retval; return retval;

Wyświetl plik

@ -414,6 +414,7 @@ int format5k_mode(RIG *rig, char *buf, rmode_t mode, pbwidth_t width)
return -RIG_EINVAL; return -RIG_EINVAL;
} }
if (width != RIG_PASSBAND_NOCHANGE) {
if (width == RIG_PASSBAND_NORMAL) if (width == RIG_PASSBAND_NORMAL)
width = rig_passband_normal(rig, mode); width = rig_passband_normal(rig, mode);
@ -433,6 +434,10 @@ int format5k_mode(RIG *rig, char *buf, rmode_t mode, pbwidth_t width)
return sprintf(buf, "MD%c BW%c", aormode, aorwidth); return sprintf(buf, "MD%c BW%c", aormode, aorwidth);
} }
else {
return sprintf(buf, "MD%c", aormode);
}
}

Wyświetl plik

@ -364,6 +364,8 @@ static int ar7030_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
return -RIG_EINVAL; return -RIG_EINVAL;
} }
if (RIG_PASSBAND_NOCHANGE == width) return RIG_OK;
if (width == RIG_PASSBAND_NORMAL) if (width == RIG_PASSBAND_NORMAL)
width = rig_passband_normal(rig, mode); width = rig_passband_normal(rig, mode);

Wyświetl plik

@ -577,7 +577,7 @@ static int ar7030p_set_mode( RIG * rig, vfo_t vfo, rmode_t mode,
ar_mode = modeToNative( mode ); ar_mode = modeToNative( mode );
rc = writeByte( rig, WORKING, MODE, ar_mode ); rc = writeByte( rig, WORKING, MODE, ar_mode );
if ( RIG_OK == rc ) if ( RIG_OK == rc && width != RIG_PASSBAND_NOCHANGE )
{ {
if ( RIG_PASSBAND_NORMAL == width ) if ( RIG_PASSBAND_NORMAL == width )
{ {

Wyświetl plik

@ -370,15 +370,21 @@ int sr2200_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
normal_width = rig_passband_normal(rig, mode); normal_width = rig_passband_normal(rig, mode);
if (width == 0) if (width == RIG_PASSBAND_NORMAL)
width = normal_width; width = normal_width;
switch (mode) { switch (mode) {
case RIG_MODE_AM: aormode = width > normal_width ? case RIG_MODE_AM:
SR2200_WAM : SR2200_AM; break; aormode = width > normal_width ?
case RIG_MODE_FM: aormode = width < normal_width ? SR2200_WAM : SR2200_AM;
SR2200_SFM : SR2200_FM; break; break;
case RIG_MODE_WFM: aormode = SR2200_WFM; break; case RIG_MODE_FM:
aormode = width >= normal_width ?
SR2200_FM : SR2200_SFM;
break;
case RIG_MODE_WFM:
aormode = SR2200_WFM;
break;
default: default:
rig_debug(RIG_DEBUG_ERR,"%s: unsupported mode %d\n", rig_debug(RIG_DEBUG_ERR,"%s: unsupported mode %d\n",
__FUNCTION__,mode); __FUNCTION__,mode);

Wyświetl plik

@ -519,7 +519,9 @@ Set @var{Mode} to one of: @code{USB}, @code{LSB}, @code{CW},
@code{SAH}, @code{DSB}. @code{SAH}, @code{DSB}.
Set @var{Passband} frequency in Hertz, or @code{0} for the Hamlib Set @var{Passband} frequency in Hertz, or @code{0} for the Hamlib
backend default. backend default. A value of @code{-1} may be passed which leaves the
rig passband unchanged from the current or default value for the mode
as defined by the rig.
@strong{N.B.} Passing a @kbd{?} (query) as the first argument @strong{N.B.} Passing a @kbd{?} (query) as the first argument
instead of @var{Mode} will return a space separated list of radio instead of @var{Mode} will return a space separated list of radio
@ -677,12 +679,16 @@ Get @var{DCS Sql} code.
@item I, set_split_freq @var{Tx Frequency} @item I, set_split_freq @var{Tx Frequency}
Set @var{TX Frequency}, in Hertz for ``split'' frequency operation. Set @var{TX Frequency}, in Hertz for ``split'' frequency operation.
See also @command{set_split_freq_mode} below.
@ifhtml @ifhtml
@* @*
@end ifhtml @end ifhtml
@item i, get_split_freq @item i, get_split_freq
Get @var{TX Frequency}, in Hertz for ``split'' frequency operation. Get @var{TX Frequency}, in Hertz for ``split'' frequency operation.
See also @command{get_split_freq_mode} below.
@ifhtml @ifhtml
@* @*
@end ifhtml @end ifhtml
@ -695,19 +701,75 @@ Set @var{TX Mode} to one of: @code{AM}, @code{FM}, @code{CW},
@code{SAH}, @code{DSB}. @code{SAH}, @code{DSB}.
The @var{TX Passband} is the exact passband frequency in Hertz, or The @var{TX Passband} is the exact passband frequency in Hertz, or
@code{0} for the Hamlib backend default. @code{0} for the Hamlib backend default. A value of @code{-1} may be
passed which leaves the rig passband unchanged from the current or
default value for the mode as defined by the rig.
@strong{N.B.} Passing a @kbd{?} (query) as the first argument instead @strong{N.B.} Passing a @kbd{?} (query) as the first argument instead
of @var{TX Mode} will return a space separated list of radio backend of @var{TX Mode} will return a space separated list of radio backend
supported TX Modes. Use this to determine the supported TX Modes of a supported TX Modes. Use this to determine the supported TX Modes of a
given radio backend. given radio backend.
See also @command{set_split_freq_mode} below.
@ifhtml
@*
@end ifhtml
@item x, get_split_mode @item x, get_split_mode
Get @var{TX Mode}, @var{TX Passband}. Get @var{TX Mode}, @var{TX Passband}.
Returns TX mode as a string from @command{set_split_mode} above and TX Returns TX mode as a string from @command{set_split_mode} above and TX
passband in Hz. passband in Hz.
See also @command{get_split_freq_mode} below.
@ifhtml
@*
@end ifhtml
@item K, set_split_freq_mode @var{Tx Frequency}, @var{TX Mode}, @var{TX Passband}
Set @var{TX Frequency}, in Hertz for ``split'' frequency operation.
Set @var{TX Mode} to one of: @code{AM}, @code{FM}, @code{CW},
@code{CWR}, @code{USB}, @code{LSB}, @code{RTTY}, @code{RTTYR},
@code{WFM}, @code{AMS}, @code{PKTLSB}, @code{PKTUSB}, @code{PKTFM},
@code{ECSSUSB}, @code{ECSSLSB}, @code{FAX}, @code{SAM}, @code{SAL},
@code{SAH}, @code{DSB}.
The @var{TX Passband} is the exact passband frequency in Hertz, or
@code{0} for the Hamlib backend default. A value of @code{-1} may be
passed which leaves the rig passband unchanged from the current or
default value for the mode as defined by the rig.
This is a convenience function that combines the effect of
@command{set_split_freq} and @command{set_split_mode}. It should be
used when both are required since it allows the back end to optimize
the operations. For example on many Icom rigs the current VFO must be
changed temporarily while executing these commands and that can
disrupt receive or transmit, using this function may minimize that
disruption.
See also @command{set_split_freq} and @command{set_split_mode} above.
@ifhtml
@*
@end ifhtml
@item k, get_split_freq_mode
Get @var{TX Frequency}, in Hertz for ``split'' frequency operation
along with The @var{TX Mode} as a string from @command{set_split_mode}
above and @var{TX Passband} in Hz.
This is a convenience function that combines the effect of
@command{get_split_freq} and @command{get_split_mode}. It should be
used when both are required since it allows the back end to optimize
the operations. For example on many Icom rigs the current VFO must be
changed temporarily while executing these commands and that can
disrupt receive or transmit, using this function may minimize that
disruption.
See also @command{get_split_freq} and @command{get_split_mode} above.
@ifhtml
@*
@end ifhtml
@item S, set_split_vfo @var{Split}, @var{TX VFO} @item S, set_split_vfo @var{Split}, @var{TX VFO}
Set @var{Split} mode, @code{0} (off) or @code{1} (on), and @var{TX VFO} Set @var{Split} mode, @code{0} (off) or @code{1} (on), and @var{TX VFO}
from @command{set_vfo} above. from @command{set_vfo} above.
@ -2104,12 +2166,16 @@ Get @var{DCS Sql} code.
@item I, set_split_freq @var{Tx Frequency} @item I, set_split_freq @var{Tx Frequency}
Set @var{TX Frequency}, in Hertz for ``split'' frequency operation. Set @var{TX Frequency}, in Hertz for ``split'' frequency operation.
See also @command{set_split_freq_mode} below.
@ifhtml @ifhtml
@* @*
@end ifhtml @end ifhtml
@item i, get_split_freq @item i, get_split_freq
Get @var{TX Frequency}, in Hertz for ``split'' frequency operation. Get @var{TX Frequency}, in Hertz for ``split'' frequency operation.
See also @command{get_split_freq_mode} below.
@ifhtml @ifhtml
@* @*
@end ifhtml @end ifhtml
@ -2122,19 +2188,75 @@ Set @var{TX Mode} to one of: @code{AM}, @code{FM}, @code{CW},
@code{SAH}, @code{DSB}. @code{SAH}, @code{DSB}.
The @var{TX Passband} is the exact passband frequency in Hertz, or The @var{TX Passband} is the exact passband frequency in Hertz, or
@code{0} for the Hamlib backend default. @code{0} for the Hamlib backend default. A value of @code{-1} may be
passed which leaves the rig passband unchanged from the current or
default value for the mode as defined by the rig.
@strong{N.B.} Passing a @kbd{?} (query) as the first argument instead @strong{N.B.} Passing a @kbd{?} (query) as the first argument instead
of @var{TX Mode} will return a space separated list of radio backend of @var{TX Mode} will return a space separated list of radio backend
supported TX Modes. Use this to determine the supported TX Modes of a supported TX Modes. Use this to determine the supported TX Modes of a
given radio backend. given radio backend.
See also @command{set_split_freq_mode} below.
@ifhtml
@*
@end ifhtml
@item x, get_split_mode @item x, get_split_mode
Get @var{TX Mode}, @var{TX Passband}. Get @var{TX Mode}, @var{TX Passband}.
Returns TX mode as a string from @command{set_split_mode} above and TX Returns TX mode as a string from @command{set_split_mode} above and TX
passband in Hz. passband in Hz.
See also @command{get_split_freq_mode} below.
@ifhtml
@*
@end ifhtml
@item K, set_split_freq_mode @var{Tx Frequency}, @var{TX Mode}, @var{TX Passband}
Set @var{TX Frequency}, in Hertz for ``split'' frequency operation.
Set @var{TX Mode} to one of: @code{AM}, @code{FM}, @code{CW},
@code{CWR}, @code{USB}, @code{LSB}, @code{RTTY}, @code{RTTYR},
@code{WFM}, @code{AMS}, @code{PKTLSB}, @code{PKTUSB}, @code{PKTFM},
@code{ECSSUSB}, @code{ECSSLSB}, @code{FAX}, @code{SAM}, @code{SAL},
@code{SAH}, @code{DSB}.
The @var{TX Passband} is the exact passband frequency in Hertz, or
@code{0} for the Hamlib backend default. A value of @code{-1} may be
passed which leaves the rig passband unchanged from the current or
default value for the mode as defined by the rig.
This is a convenience function that combines the effect of
@command{set_split_freq} and @command{set_split_mode}. It should be
used when both are required since it allows the back end to optimize
the operations. For example on many Icom rigs the current VFO must be
changed temporarily while executing these commands and that can
disrupt receive or transmit, using this function may minimize that
disruption.
See also @command{set_split_freq} and @command{set_split_mode} above.
@ifhtml
@*
@end ifhtml
@item k, get_split_freq_mode
Get @var{TX Frequency}, in Hertz for ``split'' frequency operation
along with the @var{TX Mode} as a string from @command{set_split_mode}
above and @var{TX Passband} in Hz.
This is a convenience function that combines the effect of
@command{get_split_freq} and @command{get_split_mode}. It should be
used when both are required since it allows the back end to optimize
the operations. For example on many Icom rigs the current VFO must be
changed temporarily while executing these commands and that can
disrupt receive or transmit, using this function may minimize that
disruption.
See also @command{get_split_freq} and @command{get_split_mode} above.
@ifhtml
@*
@end ifhtml
@item S, set_split_vfo @var{Split}, @var{TX VFO} @item S, set_split_vfo @var{Split}, @var{TX VFO}
Set @var{Split} mode, @code{0} (off) or @code{1} (on), and @var{TX VFO} Set @var{Split} mode, @code{0} (off) or @code{1} (on), and @var{TX VFO}
from @command{set_vfo} above. from @command{set_vfo} above.

Wyświetl plik

@ -290,31 +290,32 @@ int drake_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
if (retval != RIG_OK) if (retval != RIG_OK)
return retval; return retval;
if (width != RIG_PASSBAND_NOCHANGE) {
if (mode != RIG_MODE_FM) { if (mode != RIG_MODE_FM) {
if (width == RIG_PASSBAND_NORMAL) if (width == RIG_PASSBAND_NORMAL)
width = rig_passband_normal(rig, mode); width = rig_passband_normal(rig, mode);
switch (width) { if (width <= 500) {
case 500: width_sel = '0'; break; width_sel = '0';
}
case 1800: width_sel = '1'; break; else if (width <= 1800) {
width_sel = '1';
case 2300: width_sel = '2'; break; }
else if (width <= 2300) {
case 4000: width_sel = '4'; break; width_sel = '2';
}
case 6000: width_sel = '6'; break; else if (width <= 4000) {
width_sel = '4';
default: }
rig_debug(RIG_DEBUG_ERR, "drake_set_mode: " else {
"unsupported width %d\n", width); width_sel = '6';
return -RIG_EINVAL;
} }
mdbuf_len = sprintf((char *) mdbuf, "W%c" EOM, width_sel); mdbuf_len = sprintf((char *) mdbuf, "W%c" EOM, width_sel);
retval = drake_transaction(rig, (char *) mdbuf, mdbuf_len, (char *) ackbuf, &ack_len); retval = drake_transaction(rig, (char *) mdbuf, mdbuf_len, (char *) ackbuf, &ack_len);
} }
}
if ((mode == RIG_MODE_AMS) || (mode == RIG_MODE_ECSSUSB) || (mode == RIG_MODE_ECSSLSB) || if ((mode == RIG_MODE_AMS) || (mode == RIG_MODE_ECSSUSB) || (mode == RIG_MODE_ECSSLSB) ||
(mode == RIG_MODE_AM) || (mode == RIG_MODE_USB) || (mode == RIG_MODE_LSB)) { (mode == RIG_MODE_AM) || (mode == RIG_MODE_USB) || (mode == RIG_MODE_LSB)) {

Wyświetl plik

@ -338,6 +338,8 @@ static int dummy_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
curr->mode = mode; curr->mode = mode;
if (RIG_PASSBAND_NOCHANGE == width) return RIG_OK;
if (width == RIG_PASSBAND_NORMAL) if (width == RIG_PASSBAND_NORMAL)
curr->width = rig_passband_normal(rig, mode); curr->width = rig_passband_normal(rig, mode);
else else
@ -626,6 +628,8 @@ static int dummy_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t
rig_strvfo(vfo), rig_strrmode(tx_mode), buf); rig_strvfo(vfo), rig_strrmode(tx_mode), buf);
curr->tx_mode = tx_mode; curr->tx_mode = tx_mode;
if (RIG_PASSBAND_NOCHANGE == tx_width) return RIG_OK;
curr->tx_width = tx_width; curr->tx_width = tx_width;
return RIG_OK; return RIG_OK;

Wyświetl plik

@ -662,6 +662,16 @@ int dttsp_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
int ret = RIG_OK; int ret = RIG_OK;
int filter_l, filter_h; int filter_l, filter_h;
/* DttSP set mode */
buf_len = sprintf (buf, "setMode %d\n", rmode2dttsp(mode) );
ret = send_command (rig, buf, buf_len);
rig_debug(RIG_DEBUG_VERBOSE,"%s: %s\n",
__FUNCTION__, buf);
if (ret != RIG_OK || RIG_PASSBAND_NOCHANGE == width) return ret;
if (width == RIG_PASSBAND_NORMAL) if (width == RIG_PASSBAND_NORMAL)
width = rig_passband_normal(rig, mode); width = rig_passband_normal(rig, mode);
sprintf_freq(buf, width); sprintf_freq(buf, width);
@ -692,11 +702,6 @@ int dttsp_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
return -RIG_EINVAL; return -RIG_EINVAL;
} }
/* DttSP set mode */
buf_len = sprintf (buf, "setMode %d\n", rmode2dttsp(mode) );
ret = send_command (rig, buf, buf_len);
buf_len = sprintf (buf, "setFilter %d %d\n", filter_l, filter_h ); buf_len = sprintf (buf, "setFilter %d %d\n", filter_l, filter_h );
ret = send_command (rig, buf, buf_len); ret = send_command (rig, buf, buf_len);

Wyświetl plik

@ -582,7 +582,8 @@ int gr_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
rig_debug(RIG_DEBUG_VERBOSE,"%s called: %s %s %s\n", rig_debug(RIG_DEBUG_VERBOSE,"%s called: %s %s %s\n",
__FUNCTION__, rig_strvfo(vfo), rig_strrmode(mode), buf); __FUNCTION__, rig_strvfo(vfo), rig_strrmode(mode), buf);
if (mode == chan->mode && width == chan->width) if (mode == chan->mode
&& (RIG_PASSBAND_NOCHANGE == width || width == chan->width))
return RIG_OK; return RIG_OK;
@ -605,7 +606,8 @@ int gr_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
pthread_mutex_lock(&priv->mutex_process); pthread_mutex_lock(&priv->mutex_process);
/* Same mode, but different width */ /* Same mode, but different width */
if (mode != RIG_MODE_NONE && mode == chan->mode) { if (width != RIG_PASSBAND_NOCHANGE
&& mode != RIG_MODE_NONE && mode == chan->mode) {
mod->setWidth(width); mod->setWidth(width);
chan->width = width; chan->width = width;
pthread_mutex_unlock(&priv->mutex_process); pthread_mutex_unlock(&priv->mutex_process);
@ -627,13 +629,15 @@ int gr_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
if (mode == RIG_MODE_NONE) { if (mode == RIG_MODE_NONE) {
/* ez */ /* ez */
chan->mode = mode; chan->mode = mode;
chan->width = width; if (width != RIG_PASSBAND_NOCHANGE) chan->width = width;
pthread_mutex_unlock(&priv->mutex_process); pthread_mutex_unlock(&priv->mutex_process);
return RIG_OK; return RIG_OK;
} }
float rf_gain = chan->levels[rig_setting2idx(RIG_LEVEL_RF)].f; float rf_gain = chan->levels[rig_setting2idx(RIG_LEVEL_RF)].f;
if (RIG_PASSBAND_NOCHANGE == width) width = chan->width;
switch(mode) { switch(mode) {
case RIG_MODE_LSB: case RIG_MODE_LSB:
mod = new LSBDemodChainCF(priv->source, priv->sink, mode, width, priv->input_rate, (freq_t)freq_offset); mod = new LSBDemodChainCF(priv->source, priv->sink, mode, width, priv->input_rate, (freq_t)freq_offset);

Wyświetl plik

@ -338,6 +338,7 @@ int rig2icom_mode(RIG *rig, rmode_t mode, pbwidth_t width,
return -RIG_EINVAL; return -RIG_EINVAL;
} }
if (width != RIG_PASSBAND_NOCHANGE) {
medium_width = rig_passband_normal(rig, mode); medium_width = rig_passband_normal(rig, mode);
if (width == medium_width || width == RIG_PASSBAND_NORMAL) if (width == medium_width || width == RIG_PASSBAND_NORMAL)
icmode_ext = -1; /* medium, no passband data-> rig default. Is medium always the default? */ icmode_ext = -1; /* medium, no passband data-> rig default. Is medium always the default? */
@ -354,6 +355,7 @@ int rig2icom_mode(RIG *rig, rmode_t mode, pbwidth_t width,
icmode_ext = PD_WIDE_3; /* default to Wide */ icmode_ext = PD_WIDE_3; /* default to Wide */
} }
} }
}
*md = icmode; *md = icmode;
*pd = icmode_ext; *pd = icmode_ext;

Wyświetl plik

@ -48,10 +48,12 @@ static int ic706_r2i_mode(RIG *rig, rmode_t mode, pbwidth_t width,
if (err != RIG_OK) if (err != RIG_OK)
return err; return err;
if (width != RIG_PASSBAND_NOCHANGE) {
if (*pd == -1) if (*pd == -1)
*pd = PD_MEDIUM_2; *pd = PD_MEDIUM_2;
else else
(*pd)--; (*pd)--;
}
return RIG_OK; return RIG_OK;
} }

Wyświetl plik

@ -585,7 +585,6 @@ pbwidth_t icom_get_dsp_flt(RIG *rig, rmode_t mode) {
} }
int icom_set_dsp_flt(RIG *rig, rmode_t mode, pbwidth_t width) { int icom_set_dsp_flt(RIG *rig, rmode_t mode, pbwidth_t width) {
int retval, rfstatus, i; int retval, rfstatus, i;
unsigned char ackbuf[MAXFRAMELEN]; unsigned char ackbuf[MAXFRAMELEN];
unsigned char flt_ext; unsigned char flt_ext;
@ -593,6 +592,7 @@ int icom_set_dsp_flt(RIG *rig, rmode_t mode, pbwidth_t width) {
int ack_len=sizeof(ackbuf), flt_idx; int ack_len=sizeof(ackbuf), flt_idx;
unsigned char fw_sub_cmd = RIG_MODEL_IC7200 == rig->caps->rig_model ? 0x02 : S_MEM_FILT_WDTH; unsigned char fw_sub_cmd = RIG_MODEL_IC7200 == rig->caps->rig_model ? 0x02 : S_MEM_FILT_WDTH;
if (RIG_PASSBAND_NOCHANGE == width) return RIG_OK;
if (width == RIG_PASSBAND_NORMAL) if (width == RIG_PASSBAND_NORMAL)
width = rig_passband_normal(rig, mode); width = rig_passband_normal(rig, mode);
@ -1715,7 +1715,7 @@ int icom_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
split for certainty */ split for certainty */
if (RIG_OK != (rc = icom_transaction (rig, C_CTL_SPLT, S_SPLT_OFF, NULL, 0, ackbuf, &ack_len))) return rc; if (RIG_OK != (rc = icom_transaction (rig, C_CTL_SPLT, S_SPLT_OFF, NULL, 0, ackbuf, &ack_len))) return rc;
if (ack_len != 1 || ackbuf[0] != ACK) { if (ack_len != 1 || ackbuf[0] != ACK) {
rig_debug(RIG_DEBUG_ERR,"icom_set_split_freq_mode: ack NG (%#.2x), " rig_debug(RIG_DEBUG_ERR,"icom_set_split_freq: ack NG (%#.2x), "
"len=%d\n", ackbuf[0],ack_len); "len=%d\n", ackbuf[0],ack_len);
return -RIG_ERJCTED; return -RIG_ERJCTED;
} }
@ -1767,7 +1767,7 @@ int icom_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq)
split for certainty */ split for certainty */
if (RIG_OK != (rc = icom_transaction (rig, C_CTL_SPLT, S_SPLT_OFF, NULL, 0, ackbuf, &ack_len))) return rc; if (RIG_OK != (rc = icom_transaction (rig, C_CTL_SPLT, S_SPLT_OFF, NULL, 0, ackbuf, &ack_len))) return rc;
if (ack_len != 1 || ackbuf[0] != ACK) { if (ack_len != 1 || ackbuf[0] != ACK) {
rig_debug(RIG_DEBUG_ERR,"icom_set_split_freq_mode: ack NG (%#.2x), " rig_debug(RIG_DEBUG_ERR,"icom_get_split_freq: ack NG (%#.2x), "
"len=%d\n", ackbuf[0],ack_len); "len=%d\n", ackbuf[0],ack_len);
return -RIG_ERJCTED; return -RIG_ERJCTED;
} }
@ -1819,7 +1819,7 @@ int icom_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width
split for certainty */ split for certainty */
if (RIG_OK != (rc = icom_transaction (rig, C_CTL_SPLT, S_SPLT_OFF, NULL, 0, ackbuf, &ack_len))) return rc; if (RIG_OK != (rc = icom_transaction (rig, C_CTL_SPLT, S_SPLT_OFF, NULL, 0, ackbuf, &ack_len))) return rc;
if (ack_len != 1 || ackbuf[0] != ACK) { if (ack_len != 1 || ackbuf[0] != ACK) {
rig_debug(RIG_DEBUG_ERR,"icom_set_split_freq_mode: ack NG (%#.2x), " rig_debug(RIG_DEBUG_ERR,"icom_set_split_mode: ack NG (%#.2x), "
"len=%d\n", ackbuf[0],ack_len); "len=%d\n", ackbuf[0],ack_len);
return -RIG_ERJCTED; return -RIG_ERJCTED;
} }
@ -1872,7 +1872,7 @@ int icom_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode, pbwidth_t *tx_wid
split for certainty */ split for certainty */
if (RIG_OK != (rc = icom_transaction (rig, C_CTL_SPLT, S_SPLT_OFF, NULL, 0, ackbuf, &ack_len))) return rc; if (RIG_OK != (rc = icom_transaction (rig, C_CTL_SPLT, S_SPLT_OFF, NULL, 0, ackbuf, &ack_len))) return rc;
if (ack_len != 1 || ackbuf[0] != ACK) { if (ack_len != 1 || ackbuf[0] != ACK) {
rig_debug(RIG_DEBUG_ERR,"icom_set_split_freq_mode: ack NG (%#.2x), " rig_debug(RIG_DEBUG_ERR,"icom_get_split_mode: ack NG (%#.2x), "
"len=%d\n", ackbuf[0],ack_len); "len=%d\n", ackbuf[0],ack_len);
return -RIG_ERJCTED; return -RIG_ERJCTED;
} }
@ -1976,7 +1976,7 @@ int icom_get_split_freq_mode(RIG *rig, vfo_t vfo, freq_t *tx_freq, rmode_t *tx_m
split for certainty */ split for certainty */
if (RIG_OK != (rc = icom_transaction (rig, C_CTL_SPLT, S_SPLT_OFF, NULL, 0, ackbuf, &ack_len))) return rc; if (RIG_OK != (rc = icom_transaction (rig, C_CTL_SPLT, S_SPLT_OFF, NULL, 0, ackbuf, &ack_len))) return rc;
if (ack_len != 1 || ackbuf[0] != ACK) { if (ack_len != 1 || ackbuf[0] != ACK) {
rig_debug(RIG_DEBUG_ERR,"icom_set_split_freq_mode: ack NG (%#.2x), " rig_debug(RIG_DEBUG_ERR,"icom_get_split_freq_mode: ack NG (%#.2x), "
"len=%d\n", ackbuf[0],ack_len); "len=%d\n", ackbuf[0],ack_len);
return -RIG_ERJCTED; return -RIG_ERJCTED;
} }

Wyświetl plik

@ -367,6 +367,7 @@ typedef int vfo_t;
#define RIG_PASSBAND_NORMAL s_Hz(0) #define RIG_PASSBAND_NORMAL s_Hz(0)
#define RIG_PASSBAND_NOCHANGE s_Hz(-1)
/** /**
* \brief Passband width, in Hz * \brief Passband width, in Hz
* \sa rig_passband_normal, rig_passband_narrow, rig_passband_wide * \sa rig_passband_normal, rig_passband_narrow, rig_passband_wide

Wyświetl plik

@ -175,6 +175,11 @@ static int rig2jrc_mode(RIG *rig, rmode_t mode, pbwidth_t width,
return -RIG_EINVAL; return -RIG_EINVAL;
} }
if (RIG_PASSBAND_NOCHANGE == width) {
*jwidth = '1';
return RIG_OK;
}
if (width == RIG_PASSBAND_NORMAL) if (width == RIG_PASSBAND_NORMAL)
width = rig_passband_normal(rig, mode); width = rig_passband_normal(rig, mode);
@ -329,10 +334,12 @@ int jrc_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
if (retval != RIG_OK) if (retval != RIG_OK)
return retval; return retval;
if (width != RIG_PASSBAND_NOCHANGE) {
mdbuf_len = sprintf(mdbuf, "B" "%c" EOM, awidth); mdbuf_len = sprintf(mdbuf, "B" "%c" EOM, awidth);
retval = jrc_transaction (rig, mdbuf, mdbuf_len, NULL, NULL); retval = jrc_transaction (rig, mdbuf, mdbuf_len, NULL, NULL);
if (retval != RIG_OK) if (retval != RIG_OK)
return retval; return retval;
}
return RIG_OK; return RIG_OK;
} }
@ -1158,13 +1165,21 @@ int jrc_set_chan(RIG *rig, const channel_t *chan)
char cmdbuf[BUFSZ]; char cmdbuf[BUFSZ];
int retval, cmd_len; int retval, cmd_len;
/* read first to get current values */
channel_t current;
current.channel_num = chan->channel_num;
if ((retval = jrc_get_chan (rig, &current)) != RIG_OK) return retval;
sprintf(cmdbuf,"K%03d000",chan->channel_num); sprintf(cmdbuf,"K%03d000",chan->channel_num);
if (chan->levels[rig_setting2idx(RIG_LEVEL_ATT)].i == 20) if (chan->levels[rig_setting2idx(RIG_LEVEL_ATT)].i == 20)
cmdbuf[4] = '1'; cmdbuf[4] = '1';
retval = rig2jrc_mode(rig, chan->mode, chan->width, rmode_t mode = chan->mode;
&cmdbuf[6], &cmdbuf[5]); pbwidth_t width = chan->width;
if (RIG_MODE_NONE == mode) mode = current.mode;
if (RIG_PASSBAND_NOCHANGE == width) width = current.width;
retval = rig2jrc_mode(rig, mode, width, &cmdbuf[6], &cmdbuf[5]);
if (retval != RIG_OK) if (retval != RIG_OK)
return retval; return retval;

Wyświetl plik

@ -192,6 +192,8 @@ static int nrd525_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
if (retval != RIG_OK) if (retval != RIG_OK)
return retval; return retval;
if (RIG_PASSBAND_NOCHANGE == width) return retval;
// TODO: width // TODO: width
return retval; return retval;

Wyświetl plik

@ -228,14 +228,17 @@ static int flex6k_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
if (err != RIG_OK) if (err != RIG_OK)
return err; return err;
err = flex6k_find_width(mode, width, &idx);
if (err != RIG_OK)
return err;
if ((vfo == RIG_VFO_VFO) || (vfo == RIG_VFO_CURR)) { if ((vfo == RIG_VFO_VFO) || (vfo == RIG_VFO_CURR)) {
vfo = rig->state.current_vfo; vfo = rig->state.current_vfo;
rig_debug(RIG_DEBUG_VERBOSE, "%s: setting VFO to current\n", __func__); rig_debug(RIG_DEBUG_VERBOSE, "%s: setting VFO to current\n", __func__);
} }
if (RIG_PASSBAND_NOCHANGE == width) return err;
err = flex6k_find_width(mode, width, &idx);
if (err != RIG_OK)
return err;
/* /*
* The Flex CAT interface does not support FW for reading filter width, * The Flex CAT interface does not support FW for reading filter width,
* so use the ZZFI or ZZFJ command * so use the ZZFI or ZZFJ command

Wyświetl plik

@ -312,6 +312,7 @@ int k2_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
return -RIG_EINVAL; return -RIG_EINVAL;
} }
if (width != RIG_PASSBAND_NOCHANGE) {
if (width < 0) if (width < 0)
width = labs(width); width = labs(width);
@ -339,19 +340,21 @@ int k2_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
} else { } else {
return -RIG_EINVAL; return -RIG_EINVAL;
} }
}
/* Construct the filter command and set the radio mode and width*/
snprintf(fcmd, 8, "FW0000%c", f);
/* kenwood_set_mode() ignores width value for K2/K3/TS-570 */ /* kenwood_set_mode() ignores width value for K2/K3/TS-570 */
err = kenwood_set_mode(rig, vfo, mode, width); err = kenwood_set_mode(rig, vfo, mode, width);
if (err != RIG_OK) if (err != RIG_OK)
return err; return err;
if (width != RIG_PASSBAND_NOCHANGE) {
err = kenwood_transaction(rig, "K22", NULL, 0); err = kenwood_transaction(rig, "K22", NULL, 0);
if (err != RIG_OK) if (err != RIG_OK)
return err; return err;
/* Construct the filter command and set the radio mode and width*/
snprintf(fcmd, 8, "FW0000%c", f);
/* Set the filter slot */ /* Set the filter slot */
err = kenwood_transaction(rig, fcmd, NULL, 0); err = kenwood_transaction(rig, fcmd, NULL, 0);
if (err != RIG_OK) if (err != RIG_OK)
@ -360,6 +363,7 @@ int k2_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
err = kenwood_transaction(rig, "K20", NULL, 0); err = kenwood_transaction(rig, "K20", NULL, 0);
if (err != RIG_OK) if (err != RIG_OK)
return err; return err;
}
return RIG_OK; return RIG_OK;
} }

Wyświetl plik

@ -377,6 +377,7 @@ int k3_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
if (err != RIG_OK) if (err != RIG_OK)
return err; return err;
if (width != RIG_PASSBAND_NOCHANGE) {
/* and set the requested bandwidth. On my K3, the bandwidth is rounded /* and set the requested bandwidth. On my K3, the bandwidth is rounded
* down to the nearest 50 Hz, i.e. sending BW0239; will cause the bandwidth * down to the nearest 50 Hz, i.e. sending BW0239; will cause the bandwidth
* to be set to 2.350 kHz. As the width must be divided by 10, 10 Hz values * to be set to 2.350 kHz. As the width must be divided by 10, 10 Hz values
@ -405,6 +406,7 @@ int k3_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
err = kenwood_transaction(rig, cmd_s, NULL, 0); err = kenwood_transaction(rig, cmd_s, NULL, 0);
if (err != RIG_OK) if (err != RIG_OK)
return err; return err;
}
/* Now set data sub-mode. K3 needs to be in a DATA mode before setting /* Now set data sub-mode. K3 needs to be in a DATA mode before setting
* the sub-mode. * the sub-mode.
@ -639,6 +641,7 @@ int k3_set_split_mode(RIG * rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width)
if (err != RIG_OK) if (err != RIG_OK)
return err; return err;
if (tx_width != RIG_PASSBAND_NOCHANGE) {
/* and set the requested bandwidth. On my K3, the bandwidth is rounded /* and set the requested bandwidth. On my K3, the bandwidth is rounded
* down to the nearest 50 Hz, i.e. sending BW0239; will cause the bandwidth * down to the nearest 50 Hz, i.e. sending BW0239; will cause the bandwidth
* to be set to 2.350 kHz. As the width must be divided by 10, 10 Hz values * to be set to 2.350 kHz. As the width must be divided by 10, 10 Hz values
@ -667,6 +670,7 @@ int k3_set_split_mode(RIG * rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width)
err = kenwood_transaction(rig, cmd_s, NULL, 0); err = kenwood_transaction(rig, cmd_s, NULL, 0);
if (err != RIG_OK) if (err != RIG_OK)
return err; return err;
}
/* Now set data sub-mode. K3 needs to be in a DATA mode before setting /* Now set data sub-mode. K3 needs to be in a DATA mode before setting
* the sub-mode. * the sub-mode.

Wyświetl plik

@ -1437,6 +1437,7 @@ int kenwood_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
} }
} }
if (RIG_PASSBAND_NOCHANGE == width) return RIG_OK;
if (rig->caps->rig_model == RIG_MODEL_TS450S if (rig->caps->rig_model == RIG_MODEL_TS450S
|| rig->caps->rig_model == RIG_MODEL_TS690S || rig->caps->rig_model == RIG_MODEL_TS690S
|| rig->caps->rig_model == RIG_MODEL_TS850 || rig->caps->rig_model == RIG_MODEL_TS850

Wyświetl plik

@ -156,6 +156,7 @@ static int ts570_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
retval = kenwood_transaction(rig, buf, NULL, 0); retval = kenwood_transaction(rig, buf, NULL, 0);
if (retval != RIG_OK) return retval; if (retval != RIG_OK) return retval;
if (RIG_PASSBAND_NOCHANGE == width) return retval;
switch (mode) switch (mode)
{ {
case RIG_MODE_CW: case RIG_MODE_CW:

Wyświetl plik

@ -185,6 +185,7 @@ static int ts870s_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
retval = kenwood_transaction(rig, buf, NULL, 0); retval = kenwood_transaction(rig, buf, NULL, 0);
if (retval != RIG_OK) return retval; if (retval != RIG_OK) return retval;
if (RIG_PASSBAND_NOCHANGE == width) {
if (RIG_PASSBAND_NORMAL != width) /* leave well alone if default passband requested */ if (RIG_PASSBAND_NORMAL != width) /* leave well alone if default passband requested */
{ {
if (RIG_MODE_USB == mode || RIG_MODE_LSB == mode || RIG_MODE_AM == mode) if (RIG_MODE_USB == mode || RIG_MODE_LSB == mode || RIG_MODE_AM == mode)
@ -212,6 +213,7 @@ static int ts870s_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
retval = kenwood_transaction(rig, buf, NULL, 0); retval = kenwood_transaction(rig, buf, NULL, 0);
} }
} }
}
return retval; return retval;
} }

Wyświetl plik

@ -487,6 +487,7 @@ static int fifisdr_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
return -RIG_EIO; return -RIG_EIO;
} }
if (RIG_PASSBAND_NOCHANGE == width) return ret;
/* Set filter width */ /* Set filter width */
fifi_width = fifisdr_tole32(width); fifi_width = fifisdr_tole32(width);
ret = fifisdr_usb_write(rig, REQUEST_FIFISDR_WRITE, 0, ret = fifisdr_usb_write(rig, REQUEST_FIFISDR_WRITE, 0,

Wyświetl plik

@ -757,6 +757,7 @@ pcr_set_mode(RIG * rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
return -RIG_EINVAL; return -RIG_EINVAL;
} }
if (width != RIG_PASSBAND_NOCHANGE) {
if (width == RIG_PASSBAND_NORMAL) if (width == RIG_PASSBAND_NORMAL)
width = rig_passband_normal(rig, mode); width = rig_passband_normal(rig, mode);
@ -794,9 +795,14 @@ pcr_set_mode(RIG * rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
buf_len = sprintf((char *) buf, "K%c%010" PRIll "0%c0%c00", buf_len = sprintf((char *) buf, "K%c%010" PRIll "0%c0%c00",
is_sub_rcvr(rig, vfo) ? '1':'0', is_sub_rcvr(rig, vfo) ? '1':'0',
(int64_t) rcvr->last_freq, pcrmode, pcrfilter); (int64_t) rcvr->last_freq, pcrmode, pcrfilter);
}
else {
buf_len = sprintf((char *) buf, "K%c%010" PRIll "0%c0%c00",
is_sub_rcvr(rig, vfo) ? '1':'0',
(int64_t) rcvr->last_freq, pcrmode, rcvr->last_filter);
}
if (buf_len < 0) if (buf_len < 0)
return -RIG_ETRUNC; return -RIG_ETRUNC;
err = pcr_transaction(rig, (char *) buf); err = pcr_transaction(rig, (char *) buf);
if (err != RIG_OK) if (err != RIG_OK)
return err; return err;

Wyświetl plik

@ -265,10 +265,15 @@ int racal_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
return -RIG_EINVAL; return -RIG_EINVAL;
} }
if (width != RIG_PASSBAND_NOCHANGE) {
if (width == RIG_PASSBAND_NORMAL) if (width == RIG_PASSBAND_NORMAL)
width = rig_passband_normal(rig, mode); width = rig_passband_normal(rig, mode);
sprintf(buf, "D%dI%.0f", ra_mode, (double)(width/kHz(1))); sprintf(buf, "D%dI%.0f", ra_mode, (double)(width/kHz(1)));
}
else {
sprintf(buf, "D%d", ra_mode);
}
return racal_transaction (rig, buf, NULL, NULL); return racal_transaction (rig, buf, NULL, NULL);
} }

Wyświetl plik

@ -138,7 +138,10 @@ int rs_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
len = sprintf(buf, BOM "DEM %s" EOM, smode); len = sprintf(buf, BOM "DEM %s" EOM, smode);
retval = rs_transaction(rig, buf, len, NULL, NULL); retval = rs_transaction(rig, buf, len, NULL, NULL);
if (retval < 0)
return retval;
if (width == RIG_PASSBAND_NOCHANGE) return retval;
if (width == RIG_PASSBAND_NORMAL) if (width == RIG_PASSBAND_NORMAL)
width = rig_passband_normal(rig, mode); width = rig_passband_normal(rig, mode);

Wyświetl plik

@ -176,6 +176,7 @@ int skanti_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
if (retval != RIG_OK) if (retval != RIG_OK)
return retval; return retval;
if (RIG_PASSBAND_NOCHANGE == width) return retval;
/* /*
* TODO: please sk8000 owners, check this, I'm not sure * TODO: please sk8000 owners, check this, I'm not sure
* which passband is default! * which passband is default!

Wyświetl plik

@ -299,6 +299,7 @@ int cu_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
if (ret != RIG_OK) if (ret != RIG_OK)
return ret; return ret;
if (RIG_PASSBAND_NOCHANGE == width) return ret;
if (width == RIG_PASSBAND_NORMAL) if (width == RIG_PASSBAND_NORMAL)
width = rig_passband_normal(rig, mode); width = rig_passband_normal(rig, mode);

Wyświetl plik

@ -925,8 +925,11 @@ int HAMLIB_API rig_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
* \param mode The mode to set to * \param mode The mode to set to
* \param width The passband width to set to * \param width The passband width to set to
* *
* Sets the mode and associated passband of the target VFO. * Sets the mode and associated passband of the target VFO. The
* The passband \a width must be supported by the backend of the rig. * passband \a width must be supported by the backend of the rig or
* the special value RIG_PASSBAND_NOCHANGE which leaves the passband
* unchanged from the current value or default for the mode determined
* by the rig.
* *
* \return RIG_OK if the operation has been sucessful, otherwise * \return RIG_OK if the operation has been sucessful, otherwise
* a negative value if an error occured (in which case, cause is * a negative value if an error occured (in which case, cause is
@ -1838,7 +1841,10 @@ int HAMLIB_API rig_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq)
* \param rig The rig handle * \param rig The rig handle
* \param vfo The target VFO * \param vfo The target VFO
* \param tx_mode The transmit split mode to set to * \param tx_mode The transmit split mode to set to
* \param tx_width The transmit split width to set to * \param tx_width The transmit split width to set to or the special
* value RIG_PASSBAND_NOCHANGE which leaves the passband unchanged
* from the current value or default for the mode determined by the
* rig.
* *
* Sets the split(TX) mode. * Sets the split(TX) mode.
* *
@ -1998,7 +2004,10 @@ int HAMLIB_API rig_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode, pbwidth
* \param vfo The target VFO * \param vfo The target VFO
* \param tx_freq The transmit frequency to set to * \param tx_freq The transmit frequency to set to
* \param tx_mode The transmit split mode to set to * \param tx_mode The transmit split mode to set to
* \param tx_width The transmit split width to set to * \param tx_width The transmit split width to set to or the special
* value RIG_PASSBAND_NOCHANGE which leaves the passband unchanged
* from the current value or default for the mode determined by the
* rig.
* *
* Sets the split(TX) frequency and mode. * Sets the split(TX) frequency and mode.
* *

Wyświetl plik

@ -607,14 +607,15 @@ int tt538_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
if (retval != RIG_OK) if (retval != RIG_OK)
return retval; return retval;
if (RIG_PASSBAND_NOCHANGE == width) return retval;
if (RIG_PASSBAND_NORMAL == width)
width = rig_passband_normal (rig, mode);
/* Set rx filter bandwidth. */ /* Set rx filter bandwidth. */
if (width != RIG_PASSBAND_NORMAL) /* leave untouched if normal */
{
width = tt538_filter_number((int) width); width = tt538_filter_number((int) width);
cmd_len = sprintf((char *) cmdbuf, "*W%c" EOM, (unsigned char) width); cmd_len = sprintf((char *) cmdbuf, "*W%c" EOM, (unsigned char) width);
return tt538_transaction (rig, (char *) cmdbuf, cmd_len, NULL, NULL); return tt538_transaction (rig, (char *) cmdbuf, cmd_len, NULL, NULL);
}
return RIG_OK; return RIG_OK;
} }

Wyświetl plik

@ -699,12 +699,10 @@ int tt588_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
return retval; return retval;
/* Set rx filter bandwidth. */ /* Set rx filter bandwidth. */
if (RIG_PASSBAND_NOCHANGE == width) return retval;
if (width == RIG_PASSBAND_NORMAL) if (RIG_PASSBAND_NORMAL == width)
width = tt588_filter_number(rig_passband_normal(rig, mode)); width = rig_passband_normal (rig, mode);
else
width = tt588_filter_number((int) width); width = tt588_filter_number((int) width);
cmd_len = sprintf((char *) cmdbuf, "*W%c" EOM, (unsigned char) width); cmd_len = sprintf((char *) cmdbuf, "*W%c" EOM, (unsigned char) width);
return tt588_transaction (rig, (char *) cmdbuf, cmd_len, NULL, NULL); return tt588_transaction (rig, (char *) cmdbuf, cmd_len, NULL, NULL);
} }

Wyświetl plik

@ -424,9 +424,6 @@ int tt585_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
const char *mcmd, *wcmd; const char *mcmd, *wcmd;
int ret; int ret;
if (width == RIG_PASSBAND_NORMAL)
width = rig_passband_normal(rig, mode);
switch(mode) { switch(mode) {
case RIG_MODE_LSB: mcmd = "N"; break; case RIG_MODE_LSB: mcmd = "N"; break;
case RIG_MODE_USB: mcmd = "O"; break; case RIG_MODE_USB: mcmd = "O"; break;
@ -444,6 +441,9 @@ int tt585_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
if (ret < 0) if (ret < 0)
return ret; return ret;
if (RIG_PASSBAND_NOCHANGE == width) return ret;
if (RIG_PASSBAND_NORMAL == width)
width = rig_passband_normal (rig, mode);
if (width <= 250) if (width <= 250)
wcmd = "V"; wcmd = "V";
else if (width <= 500) else if (width <= 500)

Wyświetl plik

@ -433,6 +433,7 @@ int rx331_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
return -RIG_EINVAL; return -RIG_EINVAL;
} }
if (width != RIG_PASSBAND_NOCHANGE) {
if (width == RIG_PASSBAND_NORMAL) if (width == RIG_PASSBAND_NORMAL)
width = rig_passband_normal(rig, mode); width = rig_passband_normal(rig, mode);
@ -441,7 +442,13 @@ int rx331_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
*/ */
mdbuf_len = num_sprintf(mdbuf, "$%iD%cI%.02f" EOM, priv->receiver_id, mdbuf_len = num_sprintf(mdbuf, "$%iD%cI%.02f" EOM, priv->receiver_id,
dmode, (float)width/1e3); dmode, (float)width/1e3);
}
else {
/*
* Set DETECTION MODE
*/
mdbuf_len = num_sprintf(mdbuf, "$%iD%c" EOM, priv->receiver_id, dmode);
}
retval = write_block(&rs->rigport, mdbuf, mdbuf_len); retval = write_block(&rs->rigport, mdbuf, mdbuf_len);
return retval; return retval;

Wyświetl plik

@ -345,6 +345,7 @@ int rx340_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
return -RIG_EINVAL; return -RIG_EINVAL;
} }
if (width != RIG_PASSBAND_NOCHANGE) {
if (width == RIG_PASSBAND_NORMAL) if (width == RIG_PASSBAND_NORMAL)
width = rig_passband_normal(rig, mode); width = rig_passband_normal(rig, mode);
@ -353,7 +354,13 @@ int rx340_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
*/ */
mdbuf_len = num_sprintf(mdbuf, "D%cI%.02f" EOM, mdbuf_len = num_sprintf(mdbuf, "D%cI%.02f" EOM,
dmode, (float)width/1e3); dmode, (float)width/1e3);
}
else {
/*
* Set DETECTION MODE
*/
mdbuf_len = num_sprintf(mdbuf, "D%c" EOM, dmode);
}
retval = write_block(&rs->rigport, mdbuf, mdbuf_len); retval = write_block(&rs->rigport, mdbuf, mdbuf_len);
return retval; return retval;

Wyświetl plik

@ -272,6 +272,13 @@ int tentec_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
return -RIG_EINVAL; return -RIG_EINVAL;
} }
/* backup current values
* in case we fail to write to port
*/
saved_mode = priv->mode;
saved_width = priv->width;
if (width != RIG_PASSBAND_NOCHANGE) {
if (width == RIG_PASSBAND_NORMAL) if (width == RIG_PASSBAND_NORMAL)
width = rig_passband_normal(rig, mode); width = rig_passband_normal(rig, mode);
@ -285,18 +292,14 @@ int tentec_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
width); width);
return -RIG_EINVAL; return -RIG_EINVAL;
} }
priv->width = width;
/* backup current values }
* in case we fail to write to port
*/
saved_mode = priv->mode;
saved_width = priv->width;
priv->mode = mode; priv->mode = mode;
priv->width = width;
tentec_tuning_factor_calc(rig); tentec_tuning_factor_calc(rig);
if (width != RIG_PASSBAND_NOCHANGE) {
mdbuf_len = sprintf(mdbuf, "W%c" EOM mdbuf_len = sprintf(mdbuf, "W%c" EOM
"N%c%c%c%c%c%c" EOM "N%c%c%c%c%c%c" EOM
"M%c" EOM, "M%c" EOM,
@ -311,6 +314,21 @@ int tentec_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
priv->width = saved_width; priv->width = saved_width;
return retval; return retval;
} }
}
else {
mdbuf_len = sprintf(mdbuf,
"N%c%c%c%c%c%c" EOM
"M%c" EOM,
priv->ctf >> 8, priv->ctf & 0xff,
priv->ftf >> 8, priv->ftf & 0xff,
priv->btf >> 8, priv->btf & 0xff,
ttmode);
retval = write_block(&rs->rigport, mdbuf, mdbuf_len);
if (retval != RIG_OK) {
priv->mode = saved_mode;
return retval;
}
}
return RIG_OK; return RIG_OK;
} }

Wyświetl plik

@ -363,8 +363,9 @@ int tentec2_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
if (ret_len != 2 || mdbuf[0] != 'G') if (ret_len != 2 || mdbuf[0] != 'G')
return -RIG_ERJCTED; return -RIG_ERJCTED;
if (RIG_PASSBAND_NORMAL == width) /* with NORMAL we leave width alone */ if (RIG_PASSBAND_NOCHANGE == width) return retval;
return RIG_OK; if (RIG_PASSBAND_NORMAL == width)
width = rig_passband_normal (rig, mode);
/* /*
* Filter 0: 200 * Filter 0: 200

Wyświetl plik

@ -705,7 +705,13 @@ tt550_set_rx_mode (RIG * rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
return -RIG_EINVAL; return -RIG_EINVAL;
} }
/*
* backup current values in case we fail to write to port
*/
saved_mode = priv->rx_mode;
saved_width = priv->width;
if (width != RIG_PASSBAND_NOCHANGE) {
if (width == RIG_PASSBAND_NORMAL) if (width == RIG_PASSBAND_NORMAL)
width = rig_passband_normal (rig, mode); width = rig_passband_normal (rig, mode);
@ -721,35 +727,35 @@ tt550_set_rx_mode (RIG * rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
return -RIG_EINVAL; return -RIG_EINVAL;
} }
priv->width = width;
/* }
* backup current values in case we fail to write to port
*/
saved_mode = priv->rx_mode;
saved_width = priv->width;
priv->rx_mode = mode; priv->rx_mode = mode;
priv->width = width;
tt550_tuning_factor_calc (rig, RECEIVE); tt550_tuning_factor_calc (rig, RECEIVE);
mdbuf_len = sprintf (mdbuf, "M%c%c" EOM, ttmode, ttmode); mdbuf_len = sprintf (mdbuf, "M%c%c" EOM, ttmode, ttmode);
retval = write_block (&rs->rigport, mdbuf, mdbuf_len); retval = write_block (&rs->rigport, mdbuf, mdbuf_len);
if (retval != RIG_OK)
{
priv->rx_mode = saved_mode;
priv->width = saved_width;
return retval;
}
if (width != RIG_PASSBAND_NOCHANGE) {
mdbuf_len = sprintf (mdbuf, "W%c" EOM mdbuf_len = sprintf (mdbuf, "W%c" EOM
"N%c%c%c%c%c%c" EOM, "N%c%c%c%c%c%c" EOM,
ttfilter, ttfilter,
priv->ctf >> 8, priv->ctf & 0xff, priv->ftf >> 8, priv->ctf >> 8, priv->ctf & 0xff, priv->ftf >> 8,
priv->ftf & 0xff, priv->btf >> 8, priv->btf & 0xff); priv->ftf & 0xff, priv->btf >> 8, priv->btf & 0xff);
retval = write_block (&rs->rigport, mdbuf, mdbuf_len); retval = write_block (&rs->rigport, mdbuf, mdbuf_len);
if (retval != RIG_OK) if (retval != RIG_OK)
{ {
priv->rx_mode = saved_mode;
priv->width = saved_width; priv->width = saved_width;
return retval; return retval;
} }
}
return RIG_OK; return RIG_OK;
} }
@ -796,6 +802,13 @@ tt550_set_tx_mode (RIG * rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
return -RIG_EINVAL; return -RIG_EINVAL;
} }
/*
* backup current values in case we fail to write to port
*/
saved_mode = priv->tx_mode;
saved_width = priv->tx_width;
if (width != RIG_PASSBAND_NOCHANGE) {
/* /*
* Limit the transmitter bandwidth - it's not the same as the receiver * Limit the transmitter bandwidth - it's not the same as the receiver
*/ */
@ -829,35 +842,35 @@ tt550_set_tx_mode (RIG * rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
*/ */
ttfilter += 7; ttfilter += 7;
priv->tx_width = width;
/* }
* backup current values in case we fail to write to port
*/
saved_mode = priv->tx_mode;
saved_width = priv->tx_width;
priv->tx_mode = mode; priv->tx_mode = mode;
priv->tx_width = width;
tt550_tuning_factor_calc (rig, TRANSMIT); tt550_tuning_factor_calc (rig, TRANSMIT);
mdbuf_len = sprintf (mdbuf, "M%c%c" EOM, ttmode, ttmode); mdbuf_len = sprintf (mdbuf, "M%c%c" EOM, ttmode, ttmode);
retval = write_block (&rs->rigport, mdbuf, mdbuf_len); retval = write_block (&rs->rigport, mdbuf, mdbuf_len);
if (retval != RIG_OK)
{
priv->tx_mode = saved_mode;
priv->tx_width = saved_width;
return retval;
}
if (width != RIG_PASSBAND_NOCHANGE) {
mdbuf_len = sprintf (mdbuf, "C%c" EOM mdbuf_len = sprintf (mdbuf, "C%c" EOM
"T%c%c%c%c%c%c" EOM, "T%c%c%c%c%c%c" EOM,
ttfilter, ttfilter,
priv->ctf >> 8, priv->ctf & 0xff, priv->ftf >> 8, priv->ctf >> 8, priv->ctf & 0xff, priv->ftf >> 8,
priv->ftf & 0xff, priv->btf >> 8, priv->btf & 0xff); priv->ftf & 0xff, priv->btf >> 8, priv->btf & 0xff);
retval = write_block (&rs->rigport, mdbuf, mdbuf_len); retval = write_block (&rs->rigport, mdbuf, mdbuf_len);
if (retval != RIG_OK) if (retval != RIG_OK)
{ {
priv->tx_mode = saved_mode;
priv->tx_width = saved_width; priv->tx_width = saved_width;
return retval; return retval;
} }
}
return RIG_OK; return RIG_OK;
} }

Wyświetl plik

@ -122,7 +122,7 @@ static int wj_transaction(RIG *rig, int monitor)
default: default:
return -RIG_EINVAL; return -RIG_EINVAL;
} }
buf[5] |= (wj_width & 0x2)<<3; buf[5] |= (wj_width & 0x7)<<3;
/* Detection mode */ /* Detection mode */
switch (priv->mode) { switch (priv->mode) {
@ -137,7 +137,7 @@ static int wj_transaction(RIG *rig, int monitor)
__FUNCTION__, priv->mode); __FUNCTION__, priv->mode);
return -RIG_EINVAL; return -RIG_EINVAL;
} }
buf[5] |= wj_mode & 0x3; buf[5] |= wj_mode & 0x7;
/* BFO frequency, not sure though */ /* BFO frequency, not sure though */
wj_bfo = (priv->ifshift.i/10) + 0x400; /* LSBit is 10Hz, +455kHz */ wj_bfo = (priv->ifshift.i/10) + 0x400; /* LSBit is 10Hz, +455kHz */
@ -293,10 +293,12 @@ int wj_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
priv->mode = mode; priv->mode = mode;
if (width != RIG_PASSBAND_NOCHANGE) {
if (width == RIG_PASSBAND_NORMAL) if (width == RIG_PASSBAND_NORMAL)
width = rig_passband_normal(rig, mode); width = rig_passband_normal(rig, mode);
priv->width = width; priv->width = width;
}
return wj_transaction (rig, 0); return wj_transaction (rig, 0);
} }

Wyświetl plik

@ -416,22 +416,25 @@ int mode2rig(RIG *rig, rmode_t mode, pbwidth_t width)
case RIG_MODE_USB: md = MODE_USB; break; case RIG_MODE_USB: md = MODE_USB; break;
case RIG_MODE_LSB: md = MODE_LSB; break; case RIG_MODE_LSB: md = MODE_LSB; break;
case RIG_MODE_AM: case RIG_MODE_AM:
if (width != RIG_PASSBAND_NORMAL || if (width != RIG_PASSBAND_NOCHANGE
width < rig_passband_normal(rig, mode)) && (width != RIG_PASSBAND_NORMAL ||
width < rig_passband_normal(rig, mode)))
md = MODE_AMN; md = MODE_AMN;
else else
md = MODE_AMW; md = MODE_AMW;
break; break;
case RIG_MODE_FM: case RIG_MODE_FM:
if (width != RIG_PASSBAND_NORMAL || if (width != RIG_PASSBAND_NOCHANGE
width < rig_passband_normal(rig, mode)) && (width != RIG_PASSBAND_NORMAL ||
width < rig_passband_normal(rig, mode)))
md = MODE_FMN; md = MODE_FMN;
else else
md = MODE_FMW; md = MODE_FMW;
break; break;
case RIG_MODE_CW: case RIG_MODE_CW:
if (width != RIG_PASSBAND_NORMAL || if (width != RIG_PASSBAND_NOCHANGE
width < rig_passband_normal(rig, mode)) && (width != RIG_PASSBAND_NORMAL ||
width < rig_passband_normal(rig, mode)))
md = MODE_CWN; md = MODE_CWN;
else else
md = MODE_CWW; md = MODE_CWW;

Wyświetl plik

@ -216,8 +216,9 @@ int frg8800_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
return -RIG_EINVAL; /* sorry, wrong MODE */ return -RIG_EINVAL; /* sorry, wrong MODE */
} }
if (width != RIG_PASSBAND_NORMAL && if (width != RIG_PASSBAND_NOCHANGE
width < rig_passband_normal(rig, mode)) { && width != RIG_PASSBAND_NORMAL
&& width < rig_passband_normal(rig, mode)) {
md |= 0x08; md |= 0x08;
} }

Wyświetl plik

@ -168,8 +168,9 @@ int frg9600_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
case RIG_MODE_FM: md = MODE_SET_FMN; break; case RIG_MODE_FM: md = MODE_SET_FMN; break;
case RIG_MODE_WFM: md = MODE_SET_WFM; break; case RIG_MODE_WFM: md = MODE_SET_WFM; break;
case RIG_MODE_AM: case RIG_MODE_AM:
if (width != RIG_PASSBAND_NORMAL && if (width != RIG_PASSBAND_NOCHANGE
width < rig_passband_normal(rig, mode)) && width != RIG_PASSBAND_NORMAL
&& width < rig_passband_normal(rig, mode))
md = MODE_SET_AMN; md = MODE_SET_AMN;
else else
md = MODE_SET_AMW; md = MODE_SET_AMW;

Wyświetl plik

@ -533,6 +533,7 @@ int ft100_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) {
if (ret != RIG_OK) if (ret != RIG_OK)
return ret; return ret;
if (RIG_PASSBAND_NOCHANGE == width) return ret;
#if 1 #if 1
if (mode != RIG_MODE_FM && mode != RIG_MODE_WFM && width <= kHz(6)) if (mode != RIG_MODE_FM && mode != RIG_MODE_WFM && width <= kHz(6))
{ {

Wyświetl plik

@ -301,8 +301,9 @@ int ft736_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
return -RIG_EINVAL; /* sorry, wrong MODE */ return -RIG_EINVAL; /* sorry, wrong MODE */
} }
if (width != RIG_PASSBAND_NORMAL && if (width != RIG_PASSBAND_NOCHANGE
width < rig_passband_normal(rig, mode)) { && width != RIG_PASSBAND_NORMAL
&& width < rig_passband_normal(rig, mode)) {
md |= 0x80; md |= 0x80;
} }
@ -368,8 +369,9 @@ int ft736_set_split_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
return -RIG_EINVAL; /* sorry, wrong MODE */ return -RIG_EINVAL; /* sorry, wrong MODE */
} }
if (width != RIG_PASSBAND_NORMAL && if (RIG_PASSBAND_NOCHANGE != width
width < rig_passband_normal(rig, mode)) { && width != RIG_PASSBAND_NORMAL
&& width < rig_passband_normal(rig, mode)) {
md |= 0x80; md |= 0x80;
} }

Wyświetl plik

@ -477,13 +477,15 @@ int ft747_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width ) {
switch(mode) { switch(mode) {
case RIG_MODE_AM: case RIG_MODE_AM:
if (width < width_normal) if (width != RIG_PASSBAND_NOCHANGE
&& width < width_normal)
cmd_index = FT_747_NATIVE_MODE_SET_AMN; cmd_index = FT_747_NATIVE_MODE_SET_AMN;
else else
cmd_index = FT_747_NATIVE_MODE_SET_AMW; cmd_index = FT_747_NATIVE_MODE_SET_AMW;
break; break;
case RIG_MODE_CW: case RIG_MODE_CW:
if (width < width_normal) if (width != RIG_PASSBAND_NOCHANGE
&& width < width_normal)
cmd_index = FT_747_NATIVE_MODE_SET_CWN; cmd_index = FT_747_NATIVE_MODE_SET_CWN;
else else
cmd_index = FT_747_NATIVE_MODE_SET_CWW; cmd_index = FT_747_NATIVE_MODE_SET_CWW;
@ -495,7 +497,8 @@ int ft747_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width ) {
cmd_index = FT_747_NATIVE_MODE_SET_LSB; cmd_index = FT_747_NATIVE_MODE_SET_LSB;
break; break;
case RIG_MODE_FM: case RIG_MODE_FM:
if (width < width_normal) if (width != RIG_PASSBAND_NOCHANGE
&& width < width_normal)
cmd_index = FT_747_NATIVE_MODE_SET_FMN; cmd_index = FT_747_NATIVE_MODE_SET_FMN;
else else
cmd_index = FT_747_NATIVE_MODE_SET_FMW; cmd_index = FT_747_NATIVE_MODE_SET_FMW;

Wyświetl plik

@ -735,8 +735,9 @@ int mode2rig(RIG *rig, rmode_t mode, pbwidth_t width)
break; break;
case RIG_MODE_CW: case RIG_MODE_CW:
if (width == RIG_PASSBAND_NORMAL || if (RIG_PASSBAND_NOCHANGE == width
width >= rig_passband_normal(rig, mode)) || width == RIG_PASSBAND_NORMAL
|| width >= rig_passband_normal(rig, mode))
md = MODE_CWW; md = MODE_CWW;
else else
md = MODE_CWN; md = MODE_CWN;

Wyświetl plik

@ -628,6 +628,7 @@ static int ft840_set_mode(RIG *rig, vfo_t vfo, rmode_t mode,
* The FT-840 only supports narrow width in AM and CW modes * The FT-840 only supports narrow width in AM and CW modes
* *
*/ */
if (width != RIG_PASSBAND_NOCHANGE) {
if (width == rig_passband_narrow(rig, mode)) { if (width == rig_passband_narrow(rig, mode)) {
switch(mode) { switch(mode) {
case RIG_MODE_CW: case RIG_MODE_CW:
@ -645,6 +646,7 @@ static int ft840_set_mode(RIG *rig, vfo_t vfo, rmode_t mode,
return -RIG_EINVAL; /* Invalid width, how can caller know? */ return -RIG_EINVAL; /* Invalid width, how can caller know? */
} }
} }
}
rig_debug(RIG_DEBUG_TRACE, "%s: set mode_parm = 0x%02x\n", __func__, mode_parm); rig_debug(RIG_DEBUG_TRACE, "%s: set mode_parm = 0x%02x\n", __func__, mode_parm);

Wyświetl plik

@ -663,7 +663,7 @@ int ft847_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) {
/* /*
* Now set width * Now set width
*/ */
if (width != RIG_PASSBAND_NOCHANGE) {
if (width == rig_passband_narrow(rig, mode)) { if (width == rig_passband_narrow(rig, mode)) {
switch(mode) { switch(mode) {
case RIG_MODE_AM: case RIG_MODE_AM:
@ -693,6 +693,8 @@ int ft847_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) {
return -RIG_EINVAL; /* sorry, wrong MODE/WIDTH combo */ return -RIG_EINVAL; /* sorry, wrong MODE/WIDTH combo */
} }
} }
}
/* /*
* Now send the command * Now send the command
*/ */

Wyświetl plik

@ -783,7 +783,7 @@ int ft857_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
return -RIG_EINVAL; return -RIG_EINVAL;
} }
if (width != RIG_PASSBAND_NORMAL) if (width != RIG_PASSBAND_NOCHANGE && width != RIG_PASSBAND_NORMAL)
return -RIG_EINVAL; return -RIG_EINVAL;
rig_force_cache_timeout(&((struct ft857_priv_data *) rig->state.priv)->fm_status_tv); rig_force_cache_timeout(&((struct ft857_priv_data *) rig->state.priv)->fm_status_tv);

Wyświetl plik

@ -566,6 +566,7 @@ static int ft890_set_mode(RIG *rig, vfo_t vfo, rmode_t mode,
* The FT-890 only supports narrow width in AM and CW modes * The FT-890 only supports narrow width in AM and CW modes
* *
*/ */
if (width != RIG_PASSBAND_NOCHANGE) {
if (width == rig_passband_narrow(rig, mode)) { if (width == rig_passband_narrow(rig, mode)) {
switch(mode) { switch(mode) {
case RIG_MODE_CW: case RIG_MODE_CW:
@ -583,6 +584,7 @@ static int ft890_set_mode(RIG *rig, vfo_t vfo, rmode_t mode,
return -RIG_EINVAL; /* Invalid width, how can caller know? */ return -RIG_EINVAL; /* Invalid width, how can caller know? */
} }
} }
}
rig_debug(RIG_DEBUG_TRACE, "%s: set mode_parm = 0x%02x\n", __func__, mode_parm); rig_debug(RIG_DEBUG_TRACE, "%s: set mode_parm = 0x%02x\n", __func__, mode_parm);

Wyświetl plik

@ -798,7 +798,7 @@ int ft897_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
return -RIG_EINVAL; return -RIG_EINVAL;
} }
if (width != RIG_PASSBAND_NORMAL) if (width != RIG_PASSBAND_NOCHANGE && width != RIG_PASSBAND_NORMAL)
return -RIG_EINVAL; return -RIG_EINVAL;
rig_force_cache_timeout(&((struct ft897_priv_data *) rig->state.priv)->fm_status_tv); rig_force_cache_timeout(&((struct ft897_priv_data *) rig->state.priv)->fm_status_tv);

Wyświetl plik

@ -566,6 +566,7 @@ static int ft900_set_mode(RIG *rig, vfo_t vfo, rmode_t mode,
* The FT-900 only supports narrow width in AM and CW modes * The FT-900 only supports narrow width in AM and CW modes
* *
*/ */
if (width != RIG_PASSBAND_NOCHANGE) {
if (width == rig_passband_narrow(rig, mode)) { if (width == rig_passband_narrow(rig, mode)) {
switch(mode) { switch(mode) {
case RIG_MODE_CW: case RIG_MODE_CW:
@ -583,6 +584,7 @@ static int ft900_set_mode(RIG *rig, vfo_t vfo, rmode_t mode,
return -RIG_EINVAL; /* Invalid width, how can caller know? */ return -RIG_EINVAL; /* Invalid width, how can caller know? */
} }
} }
}
rig_debug(RIG_DEBUG_TRACE, "%s: set mode_parm = 0x%02x\n", __func__, mode_parm); rig_debug(RIG_DEBUG_TRACE, "%s: set mode_parm = 0x%02x\n", __func__, mode_parm);

Wyświetl plik

@ -723,6 +723,7 @@ static int ft920_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width ) {
* Yeah, it's ugly... -N0NB * Yeah, it's ugly... -N0NB
* *
*/ */
if (width != RIG_PASSBAND_NOCHANGE) {
if (width == RIG_PASSBAND_NORMAL || width == rig_passband_normal(rig, mode)) { if (width == RIG_PASSBAND_NORMAL || width == rig_passband_normal(rig, mode)) {
switch(vfo) { switch(vfo) {
case RIG_VFO_A: case RIG_VFO_A:
@ -766,6 +767,7 @@ static int ft920_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width ) {
} }
} }
} }
}
rig_debug(RIG_DEBUG_TRACE, "%s: set mode_parm = 0x%02x\n", __func__, mode_parm); rig_debug(RIG_DEBUG_TRACE, "%s: set mode_parm = 0x%02x\n", __func__, mode_parm);
rig_debug(RIG_DEBUG_TRACE, "%s: set cmd_index = %i\n", __func__, cmd_index); rig_debug(RIG_DEBUG_TRACE, "%s: set cmd_index = %i\n", __func__, cmd_index);

Wyświetl plik

@ -728,7 +728,9 @@ int ft980_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
return -RIG_EINVAL; /* sorry, wrong MODE */ return -RIG_EINVAL; /* sorry, wrong MODE */
} }
if (width != RIG_PASSBAND_NORMAL && width < rig_passband_normal(rig, mode)) { if (width != RIG_PASSBAND_NOCHANGE
&& width != RIG_PASSBAND_NORMAL
&& width < rig_passband_normal(rig, mode)) {
switch(md) { switch(md) {
case MD_CW: md = MD_CWN; break; case MD_CW: md = MD_CWN; break;
case MD_AM: md = MD_AMN; break; case MD_AM: md = MD_AMN; break;

Wyświetl plik

@ -1608,6 +1608,7 @@ int ft990_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
ci == FT990_NATIVE_MODE_SET_PKT_FM) ci == FT990_NATIVE_MODE_SET_PKT_FM)
return RIG_OK; return RIG_OK;
if (RIG_PASSBAND_NOCHANGE == width) return err;
switch(width) { switch(width) {
case 250: case 250:
bw = FT990_BW_F250; bw = FT990_BW_F250;

Wyświetl plik

@ -555,9 +555,6 @@ int newcat_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
rig_debug(RIG_DEBUG_VERBOSE,"%s: generic mode = %x \n", rig_debug(RIG_DEBUG_VERBOSE,"%s: generic mode = %x \n",
__func__, mode); __func__, mode);
if (RIG_PASSBAND_NORMAL == width)
width = rig_passband_normal(rig, mode);
switch(mode) { switch(mode) {
case RIG_MODE_LSB: case RIG_MODE_LSB:
priv->cmd_str[3] = '1'; priv->cmd_str[3] = '1';
@ -600,6 +597,7 @@ int newcat_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
if (err != RIG_OK) if (err != RIG_OK)
return err; return err;
if (RIG_PASSBAND_NOCHANGE == width) return err;
if (RIG_PASSBAND_NORMAL == width) if (RIG_PASSBAND_NORMAL == width)
width = rig_passband_normal(rig, mode); width = rig_passband_normal(rig, mode);

Wyświetl plik

@ -450,7 +450,9 @@ int mode2rig(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
case RIG_MODE_WFM: md = MODE_WFM; break; case RIG_MODE_WFM: md = MODE_WFM; break;
case RIG_MODE_FM: md = MODE_FMN; break; case RIG_MODE_FM: md = MODE_FMN; break;
case RIG_MODE_AM: case RIG_MODE_AM:
if (width != RIG_PASSBAND_NORMAL && width < rig_passband_normal(rig, mode)) if (width != RIG_PASSBAND_NOCHANGE
&& width != RIG_PASSBAND_NORMAL
&& width < rig_passband_normal(rig, mode))
md = MODE_AMN; md = MODE_AMN;
else if (width != RIG_PASSBAND_NORMAL && width > rig_passband_normal(rig, mode)) else if (width != RIG_PASSBAND_NORMAL && width > rig_passband_normal(rig, mode))
md = MODE_AMW; md = MODE_AMW;