From 4ff31d008fd21f1768862a774dd1b93bdb2c56c3 Mon Sep 17 00:00:00 2001 From: Michael Black W9MDB Date: Mon, 22 Jun 2020 23:16:02 -0500 Subject: [PATCH] Fix rigctl -o with rigctld https://github.com/Hamlib/Hamlib/issues/287 --- src/rig.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/rig.c b/src/rig.c index 8ff9ca2ad..257a32052 100644 --- a/src/rig.c +++ b/src/rig.c @@ -1459,10 +1459,10 @@ int HAMLIB_API rig_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) // If we're in vfo_mode then rigctld will do any VFO swapping we need if ((caps->targetable_vfo & RIG_TARGETABLE_FREQ) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo - || rig->state.vfo_opt == 1) - { - // If rig does not have set_vfo we need to change vfo - if (vfo == RIG_VFO_CURR && caps->set_vfo == NULL) + || (rig->state.vfo_opt == 1 && rig->caps->rig_model == RIG_MODEL_NETRIGCTL)) +{ + // If rig does not have set_vfo we need to change vfo + if (vfo == RIG_VFO_CURR && caps->set_vfo == NULL) { vfo = vfo_fixup(rig, RIG_VFO_A); rig_debug(RIG_DEBUG_TRACE, "%s: no set_vfo so vfo=%s\n", __func__, @@ -1540,29 +1540,29 @@ int HAMLIB_API rig_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) /* VFO compensation */ if (rig->state.vfo_comp != 0.0) - { - *freq = (freq_t)(*freq / (1.0 + (double)rig->state.vfo_comp)); +{ + *freq = (freq_t)(*freq / (1.0 + (double)rig->state.vfo_comp)); } if (retcode == RIG_OK && (vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo)) - { - rig->state.current_freq = *freq; - } +{ + rig->state.current_freq = *freq; +} - if (rig->state.lo_freq != 0.0) - { - *freq += rig->state.lo_freq; - } +if (rig->state.lo_freq != 0.0) +{ + *freq += rig->state.lo_freq; +} - cache_ms = elapsed_ms(&(rig->state.cache.time_freq), ELAPSED_SET); - rig_debug(RIG_DEBUG_TRACE, "%s: cache reset age=%dms, vfo=%s, freq=%.0f\n", - __func__, cache_ms, rig_strvfo(vfo), *freq); - rig->state.cache.freq = *freq; - rig->state.cache.vfo_freq = vfo; +cache_ms = elapsed_ms(&(rig->state.cache.time_freq), ELAPSED_SET); + rig_debug(RIG_DEBUG_TRACE, "%s: cache reset age=%dms, vfo=%s, freq=%.0f\n", + __func__, cache_ms, rig_strvfo(vfo), *freq); + rig->state.cache.freq = *freq; + rig->state.cache.vfo_freq = vfo; - return retcode; + return retcode; }