[Hamlib-commits] Hamlib -- Ham radio control libraries branch master updated. f4748ebf8a3bc31013204
Library to control radio transceivers and receivers
Brought to you by:
n0nb
|
From: Michael B. <mdb...@us...> - 2021-02-16 21:59:49
|
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 f4748ebf8a3bc31013204cde343acff8ee971ec5 (commit)
from 7c26d2afef71d079b1bcde62bf0ae66b4b181eb0 (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 f4748ebf8a3bc31013204cde343acff8ee971ec5
Author: Michael Black W9MDB <mdb...@ya...>
Date: Tue Feb 16 15:58:12 2021 -0600
Change rig.c to query freq after set freq to ensure it gets set
Up to 4 retries
https://github.com/Hamlib/Hamlib/issues/549
diff --git a/src/rig.c b/src/rig.c
index 33262942..e0e156b0 100644
--- a/src/rig.c
+++ b/src/rig.c
@@ -1575,7 +1575,28 @@ int HAMLIB_API rig_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
rig_debug(RIG_DEBUG_TRACE, "%s: TARGETABLE_FREQ vfo=%s\n", __func__,
rig_strvfo(vfo));
- retcode = caps->set_freq(rig, vfo, freq);
+ int retry=5;
+ freq_t tfreq;
+ do {
+ retcode = caps->set_freq(rig, vfo, freq);
+ if (retcode != RIG_OK) RETURNFUNC(retcode);
+ set_cache_freq(rig, RIG_VFO_ALL, (freq_t)0);
+ if (caps->set_freq)
+ {
+ retcode = rig_get_freq(rig, vfo, &tfreq);
+ if (retcode != RIG_OK) RETURNFUNC(retcode);
+ if (tfreq != freq)
+ {
+ hl_usleep(50*1000);
+ rig_debug(RIG_DEBUG_WARN, "%s: freq not set correctly?? got %.0f asked for %.0f\n", __func__, (double)tfreq, (double)freq);
+ }
+ }
+ else { retry = 1; }
+ } while (tfreq != freq && --retry > 0);
+ if (retry == 0)
+ {
+ rig_debug(RIG_DEBUG_ERR, "%s: unable to set frequency!!\n", __func__);
+ }
}
else
{
@@ -3290,10 +3311,9 @@ int HAMLIB_API rig_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
if (caps->set_freq && (caps->targetable_vfo & RIG_TARGETABLE_FREQ))
{
- RETURNFUNC(caps->set_freq(rig, tx_vfo, tx_freq));
+ RETURNFUNC(rig_set_freq(rig, tx_vfo, tx_freq));
}
-
if (caps->set_vfo)
{
retcode = caps->set_vfo(rig, tx_vfo);
@@ -3318,7 +3338,7 @@ int HAMLIB_API rig_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
}
else
{
- retcode = caps->set_freq(rig, RIG_VFO_CURR, tx_freq);
+ retcode = rig_set_freq(rig, RIG_VFO_CURR, tx_freq);
}
/* try and revert even if we had an error above */
-----------------------------------------------------------------------
Summary of changes:
src/rig.c | 28 ++++++++++++++++++++++++----
1 file changed, 24 insertions(+), 4 deletions(-)
hooks/post-receive
--
Hamlib -- Ham radio control libraries
|