Skip to content

Commit 12cc40f

Browse files
jj1bdxN0NB
authored andcommitted
Fix IC-705 filter selection and bandwidth handling for FM and WFM
* Enable `.fm_filters` in `IC705_priv_caps` * `icom_get_mode_without_data()`: activate FM filter selection code if `RIG_IS_IC705` * `icom2rig_mode()`: activate FM filter fixed width code if `RIG_IS_IC705` * TODO: cases in WFM should be solved independently * `icom2rig_mode()`: handle FM and WFM separately and correctly at least for IC-705, no changes for IC-7300 and IC-9700 * `icom_get_mode_without_data()`: add WFM to the code assuming that values from `icom2rig_mode()` is correct * icom.c: A partial rollback for Hamlib@a395b91 * The workaround to use `icom_set_mode_without_data()` is not necessary * The later experiments showed CI-V command 0x26 worked OK too for WFM * Add WFM freq to ic705_caps.filters * Fix icom_set_mode_x26() FM behavior `icom_set_mode_x26()` did not pass the correct command value for FM or PKTFM modes when width is set to `RIG_PASSBAND_NORMAL` (i.e., 0 (zero)). With this source code change, the command value `buf[2]` is forcefully set to 1 when `RIG_PASSBAND_NORMAL` or `RIG_PASSBAND_NOCHANGE` are passed to the parameter `width`. This fix solves the bug for IC-705 with rigctl when entering the command `M FM 0` after `M WFM 0` *did not* change the mode properly to (narrow) FM.
1 parent fa2520c commit 12cc40f

File tree

3 files changed

+57
-17
lines changed

3 files changed

+57
-17
lines changed

rigs/icom/frame.c

+19-7
Original file line numberDiff line numberDiff line change
@@ -814,15 +814,27 @@ void icom2rig_mode(RIG *rig, unsigned char md, int pd, rmode_t *mode,
814814
rig_debug(RIG_DEBUG_TRACE, "%s: mode=0x%02x, pd=%d\n", __func__, md, pd);
815815

816816
// Some rigs return fixed with for FM mode
817-
if ((RIG_IS_IC7300 || RIG_IS_IC9700) && (md == S_FM || md == S_WFM))
818-
{
819-
*mode = RIG_MODE_FM;
817+
if (RIG_IS_IC7300 || RIG_IS_IC9700 || RIG_IS_IC705) {
818+
if (md == S_FM) {
819+
*mode = RIG_MODE_FM;
820820

821-
if (*width == 1) { *width = 15000; }
822-
else if (*width == 2) { *width = 10000; }
823-
else { *width = 7000; }
821+
if (*width == 1) { *width = 15000; }
822+
else if (*width == 2) { *width = 10000; }
823+
else { *width = 7000; }
824+
825+
return;
826+
} else if (md == S_WFM) {
827+
828+
// For IC-705, *width will always be 1
829+
// At least this works for IC-705
824830

825-
return;
831+
*mode = RIG_MODE_WFM;
832+
*width = 200000;
833+
834+
return;
835+
}
836+
// If not FM nor SFM mode,
837+
// fall down this block for further processing
826838
}
827839

828840
*width = RIG_PASSBAND_NORMAL;

rigs/icom/ic7300.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,8 @@ static const struct icom_priv_caps IC705_priv_caps =
637637
.x1cx03_possibly = 1,
638638
.x1ax03_supported = 1,
639639
.mode_with_filter = 1,
640-
.data_mode_supported = 1
640+
.data_mode_supported = 1,
641+
.fm_filters = { 7000, 10000, 15000 }
641642
};
642643

643644
static const struct icom_priv_caps IC905_priv_caps =
@@ -1498,6 +1499,7 @@ struct rig_caps ic705_caps =
14981499
{RIG_MODE_FM | RIG_MODE_PKTFM, kHz(10)},
14991500
{RIG_MODE_FM | RIG_MODE_PKTFM, kHz(7)},
15001501
{RIG_MODE_FM | RIG_MODE_PKTFM, kHz(15)},
1502+
{RIG_MODE_WFM, kHz(200)},
15011503
RIG_FLT_END,
15021504
},
15031505

rigs/icom/icom.c

+35-9
Original file line numberDiff line numberDiff line change
@@ -2441,6 +2441,22 @@ static int icom_set_mode_x26(RIG *rig, vfo_t vfo, rmode_t mode,
24412441
if (width > 10000) { buf[2] = 1; }
24422442
else if (width > 7000) { buf[2] = 2; }
24432443
else if (width > 3) { buf[2] = 3; }
2444+
// Set "normal" bandwidth explicitly here
2445+
// when width is zero or even less
2446+
// (namely RIG_PASSBAND_NORMAL or RIG_PASSBAND_NOCHANGE)
2447+
else if (width < 1) { buf[2] = 1; }
2448+
2449+
if (width == RIG_PASSBAND_NOCHANGE)
2450+
{
2451+
buf_len = 1;
2452+
}
2453+
}
2454+
else if (mode == RIG_MODE_WFM)
2455+
{
2456+
rig_debug(RIG_DEBUG_TRACE, "%s: wfm_width=%d\n", __func__, (int)width);
2457+
// For IC-705, there's only one filter mode for WFM
2458+
// So set always to 1
2459+
buf[2] = 1;
24442460

24452461
if (width == RIG_PASSBAND_NOCHANGE)
24462462
{
@@ -2574,9 +2590,7 @@ int icom_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
25742590
(int) base_mode, (int) width, rig_strvfo(rs->current_vfo));
25752591

25762592
// It is only necessary to change base mode if command 0x26 is not supported
2577-
// NOTE: IC-705 does not support WFM for command 0x26
2578-
if (!(rs->targetable_vfo & RIG_TARGETABLE_MODE) || force_vfo_swap ||
2579-
(RIG_IS_IC705 && (mode == RIG_MODE_WFM)))
2593+
if (!(rs->targetable_vfo & RIG_TARGETABLE_MODE) || force_vfo_swap)
25802594
{
25812595
retval = icom_set_mode_without_data(rig, vfo, base_mode, width);
25822596
}
@@ -2625,8 +2639,8 @@ int icom_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
26252639
if (datamode[0] == 0) { datamode[1] = 0; } // the only good combo possible according to manual
26262640

26272641
// we need to let FM mode widths through here with datamode[1] set to FM width
2628-
if ((priv_caps->fm_filters[0] != 0) && (mode == RIG_MODE_FM
2629-
|| mode == RIG_MODE_WFM))
2642+
// (This is not applicable to WFM)
2643+
if ((priv_caps->fm_filters[0] != 0) && (mode == RIG_MODE_FM))
26302644
{
26312645
// assumed fm_filters is ascending sequence -- see ic7300.c for example
26322646
if (width >= 1 && width <= 3) { datamode[1] = width; }
@@ -2653,6 +2667,13 @@ int icom_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
26532667
{
26542668
if (datamode[0] == 0) { datamode[1] = 0; }
26552669

2670+
// For IC-705, this is the only valid values for WFM
2671+
if (RIG_IS_IC705 && (mode == RIG_MODE_WFM))
2672+
{
2673+
datamode[0] = 0;
2674+
datamode[1] = 1;
2675+
}
2676+
26562677
retval = icom_set_mode_x26(rig, vfo, mode, mode_icom, datamode[0], datamode[1],
26572678
width);
26582679
}
@@ -2816,8 +2837,8 @@ static int icom_get_mode_without_data(RIG *rig, vfo_t vfo, rmode_t *mode,
28162837
mode_len == 2 ? modebuf[2] : -1, mode, width);
28172838
}
28182839

2819-
if ((RIG_IS_IC7300 || RIG_IS_IC9700) && (*mode == RIG_MODE_FM
2820-
|| *mode == RIG_MODE_PKTFM))
2840+
if ((RIG_IS_IC7300 || RIG_IS_IC9700 || RIG_IS_IC705) && (*mode == RIG_MODE_FM
2841+
|| *mode == RIG_MODE_PKTFM || *mode == RIG_MODE_WFM))
28212842
{
28222843
// we already have width from icom2rig_mode
28232844
RETURNFUNC2(RIG_OK);
@@ -2849,7 +2870,7 @@ static int icom_get_mode_without_data(RIG *rig, vfo_t vfo, rmode_t *mode,
28492870

28502871
if (vfo == rs->current_vfo)
28512872
{
2852-
if (!((RIG_IS_IC7300 || RIG_IS_IC9700) && (*mode == RIG_MODE_FM
2873+
if (!((RIG_IS_IC7300 || RIG_IS_IC9700 || RIG_IS_IC705) && (*mode == RIG_MODE_FM
28532874
|| *mode == RIG_MODE_PKTFM))) // can't do this in FM mode
28542875
{
28552876
filter_width = icom_get_dsp_flt(rig, *mode);
@@ -2872,13 +2893,18 @@ static int icom_get_mode_without_data(RIG *rig, vfo_t vfo, rmode_t *mode,
28722893
{
28732894
*width = 12000; // some default to 12000
28742895

2875-
if (RIG_IS_IC7300 || RIG_IS_IC9700)
2896+
if (RIG_IS_IC7300 || RIG_IS_IC9700 || RIG_IS_IC705)
28762897
{
28772898
if (priv_data->filter == 1) { *width = 15000; }
28782899
else if (priv_data->filter == 2) { *width = 10000; }
28792900
else if (priv_data->filter == 3) { *width = 7000; }
28802901
}
28812902
}
2903+
else if (*mode == RIG_MODE_WFM)
2904+
{
2905+
// IC-705 only valid value
2906+
if (RIG_IS_IC705) { *width = 200000; }
2907+
}
28822908

28832909
RETURNFUNC2(RIG_OK);
28842910
}

0 commit comments

Comments
 (0)