Fix RIG_PASSBAND_NOCHANGE use with Icom data modes. Allow selecting FIL2 as normal passband when in data mode. Add new Icom rigs to list that determines whether Icom data mode command supports setting filter too.

This commit is contained in:
Mikael Nousiainen 2020-12-21 18:15:15 +02:00
parent 1d15625757
commit 9e62b2783f
2 changed files with 39 additions and 28 deletions

View File

@ -414,6 +414,8 @@ int rig2icom_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width,
{
case RIG_MODE_AM: icmode = S_AM; break;
case RIG_MODE_PKTAM: icmode = S_AM; break;
case RIG_MODE_AMN: icmode = S_AMN; break;
case RIG_MODE_AMS: icmode = S_AMS; break;
@ -440,8 +442,12 @@ int rig2icom_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width,
case RIG_MODE_FM: icmode = S_FM; break;
case RIG_MODE_PKTFM: icmode = S_FM; break;
case RIG_MODE_FMN: icmode = S_FMN; break;
case RIG_MODE_PKTFMN: icmode = S_FMN; break;
case RIG_MODE_WFM: icmode = S_WFM; break;
case RIG_MODE_P25: icmode = S_P25; break;
@ -468,15 +474,19 @@ int rig2icom_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width,
{
pbwidth_t medium_width = rig_passband_normal(rig, mode);
if (width == medium_width || width == RIG_PASSBAND_NORMAL)
if (width == RIG_PASSBAND_NORMAL)
{
icmode_ext =
-1; /* medium, no passband data-> rig default. Is medium always the default? */
// Use rig default for "normal" passband
icmode_ext = -1;
}
else if (width < medium_width)
{
icmode_ext = PD_NARROW_3;
}
else if (width == medium_width)
{
icmode_ext = PD_MEDIUM_3;
}
else
{
icmode_ext = PD_WIDE_3;

View File

@ -1572,10 +1572,19 @@ int icom_set_mode_with_data(RIG *rig, vfo_t vfo, rmode_t mode,
unsigned char ackbuf[MAXFRAMELEN];
int ack_len = sizeof(ackbuf);
rmode_t icom_mode;
unsigned char dm_sub_cmd = RIG_MODEL_IC7200 == rig->caps->rig_model ? 0x04 :
S_MEM_DATA_MODE;
int filter_byte = rig->caps->rig_model == RIG_MODEL_IC7300
|| rig->caps->rig_model == RIG_MODEL_IC7610;
unsigned char dm_sub_cmd =
rig->caps->rig_model == RIG_MODEL_IC7200 ? 0x04 : S_MEM_DATA_MODE;
int filter_byte = rig->caps->rig_model == RIG_MODEL_IC7100
|| rig->caps->rig_model == RIG_MODEL_IC7200
|| rig->caps->rig_model == RIG_MODEL_IC7300
|| rig->caps->rig_model == RIG_MODEL_IC7600
|| rig->caps->rig_model == RIG_MODEL_IC7610
|| rig->caps->rig_model == RIG_MODEL_IC7700
|| rig->caps->rig_model == RIG_MODEL_IC7800
|| rig->caps->rig_model == RIG_MODEL_IC785x
|| rig->caps->rig_model == RIG_MODEL_IC9100
|| rig->caps->rig_model == RIG_MODEL_IC9700
|| rig->caps->rig_model == RIG_MODEL_IC705;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
@ -1611,6 +1620,8 @@ int icom_set_mode_with_data(RIG *rig, vfo_t vfo, rmode_t mode,
if (RIG_OK == retval)
{
unsigned char datamode[2];
unsigned char mode_icom; // Not used, we only need the width
signed char width_icom;
switch (mode)
{
@ -1629,31 +1640,21 @@ int icom_set_mode_with_data(RIG *rig, vfo_t vfo, rmode_t mode,
break;
}
if (width != RIG_PASSBAND_NOCHANGE)
rig2icom_mode(rig, vfo, mode, width, &mode_icom, &width_icom);
if (filter_byte && width_icom != -1) // then we need the width byte too
{
unsigned char mode_icom; // not usb as it will map to USB/LSB
signed char width_icom;
rig2icom_mode(rig, vfo, mode, width, &mode_icom, &width_icom);
if (filter_byte && width_icom != -1) // then we need the width byte too
{
// since width_icom is 0-2 for rigs that need this here we have to make it 1-3
datamode[1] = datamode[0] ? width_icom : 0;
retval =
icom_transaction(rig, C_CTL_MEM, dm_sub_cmd, datamode, 2,
ackbuf,
&ack_len);
}
else
{
retval =
icom_transaction(rig, C_CTL_MEM, dm_sub_cmd, datamode, 1, ackbuf,
&ack_len);
}
// since width_icom is 0-2 for rigs that need this here we have to make it 1-3
datamode[1] = datamode[0] ? width_icom : 0;
retval =
icom_transaction(rig, C_CTL_MEM, dm_sub_cmd, datamode, 2,
ackbuf,
&ack_len);
}
else
{
rig_debug(RIG_DEBUG_TRACE, "%s RIG_PASSBAND_NOCHANGE\n", __func__);
return RIG_OK;
retval =
icom_transaction(rig, C_CTL_MEM, dm_sub_cmd, datamode, 1, ackbuf,
&ack_len);
}
if (retval != RIG_OK)