From 238e17b736256a0d49da23b5a20fd14dd190023f Mon Sep 17 00:00:00 2001 From: Mike Black W9MDB Date: Mon, 22 Nov 2021 16:54:22 -0600 Subject: [PATCH] rig_set_mode for non-targetable rigs will only set mode on VFOB once per run unless mode is changed This allows subsequent rig_set_mode to execute quickly without any VFO juggling If user twiddles with VFOB mode they are on their own https://github.com/Hamlib/Hamlib/issues/872 --- src/rig.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/rig.c b/src/rig.c index b8c90e20e..df636ca03 100644 --- a/src/rig.c +++ b/src/rig.c @@ -2354,8 +2354,8 @@ int HAMLIB_API rig_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) ELAPSED1; - rig_debug(RIG_DEBUG_VERBOSE, "%s called, vfo=%s, mode=%s, width=%d\n", __func__, - rig_strvfo(vfo), rig_strrmode(mode), (int)width); + rig_debug(RIG_DEBUG_VERBOSE, "%s called, vfo=%s, mode=%s, width=%dm, curr_vfo=%s\n", __func__, + rig_strvfo(vfo), rig_strrmode(mode), (int)width, rig_strvfo(rig->state.current_vfo)); if (CHECK_RIG_ARG(rig)) { @@ -2392,6 +2392,12 @@ int HAMLIB_API rig_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) int rc2; vfo_t curr_vfo; + // if not a targetable rig we will only set mode on VFOB if it is changing + if (rig->state.cache.modeMainB == mode) + { + rig_debug(RIG_DEBUG_TRACE, "%s: VFOB mode not changing so ignoring\n", __func__); + return(RIG_OK); + } rig_debug(RIG_DEBUG_TRACE, "%s: not targetable need vfo swap\n", __func__); if (!caps->set_vfo)