From 8cad7b0a8f0aafcc8832befa55d25ce4147a93a9 Mon Sep 17 00:00:00 2001 From: Michael Black W9MDB Date: Sun, 14 Jun 2020 12:55:14 -0500 Subject: [PATCH] Some Yaesu rigs like FT-DX101D will turn off split mode when setting mode of VFO_B So, if we set mode on VFOB and we're in split we will query split after and reset if needed We query rather than relying on specific models to cover all such Yaesus that might exist https://github.com/Hamlib/Hamlib/issues/293 --- rigs/yaesu/newcat.c | 19 +++++++++++++++++++ rigs/yaesu/newcat.h | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/rigs/yaesu/newcat.c b/rigs/yaesu/newcat.c index 7920f8878..bdcf587bb 100644 --- a/rigs/yaesu/newcat.c +++ b/rigs/yaesu/newcat.c @@ -731,6 +731,7 @@ int newcat_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { struct newcat_priv_data *priv; int err; + split_t split_save = rig->state.cache.split; priv = (struct newcat_priv_data *)rig->state.priv; @@ -786,6 +787,22 @@ int newcat_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) /* Set width after mode has been set */ err = newcat_set_rx_bandwidth(rig, vfo, mode, width); + // some rigs if you set mode on VFOB it will turn off split + // so if we started in split we query split and turn it back on if needed + if (split_save) + { + split_t split; + vfo_t tx_vfo; + err = rig_get_split_vfo(rig, RIG_VFO_A, &split, &tx_vfo); + + // we'll just reset to split to what we want if we need to + if (!split) + { + rig_debug(RIG_DEBUG_TRACE, "%s: turning split back on...buggy rig\n", __func__); + err = rig_set_split_vfo(rig, RIG_VFO_A, split_save, RIG_VFO_B); + } + } + return err; } @@ -1504,6 +1521,7 @@ int newcat_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo) return err; } + // should this just return VFO_A/VFO_B? if (*tx_vfo != vfo) { *split = RIG_SPLIT_ON; @@ -4787,6 +4805,7 @@ int newcat_set_tx_vfo(RIG *rig, vfo_t tx_vfo) // The DX101D returns FT0 when in split and not transmitting command = "ST"; } + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "%s%c%c", command, p1, cat_term); rig_debug(RIG_DEBUG_TRACE, "cmd_str = %s\n", priv->cmd_str); diff --git a/rigs/yaesu/newcat.h b/rigs/yaesu/newcat.h index 3d1b692a4..d0e1f2a85 100644 --- a/rigs/yaesu/newcat.h +++ b/rigs/yaesu/newcat.h @@ -50,7 +50,7 @@ typedef char ncboolean; /* shared function version */ -#define NEWCAT_VER "20200611" +#define NEWCAT_VER "20200614" /* Hopefully large enough for future use, 128 chars plus '\0' */ #define NEWCAT_DATA_LEN 129