Test for passband width < 0 or normal passband

Use the absolute value of any negative value that may be passed in via
the width parameter to set_mode.

If RIG_PASSBAND_NORMAL is passed in, call rig_passband_normal() to
determine the normal width for the mode before selecting the correct
filter (needs testing).
Hamlib-1.2.15
Nate Bargmann 2012-06-15 18:30:57 -05:00
rodzic 370ce23c29
commit 94ea3ced4c
1 zmienionych plików z 7 dodań i 1 usunięć

Wyświetl plik

@ -104,7 +104,7 @@ const struct rig_caps k2_caps = {
.rig_model = RIG_MODEL_K2, .rig_model = RIG_MODEL_K2,
.model_name = "K2", .model_name = "K2",
.mfg_name = "Elecraft", .mfg_name = "Elecraft",
.version = "20110603", .version = "20120615",
.copyright = "LGPL", .copyright = "LGPL",
.status = RIG_STATUS_BETA, .status = RIG_STATUS_BETA,
.rig_type = RIG_TYPE_TRANSCEIVER, .rig_type = RIG_TYPE_TRANSCEIVER,
@ -298,11 +298,17 @@ int k2_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
return -RIG_EINVAL; return -RIG_EINVAL;
} }
if (width < 0)
width = labs(width);
/* Step through the filter list looking for the best match /* Step through the filter list looking for the best match
* for the passed in width. The choice is to select the filter * for the passed in width. The choice is to select the filter
* that is wide enough for the width without being too narrow * that is wide enough for the width without being too narrow
* if possible. * 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) if (width > flt->filt_list[0].width || ((flt->filt_list[0].width >= width)
&& (width > flt->filt_list[1].width))) { && (width > flt->filt_list[1].width))) {
width = flt->filt_list[0].width; width = flt->filt_list[0].width;