[Hamlib-commits] Hamlib -- Ham radio control libraries branch master updated. d816d27c7499695e314d5
Library to control radio transceivers and receivers
Brought to you by:
n0nb
From: Michael B. <mdb...@us...> - 2021-03-12 15:04:42
|
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 d816d27c7499695e314d593171f7a10d7cac87e2 (commit) via 8202c86586c943b06da22de7a8a6f01b3f8792bc (commit) from 196ffb39a89acaa11177f50262dbcefd1585d3ad (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 d816d27c7499695e314d593171f7a10d7cac87e2 Author: Michael Black W9MDB <mdb...@ya...> Date: Fri Mar 12 09:02:26 2021 -0600 Fix FlRig conditon where 0Hz can be returned on a network error Was returning a bad error code If any rig returns 0 Hz freq will be returned from cache instead I don't think there's anytime we want a zero Hz frequency diff --git a/rigs/dummy/flrig.c b/rigs/dummy/flrig.c index 746e58fe..d564b13a 100644 --- a/rigs/dummy/flrig.c +++ b/rigs/dummy/flrig.c @@ -1072,7 +1072,7 @@ static int flrig_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { rig_debug(RIG_DEBUG_ERR, "%s: freq==0??\nvalue=%s\n", __func__, value); - RETURNFUNC(-(102 + RIG_EPROTO)); + RETURNFUNC(-RIG_EPROTO); } else { diff --git a/src/rig.c b/src/rig.c index c17518fb..c719759d 100644 --- a/src/rig.c +++ b/src/rig.c @@ -1831,6 +1831,12 @@ int HAMLIB_API rig_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) retcode = caps->get_freq(rig, vfo, freq); + // sometimes a network rig like FLRig will return freq=0 + // so we'll just reuse the cache for that condition + if (*freq == 0) { + *freq = rig->state.cache.freq; + } + if (retcode == RIG_OK) { rig->state.cache.freq = *freq; @@ -1971,7 +1977,7 @@ int HAMLIB_API rig_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) || vfo == rig->state.current_vfo) { retcode = caps->set_mode(rig, vfo, mode, width); - rig_debug(RIG_DEBUG_TRACE, "%s: retcode after set_mode=%d\n", __func__, + rig_debug(RIG_DEBUG_TRACE, "%s: targetable retcode after set_mode=%d\n", __func__, retcode); } else @@ -1979,6 +1985,7 @@ int HAMLIB_API rig_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) int rc2; vfo_t curr_vfo; + rig_debug(RIG_DEBUG_TRACE, "%s: not targetable need vfo swap\n", __func__); if (!caps->set_vfo) { RETURNFUNC(-RIG_ENAVAIL); commit 8202c86586c943b06da22de7a8a6f01b3f8792bc Author: Michael Black W9MDB <mdb...@ya...> Date: Fri Mar 12 08:13:35 2021 -0600 Add FlRig version info to flrig.c diff --git a/rigs/dummy/flrig.c b/rigs/dummy/flrig.c index 59dc5823..746e58fe 100644 --- a/rigs/dummy/flrig.c +++ b/rigs/dummy/flrig.c @@ -747,8 +747,34 @@ static int flrig_open(RIG *rig) struct flrig_priv_data *priv = (struct flrig_priv_data *) rig->state.priv; ENTERFUNC; - rig_debug(RIG_DEBUG_TRACE, "%s version %s\n", __func__, BACKEND_VER); + rig_debug(RIG_DEBUG_VERBOSE, "%s version %s\n", __func__, BACKEND_VER); + + retval = flrig_transaction(rig, "main.get_version", NULL, value, sizeof(value)); + + if (retval != RIG_OK) + { + rig_debug(RIG_DEBUG_ERR, "%s: get_version failed: %s\n", __func__, + rigerror(retval)); + RETURNFUNC(retval); + } + rig_debug(RIG_DEBUG_VERBOSE, "%s FlRig version %s\n", __func__, value); + + retval = flrig_transaction(rig, "rig.get_xcvr", NULL, value, sizeof(value)); + + if (retval != RIG_OK) + { + rig_debug(RIG_DEBUG_ERR, "%s: get_xcvr failed: %s\n", __func__, + rigerror(retval)); + RETURNFUNC(retval); + } + retval = flrig_transaction(rig, "rig.get_xcvr", NULL, value, sizeof(value)); + if (retval != RIG_OK) + { + rig_debug(RIG_DEBUG_ERR, "%s: get_xcvr failed: %s\n", __func__, + rigerror(retval)); + RETURNFUNC(retval); + } retval = flrig_transaction(rig, "rig.get_xcvr", NULL, value, sizeof(value)); if (retval != RIG_OK) @@ -831,7 +857,7 @@ static int flrig_open(RIG *rig) if (retval != RIG_OK) { RETURNFUNC(retval); } - rig_debug(RIG_DEBUG_TRACE, "%s: modes=%s\n", __func__, value); + rig_debug(RIG_DEBUG_VERBOSE, "%s: modes=%s\n", __func__, value); modes = 0; pr = value; diff --git a/rigs/dummy/flrig.h b/rigs/dummy/flrig.h index a69e4ae1..3eca8630 100644 --- a/rigs/dummy/flrig.h +++ b/rigs/dummy/flrig.h @@ -28,7 +28,7 @@ #include <sys/time.h> #endif -#define BACKEND_VER "20210311" +#define BACKEND_VER "20210312" #define EOM "\r" #define TRUE 1 ----------------------------------------------------------------------- Summary of changes: rigs/dummy/flrig.c | 32 +++++++++++++++++++++++++++++--- rigs/dummy/flrig.h | 2 +- src/rig.c | 9 ++++++++- 3 files changed, 38 insertions(+), 5 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |