Fix IC7300 set mode FM

Allow IC7300 to use width of 1,2,3 to select filter
pull/1626/head
Mike Black W9MDB 2024-10-13 16:10:00 -05:00
rodzic 327517a881
commit 41eb2b076c
4 zmienionych plików z 49 dodań i 18 usunięć

1
NEWS
Wyświetl plik

@ -13,6 +13,7 @@ Version 5.x -- future
* Change FT1000MP Mark V model names to align with FT1000MP
Version 4.6
* IC7300 Mode filter can now be set by # (i.e. 1,2,3)
* Fixed AF6SA WRC rotor controller
* Added Rhode&Schwarz XK852
* Added Xiegu X6200

Wyświetl plik

@ -67,7 +67,7 @@ int ic9700_set_vfo(RIG *rig, vfo_t vfo);
#define IC7300_PARMS (RIG_PARM_ANN|RIG_PARM_BACKLIGHT|RIG_PARM_SCREENSAVER|RIG_PARM_TIME|RIG_PARM_BEEP|RIG_PARM_KEYERTYPE|RIG_PARM_AFIF)
#define IC7300_VFO_OPS (RIG_OP_CPY|RIG_OP_XCHG|RIG_OP_FROM_VFO|RIG_OP_TO_VFO|RIG_OP_MCL|RIG_OP_TUNE)
#define IC7300_SCAN_OPS (RIG_SCAN_STOP|RIG_SCAN_MEM|RIG_SCAN_PROG|RIG_SCAN_SLCT)
#define IC7300_SCAN_OPS (RIG_SCAN_STOP|RIG_SCAN_MEM|RIG_SCAN_PROG|RIG_SCAN_SLCT|RIG_SCAN_VFO)
#define IC7300_ANTS (RIG_ANT_1) /* ant-1 is Hf-6m */
@ -419,7 +419,8 @@ static const struct icom_priv_caps IC7300_priv_caps =
.x1cx03_possibly = 1,
.x1ax03_supported = 1,
.mode_with_filter = 1,
.data_mode_supported = 1
.data_mode_supported = 1,
.fm_filters = { 7000, 10000, 15000 }
};
static const struct icom_priv_caps IC9700_priv_caps =
@ -474,7 +475,7 @@ static const struct icom_priv_caps IC9700_priv_caps =
.x1cx03_possibly = 1,
.x1ax03_supported = 1,
.mode_with_filter = 1,
.data_mode_supported = 1
.data_mode_supported = 1,
};
static const struct icom_priv_caps IC705_priv_caps =
@ -741,7 +742,7 @@ struct rig_caps ic7300_caps =
RIG_MODEL(RIG_MODEL_IC7300),
.model_name = "IC-7300",
.mfg_name = "Icom",
.version = BACKEND_VER ".13",
.version = BACKEND_VER ".14",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER,

Wyświetl plik

@ -512,19 +512,19 @@ const struct confparams icom_cfg_params[] =
},
{
TOK_FILTER_USBD, "filter_usbd", "Filter to use USBD", "Filter to use for USBD/LSBD when setting mode",
"0", RIG_CONF_NUMERIC, {.n = {0, 3, 1}}
"1", RIG_CONF_NUMERIC, {.n = {0, 3, 1}}
},
{
TOK_FILTER_USB, "filter_usb", "Filter to use USB", "Filter to use when for USB/LSB setting mode",
"0", RIG_CONF_NUMERIC, {.n = {0, 3, 1}}
"2", RIG_CONF_NUMERIC, {.n = {0, 3, 1}}
},
{
TOK_FILTER_CW, "filter_cw", "Filter to use CW", "Filter to use for CW/CWR when setting mode",
"0", RIG_CONF_NUMERIC, {.n = {0, 3, 1}}
"3", RIG_CONF_NUMERIC, {.n = {0, 3, 1}}
},
{
TOK_FILTER_FM, "filter_fm", "Filter to use FM", "Filter to use for FM/PKTFM when setting mode",
"0", RIG_CONF_NUMERIC, {.n = {0, 3, 1}}
"1", RIG_CONF_NUMERIC, {.n = {0, 3, 1}}
},
{RIG_CONF_END, NULL,}
};
@ -858,6 +858,7 @@ static int icom_check_ack(int ack_len, unsigned char *ackbuf)
{
// if we don't get ACK/NAK some serial corruption occurred
// so we'll call it a timeout for retry purposes
rig_debug(RIG_DEBUG_WARN, "%s: command timed out (%#.2x)\n", __func__, ackbuf[0]);
return -RIG_ETIMEOUT;
}
@ -2346,7 +2347,7 @@ static int icom_get_mode_x26(RIG *rig, vfo_t vfo, int *mode_len,
static int icom_set_mode_x26(RIG *rig, vfo_t vfo, rmode_t mode,
rmode_t icom_mode, int datamode,
int filter)
int filter, pbwidth_t width)
{
struct icom_priv_data *priv = STATE(rig)->priv;
const struct icom_priv_caps *priv_caps = rig->caps->priv;
@ -2354,6 +2355,7 @@ static int icom_set_mode_x26(RIG *rig, vfo_t vfo, rmode_t mode,
unsigned char buf[3];
unsigned char ackbuf[MAXFRAMELEN];
int ack_len = sizeof(ackbuf);
int buf_len = 3;
int mode_len;
unsigned char mode_buf[4];
@ -2380,25 +2382,45 @@ static int icom_set_mode_x26(RIG *rig, vfo_t vfo, rmode_t mode,
if (priv->filter_usbd > 0 && (mode == RIG_MODE_PKTUSB
|| mode == RIG_MODE_PKTLSB))
{
rig_debug(RIG_DEBUG_TRACE, "%s: filter usbd=%d\n", __func__, priv->filter_usbd);
rig_debug(RIG_DEBUG_TRACE, "%s: filter usbd=%d, width=%d\n", __func__, priv->filter_usbd, (int)width);
buf[2] = priv->filter_usbd;
if (width >= 1 && width <=3) buf[2] = width;
if (width == RIG_PASSBAND_NOCHANGE)
{
buf_len = 1;
}
}
else if (priv->filter_usb > 0 && (mode == RIG_MODE_USB || mode == RIG_MODE_LSB))
{
rig_debug(RIG_DEBUG_TRACE, "%s: filter usb=%d\n", __func__, priv->filter_usb);
buf[2] = priv->filter_usb;
if (width == RIG_PASSBAND_NOCHANGE)
{
buf_len = 1;
}
}
else if (priv->filter_cw > 0 && (mode == RIG_MODE_CW || mode == RIG_MODE_CWR))
{
rig_debug(RIG_DEBUG_TRACE, "%s: filter cw=%d\n", __func__, priv->filter_cw);
buf[2] = priv->filter_cw;
if (width == RIG_PASSBAND_NOCHANGE)
{
buf_len = 1;
}
}
else if (priv->filter_fm > 0 && (mode == RIG_MODE_FM || mode == RIG_MODE_PKTFM))
else if (mode == RIG_MODE_FM || mode == RIG_MODE_PKTFM)
{
rig_debug(RIG_DEBUG_TRACE, "%s: filter fm=%d\n", __func__, priv->filter_fm);
buf[2] = priv->filter_fm;
rig_debug(RIG_DEBUG_TRACE, "%s: width=%d\n", __func__, (int)width);
buf[2] = width;
if (width > 10000) buf[2] = 1;
else if (width > 7000) buf[2] = 2;
else if (width > 3) buf[2] = 3;
if (width == RIG_PASSBAND_NOCHANGE)
{
buf_len = 1;
}
}
int vfo_number = icom_get_vfo_number_x25x26(rig, vfo);
@ -2406,7 +2428,7 @@ static int icom_set_mode_x26(RIG *rig, vfo_t vfo, rmode_t mode,
rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s, vfo_number=%d\n", __func__,
rig_strvfo(vfo), vfo_number);
retval = icom_transaction(rig, C_SEND_SEL_MODE, vfo_number, buf, 3, ackbuf,
retval = icom_transaction(rig, C_SEND_SEL_MODE, vfo_number, buf, buf_len, ackbuf,
&ack_len);
if (priv->x26cmdfails < 0 || priv_caps->x25x26_always)
@ -2568,11 +2590,17 @@ int icom_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
if (datamode[0] == 0) { datamode[1] = 0; } // the only good combo possible according to manual
// we need to let FM mode widths through here with datamode[1] set to FM width
if((RIG_IS_IC7300 || RIG_IS_IC9700) && (mode == RIG_MODE_FM || mode == RIG_MODE_WFM))
if((priv_caps->fm_filters != NULL) && (mode == RIG_MODE_FM || mode == RIG_MODE_WFM))
{
if (width <= 7000) datamode[1] = 3;
else if (width <= 10000) datamode[1] = 2;
// assumed fm_filters is ascending sequence -- see ic7300.c for example
if (width <= 3) datamode[1] = width;
else if (width <= priv_caps->fm_filters[0]) datamode[1] = 3;
else if (width <= priv_caps->fm_filters[1]) datamode[1] = 2;
else datamode[1] = 1;
if (width > 3)
{
rig_debug(RIG_DEBUG_WARN, "%s: IC7300 width set by 1,2,3 - adjustable widht not implemented yet\n", __func__);
}
}
rig_debug(RIG_DEBUG_TRACE, "%s(%d) mode_icom=%d, datamode=%d, filter=%d\n",
@ -2585,7 +2613,7 @@ int icom_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
else
{
if (datamode[0] == 0) datamode[1] = 0;
retval = icom_set_mode_x26(rig, vfo, mode, mode_icom, datamode[0], datamode[1]);
retval = icom_set_mode_x26(rig, vfo, mode, mode_icom, datamode[0], datamode[1], width);
}
if (retval != RIG_OK)

Wyświetl plik

@ -251,6 +251,7 @@ struct icom_priv_caps
int x1ax03_supported; /*!< Rig supports setting/getting filter width */
int mode_with_filter; /*!< Rig mode commands include filter selection */
int data_mode_supported; /*!< Rig supports data mode flag */
int fm_filters[3]; /*!< For models with FIL1/2/3 for FM low-to-high fixed filters -- IC7300/9700 */
};
struct icom_priv_data