From 5883897656f7c8937d81af112ea7d9f7792e89f2 Mon Sep 17 00:00:00 2001 From: Michael Black W9MDB Date: Sat, 12 Dec 2020 23:05:59 -0600 Subject: [PATCH] icom.c passband nochange seems to be working https://github.com/Hamlib/Hamlib/issues/448 --- rigs/icom/frame.c | 5 ++--- rigs/icom/icom.c | 10 +++++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/rigs/icom/frame.c b/rigs/icom/frame.c index ec5e20e31..e52950add 100644 --- a/rigs/icom/frame.c +++ b/rigs/icom/frame.c @@ -404,7 +404,6 @@ int rig2icom_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width, "%s: Failed to get width for passband nochange err=%s\n", __func__, rigerror(ret)); } - return RIG_OK; } switch (mode) @@ -491,15 +490,15 @@ int rig2icom_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width, icmode_ext = PD_WIDE_3; /* default to Wide */ } } + *pd = icmode_ext; } else { // filter should already be set elsewhere - icmode_ext = priv_data->filter; + *pd = priv_data->filter; } *md = icmode; - *pd = icmode_ext; return RIG_OK; } diff --git a/rigs/icom/icom.c b/rigs/icom/icom.c index d4b66816b..1248b87bd 100644 --- a/rigs/icom/icom.c +++ b/rigs/icom/icom.c @@ -1604,6 +1604,7 @@ int icom_set_mode_with_data(RIG *rig, vfo_t vfo, rmode_t mode, break; } + rig_debug(RIG_DEBUG_VERBOSE, "%s mode=%d, width=%d\n", __func__, (int)icom_mode, (int)width); retval = icom_set_mode(rig, vfo, icom_mode, width); if (RIG_OK == retval) @@ -1704,16 +1705,18 @@ int icom_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { err = rig2icom_mode(rig, vfo, mode, width, &icmode, &icmode_ext); } + if (width == RIG_PASSBAND_NOCHANGE) icmode_ext = priv_data->filter; if (err < 0) { + rig_debug(RIG_DEBUG_ERR, "%s: Error on rig2icom err=%d\n", __func__, err); return err; } + rig_debug(RIG_DEBUG_VERBOSE, "%s: icmode=%d, icmode_ext=%d\n", __func__, icmode, icmode_ext); /* IC-731, IC-735, IC-7000 don't support passband data */ /* IC-726 & IC-475A/E also limited support - only on CW */ /* TODO: G4WJS CW wide/narrow are possible with above two radios */ - if (icmode_ext == -1) icmode_ext = priv_data->filter; if (priv->civ_731_mode || rig->caps->rig_model == RIG_MODEL_OS456 || rig->caps->rig_model == RIG_MODEL_IC726 || rig->caps->rig_model == RIG_MODEL_IC475 @@ -1722,6 +1725,7 @@ int icom_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) icmode_ext = -1; } + rig_debug(RIG_DEBUG_VERBOSE, "%s: #2 icmode=%d, icmode_ext=%d\n", __func__, icmode, icmode_ext); retval = icom_transaction(rig, C_SET_MODE, icmode, (unsigned char *) &icmode_ext, (icmode_ext == -1 ? 0 : 1), ackbuf, &ack_len); @@ -1771,6 +1775,7 @@ int icom_get_mode_with_data(RIG *rig, vfo_t vfo, rmode_t *mode, rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); retval = icom_get_mode(rig, vfo, mode, width); + rig_debug(RIG_DEBUG_VERBOSE, "%s mode=%d\n", __func__, (int)*mode); if (retval != RIG_OK) { return retval; @@ -1816,6 +1821,7 @@ int icom_get_mode_with_data(RIG *rig, vfo_t vfo, rmode_t *mode, return -RIG_ERJCTED; } + rig_debug(RIG_DEBUG_VERBOSE, "%s databuf[2]=%d, mode=%d\n", __func__, (int)databuf[2], (int)*mode); if (databuf[2]) /* 0x01/0x02/0x03 -> data mode, 0x00 -> not data mode */ { switch (*mode) @@ -2045,8 +2051,6 @@ int icom_set_vfo(RIG *rig, vfo_t vfo) return -RIG_EINVAL; } - rig_debug(RIG_DEBUG_TRACE, "%s: debug#1\n", __func__); - if (vfo != rig->state.current_vfo) { rig_debug(RIG_DEBUG_TRACE, "%s: VFO changing from %s to %s\n", __func__,