[Hamlib-commits] Hamlib -- Ham radio control libraries branch master updated. 1ad029bfb3322b3ef34f6
Library to control radio transceivers and receivers
Brought to you by:
n0nb
From: Michael B. <mdb...@us...> - 2020-07-02 16:18:51
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Hamlib -- Ham radio control libraries". The branch, master has been updated via 1ad029bfb3322b3ef34f67d732c7e29ba450e979 (commit) via 4cb0f2917e1816574456b5c1912f49d5ecc959cf (commit) via c12f5d3d55277603dc27b78248d1f3cabc9bcbd5 (commit) via 5a02969257d3829af9adbaca0fb5a68a106d1f2b (commit) via fa08887471dfc9755dfd59e396bd684fa6bf0f36 (commit) via 613b7a6830ac59ab914b73a50d2dad23d91d0c84 (commit) from bda6d1d12d819942000ea1871645f41d91069772 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 1ad029bfb3322b3ef34f67d732c7e29ba450e979 Author: Michael Black W9MDB <mdb...@ya...> Date: Thu Jul 2 11:18:33 2020 -0500 astyle rig.c diff --git a/src/rig.c b/src/rig.c index ca0101bb..f4282f62 100644 --- a/src/rig.c +++ b/src/rig.c @@ -1268,7 +1268,8 @@ int HAMLIB_API rig_set_freq(RIG *rig, vfo_t vfo, freq_t freq) const struct rig_caps *caps; int retcode; - rig_debug(RIG_DEBUG_VERBOSE, "%s called vfo=%s, freq=%g\n", __func__, rig_strvfo(vfo), freq); + rig_debug(RIG_DEBUG_VERBOSE, "%s called vfo=%s, freq=%g\n", __func__, + rig_strvfo(vfo), freq); if (CHECK_RIG_ARG(rig)) { commit 4cb0f2917e1816574456b5c1912f49d5ecc959cf Author: Michael Black W9MDB <mdb...@ya...> Date: Thu Jul 2 11:15:27 2020 -0500 Fix rig_debug in rig.c diff --git a/src/rig.c b/src/rig.c index 8860c897..ca0101bb 100644 --- a/src/rig.c +++ b/src/rig.c @@ -1268,7 +1268,7 @@ int HAMLIB_API rig_set_freq(RIG *rig, vfo_t vfo, freq_t freq) const struct rig_caps *caps; int retcode; - rig_debug(RIG_DEBUG_VERBOSE, "%s called vfo=%s\n", __func__, rig_strvfo(vfo)); + rig_debug(RIG_DEBUG_VERBOSE, "%s called vfo=%s, freq=%g\n", __func__, rig_strvfo(vfo), freq); if (CHECK_RIG_ARG(rig)) { @@ -1374,7 +1374,7 @@ int HAMLIB_API rig_set_freq(RIG *rig, vfo_t vfo, freq_t freq) if (freq_new != freq) { - rig_debug(RIG_DEBUG_TRACE, "%s: Asked freq=%.0f, got freq=%.0f\n", __func__, + rig_debug(RIG_DEBUG_TRACE, "%s: Asked freq=%g, got freq=%g\n", __func__, freq, freq_new); } commit c12f5d3d55277603dc27b78248d1f3cabc9bcbd5 Author: Michael Black W9MDB <mdb...@ya...> Date: Thu Jul 2 11:14:30 2020 -0500 Remove unused var from flrig.c diff --git a/dummy/flrig.c b/dummy/flrig.c index 3eecaeab..2fecbdb9 100644 --- a/dummy/flrig.c +++ b/dummy/flrig.c @@ -1014,7 +1014,6 @@ static int flrig_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) static int flrig_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { int retval; - char value[MAXXMLLEN]; char cmd_arg[MAXARGLEN]; char *cmd; struct flrig_priv_data *priv = (struct flrig_priv_data *) rig->state.priv; commit 5a02969257d3829af9adbaca0fb5a68a106d1f2b Author: Michael Black W9MDB <mdb...@ya...> Date: Thu Jul 2 10:45:58 2020 -0500 Fix debug in flrig.c diff --git a/dummy/flrig.c b/dummy/flrig.c index 03f89383..3eecaeab 100644 --- a/dummy/flrig.c +++ b/dummy/flrig.c @@ -1044,13 +1044,13 @@ static int flrig_set_freq(RIG *rig, vfo_t vfo, freq_t freq) if (vfo == RIG_VFO_A) { cmd = "rig.set_vfoA"; - rig_debug(RIG_DEBUG_TRACE, "rig.set_vfoA %s", value); + rig_debug(RIG_DEBUG_TRACE, "rig.set_vfoA %.0f", freq); priv->curr_freqA = freq; } else { cmd = "rig.set_vfoB"; - rig_debug(RIG_DEBUG_TRACE, "rig.set_vfoA %s", value); + rig_debug(RIG_DEBUG_TRACE, "rig.set_vfoA %.0f", freq); priv->curr_freqB = freq; } commit fa08887471dfc9755dfd59e396bd684fa6bf0f36 Author: Michael Black W9MDB <mdb...@ya...> Date: Thu Jul 2 10:23:41 2020 -0500 Change hamlib_cache_t enums to HAMLIB namespace diff --git a/include/hamlib/rig.h b/include/hamlib/rig.h index fe9f12fa..ef9c4627 100644 --- a/include/hamlib/rig.h +++ b/include/hamlib/rig.h @@ -1903,12 +1903,12 @@ typedef hamlib_port_t port_t; #define HAMLIB_ELAPSED_INVALIDATE 2 typedef enum { - CACHE_ALL, // to set all cache timeouts at once - CACHE_VFO, - CACHE_FREQ, - CACHE_MODE, - CACHE_PTT, - CACHE_SPLIT + HAMLIB_CACHE_ALL, // to set all cache timeouts at once + HAMLIB_CACHE_VFO, + HAMLIB_CACHE_FREQ, + HAMLIB_CACHE_MODE, + HAMLIB_CACHE_PTT, + HAMLIB_CACHE_SPLIT } hamlib_cache_t; /** diff --git a/src/conf.c b/src/conf.c index f343f8db..43c8bed7 100644 --- a/src/conf.c +++ b/src/conf.c @@ -549,7 +549,7 @@ static int frontend_set_conf(RIG *rig, token_t token, const char *val) break; case TOK_CACHE_TIMEOUT: - rig_set_cache_timeout_ms(rig, CACHE_ALL, atol(val)); + rig_set_cache_timeout_ms(rig, HAMLIB_CACHE_ALL, atol(val)); break; default: @@ -861,7 +861,7 @@ static int frontend_get_conf(RIG *rig, token_t token, char *val) break; case TOK_CACHE_TIMEOUT: - sprintf(val, "%d", rig_get_cache_timeout_ms(rig, CACHE_ALL)); + sprintf(val, "%d", rig_get_cache_timeout_ms(rig, HAMLIB_CACHE_ALL)); break; default: diff --git a/tests/rigctl_parse.c b/tests/rigctl_parse.c index 31c1d28c..a6b75b60 100644 --- a/tests/rigctl_parse.c +++ b/tests/rigctl_parse.c @@ -4598,7 +4598,7 @@ declare_proto_rig(set_cache) int ms; CHKSCN1ARG(sscanf(arg1, "%d", &ms)); - return rig_set_cache_timeout_ms(rig, CACHE_ALL, ms); + return rig_set_cache_timeout_ms(rig, HAMLIB_CACHE_ALL, ms); } @@ -4607,7 +4607,7 @@ declare_proto_rig(get_cache) { int ms; - ms = rig_get_cache_timeout_ms(rig, CACHE_ALL); + ms = rig_get_cache_timeout_ms(rig, HAMLIB_CACHE_ALL); if ((interactive && prompt) || (interactive && !prompt && ext_resp)) { commit 613b7a6830ac59ab914b73a50d2dad23d91d0c84 Author: Michael Black W9MDB <mdb...@ya...> Date: Thu Jul 2 09:40:48 2020 -0500 Add get_freq to set_freq for confirmation if < 100Hz interval Should correct incorrect cache reporting and doppler issues https://github.com/Hamlib/Hamlib/issues/334 diff --git a/src/rig.c b/src/rig.c index e781aa61..8860c897 100644 --- a/src/rig.c +++ b/src/rig.c @@ -1352,17 +1352,38 @@ int HAMLIB_API rig_set_freq(RIG *rig, vfo_t vfo, freq_t freq) } } - if (retcode == RIG_OK - && (vfo == RIG_VFO_CURR - || vfo == rig->state.current_vfo)) - { - rig->state.current_freq = freq; - } - if (retcode == RIG_OK) { + freq_t freq_new = freq; + + // verify our freq to ensure HZ mods are seen + // some rigs truncate or round e.g. 1,2,5,10,20,100Hz intervals + // we'll try this all the time and if it works out OK eliminate the #else + + if ((unsigned long long)freq % 100 != 0 // only need to do if < 100Hz interval +#if 0 + // do we need to only do this when cache is turned on? 2020-07-02 W9MDB + && rig->state.cache.timeout_ms > 0 +#endif + ) + { + retcode = rig_get_freq(rig, vfo, &freq_new); + + if (retcode != RIG_OK) { return retcode; } + } + + if (freq_new != freq) + { + rig_debug(RIG_DEBUG_TRACE, "%s: Asked freq=%.0f, got freq=%.0f\n", __func__, + freq, + freq_new); + } + + // update our current freq too + if (vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) { rig->state.current_freq = freq_new; } + elapsed_ms(&rig->state.cache.time_ptt, HAMLIB_ELAPSED_SET); - rig->state.cache.freq = freq; + rig->state.cache.freq = freq_new; rig->state.cache.vfo_freq = vfo; } @@ -1460,9 +1481,9 @@ int HAMLIB_API rig_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) if ((caps->targetable_vfo & RIG_TARGETABLE_FREQ) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo || (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) + { + // 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 +1561,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), HAMLIB_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), HAMLIB_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; } @@ -2030,7 +2051,8 @@ int HAMLIB_API rig_get_vfo(RIG *rig, vfo_t *vfo) if (CHECK_RIG_ARG(rig) || !vfo) { - rig_debug(RIG_DEBUG_ERR, "%s: no rig and/or vfo? rig=%p, vfo=%p\n", __func__, rig, vfo); + rig_debug(RIG_DEBUG_ERR, "%s: no rig and/or vfo? rig=%p, vfo=%p\n", __func__, + rig, vfo); return -RIG_EINVAL; } @@ -2071,7 +2093,8 @@ int HAMLIB_API rig_get_vfo(RIG *rig, vfo_t *vfo) if (retcode != RIG_OK) { - rig_debug(RIG_DEBUG_ERR, "%s: returning %d(%s)\n", __func__, retcode,rigerror(retcode)); + rig_debug(RIG_DEBUG_ERR, "%s: returning %d(%s)\n", __func__, retcode, + rigerror(retcode)); } return retcode; ----------------------------------------------------------------------- Summary of changes: dummy/flrig.c | 5 ++-- include/hamlib/rig.h | 12 ++++---- src/conf.c | 4 +-- src/rig.c | 82 +++++++++++++++++++++++++++++++++------------------- tests/rigctl_parse.c | 4 +-- 5 files changed, 65 insertions(+), 42 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |