mirror of
https://github.com/Hamlib/Hamlib.git
synced 2024-09-21 18:37:18 +00:00
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.
This commit is contained in:
parent
22218fed79
commit
222ad74de7
@ -2962,10 +2962,12 @@ int adat_set_mode(RIG *pRig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
||||
pPriv->nRIGMode = mode;
|
||||
nRC = adat_vfo_rnr2anr(vfo, &(pPriv->nCurrentVFO));
|
||||
|
||||
if (width == RIG_PASSBAND_NORMAL)
|
||||
width = rig_passband_normal(pRig, mode);
|
||||
if (width != RIG_PASSBAND_NOCHANGE) {
|
||||
if (width == RIG_PASSBAND_NORMAL)
|
||||
width = rig_passband_normal(pRig, mode);
|
||||
|
||||
pPriv->nWidth = width;
|
||||
pPriv->nWidth = width;
|
||||
}
|
||||
|
||||
nRC = adat_transaction(pRig, &adat_cmd_list_set_mode);
|
||||
}
|
||||
|
@ -292,6 +292,8 @@ int alinco_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
||||
if (retval != RIG_OK)
|
||||
return retval;
|
||||
|
||||
if (width == RIG_PASSBAND_NOCHANGE) return retval;
|
||||
|
||||
/*
|
||||
* TODO: please DX77 owners, check this, I'm not sure
|
||||
* which passband is default!
|
||||
|
78
aor/aor.c
78
aor/aor.c
@ -299,55 +299,57 @@ int format8k_mode(RIG *rig, char *buf, rmode_t mode, pbwidth_t width)
|
||||
|
||||
switch (mode) {
|
||||
case RIG_MODE_AM:
|
||||
if (rig->caps->rig_model == RIG_MODEL_AR8000)
|
||||
{
|
||||
aormode = AR8K_AM;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(width) {
|
||||
case RIG_PASSBAND_NORMAL:
|
||||
case s_kHz(9): aormode = AR8K_AM; break;
|
||||
if (rig->caps->rig_model == RIG_MODEL_AR8000)
|
||||
{
|
||||
aormode = AR8K_AM;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(width) {
|
||||
case RIG_PASSBAND_NORMAL:
|
||||
case s_kHz(9): aormode = AR8K_AM; break;
|
||||
|
||||
case s_kHz(12): aormode = AR8K_WAM; break;
|
||||
case s_kHz(3): aormode = AR8K_NAM; break;
|
||||
default:
|
||||
rig_debug(RIG_DEBUG_ERR,
|
||||
"%s: unsupported passband %d %d\n",
|
||||
__FUNCTION__,
|
||||
mode, width);
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
}
|
||||
case s_kHz(12): aormode = AR8K_WAM; break;
|
||||
case s_kHz(3): aormode = AR8K_NAM; break;
|
||||
case RIG_PASSBAND_NOCHANGE: aormode = AR8K_AM; break;
|
||||
default:
|
||||
rig_debug(RIG_DEBUG_ERR,
|
||||
"%s: unsupported passband %d %d\n",
|
||||
__FUNCTION__,
|
||||
mode, width);
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case RIG_MODE_CW: aormode = AR8K_CW; break;
|
||||
case RIG_MODE_USB: aormode = AR8K_USB; break;
|
||||
case RIG_MODE_LSB: aormode = AR8K_LSB; break;
|
||||
case RIG_MODE_WFM: aormode = AR8K_WFM; break;
|
||||
case RIG_MODE_FM:
|
||||
if (rig->caps->rig_model == RIG_MODEL_AR8000)
|
||||
{
|
||||
aormode = AR8K_NFM;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(width) {
|
||||
case RIG_PASSBAND_NORMAL:
|
||||
case s_kHz(12): aormode = AR8K_NFM; break;
|
||||
if (rig->caps->rig_model == RIG_MODEL_AR8000)
|
||||
{
|
||||
aormode = AR8K_NFM;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(width) {
|
||||
case RIG_PASSBAND_NORMAL:
|
||||
case s_kHz(12): aormode = AR8K_NFM; break;
|
||||
|
||||
case s_kHz(9): aormode = AR8K_SFM; break;
|
||||
default:
|
||||
rig_debug(RIG_DEBUG_ERR,
|
||||
"%s: unsupported passband %d %d\n",
|
||||
__FUNCTION__,
|
||||
mode, width);
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
}
|
||||
case s_kHz(9): aormode = AR8K_SFM; break;
|
||||
case RIG_PASSBAND_NOCHANGE: aormode = AR8K_NFM; break;
|
||||
default:
|
||||
rig_debug(RIG_DEBUG_ERR,
|
||||
"%s: unsupported passband %d %d\n",
|
||||
__FUNCTION__,
|
||||
mode, width);
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
rig_debug(RIG_DEBUG_ERR,"%s: unsupported mode %d\n",
|
||||
__FUNCTION__, mode);
|
||||
__FUNCTION__, mode);
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
|
11
aor/ar3030.c
11
aor/ar3030.c
@ -379,9 +379,14 @@ int ar3030_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
mdbuf_len = sprintf(mdbuf, "%dB%c" EOM,
|
||||
width < rig_passband_normal(rig,mode) ? 1 : 0,
|
||||
aormode);
|
||||
if (width != RIG_PASSBAND_NOCHANGE) {
|
||||
mdbuf_len = sprintf(mdbuf, "%c" EOM, aormode);
|
||||
}
|
||||
else {
|
||||
mdbuf_len = sprintf(mdbuf, "%dB%c" EOM,
|
||||
width < rig_passband_normal(rig,mode) ? 1 : 0,
|
||||
aormode);
|
||||
}
|
||||
retval = ar3030_transaction (rig, mdbuf, mdbuf_len, NULL, NULL);
|
||||
|
||||
return retval;
|
||||
|
41
aor/ar5000.c
41
aor/ar5000.c
@ -396,9 +396,9 @@ const struct rig_caps ar5000a_caps = {
|
||||
|
||||
int format5k_mode(RIG *rig, char *buf, rmode_t mode, pbwidth_t width)
|
||||
{
|
||||
int aormode, aorwidth;
|
||||
int aormode, aorwidth;
|
||||
|
||||
switch (mode) {
|
||||
switch (mode) {
|
||||
case RIG_MODE_AM: aormode = AR5K_AM; break;
|
||||
case RIG_MODE_WFM:
|
||||
case RIG_MODE_FM: aormode = AR5K_FM; break;
|
||||
@ -409,29 +409,34 @@ int format5k_mode(RIG *rig, char *buf, rmode_t mode, pbwidth_t width)
|
||||
case RIG_MODE_SAL: aormode = AR5K_SAL; break;
|
||||
case RIG_MODE_SAH: aormode = AR5K_SAH; break;
|
||||
default:
|
||||
rig_debug(RIG_DEBUG_ERR,"%s: unsupported mode %d\n",
|
||||
__FUNCTION__, mode);
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
rig_debug(RIG_DEBUG_ERR,"%s: unsupported mode %d\n",
|
||||
__FUNCTION__, mode);
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
if (width != RIG_PASSBAND_NOCHANGE) {
|
||||
if (width == RIG_PASSBAND_NORMAL)
|
||||
width = rig_passband_normal(rig, mode);
|
||||
width = rig_passband_normal(rig, mode);
|
||||
|
||||
switch (width) {
|
||||
case 500: aorwidth = '0'; break;
|
||||
case s_kHz(3): aorwidth = '1'; break;
|
||||
case s_kHz(6): aorwidth = '2'; break;
|
||||
case s_kHz(15): aorwidth = '3'; break;
|
||||
case s_kHz(30): aorwidth = '4'; break;
|
||||
case s_kHz(110): aorwidth = '5'; break;
|
||||
case s_kHz(220): aorwidth = '6'; break;
|
||||
default:
|
||||
rig_debug(RIG_DEBUG_ERR,"%s: unsupported width %d\n",
|
||||
__FUNCTION__, width);
|
||||
return -RIG_EINVAL;
|
||||
case 500: aorwidth = '0'; break;
|
||||
case s_kHz(3): aorwidth = '1'; break;
|
||||
case s_kHz(6): aorwidth = '2'; break;
|
||||
case s_kHz(15): aorwidth = '3'; break;
|
||||
case s_kHz(30): aorwidth = '4'; break;
|
||||
case s_kHz(110): aorwidth = '5'; break;
|
||||
case s_kHz(220): aorwidth = '6'; break;
|
||||
default:
|
||||
rig_debug(RIG_DEBUG_ERR,"%s: unsupported width %d\n",
|
||||
__FUNCTION__, width);
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
return sprintf(buf, "MD%c BW%c", aormode, aorwidth);
|
||||
}
|
||||
else {
|
||||
return sprintf(buf, "MD%c", aormode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -364,6 +364,8 @@ static int ar7030_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
if (RIG_PASSBAND_NOCHANGE == width) return RIG_OK;
|
||||
|
||||
if (width == RIG_PASSBAND_NORMAL)
|
||||
width = rig_passband_normal(rig, mode);
|
||||
|
||||
|
@ -572,46 +572,46 @@ static int ar7030p_set_mode( RIG * rig, vfo_t vfo, rmode_t mode,
|
||||
|
||||
rc = lockRx( rig, LOCK_1 );
|
||||
if ( RIG_OK == rc )
|
||||
{
|
||||
/* TODO - deal with selected VFO */
|
||||
ar_mode = modeToNative( mode );
|
||||
|
||||
rc = writeByte( rig, WORKING, MODE, ar_mode );
|
||||
if ( RIG_OK == rc )
|
||||
{
|
||||
if ( RIG_PASSBAND_NORMAL == width )
|
||||
{
|
||||
width = rig_passband_normal( rig, mode );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* TODO - get filter BWs at startup */
|
||||
ar_filter = (unsigned char) 6;
|
||||
for ( i = 1; i <= 6; i++ )
|
||||
{
|
||||
if ( width <= filterTab[ i ] )
|
||||
{
|
||||
if ( filterTab[ i ] < filterTab[ (int) ar_filter ] )
|
||||
{
|
||||
ar_filter = (unsigned char) i;
|
||||
}
|
||||
}
|
||||
/* TODO - deal with selected VFO */
|
||||
ar_mode = modeToNative( mode );
|
||||
|
||||
rig_debug( RIG_DEBUG_VERBOSE, "%s: width %d ar_filter %d filterTab[%d] %d\n",
|
||||
__func__, width, ar_filter, i, filterTab[i] );
|
||||
}
|
||||
}
|
||||
rc = writeByte( rig, WORKING, MODE, ar_mode );
|
||||
if ( RIG_OK == rc && width != RIG_PASSBAND_NOCHANGE )
|
||||
{
|
||||
if ( RIG_PASSBAND_NORMAL == width )
|
||||
{
|
||||
width = rig_passband_normal( rig, mode );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* TODO - get filter BWs at startup */
|
||||
ar_filter = (unsigned char) 6;
|
||||
for ( i = 1; i <= 6; i++ )
|
||||
{
|
||||
if ( width <= filterTab[ i ] )
|
||||
{
|
||||
if ( filterTab[ i ] < filterTab[ (int) ar_filter ] )
|
||||
{
|
||||
ar_filter = (unsigned char) i;
|
||||
}
|
||||
}
|
||||
|
||||
rc = writeByte( rig, WORKING, FILTER, ar_filter );
|
||||
if ( RIG_OK == rc )
|
||||
{
|
||||
rc = execRoutine( rig, SET_ALL );
|
||||
}
|
||||
rig_debug( RIG_DEBUG_VERBOSE, "%s: width %d ar_filter %d filterTab[%d] %d\n",
|
||||
__func__, width, ar_filter, i, filterTab[i] );
|
||||
}
|
||||
}
|
||||
|
||||
rc = writeByte( rig, WORKING, FILTER, ar_filter );
|
||||
if ( RIG_OK == rc )
|
||||
{
|
||||
rc = execRoutine( rig, SET_ALL );
|
||||
}
|
||||
}
|
||||
|
||||
rc = lockRx( rig, LOCK_0 );
|
||||
}
|
||||
|
||||
rc = lockRx( rig, LOCK_0 );
|
||||
}
|
||||
|
||||
return( rc );
|
||||
}
|
||||
|
||||
|
18
aor/sr2200.c
18
aor/sr2200.c
@ -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);
|
||||
|
||||
if (width == 0)
|
||||
if (width == RIG_PASSBAND_NORMAL)
|
||||
width = normal_width;
|
||||
|
||||
switch (mode) {
|
||||
case RIG_MODE_AM: aormode = width > normal_width ?
|
||||
SR2200_WAM : SR2200_AM; break;
|
||||
case RIG_MODE_FM: aormode = width < normal_width ?
|
||||
SR2200_SFM : SR2200_FM; break;
|
||||
case RIG_MODE_WFM: aormode = SR2200_WFM; break;
|
||||
case RIG_MODE_AM:
|
||||
aormode = width > normal_width ?
|
||||
SR2200_WAM : SR2200_AM;
|
||||
break;
|
||||
case RIG_MODE_FM:
|
||||
aormode = width >= normal_width ?
|
||||
SR2200_FM : SR2200_SFM;
|
||||
break;
|
||||
case RIG_MODE_WFM:
|
||||
aormode = SR2200_WFM;
|
||||
break;
|
||||
default:
|
||||
rig_debug(RIG_DEBUG_ERR,"%s: unsupported mode %d\n",
|
||||
__FUNCTION__,mode);
|
||||
|
@ -519,7 +519,9 @@ Set @var{Mode} to one of: @code{USB}, @code{LSB}, @code{CW},
|
||||
@code{SAH}, @code{DSB}.
|
||||
|
||||
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
|
||||
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}
|
||||
Set @var{TX Frequency}, in Hertz for ``split'' frequency operation.
|
||||
|
||||
See also @command{set_split_freq_mode} below.
|
||||
@ifhtml
|
||||
@*
|
||||
@end ifhtml
|
||||
|
||||
@item i, get_split_freq
|
||||
Get @var{TX Frequency}, in Hertz for ``split'' frequency operation.
|
||||
|
||||
See also @command{get_split_freq_mode} below.
|
||||
@ifhtml
|
||||
@*
|
||||
@end ifhtml
|
||||
@ -695,19 +701,75 @@ Set @var{TX Mode} to one of: @code{AM}, @code{FM}, @code{CW},
|
||||
@code{SAH}, @code{DSB}.
|
||||
|
||||
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
|
||||
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
|
||||
given radio backend.
|
||||
|
||||
See also @command{set_split_freq_mode} below.
|
||||
@ifhtml
|
||||
@*
|
||||
@end ifhtml
|
||||
|
||||
@item x, get_split_mode
|
||||
Get @var{TX Mode}, @var{TX Passband}.
|
||||
|
||||
Returns TX mode as a string from @command{set_split_mode} above and TX
|
||||
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}
|
||||
Set @var{Split} mode, @code{0} (off) or @code{1} (on), and @var{TX VFO}
|
||||
from @command{set_vfo} above.
|
||||
@ -2104,12 +2166,16 @@ Get @var{DCS Sql} code.
|
||||
|
||||
@item I, set_split_freq @var{Tx Frequency}
|
||||
Set @var{TX Frequency}, in Hertz for ``split'' frequency operation.
|
||||
|
||||
See also @command{set_split_freq_mode} below.
|
||||
@ifhtml
|
||||
@*
|
||||
@end ifhtml
|
||||
|
||||
@item i, get_split_freq
|
||||
Get @var{TX Frequency}, in Hertz for ``split'' frequency operation.
|
||||
|
||||
See also @command{get_split_freq_mode} below.
|
||||
@ifhtml
|
||||
@*
|
||||
@end ifhtml
|
||||
@ -2122,19 +2188,75 @@ Set @var{TX Mode} to one of: @code{AM}, @code{FM}, @code{CW},
|
||||
@code{SAH}, @code{DSB}.
|
||||
|
||||
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
|
||||
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
|
||||
given radio backend.
|
||||
|
||||
See also @command{set_split_freq_mode} below.
|
||||
@ifhtml
|
||||
@*
|
||||
@end ifhtml
|
||||
|
||||
@item x, get_split_mode
|
||||
Get @var{TX Mode}, @var{TX Passband}.
|
||||
|
||||
Returns TX mode as a string from @command{set_split_mode} above and TX
|
||||
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}
|
||||
Set @var{Split} mode, @code{0} (off) or @code{1} (on), and @var{TX VFO}
|
||||
from @command{set_vfo} above.
|
||||
|
@ -290,30 +290,31 @@ int drake_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
||||
if (retval != RIG_OK)
|
||||
return retval;
|
||||
|
||||
if (mode != RIG_MODE_FM) {
|
||||
if (width != RIG_PASSBAND_NOCHANGE) {
|
||||
if (mode != RIG_MODE_FM) {
|
||||
|
||||
if (width == RIG_PASSBAND_NORMAL)
|
||||
width = rig_passband_normal(rig, mode);
|
||||
if (width == RIG_PASSBAND_NORMAL)
|
||||
width = rig_passband_normal(rig, mode);
|
||||
|
||||
switch (width) {
|
||||
case 500: width_sel = '0'; break;
|
||||
if (width <= 500) {
|
||||
width_sel = '0';
|
||||
}
|
||||
else if (width <= 1800) {
|
||||
width_sel = '1';
|
||||
}
|
||||
else if (width <= 2300) {
|
||||
width_sel = '2';
|
||||
}
|
||||
else if (width <= 4000) {
|
||||
width_sel = '4';
|
||||
}
|
||||
else {
|
||||
width_sel = '6';
|
||||
}
|
||||
|
||||
case 1800: width_sel = '1'; break;
|
||||
|
||||
case 2300: width_sel = '2'; break;
|
||||
|
||||
case 4000: width_sel = '4'; break;
|
||||
|
||||
case 6000: width_sel = '6'; break;
|
||||
|
||||
default:
|
||||
rig_debug(RIG_DEBUG_ERR, "drake_set_mode: "
|
||||
"unsupported width %d\n", width);
|
||||
return -RIG_EINVAL;
|
||||
mdbuf_len = sprintf((char *) mdbuf, "W%c" EOM, width_sel);
|
||||
retval = drake_transaction(rig, (char *) mdbuf, mdbuf_len, (char *) ackbuf, &ack_len);
|
||||
}
|
||||
|
||||
mdbuf_len = sprintf((char *) mdbuf, "W%c" EOM, width_sel);
|
||||
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) ||
|
||||
|
@ -338,6 +338,8 @@ static int dummy_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
||||
|
||||
curr->mode = mode;
|
||||
|
||||
if (RIG_PASSBAND_NOCHANGE == width) return RIG_OK;
|
||||
|
||||
if (width == RIG_PASSBAND_NORMAL)
|
||||
curr->width = rig_passband_normal(rig, mode);
|
||||
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);
|
||||
|
||||
curr->tx_mode = tx_mode;
|
||||
if (RIG_PASSBAND_NOCHANGE == tx_width) return RIG_OK;
|
||||
|
||||
curr->tx_width = tx_width;
|
||||
|
||||
return RIG_OK;
|
||||
|
@ -662,6 +662,16 @@ int dttsp_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
||||
int ret = RIG_OK;
|
||||
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)
|
||||
width = rig_passband_normal(rig, mode);
|
||||
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;
|
||||
}
|
||||
|
||||
/* 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 );
|
||||
ret = send_command (rig, buf, buf_len);
|
||||
|
||||
|
@ -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",
|
||||
__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;
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
/* 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);
|
||||
chan->width = width;
|
||||
pthread_mutex_unlock(&priv->mutex_process);
|
||||
@ -626,14 +628,16 @@ int gr_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
||||
|
||||
if (mode == RIG_MODE_NONE) {
|
||||
/* ez */
|
||||
chan->mode = mode;
|
||||
chan->width = width;
|
||||
chan->mode = mode;
|
||||
if (width != RIG_PASSBAND_NOCHANGE) chan->width = width;
|
||||
pthread_mutex_unlock(&priv->mutex_process);
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
float rf_gain = chan->levels[rig_setting2idx(RIG_LEVEL_RF)].f;
|
||||
|
||||
if (RIG_PASSBAND_NOCHANGE == width) width = chan->width;
|
||||
|
||||
switch(mode) {
|
||||
case RIG_MODE_LSB:
|
||||
mod = new LSBDemodChainCF(priv->source, priv->sink, mode, width, priv->input_rate, (freq_t)freq_offset);
|
||||
|
18
icom/frame.c
18
icom/frame.c
@ -338,21 +338,23 @@ int rig2icom_mode(RIG *rig, rmode_t mode, pbwidth_t width,
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
medium_width = rig_passband_normal(rig, mode);
|
||||
if (width == medium_width || width == RIG_PASSBAND_NORMAL)
|
||||
if (width != RIG_PASSBAND_NOCHANGE) {
|
||||
medium_width = rig_passband_normal(rig, mode);
|
||||
if (width == medium_width || width == RIG_PASSBAND_NORMAL)
|
||||
icmode_ext = -1; /* medium, no passband data-> rig default. Is medium always the default? */
|
||||
else if (width < medium_width)
|
||||
else if (width < medium_width)
|
||||
icmode_ext = PD_NARROW_3;
|
||||
else
|
||||
else
|
||||
icmode_ext = PD_WIDE_3;
|
||||
|
||||
if (rig->caps->rig_model == RIG_MODEL_ICR7000) {
|
||||
if (rig->caps->rig_model == RIG_MODEL_ICR7000) {
|
||||
if (mode == RIG_MODE_USB || mode == RIG_MODE_LSB) {
|
||||
icmode = S_R7000_SSB;
|
||||
icmode_ext = 0x00;
|
||||
icmode = S_R7000_SSB;
|
||||
icmode_ext = 0x00;
|
||||
} else if (mode == RIG_MODE_AM && icmode_ext == -1) {
|
||||
icmode_ext = PD_WIDE_3; /* default to Wide */
|
||||
icmode_ext = PD_WIDE_3; /* default to Wide */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*md = icmode;
|
||||
|
@ -46,12 +46,14 @@ static int ic706_r2i_mode(RIG *rig, rmode_t mode, pbwidth_t width,
|
||||
err = rig2icom_mode(rig, mode, width, md, pd);
|
||||
|
||||
if (err != RIG_OK)
|
||||
return err;
|
||||
return err;
|
||||
|
||||
if (width != RIG_PASSBAND_NOCHANGE) {
|
||||
if (*pd == -1)
|
||||
*pd = PD_MEDIUM_2;
|
||||
*pd = PD_MEDIUM_2;
|
||||
else
|
||||
(*pd)--;
|
||||
(*pd)--;
|
||||
}
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
64
icom/icom.c
64
icom/icom.c
@ -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 retval, rfstatus, i;
|
||||
unsigned char ackbuf[MAXFRAMELEN];
|
||||
unsigned char flt_ext;
|
||||
@ -593,45 +592,46 @@ int icom_set_dsp_flt(RIG *rig, rmode_t mode, pbwidth_t width) {
|
||||
int ack_len=sizeof(ackbuf), flt_idx;
|
||||
unsigned char fw_sub_cmd = RIG_MODEL_IC7200 == rig->caps->rig_model ? 0x02 : S_MEM_FILT_WDTH;
|
||||
|
||||
if (width == RIG_PASSBAND_NORMAL)
|
||||
width = rig_passband_normal(rig, mode);
|
||||
if (RIG_PASSBAND_NOCHANGE == width) return RIG_OK;
|
||||
if (width == RIG_PASSBAND_NORMAL)
|
||||
width = rig_passband_normal(rig, mode);
|
||||
|
||||
if (rig_has_get_func(rig, RIG_FUNC_RF) && (mode & (RIG_MODE_RTTY | RIG_MODE_RTTYR))) {
|
||||
if(!rig_get_func(rig, RIG_VFO_CURR, RIG_FUNC_RF, &rfstatus) && (rfstatus)) {
|
||||
for (i=0; i<RTTY_FIL_NB; i++) {
|
||||
if (rtty_fil[i] == width) {
|
||||
rfwidth.i = i;
|
||||
return rig_set_ext_parm (rig, TOK_RTTY_FLTR, rfwidth);
|
||||
}
|
||||
}
|
||||
/* not found */
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
for (i=0; i<RTTY_FIL_NB; i++) {
|
||||
if (rtty_fil[i] == width) {
|
||||
rfwidth.i = i;
|
||||
return rig_set_ext_parm (rig, TOK_RTTY_FLTR, rfwidth);
|
||||
}
|
||||
}
|
||||
/* not found */
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
if (mode & RIG_MODE_AM)
|
||||
flt_idx = (width/200)-1; /* TBC: Ic_7800? */
|
||||
else if (mode & (RIG_MODE_CW | RIG_MODE_USB | RIG_MODE_LSB | RIG_MODE_RTTY | RIG_MODE_RTTYR)) {
|
||||
if (width == 0)
|
||||
width = 1;
|
||||
flt_idx = width <= 500 ? ((width+49)/50)-1 : ((width+99)/100)+4;
|
||||
} else
|
||||
return RIG_OK;
|
||||
if (mode & RIG_MODE_AM)
|
||||
flt_idx = (width/200)-1; /* TBC: Ic_7800? */
|
||||
else if (mode & (RIG_MODE_CW | RIG_MODE_USB | RIG_MODE_LSB | RIG_MODE_RTTY | RIG_MODE_RTTYR)) {
|
||||
if (width == 0)
|
||||
width = 1;
|
||||
flt_idx = width <= 500 ? ((width+49)/50)-1 : ((width+99)/100)+4;
|
||||
} else
|
||||
return RIG_OK;
|
||||
|
||||
to_bcd(&flt_ext, flt_idx, 2);
|
||||
to_bcd(&flt_ext, flt_idx, 2);
|
||||
|
||||
retval = icom_transaction (rig, C_CTL_MEM, fw_sub_cmd, &flt_ext, 1,
|
||||
ackbuf, &ack_len);
|
||||
ackbuf, &ack_len);
|
||||
if (retval != RIG_OK) {
|
||||
rig_debug(RIG_DEBUG_ERR,"%s: protocol error (%#.2x), "
|
||||
"len=%d\n", __FUNCTION__,ackbuf[0],ack_len);
|
||||
return retval;
|
||||
"len=%d\n", __FUNCTION__,ackbuf[0],ack_len);
|
||||
return retval;
|
||||
}
|
||||
if (ack_len != 1 || ackbuf[0] != ACK) {
|
||||
rig_debug(RIG_DEBUG_ERR,"%s: command not supported ? (%#.2x), "
|
||||
"len=%d\n", __FUNCTION__,ackbuf[0],ack_len);
|
||||
return retval;
|
||||
}
|
||||
"len=%d\n", __FUNCTION__,ackbuf[0],ack_len);
|
||||
return retval;
|
||||
}
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
@ -1715,7 +1715,7 @@ int icom_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
|
||||
split for certainty */
|
||||
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) {
|
||||
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);
|
||||
return -RIG_ERJCTED;
|
||||
}
|
||||
@ -1767,7 +1767,7 @@ int icom_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq)
|
||||
split for certainty */
|
||||
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) {
|
||||
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);
|
||||
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 */
|
||||
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) {
|
||||
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);
|
||||
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 */
|
||||
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) {
|
||||
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);
|
||||
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 */
|
||||
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) {
|
||||
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);
|
||||
return -RIG_ERJCTED;
|
||||
}
|
||||
|
@ -367,6 +367,7 @@ typedef int vfo_t;
|
||||
|
||||
|
||||
#define RIG_PASSBAND_NORMAL s_Hz(0)
|
||||
#define RIG_PASSBAND_NOCHANGE s_Hz(-1)
|
||||
/**
|
||||
* \brief Passband width, in Hz
|
||||
* \sa rig_passband_normal, rig_passband_narrow, rig_passband_wide
|
||||
|
27
jrc/jrc.c
27
jrc/jrc.c
@ -175,6 +175,11 @@ static int rig2jrc_mode(RIG *rig, rmode_t mode, pbwidth_t width,
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
if (RIG_PASSBAND_NOCHANGE == width) {
|
||||
*jwidth = '1';
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
if (width == RIG_PASSBAND_NORMAL)
|
||||
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)
|
||||
return retval;
|
||||
|
||||
mdbuf_len = sprintf(mdbuf, "B" "%c" EOM, awidth);
|
||||
retval = jrc_transaction (rig, mdbuf, mdbuf_len, NULL, NULL);
|
||||
if (retval != RIG_OK)
|
||||
return retval;
|
||||
if (width != RIG_PASSBAND_NOCHANGE) {
|
||||
mdbuf_len = sprintf(mdbuf, "B" "%c" EOM, awidth);
|
||||
retval = jrc_transaction (rig, mdbuf, mdbuf_len, NULL, NULL);
|
||||
if (retval != RIG_OK)
|
||||
return retval;
|
||||
}
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
@ -1158,13 +1165,21 @@ int jrc_set_chan(RIG *rig, const channel_t *chan)
|
||||
char cmdbuf[BUFSZ];
|
||||
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, ¤t)) != RIG_OK) return retval;
|
||||
|
||||
sprintf(cmdbuf,"K%03d000",chan->channel_num);
|
||||
|
||||
if (chan->levels[rig_setting2idx(RIG_LEVEL_ATT)].i == 20)
|
||||
cmdbuf[4] = '1';
|
||||
|
||||
retval = rig2jrc_mode(rig, chan->mode, chan->width,
|
||||
&cmdbuf[6], &cmdbuf[5]);
|
||||
rmode_t mode = chan->mode;
|
||||
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)
|
||||
return retval;
|
||||
|
||||
|
@ -192,6 +192,8 @@ static int nrd525_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
||||
if (retval != RIG_OK)
|
||||
return retval;
|
||||
|
||||
if (RIG_PASSBAND_NOCHANGE == width) return retval;
|
||||
|
||||
// TODO: width
|
||||
|
||||
return retval;
|
||||
|
@ -228,14 +228,17 @@ static int flex6k_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
||||
if (err != RIG_OK)
|
||||
return err;
|
||||
|
||||
err = flex6k_find_width(mode, width, &idx);
|
||||
if (err != RIG_OK)
|
||||
return err;
|
||||
|
||||
if ((vfo == RIG_VFO_VFO) || (vfo == RIG_VFO_CURR)) {
|
||||
vfo = rig->state.current_vfo;
|
||||
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,
|
||||
* so use the ZZFI or ZZFJ command
|
||||
|
78
kenwood/k2.c
78
kenwood/k2.c
@ -312,54 +312,58 @@ int k2_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
if (width < 0)
|
||||
width = labs(width);
|
||||
if (width != RIG_PASSBAND_NOCHANGE) {
|
||||
if (width < 0)
|
||||
width = labs(width);
|
||||
|
||||
/* Step through the filter list looking for the best match
|
||||
* for the passed in width. The choice is to select the filter
|
||||
* that is wide enough for the width without being too narrow
|
||||
* if possible.
|
||||
*/
|
||||
if (width == RIG_PASSBAND_NORMAL)
|
||||
width = rig_passband_normal(rig, mode);
|
||||
/* Step through the filter list looking for the best match
|
||||
* for the passed in width. The choice is to select the filter
|
||||
* that is wide enough for the width without being too narrow
|
||||
* if possible.
|
||||
*/
|
||||
if (width == RIG_PASSBAND_NORMAL)
|
||||
width = rig_passband_normal(rig, mode);
|
||||
|
||||
if (width > flt->filt_list[0].width || ((flt->filt_list[0].width >= width)
|
||||
&& (width > flt->filt_list[1].width))) {
|
||||
width = flt->filt_list[0].width;
|
||||
f = '1';
|
||||
} else if ((flt->filt_list[1].width >= width) && (width > flt->filt_list[2].width)) {
|
||||
width = flt->filt_list[1].width;
|
||||
f = '2';
|
||||
} else if ((flt->filt_list[2].width >= width) && (width > flt->filt_list[3].width)) {
|
||||
width = flt->filt_list[2].width;
|
||||
f = '3';
|
||||
} else if ((flt->filt_list[3].width >= width) && (width >= freq)) {
|
||||
width = flt->filt_list[3].width;
|
||||
f = '4';
|
||||
} else {
|
||||
return -RIG_EINVAL;
|
||||
if (width > flt->filt_list[0].width || ((flt->filt_list[0].width >= width)
|
||||
&& (width > flt->filt_list[1].width))) {
|
||||
width = flt->filt_list[0].width;
|
||||
f = '1';
|
||||
} else if ((flt->filt_list[1].width >= width) && (width > flt->filt_list[2].width)) {
|
||||
width = flt->filt_list[1].width;
|
||||
f = '2';
|
||||
} else if ((flt->filt_list[2].width >= width) && (width > flt->filt_list[3].width)) {
|
||||
width = flt->filt_list[2].width;
|
||||
f = '3';
|
||||
} else if ((flt->filt_list[3].width >= width) && (width >= freq)) {
|
||||
width = flt->filt_list[3].width;
|
||||
f = '4';
|
||||
} else {
|
||||
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 */
|
||||
err = kenwood_set_mode(rig, vfo, mode, width);
|
||||
if (err != RIG_OK)
|
||||
return err;
|
||||
|
||||
err = kenwood_transaction(rig, "K22", NULL, 0);
|
||||
if (err != RIG_OK)
|
||||
return err;
|
||||
if (width != RIG_PASSBAND_NOCHANGE) {
|
||||
err = kenwood_transaction(rig, "K22", NULL, 0);
|
||||
if (err != RIG_OK)
|
||||
return err;
|
||||
|
||||
/* Set the filter slot */
|
||||
err = kenwood_transaction(rig, fcmd, NULL, 0);
|
||||
if (err != RIG_OK)
|
||||
return err;
|
||||
/* Construct the filter command and set the radio mode and width*/
|
||||
snprintf(fcmd, 8, "FW0000%c", f);
|
||||
|
||||
err = kenwood_transaction(rig, "K20", NULL, 0);
|
||||
if (err != RIG_OK)
|
||||
return err;
|
||||
/* Set the filter slot */
|
||||
err = kenwood_transaction(rig, fcmd, NULL, 0);
|
||||
if (err != RIG_OK)
|
||||
return err;
|
||||
|
||||
err = kenwood_transaction(rig, "K20", NULL, 0);
|
||||
if (err != RIG_OK)
|
||||
return err;
|
||||
}
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
100
kenwood/k3.c
100
kenwood/k3.c
@ -377,34 +377,36 @@ int k3_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
||||
if (err != RIG_OK)
|
||||
return err;
|
||||
|
||||
/* 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
|
||||
* to be set to 2.350 kHz. As the width must be divided by 10, 10 Hz values
|
||||
* between 0 and 4 round down to the nearest 100 Hz and values between 5
|
||||
* and 9 round down to the nearest 50 Hz.
|
||||
*
|
||||
* width string value must be padded with leading '0' to equal four
|
||||
* characters.
|
||||
*/
|
||||
if (width != RIG_PASSBAND_NOCHANGE) {
|
||||
/* 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
|
||||
* to be set to 2.350 kHz. As the width must be divided by 10, 10 Hz values
|
||||
* between 0 and 4 round down to the nearest 100 Hz and values between 5
|
||||
* and 9 round down to the nearest 50 Hz.
|
||||
*
|
||||
* width string value must be padded with leading '0' to equal four
|
||||
* characters.
|
||||
*/
|
||||
|
||||
/* passband widths vary by mode so gather lower and upper limits */
|
||||
pbwidth_t pb_nar = rig_passband_narrow(rig, mode);
|
||||
pbwidth_t pb_wid = rig_passband_wide(rig, mode);
|
||||
/* passband widths vary by mode so gather lower and upper limits */
|
||||
pbwidth_t pb_nar = rig_passband_narrow(rig, mode);
|
||||
pbwidth_t pb_wid = rig_passband_wide(rig, mode);
|
||||
|
||||
if (width < 0)
|
||||
width = labs(width);
|
||||
if (width < 0)
|
||||
width = labs(width);
|
||||
|
||||
if (width == RIG_PASSBAND_NORMAL)
|
||||
width = rig_passband_normal(rig, mode);
|
||||
else if (width < pb_nar)
|
||||
width = pb_nar;
|
||||
else if (width > pb_wid)
|
||||
width = pb_wid;
|
||||
if (width == RIG_PASSBAND_NORMAL)
|
||||
width = rig_passband_normal(rig, mode);
|
||||
else if (width < pb_nar)
|
||||
width = pb_nar;
|
||||
else if (width > pb_wid)
|
||||
width = pb_wid;
|
||||
|
||||
sprintf(cmd_s, "BW%04ld", width / 10);
|
||||
err = kenwood_transaction(rig, cmd_s, NULL, 0);
|
||||
if (err != RIG_OK)
|
||||
return err;
|
||||
sprintf(cmd_s, "BW%04ld", width / 10);
|
||||
err = kenwood_transaction(rig, cmd_s, NULL, 0);
|
||||
if (err != RIG_OK)
|
||||
return err;
|
||||
}
|
||||
|
||||
/* Now set data sub-mode. K3 needs to be in a DATA mode before setting
|
||||
* the sub-mode.
|
||||
@ -639,34 +641,36 @@ int k3_set_split_mode(RIG * rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width)
|
||||
if (err != RIG_OK)
|
||||
return err;
|
||||
|
||||
/* 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
|
||||
* to be set to 2.350 kHz. As the width must be divided by 10, 10 Hz values
|
||||
* between 0 and 4 round down to the nearest 100 Hz and values between 5
|
||||
* and 9 round down to the nearest 50 Hz.
|
||||
*
|
||||
* tx_width string value must be padded with leading '0' to equal four
|
||||
* characters.
|
||||
*/
|
||||
if (tx_width != RIG_PASSBAND_NOCHANGE) {
|
||||
/* 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
|
||||
* to be set to 2.350 kHz. As the width must be divided by 10, 10 Hz values
|
||||
* between 0 and 4 round down to the nearest 100 Hz and values between 5
|
||||
* and 9 round down to the nearest 50 Hz.
|
||||
*
|
||||
* tx_width string value must be padded with leading '0' to equal four
|
||||
* characters.
|
||||
*/
|
||||
|
||||
/* passband widths vary by mode so gather lower and upper limits */
|
||||
pbwidth_t pb_nar = rig_passband_narrow(rig, tx_mode);
|
||||
pbwidth_t pb_wid = rig_passband_wide(rig, tx_mode);
|
||||
/* passband widths vary by mode so gather lower and upper limits */
|
||||
pbwidth_t pb_nar = rig_passband_narrow(rig, tx_mode);
|
||||
pbwidth_t pb_wid = rig_passband_wide(rig, tx_mode);
|
||||
|
||||
if (tx_width < 0)
|
||||
tx_width = labs(tx_width);
|
||||
if (tx_width < 0)
|
||||
tx_width = labs(tx_width);
|
||||
|
||||
if (tx_width == RIG_PASSBAND_NORMAL)
|
||||
tx_width = rig_passband_normal(rig, tx_mode);
|
||||
else if (tx_width < pb_nar)
|
||||
tx_width = pb_nar;
|
||||
else if (tx_width > pb_wid)
|
||||
tx_width = pb_wid;
|
||||
if (tx_width == RIG_PASSBAND_NORMAL)
|
||||
tx_width = rig_passband_normal(rig, tx_mode);
|
||||
else if (tx_width < pb_nar)
|
||||
tx_width = pb_nar;
|
||||
else if (tx_width > pb_wid)
|
||||
tx_width = pb_wid;
|
||||
|
||||
sprintf(cmd_s, "BW$%04ld", tx_width / 10);
|
||||
err = kenwood_transaction(rig, cmd_s, NULL, 0);
|
||||
if (err != RIG_OK)
|
||||
return err;
|
||||
sprintf(cmd_s, "BW$%04ld", tx_width / 10);
|
||||
err = kenwood_transaction(rig, cmd_s, NULL, 0);
|
||||
if (err != RIG_OK)
|
||||
return err;
|
||||
}
|
||||
|
||||
/* Now set data sub-mode. K3 needs to be in a DATA mode before setting
|
||||
* the sub-mode.
|
||||
|
@ -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
|
||||
|| rig->caps->rig_model == RIG_MODEL_TS690S
|
||||
|| rig->caps->rig_model == RIG_MODEL_TS850
|
||||
|
@ -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);
|
||||
if (retval != RIG_OK) return retval;
|
||||
|
||||
if (RIG_PASSBAND_NOCHANGE == width) return retval;
|
||||
switch (mode)
|
||||
{
|
||||
case RIG_MODE_CW:
|
||||
|
@ -185,33 +185,35 @@ static int ts870s_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
||||
retval = kenwood_transaction(rig, buf, NULL, 0);
|
||||
if (retval != RIG_OK) return retval;
|
||||
|
||||
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)
|
||||
{
|
||||
/* we assume the HPF is set to default and set the LPF to
|
||||
give the best approximaation of the requested width */
|
||||
if (RIG_MODE_AM == mode)
|
||||
{
|
||||
mode_default_hpf = 300;
|
||||
}
|
||||
else
|
||||
{
|
||||
mode_default_hpf = 100;
|
||||
}
|
||||
sprintf(buf, "IS %04d", (int)(width + mode_default_hpf));
|
||||
retval = kenwood_transaction(rig, buf, NULL, 0);
|
||||
if (RIG_PASSBAND_NOCHANGE == width) {
|
||||
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)
|
||||
{
|
||||
/* we assume the HPF is set to default and set the LPF to
|
||||
give the best approximaation of the requested width */
|
||||
if (RIG_MODE_AM == mode)
|
||||
{
|
||||
mode_default_hpf = 300;
|
||||
}
|
||||
else
|
||||
{
|
||||
mode_default_hpf = 100;
|
||||
}
|
||||
sprintf(buf, "IS %04d", (int)(width + mode_default_hpf));
|
||||
retval = kenwood_transaction(rig, buf, NULL, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* This rig will simply use an IF bandpass which is closest to width,
|
||||
* so we don't need to check the value...
|
||||
*/
|
||||
sprintf(buf, "FW%04d", (int)width/10);
|
||||
retval = kenwood_transaction(rig, buf, NULL, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* This rig will simply use an IF bandpass which is closest to width,
|
||||
* so we don't need to check the value...
|
||||
*/
|
||||
sprintf(buf, "FW%04d", (int)width/10);
|
||||
retval = kenwood_transaction(rig, buf, NULL, 0);
|
||||
}
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
@ -487,6 +487,7 @@ static int fifisdr_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
||||
return -RIG_EIO;
|
||||
}
|
||||
|
||||
if (RIG_PASSBAND_NOCHANGE == width) return ret;
|
||||
/* Set filter width */
|
||||
fifi_width = fifisdr_tole32(width);
|
||||
ret = fifisdr_usb_write(rig, REQUEST_FIFISDR_WRITE, 0,
|
||||
|
76
pcr/pcr.c
76
pcr/pcr.c
@ -757,46 +757,52 @@ pcr_set_mode(RIG * rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
if (width == RIG_PASSBAND_NORMAL)
|
||||
width = rig_passband_normal(rig, mode);
|
||||
if (width != RIG_PASSBAND_NOCHANGE) {
|
||||
if (width == RIG_PASSBAND_NORMAL)
|
||||
width = rig_passband_normal(rig, mode);
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: will set to %d\n",
|
||||
__func__, width);
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: will set to %d\n",
|
||||
__func__, width);
|
||||
|
||||
switch (width) {
|
||||
/* nop, pcrfilter already set
|
||||
* TODO: use rig_passband_normal instead?
|
||||
*/
|
||||
case s_kHz(2.8):
|
||||
pcrfilter = FLT_2_8kHz;
|
||||
break;
|
||||
case s_kHz(6):
|
||||
pcrfilter = FLT_6kHz;
|
||||
break;
|
||||
case s_kHz(15):
|
||||
pcrfilter = FLT_15kHz;
|
||||
break;
|
||||
case s_kHz(50):
|
||||
pcrfilter = FLT_50kHz;
|
||||
break;
|
||||
case s_kHz(230):
|
||||
pcrfilter = FLT_230kHz;
|
||||
break;
|
||||
default:
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: unsupported width %d\n",
|
||||
__func__, width);
|
||||
return -RIG_EINVAL;
|
||||
switch (width) {
|
||||
/* nop, pcrfilter already set
|
||||
* TODO: use rig_passband_normal instead?
|
||||
*/
|
||||
case s_kHz(2.8):
|
||||
pcrfilter = FLT_2_8kHz;
|
||||
break;
|
||||
case s_kHz(6):
|
||||
pcrfilter = FLT_6kHz;
|
||||
break;
|
||||
case s_kHz(15):
|
||||
pcrfilter = FLT_15kHz;
|
||||
break;
|
||||
case s_kHz(50):
|
||||
pcrfilter = FLT_50kHz;
|
||||
break;
|
||||
case s_kHz(230):
|
||||
pcrfilter = FLT_230kHz;
|
||||
break;
|
||||
default:
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: unsupported width %d\n",
|
||||
__func__, width);
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: filter set to %d (%c)\n",
|
||||
__func__, width, pcrfilter);
|
||||
|
||||
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, 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);
|
||||
}
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: filter set to %d (%c)\n",
|
||||
__func__, width, pcrfilter);
|
||||
|
||||
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, pcrfilter);
|
||||
if (buf_len < 0)
|
||||
return -RIG_ETRUNC;
|
||||
|
||||
err = pcr_transaction(rig, (char *) buf);
|
||||
if (err != RIG_OK)
|
||||
return err;
|
||||
|
@ -265,10 +265,15 @@ int racal_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
if (width == RIG_PASSBAND_NORMAL)
|
||||
width = rig_passband_normal(rig, mode);
|
||||
if (width != RIG_PASSBAND_NOCHANGE) {
|
||||
if (width == RIG_PASSBAND_NORMAL)
|
||||
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);
|
||||
}
|
||||
|
3
rs/rs.c
3
rs/rs.c
@ -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);
|
||||
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)
|
||||
width = rig_passband_normal(rig, mode);
|
||||
|
||||
|
@ -176,6 +176,7 @@ int skanti_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
||||
if (retval != RIG_OK)
|
||||
return retval;
|
||||
|
||||
if (RIG_PASSBAND_NOCHANGE == width) return retval;
|
||||
/*
|
||||
* TODO: please sk8000 owners, check this, I'm not sure
|
||||
* which passband is default!
|
||||
|
@ -299,6 +299,7 @@ int cu_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
||||
if (ret != RIG_OK)
|
||||
return ret;
|
||||
|
||||
if (RIG_PASSBAND_NOCHANGE == width) return ret;
|
||||
if (width == RIG_PASSBAND_NORMAL)
|
||||
width = rig_passband_normal(rig, mode);
|
||||
|
||||
|
17
src/rig.c
17
src/rig.c
@ -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 width The passband width to set to
|
||||
*
|
||||
* Sets the mode and associated passband of the target VFO.
|
||||
* The passband \a width must be supported by the backend of the rig.
|
||||
* Sets the mode and associated passband of the target VFO. The
|
||||
* 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
|
||||
* 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 vfo The target VFO
|
||||
* \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.
|
||||
*
|
||||
@ -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 tx_freq The transmit frequency 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.
|
||||
*
|
||||
|
@ -607,14 +607,15 @@ int tt538_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
||||
if (retval != RIG_OK)
|
||||
return retval;
|
||||
|
||||
if (RIG_PASSBAND_NOCHANGE == width) return retval;
|
||||
if (RIG_PASSBAND_NORMAL == width)
|
||||
width = rig_passband_normal (rig, mode);
|
||||
/* 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);
|
||||
return tt538_transaction (rig, (char *) cmdbuf, cmd_len, NULL, NULL);
|
||||
|
||||
cmd_len = sprintf((char *) cmdbuf, "*W%c" EOM, (unsigned char) width);
|
||||
return tt538_transaction (rig, (char *) cmdbuf, cmd_len, NULL, NULL);
|
||||
}
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
@ -699,12 +699,10 @@ int tt588_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
||||
return retval;
|
||||
|
||||
/* Set rx filter bandwidth. */
|
||||
|
||||
if (width == RIG_PASSBAND_NORMAL)
|
||||
width = tt588_filter_number(rig_passband_normal(rig, mode));
|
||||
else
|
||||
width = tt588_filter_number((int) width);
|
||||
|
||||
if (RIG_PASSBAND_NOCHANGE == width) return retval;
|
||||
if (RIG_PASSBAND_NORMAL == width)
|
||||
width = rig_passband_normal (rig, mode);
|
||||
width = tt588_filter_number((int) width);
|
||||
cmd_len = sprintf((char *) cmdbuf, "*W%c" EOM, (unsigned char) width);
|
||||
return tt588_transaction (rig, (char *) cmdbuf, cmd_len, NULL, NULL);
|
||||
}
|
||||
|
@ -424,9 +424,6 @@ int tt585_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
||||
const char *mcmd, *wcmd;
|
||||
int ret;
|
||||
|
||||
if (width == RIG_PASSBAND_NORMAL)
|
||||
width = rig_passband_normal(rig, mode);
|
||||
|
||||
switch(mode) {
|
||||
case RIG_MODE_LSB: mcmd = "N"; 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)
|
||||
return ret;
|
||||
|
||||
if (RIG_PASSBAND_NOCHANGE == width) return ret;
|
||||
if (RIG_PASSBAND_NORMAL == width)
|
||||
width = rig_passband_normal (rig, mode);
|
||||
if (width <= 250)
|
||||
wcmd = "V";
|
||||
else if (width <= 500)
|
||||
|
@ -433,15 +433,22 @@ int rx331_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
if (width == RIG_PASSBAND_NORMAL)
|
||||
if (width != RIG_PASSBAND_NOCHANGE) {
|
||||
if (width == RIG_PASSBAND_NORMAL)
|
||||
width = rig_passband_normal(rig, mode);
|
||||
|
||||
/*
|
||||
* Set DETECTION MODE and IF FILTER
|
||||
*/
|
||||
mdbuf_len = num_sprintf(mdbuf, "$%iD%cI%.02f" EOM, priv->receiver_id,
|
||||
dmode, (float)width/1e3);
|
||||
|
||||
/*
|
||||
* Set DETECTION MODE and IF FILTER
|
||||
*/
|
||||
mdbuf_len = num_sprintf(mdbuf, "$%iD%cI%.02f" EOM, priv->receiver_id,
|
||||
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);
|
||||
|
||||
return retval;
|
||||
|
@ -345,15 +345,22 @@ int rx340_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
if (width == RIG_PASSBAND_NORMAL)
|
||||
if (width != RIG_PASSBAND_NOCHANGE) {
|
||||
if (width == RIG_PASSBAND_NORMAL)
|
||||
width = rig_passband_normal(rig, mode);
|
||||
|
||||
/*
|
||||
* Set DETECTION MODE and IF FILTER
|
||||
*/
|
||||
mdbuf_len = num_sprintf(mdbuf, "D%cI%.02f" EOM,
|
||||
dmode, (float)width/1e3);
|
||||
|
||||
mdbuf_len = num_sprintf(mdbuf, "D%cI%.02f" EOM,
|
||||
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);
|
||||
|
||||
return retval;
|
||||
|
@ -272,44 +272,62 @@ int tentec_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
if (width == RIG_PASSBAND_NORMAL)
|
||||
width = rig_passband_normal(rig, mode);
|
||||
|
||||
for (ttfilter=0; tentec_filters[ttfilter] != 0; ttfilter++) {
|
||||
if (tentec_filters[ttfilter] == width)
|
||||
break;
|
||||
}
|
||||
if (tentec_filters[ttfilter] != width) {
|
||||
rig_debug(RIG_DEBUG_ERR,
|
||||
"tentec_set_mode: unsupported width %d\n",
|
||||
width);
|
||||
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)
|
||||
width = rig_passband_normal(rig, mode);
|
||||
|
||||
for (ttfilter=0; tentec_filters[ttfilter] != 0; ttfilter++) {
|
||||
if (tentec_filters[ttfilter] == width)
|
||||
break;
|
||||
}
|
||||
if (tentec_filters[ttfilter] != width) {
|
||||
rig_debug(RIG_DEBUG_ERR,
|
||||
"tentec_set_mode: unsupported width %d\n",
|
||||
width);
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
priv->width = width;
|
||||
}
|
||||
|
||||
priv->mode = mode;
|
||||
priv->width = width;
|
||||
|
||||
tentec_tuning_factor_calc(rig);
|
||||
|
||||
mdbuf_len = sprintf(mdbuf, "W%c" EOM
|
||||
"N%c%c%c%c%c%c" EOM
|
||||
"M%c" EOM,
|
||||
ttfilter,
|
||||
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;
|
||||
priv->width = saved_width;
|
||||
return retval;
|
||||
if (width != RIG_PASSBAND_NOCHANGE) {
|
||||
mdbuf_len = sprintf(mdbuf, "W%c" EOM
|
||||
"N%c%c%c%c%c%c" EOM
|
||||
"M%c" EOM,
|
||||
ttfilter,
|
||||
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;
|
||||
priv->width = saved_width;
|
||||
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;
|
||||
|
@ -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')
|
||||
return -RIG_ERJCTED;
|
||||
|
||||
if (RIG_PASSBAND_NORMAL == width) /* with NORMAL we leave width alone */
|
||||
return RIG_OK;
|
||||
if (RIG_PASSBAND_NOCHANGE == width) return retval;
|
||||
if (RIG_PASSBAND_NORMAL == width)
|
||||
width = rig_passband_normal (rig, mode);
|
||||
|
||||
/*
|
||||
* Filter 0: 200
|
||||
|
155
tentec/tt550.c
155
tentec/tt550.c
@ -705,45 +705,37 @@ tt550_set_rx_mode (RIG * rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
|
||||
if (width == RIG_PASSBAND_NORMAL)
|
||||
width = rig_passband_normal (rig, mode);
|
||||
|
||||
for (ttfilter = 0; tt550_filters[ttfilter] != 0; ttfilter++)
|
||||
{
|
||||
if (tt550_filters[ttfilter] == width)
|
||||
break;
|
||||
}
|
||||
if (tt550_filters[ttfilter] != width)
|
||||
{
|
||||
rig_debug (RIG_DEBUG_ERR, "tt550_set_mode: unsupported width %d\n",
|
||||
width);
|
||||
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)
|
||||
width = rig_passband_normal (rig, mode);
|
||||
|
||||
for (ttfilter = 0; tt550_filters[ttfilter] != 0; ttfilter++)
|
||||
{
|
||||
if (tt550_filters[ttfilter] == width)
|
||||
break;
|
||||
}
|
||||
if (tt550_filters[ttfilter] != width)
|
||||
{
|
||||
rig_debug (RIG_DEBUG_ERR, "tt550_set_mode: unsupported width %d\n",
|
||||
width);
|
||||
return -RIG_EINVAL;
|
||||
|
||||
}
|
||||
priv->width = width;
|
||||
}
|
||||
|
||||
priv->rx_mode = mode;
|
||||
priv->width = width;
|
||||
|
||||
tt550_tuning_factor_calc (rig, RECEIVE);
|
||||
|
||||
mdbuf_len = sprintf (mdbuf, "M%c%c" EOM, ttmode, ttmode);
|
||||
retval = write_block (&rs->rigport, mdbuf, mdbuf_len);
|
||||
|
||||
|
||||
mdbuf_len = sprintf (mdbuf, "W%c" EOM
|
||||
"N%c%c%c%c%c%c" EOM,
|
||||
ttfilter,
|
||||
priv->ctf >> 8, priv->ctf & 0xff, priv->ftf >> 8,
|
||||
priv->ftf & 0xff, priv->btf >> 8, priv->btf & 0xff);
|
||||
retval = write_block (&rs->rigport, mdbuf, mdbuf_len);
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
priv->rx_mode = saved_mode;
|
||||
@ -751,6 +743,20 @@ tt550_set_rx_mode (RIG * rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
||||
return retval;
|
||||
}
|
||||
|
||||
if (width != RIG_PASSBAND_NOCHANGE) {
|
||||
mdbuf_len = sprintf (mdbuf, "W%c" EOM
|
||||
"N%c%c%c%c%c%c" EOM,
|
||||
ttfilter,
|
||||
priv->ctf >> 8, priv->ctf & 0xff, priv->ftf >> 8,
|
||||
priv->ftf & 0xff, priv->btf >> 8, priv->btf & 0xff);
|
||||
retval = write_block (&rs->rigport, mdbuf, mdbuf_len);
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
priv->width = saved_width;
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
@ -796,62 +802,55 @@ tt550_set_tx_mode (RIG * rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Limit the transmitter bandwidth - it's not the same as the receiver
|
||||
*/
|
||||
if (width < 1050)
|
||||
width = 1050;
|
||||
if (width > 3900)
|
||||
width = 3900;
|
||||
|
||||
if (width == RIG_PASSBAND_NORMAL)
|
||||
width = rig_passband_normal (rig, mode);
|
||||
|
||||
for (ttfilter = 0; tt550_tx_filters[ttfilter] != 0; ttfilter++)
|
||||
{
|
||||
if (tt550_tx_filters[ttfilter] == width)
|
||||
break;
|
||||
}
|
||||
|
||||
if (tt550_tx_filters[ttfilter] != width)
|
||||
{
|
||||
rig_debug (RIG_DEBUG_ERR,
|
||||
"tt550_set_mode: unsupported tx width %d,%d\n", width,
|
||||
ttfilter);
|
||||
return -RIG_EINVAL;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* The tx filter array contains just the allowed filter values, but the
|
||||
* command assumes that the first allowed value is at offset 7. We add
|
||||
* 7 to compensate for the array difference
|
||||
*/
|
||||
|
||||
ttfilter += 7;
|
||||
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
if (width < 1050)
|
||||
width = 1050;
|
||||
if (width > 3900)
|
||||
width = 3900;
|
||||
|
||||
if (width == RIG_PASSBAND_NORMAL)
|
||||
width = rig_passband_normal (rig, mode);
|
||||
|
||||
for (ttfilter = 0; tt550_tx_filters[ttfilter] != 0; ttfilter++)
|
||||
{
|
||||
if (tt550_tx_filters[ttfilter] == width)
|
||||
break;
|
||||
}
|
||||
|
||||
if (tt550_tx_filters[ttfilter] != width)
|
||||
{
|
||||
rig_debug (RIG_DEBUG_ERR,
|
||||
"tt550_set_mode: unsupported tx width %d,%d\n", width,
|
||||
ttfilter);
|
||||
return -RIG_EINVAL;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* The tx filter array contains just the allowed filter values, but the
|
||||
* command assumes that the first allowed value is at offset 7. We add
|
||||
* 7 to compensate for the array difference
|
||||
*/
|
||||
|
||||
ttfilter += 7;
|
||||
priv->tx_width = width;
|
||||
}
|
||||
|
||||
priv->tx_mode = mode;
|
||||
priv->tx_width = width;
|
||||
|
||||
tt550_tuning_factor_calc (rig, TRANSMIT);
|
||||
|
||||
mdbuf_len = sprintf (mdbuf, "M%c%c" EOM, ttmode, ttmode);
|
||||
retval = write_block (&rs->rigport, mdbuf, mdbuf_len);
|
||||
|
||||
|
||||
mdbuf_len = sprintf (mdbuf, "C%c" EOM
|
||||
"T%c%c%c%c%c%c" EOM,
|
||||
ttfilter,
|
||||
priv->ctf >> 8, priv->ctf & 0xff, priv->ftf >> 8,
|
||||
priv->ftf & 0xff, priv->btf >> 8, priv->btf & 0xff);
|
||||
retval = write_block (&rs->rigport, mdbuf, mdbuf_len);
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
priv->tx_mode = saved_mode;
|
||||
@ -859,6 +858,20 @@ tt550_set_tx_mode (RIG * rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
||||
return retval;
|
||||
}
|
||||
|
||||
if (width != RIG_PASSBAND_NOCHANGE) {
|
||||
mdbuf_len = sprintf (mdbuf, "C%c" EOM
|
||||
"T%c%c%c%c%c%c" EOM,
|
||||
ttfilter,
|
||||
priv->ctf >> 8, priv->ctf & 0xff, priv->ftf >> 8,
|
||||
priv->ftf & 0xff, priv->btf >> 8, priv->btf & 0xff);
|
||||
retval = write_block (&rs->rigport, mdbuf, mdbuf_len);
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
priv->tx_width = saved_width;
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
12
wj/wj.c
12
wj/wj.c
@ -122,7 +122,7 @@ static int wj_transaction(RIG *rig, int monitor)
|
||||
default:
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
buf[5] |= (wj_width & 0x2)<<3;
|
||||
buf[5] |= (wj_width & 0x7)<<3;
|
||||
|
||||
/* Detection mode */
|
||||
switch (priv->mode) {
|
||||
@ -137,7 +137,7 @@ static int wj_transaction(RIG *rig, int monitor)
|
||||
__FUNCTION__, priv->mode);
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
buf[5] |= wj_mode & 0x3;
|
||||
buf[5] |= wj_mode & 0x7;
|
||||
|
||||
/* BFO frequency, not sure though */
|
||||
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;
|
||||
|
||||
if (width == RIG_PASSBAND_NORMAL)
|
||||
width = rig_passband_normal(rig, mode);
|
||||
if (width != RIG_PASSBAND_NOCHANGE) {
|
||||
if (width == RIG_PASSBAND_NORMAL)
|
||||
width = rig_passband_normal(rig, mode);
|
||||
|
||||
priv->width = width;
|
||||
priv->width = width;
|
||||
}
|
||||
|
||||
return wj_transaction (rig, 0);
|
||||
}
|
||||
|
@ -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_LSB: md = MODE_LSB; break;
|
||||
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;
|
||||
else
|
||||
md = MODE_AMW;
|
||||
break;
|
||||
case RIG_MODE_FM:
|
||||
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_FMN;
|
||||
else
|
||||
md = MODE_FMW;
|
||||
break;
|
||||
case RIG_MODE_CW:
|
||||
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_CWN;
|
||||
else
|
||||
md = MODE_CWW;
|
||||
|
@ -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 */
|
||||
}
|
||||
|
||||
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 |= 0x08;
|
||||
}
|
||||
|
||||
|
@ -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_WFM: md = MODE_SET_WFM; break;
|
||||
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_SET_AMN;
|
||||
else
|
||||
md = MODE_SET_AMW;
|
||||
|
@ -533,6 +533,7 @@ int ft100_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) {
|
||||
if (ret != RIG_OK)
|
||||
return ret;
|
||||
|
||||
if (RIG_PASSBAND_NOCHANGE == width) return ret;
|
||||
#if 1
|
||||
if (mode != RIG_MODE_FM && mode != RIG_MODE_WFM && width <= kHz(6))
|
||||
{
|
||||
|
@ -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 */
|
||||
}
|
||||
|
||||
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 |= 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 */
|
||||
}
|
||||
|
||||
if (width != RIG_PASSBAND_NORMAL &&
|
||||
width < rig_passband_normal(rig, mode)) {
|
||||
if (RIG_PASSBAND_NOCHANGE != width
|
||||
&& width != RIG_PASSBAND_NORMAL
|
||||
&& width < rig_passband_normal(rig, mode)) {
|
||||
md |= 0x80;
|
||||
}
|
||||
|
||||
|
@ -477,13 +477,15 @@ int ft747_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width ) {
|
||||
|
||||
switch(mode) {
|
||||
case RIG_MODE_AM:
|
||||
if (width < width_normal)
|
||||
if (width != RIG_PASSBAND_NOCHANGE
|
||||
&& width < width_normal)
|
||||
cmd_index = FT_747_NATIVE_MODE_SET_AMN;
|
||||
else
|
||||
cmd_index = FT_747_NATIVE_MODE_SET_AMW;
|
||||
break;
|
||||
case RIG_MODE_CW:
|
||||
if (width < width_normal)
|
||||
if (width != RIG_PASSBAND_NOCHANGE
|
||||
&& width < width_normal)
|
||||
cmd_index = FT_747_NATIVE_MODE_SET_CWN;
|
||||
else
|
||||
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;
|
||||
break;
|
||||
case RIG_MODE_FM:
|
||||
if (width < width_normal)
|
||||
if (width != RIG_PASSBAND_NOCHANGE
|
||||
&& width < width_normal)
|
||||
cmd_index = FT_747_NATIVE_MODE_SET_FMN;
|
||||
else
|
||||
cmd_index = FT_747_NATIVE_MODE_SET_FMW;
|
||||
|
@ -735,8 +735,9 @@ int mode2rig(RIG *rig, rmode_t mode, pbwidth_t width)
|
||||
break;
|
||||
|
||||
case RIG_MODE_CW:
|
||||
if (width == RIG_PASSBAND_NORMAL ||
|
||||
width >= rig_passband_normal(rig, mode))
|
||||
if (RIG_PASSBAND_NOCHANGE == width
|
||||
|| width == RIG_PASSBAND_NORMAL
|
||||
|| width >= rig_passband_normal(rig, mode))
|
||||
md = MODE_CWW;
|
||||
else
|
||||
md = MODE_CWN;
|
||||
|
@ -628,21 +628,23 @@ 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
|
||||
*
|
||||
*/
|
||||
if (width == rig_passband_narrow(rig, mode)) {
|
||||
switch(mode) {
|
||||
case RIG_MODE_CW:
|
||||
mode_parm = MODE_SET_CW_N;
|
||||
break;
|
||||
case RIG_MODE_AM:
|
||||
mode_parm = MODE_SET_AM_N;
|
||||
break;
|
||||
default:
|
||||
return -RIG_EINVAL; /* Invalid mode, how can caller know? */
|
||||
}
|
||||
} else {
|
||||
if (width != RIG_PASSBAND_NORMAL &&
|
||||
width != rig_passband_normal(rig, mode)) {
|
||||
return -RIG_EINVAL; /* Invalid width, how can caller know? */
|
||||
if (width != RIG_PASSBAND_NOCHANGE) {
|
||||
if (width == rig_passband_narrow(rig, mode)) {
|
||||
switch(mode) {
|
||||
case RIG_MODE_CW:
|
||||
mode_parm = MODE_SET_CW_N;
|
||||
break;
|
||||
case RIG_MODE_AM:
|
||||
mode_parm = MODE_SET_AM_N;
|
||||
break;
|
||||
default:
|
||||
return -RIG_EINVAL; /* Invalid mode, how can caller know? */
|
||||
}
|
||||
} else {
|
||||
if (width != RIG_PASSBAND_NORMAL &&
|
||||
width != rig_passband_normal(rig, mode)) {
|
||||
return -RIG_EINVAL; /* Invalid width, how can caller know? */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -663,36 +663,38 @@ int ft847_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) {
|
||||
/*
|
||||
* Now set width
|
||||
*/
|
||||
|
||||
if (width == rig_passband_narrow(rig, mode)) {
|
||||
switch(mode) {
|
||||
case RIG_MODE_AM:
|
||||
cmd_index = FT_847_NATIVE_CAT_SET_MODE_MAIN_AMN;
|
||||
break;
|
||||
case RIG_MODE_FM:
|
||||
cmd_index = FT_847_NATIVE_CAT_SET_MODE_MAIN_FMN;
|
||||
break;
|
||||
case RIG_MODE_CW:
|
||||
cmd_index = FT_847_NATIVE_CAT_SET_MODE_MAIN_CWN;
|
||||
break;
|
||||
case RIG_MODE_CWR:
|
||||
cmd_index = FT_847_NATIVE_CAT_SET_MODE_MAIN_CWRN;
|
||||
break;
|
||||
case RIG_MODE_USB:
|
||||
case RIG_MODE_LSB:
|
||||
break;
|
||||
default:
|
||||
rig_debug(RIG_DEBUG_ERR,"%s: unsupported mode/width: %s/%d, narrow: %d\n",
|
||||
__FUNCTION__, rig_strrmode(mode), width,
|
||||
rig_passband_narrow(rig, mode));
|
||||
return -RIG_EINVAL; /* sorry, wrong MODE/WIDTH combo */
|
||||
}
|
||||
} else {
|
||||
if (width != RIG_PASSBAND_NOCHANGE) {
|
||||
if (width == rig_passband_narrow(rig, mode)) {
|
||||
switch(mode) {
|
||||
case RIG_MODE_AM:
|
||||
cmd_index = FT_847_NATIVE_CAT_SET_MODE_MAIN_AMN;
|
||||
break;
|
||||
case RIG_MODE_FM:
|
||||
cmd_index = FT_847_NATIVE_CAT_SET_MODE_MAIN_FMN;
|
||||
break;
|
||||
case RIG_MODE_CW:
|
||||
cmd_index = FT_847_NATIVE_CAT_SET_MODE_MAIN_CWN;
|
||||
break;
|
||||
case RIG_MODE_CWR:
|
||||
cmd_index = FT_847_NATIVE_CAT_SET_MODE_MAIN_CWRN;
|
||||
break;
|
||||
case RIG_MODE_USB:
|
||||
case RIG_MODE_LSB:
|
||||
break;
|
||||
default:
|
||||
rig_debug(RIG_DEBUG_ERR,"%s: unsupported mode/width: %s/%d, narrow: %d\n",
|
||||
__FUNCTION__, rig_strrmode(mode), width,
|
||||
rig_passband_narrow(rig, mode));
|
||||
return -RIG_EINVAL; /* sorry, wrong MODE/WIDTH combo */
|
||||
}
|
||||
} else {
|
||||
if (width != RIG_PASSBAND_NORMAL &&
|
||||
width != rig_passband_normal(rig, mode)) {
|
||||
return -RIG_EINVAL; /* sorry, wrong MODE/WIDTH combo */
|
||||
}
|
||||
}
|
||||
width != rig_passband_normal(rig, mode)) {
|
||||
return -RIG_EINVAL; /* sorry, wrong MODE/WIDTH combo */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Now send the command
|
||||
*/
|
||||
|
@ -783,7 +783,7 @@ int ft857_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
if (width != RIG_PASSBAND_NORMAL)
|
||||
if (width != RIG_PASSBAND_NOCHANGE && width != RIG_PASSBAND_NORMAL)
|
||||
return -RIG_EINVAL;
|
||||
|
||||
rig_force_cache_timeout(&((struct ft857_priv_data *) rig->state.priv)->fm_status_tv);
|
||||
|
@ -566,21 +566,23 @@ 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
|
||||
*
|
||||
*/
|
||||
if (width == rig_passband_narrow(rig, mode)) {
|
||||
switch(mode) {
|
||||
case RIG_MODE_CW:
|
||||
mode_parm = MODE_SET_CW_N;
|
||||
break;
|
||||
case RIG_MODE_AM:
|
||||
mode_parm = MODE_SET_AM_N;
|
||||
break;
|
||||
default:
|
||||
return -RIG_EINVAL; /* Invalid mode, how can caller know? */
|
||||
}
|
||||
} else {
|
||||
if (width != RIG_PASSBAND_NORMAL &&
|
||||
width != rig_passband_normal(rig, mode)) {
|
||||
return -RIG_EINVAL; /* Invalid width, how can caller know? */
|
||||
if (width != RIG_PASSBAND_NOCHANGE) {
|
||||
if (width == rig_passband_narrow(rig, mode)) {
|
||||
switch(mode) {
|
||||
case RIG_MODE_CW:
|
||||
mode_parm = MODE_SET_CW_N;
|
||||
break;
|
||||
case RIG_MODE_AM:
|
||||
mode_parm = MODE_SET_AM_N;
|
||||
break;
|
||||
default:
|
||||
return -RIG_EINVAL; /* Invalid mode, how can caller know? */
|
||||
}
|
||||
} else {
|
||||
if (width != RIG_PASSBAND_NORMAL &&
|
||||
width != rig_passband_normal(rig, mode)) {
|
||||
return -RIG_EINVAL; /* Invalid width, how can caller know? */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -798,7 +798,7 @@ int ft897_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
if (width != RIG_PASSBAND_NORMAL)
|
||||
if (width != RIG_PASSBAND_NOCHANGE && width != RIG_PASSBAND_NORMAL)
|
||||
return -RIG_EINVAL;
|
||||
|
||||
rig_force_cache_timeout(&((struct ft897_priv_data *) rig->state.priv)->fm_status_tv);
|
||||
|
@ -566,21 +566,23 @@ 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
|
||||
*
|
||||
*/
|
||||
if (width == rig_passband_narrow(rig, mode)) {
|
||||
switch(mode) {
|
||||
case RIG_MODE_CW:
|
||||
mode_parm = MODE_SET_CW_N;
|
||||
break;
|
||||
case RIG_MODE_AM:
|
||||
mode_parm = MODE_SET_AM_N;
|
||||
break;
|
||||
default:
|
||||
return -RIG_EINVAL; /* Invalid mode, how can caller know? */
|
||||
}
|
||||
} else {
|
||||
if (width != RIG_PASSBAND_NORMAL &&
|
||||
width != rig_passband_normal(rig, mode)) {
|
||||
return -RIG_EINVAL; /* Invalid width, how can caller know? */
|
||||
if (width != RIG_PASSBAND_NOCHANGE) {
|
||||
if (width == rig_passband_narrow(rig, mode)) {
|
||||
switch(mode) {
|
||||
case RIG_MODE_CW:
|
||||
mode_parm = MODE_SET_CW_N;
|
||||
break;
|
||||
case RIG_MODE_AM:
|
||||
mode_parm = MODE_SET_AM_N;
|
||||
break;
|
||||
default:
|
||||
return -RIG_EINVAL; /* Invalid mode, how can caller know? */
|
||||
}
|
||||
} else {
|
||||
if (width != RIG_PASSBAND_NORMAL &&
|
||||
width != rig_passband_normal(rig, mode)) {
|
||||
return -RIG_EINVAL; /* Invalid width, how can caller know? */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -723,48 +723,50 @@ static int ft920_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width ) {
|
||||
* Yeah, it's ugly... -N0NB
|
||||
*
|
||||
*/
|
||||
if (width == RIG_PASSBAND_NORMAL || width == rig_passband_normal(rig, mode)) {
|
||||
if (width != RIG_PASSBAND_NOCHANGE) {
|
||||
if (width == RIG_PASSBAND_NORMAL || width == rig_passband_normal(rig, mode)) {
|
||||
switch(vfo) {
|
||||
case RIG_VFO_A:
|
||||
case RIG_VFO_VFO:
|
||||
case RIG_VFO_MEM:
|
||||
case RIG_VFO_MAIN:
|
||||
cmd_index = FT920_NATIVE_VFO_A_PASSBAND_WIDE;
|
||||
break;
|
||||
cmd_index = FT920_NATIVE_VFO_A_PASSBAND_WIDE;
|
||||
break;
|
||||
case RIG_VFO_B:
|
||||
case RIG_VFO_SUB:
|
||||
cmd_index = FT920_NATIVE_VFO_B_PASSBAND_WIDE;
|
||||
break;
|
||||
cmd_index = FT920_NATIVE_VFO_B_PASSBAND_WIDE;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
} else {
|
||||
if (width == rig_passband_narrow(rig, mode)) {
|
||||
switch(mode) {
|
||||
case RIG_MODE_CW:
|
||||
case RIG_MODE_AM:
|
||||
case RIG_MODE_FM:
|
||||
case RIG_MODE_PKTFM:
|
||||
case RIG_MODE_RTTY:
|
||||
switch(vfo) {
|
||||
case RIG_VFO_A:
|
||||
case RIG_VFO_VFO:
|
||||
case RIG_VFO_MEM:
|
||||
case RIG_VFO_MAIN:
|
||||
cmd_index = FT920_NATIVE_VFO_A_PASSBAND_NAR;
|
||||
break;
|
||||
case RIG_VFO_B:
|
||||
case RIG_VFO_SUB:
|
||||
cmd_index = FT920_NATIVE_VFO_B_PASSBAND_NAR;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return -RIG_EINVAL; /* Invalid mode; how can caller know? */
|
||||
switch(mode) {
|
||||
case RIG_MODE_CW:
|
||||
case RIG_MODE_AM:
|
||||
case RIG_MODE_FM:
|
||||
case RIG_MODE_PKTFM:
|
||||
case RIG_MODE_RTTY:
|
||||
switch(vfo) {
|
||||
case RIG_VFO_A:
|
||||
case RIG_VFO_VFO:
|
||||
case RIG_VFO_MEM:
|
||||
case RIG_VFO_MAIN:
|
||||
cmd_index = FT920_NATIVE_VFO_A_PASSBAND_NAR;
|
||||
break;
|
||||
case RIG_VFO_B:
|
||||
case RIG_VFO_SUB:
|
||||
cmd_index = FT920_NATIVE_VFO_B_PASSBAND_NAR;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return -RIG_EINVAL; /* Invalid mode; how can caller know? */
|
||||
}
|
||||
} else {
|
||||
if (width != RIG_PASSBAND_NORMAL && width != rig_passband_normal(rig, mode)) {
|
||||
return -RIG_EINVAL; /* Invalid width; how can caller know? */
|
||||
}
|
||||
if (width != RIG_PASSBAND_NORMAL && width != rig_passband_normal(rig, mode)) {
|
||||
return -RIG_EINVAL; /* Invalid width; how can caller know? */
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: set mode_parm = 0x%02x\n", __func__, mode_parm);
|
||||
|
@ -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 */
|
||||
}
|
||||
|
||||
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) {
|
||||
case MD_CW: md = MD_CWN; break;
|
||||
case MD_AM: md = MD_AMN; break;
|
||||
|
@ -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)
|
||||
return RIG_OK;
|
||||
|
||||
if (RIG_PASSBAND_NOCHANGE == width) return err;
|
||||
switch(width) {
|
||||
case 250:
|
||||
bw = FT990_BW_F250;
|
||||
|
@ -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",
|
||||
__func__, mode);
|
||||
|
||||
if (RIG_PASSBAND_NORMAL == width)
|
||||
width = rig_passband_normal(rig, mode);
|
||||
|
||||
switch(mode) {
|
||||
case RIG_MODE_LSB:
|
||||
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)
|
||||
return err;
|
||||
|
||||
if (RIG_PASSBAND_NOCHANGE == width) return err;
|
||||
if (RIG_PASSBAND_NORMAL == width)
|
||||
width = rig_passband_normal(rig, mode);
|
||||
|
||||
|
@ -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_FM: md = MODE_FMN; break;
|
||||
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;
|
||||
else if (width != RIG_PASSBAND_NORMAL && width > rig_passband_normal(rig, mode))
|
||||
md = MODE_AMW;
|
||||
|
Loading…
Reference in New Issue
Block a user