[Hamlib-commits] Hamlib -- Ham radio control libraries branch master updated. b4627b75ba065d22c85fa
Library to control radio transceivers and receivers
Brought to you by:
n0nb
From: Michael B. <mdb...@us...> - 2021-01-13 14:51:48
|
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 b4627b75ba065d22c85fa71d045486702be1e199 (commit) via 4e9791d8b9cf561ea4faa7b70864614dc15b34c9 (commit) via 00a7f2c749396160b289d6250ffe898336e89040 (commit) from a9a806f8e02d859a3778728247dc87ebaa81a133 (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 b4627b75ba065d22c85fa71d045486702be1e199 Author: Michael Black W9MDB <mdb...@ya...> Date: Wed Jan 13 08:48:48 2021 -0600 Fix newcat.c retry when read command returns ?; https://github.com/Hamlib/Hamlib/issues/505 diff --git a/rigs/yaesu/newcat.c b/rigs/yaesu/newcat.c index 2b733653..245dcab9 100644 --- a/rigs/yaesu/newcat.c +++ b/rigs/yaesu/newcat.c @@ -539,6 +539,29 @@ int newcat_open(RIG *rig) (void)newcat_get_rigid(rig); rig_debug(RIG_DEBUG_VERBOSE, "%s: rig_id=%d\n", __func__, priv->rig_id); +#if 0 // possible future enhancement? + // some rigs have a CAT TOT timeout that defaults to 10ms + // so we'll increase CAT timeout to 100ms + if (priv->rig_id == NC_RIGID_FT2000 + || priv->rig_id == NC_RIGID_FT2000D + || priv->rig_id == NC_RIGID_FT891 + || priv->rig_id == NC_RIGID_FT991 + || priv->rig_id == NC_RIGID_FT950) + { + int err; + char *cmd = "EX0291%c"; + if (priv->rig_id == NC_RIGID_FT950) cmd = "EX0271%c"; + else if (priv->rig_id == NC_RIGID_FT891) cmd = "EX05071c"; + else if (priv->rig_id == NC_RIGID_FT991) cmd = "EX0321c"; + snprintf(priv->cmd_str, sizeof(priv->cmd_str), cmd, cat_term); + + if (RIG_OK != (err = newcat_set_cmd(rig))) + { + return err; + } + } +#endif + rig_debug(RIG_DEBUG_VERBOSE, "%s: returning RIG_OK\n", __func__); return RIG_OK; } @@ -784,6 +807,7 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq) && !rig->state.cache.split && !is_ft891) // 891 does not remember bandwidth so don't do this { + hl_usleep(200*1000); // seems we need some time before doing band select 200ms enough? snprintf(priv->cmd_str, sizeof(priv->cmd_str), "BS%02d%c", newcat_band_index(freq), cat_term); @@ -883,6 +907,7 @@ int newcat_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) break; default: + rig_debug(RIG_DEBUG_ERR, "%s: unsupported vfo=%s\n", __func__, rig_strvfo(vfo)); return -RIG_EINVAL; /* sorry, unsupported VFO */ } @@ -9201,9 +9226,9 @@ int newcat_get_cmd(RIG *rig) while (rc != RIG_OK && retry_count++ <= state->rigport.retry) { + rig_flush(&state->rigport); /* discard any unsolicited data */ if (rc != -RIG_BUSBUSY) { - rig_flush(&state->rigport); /* discard any unsolicited data */ /* send the command */ rig_debug(RIG_DEBUG_TRACE, "cmd_str = %s\n", priv->cmd_str); @@ -9294,8 +9319,8 @@ int newcat_get_cmd(RIG *rig) return -RIG_ERJCTED; } - rig_debug(RIG_DEBUG_WARN, "%s: Rig busy - retrying: '%s'\n", __func__, - priv->cmd_str); + rig_debug(RIG_DEBUG_WARN, "%s: Rig busy - retrying %d of %d: '%s'\n", __func__, + retry_count, state->rigport.retry, priv->cmd_str); rc = -RIG_ERJCTED; /* retry */ break; @@ -9449,17 +9474,12 @@ int newcat_set_cmd(RIG *rig) rig_debug(RIG_DEBUG_WARN, "%s: Rig busy - retrying: '%s'\n", __func__, priv->cmd_str); - /* read the verify command reply */ + /* read/flush the verify command reply which should still be there */ if ((rc = read_string(&state->rigport, priv->ret_data, sizeof(priv->ret_data), &cat_term, sizeof(cat_term))) > 0) { rig_debug(RIG_DEBUG_TRACE, "%s: read count = %d, ret_data = %s\n", __func__, rc, priv->ret_data); - rc = RIG_OK; /* probably recovered and read verification */ - } - else - { - /* probably a timeout */ rc = -RIG_BUSBUSY; /* retry */ } diff --git a/rigs/yaesu/newcat.h b/rigs/yaesu/newcat.h index 7c8918da..452cb283 100644 --- a/rigs/yaesu/newcat.h +++ b/rigs/yaesu/newcat.h @@ -50,7 +50,7 @@ typedef char ncboolean; /* shared function version */ -#define NEWCAT_VER "20210112" +#define NEWCAT_VER "20210113" /* Hopefully large enough for future use, 128 chars plus '\0' */ #define NEWCAT_DATA_LEN 129 commit 4e9791d8b9cf561ea4faa7b70864614dc15b34c9 Author: Michael Black W9MDB <mdb...@ya...> Date: Tue Jan 12 23:03:54 2021 -0600 Update flrig version diff --git a/rigs/dummy/flrig.h b/rigs/dummy/flrig.h index dd0ecc19..4c6633b3 100644 --- a/rigs/dummy/flrig.h +++ b/rigs/dummy/flrig.h @@ -28,7 +28,7 @@ #include <sys/time.h> #endif -#define BACKEND_VER "20201231" +#define BACKEND_VER "20210112" #define EOM "\r" #define TRUE 1 commit 00a7f2c749396160b289d6250ffe898336e89040 Author: Michael Black W9MDB <mdb...@ya...> Date: Tue Jan 12 23:03:20 2021 -0600 Fix flrig set_micgain to use i4 format diff --git a/rigs/dummy/flrig.c b/rigs/dummy/flrig.c index dacd414c..46eea2de 100644 --- a/rigs/dummy/flrig.c +++ b/rigs/dummy/flrig.c @@ -58,7 +58,7 @@ RIG_MODE_FM | RIG_MODE_WFM | RIG_MODE_FMN | RIG_MODE_PKTFM |\ RIG_MODE_C4FM) -#define FLRIG_LEVELS (RIG_LEVEL_AF | RIG_LEVEL_RF | RIG_LEVEL_MICGAIN | RIG_LEVEL_STRENGTH | RIG_LEVEL_RFPOWER_METER | RIG_LEVEL_RFPOWER_METER_WATTS) +#define FLRIG_LEVELS (RIG_LEVEL_AF | RIG_LEVEL_RF | RIG_LEVEL_MICGAIN | RIG_LEVEL_STRENGTH | RIG_LEVEL_RFPOWER_METER | RIG_LEVEL_RFPOWER_METER_WATTS | RIG_LEVEL_RFPOWER) #define streq(s1,s2) (strcmp(s1,s2)==0) @@ -1883,6 +1883,7 @@ static int flrig_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) int retval; char cmd_arg[MAXARGLEN]; char *cmd; + char *param_type="i4"; rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s level=%d, val=%f\n", __func__, rig_strvfo(vfo), (int)level, val.f); @@ -1894,23 +1895,26 @@ static int flrig_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) return -RIG_EINVAL; } - sprintf(cmd_arg, - "<params><param><value><double>%d</double></value></param></params>", - (int)val.f); - switch (level) { - case RIG_LEVEL_RF: cmd = "rig.set_rfgain"; break; + case RIG_LEVEL_RF: cmd = "rig.set_rfgain"; val.f*= 100; break; + + case RIG_LEVEL_AF: cmd = "rig.set_volume"; val.f*= 100; break; - case RIG_LEVEL_AF: cmd = "rig.set_volume"; break; + case RIG_LEVEL_MICGAIN: cmd = "rig.set_micgain"; val.f*= 100; break; - case RIG_LEVEL_MICGAIN: cmd = "rig.set_micgain"; break; + case RIG_LEVEL_RFPOWER: cmd = "rig.set_power"; val.f*= 100; break; default: rig_debug(RIG_DEBUG_ERR, "%s: invalid level=%d\n", __func__, (int)level); return -RIG_EINVAL; } + sprintf(cmd_arg, + "<params><param><value><%s>%d</%s></value></param></params>", + param_type, (int)val.f, param_type); + + retval = flrig_transaction(rig, cmd, cmd_arg, NULL, 0); if (retval < 0) @@ -1945,6 +1949,8 @@ static int flrig_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) case RIG_LEVEL_MICGAIN: cmd = "rig.get_micgain"; break; case RIG_LEVEL_STRENGTH: cmd = "rig.get_smeter"; break; + + case RIG_LEVEL_RFPOWER: cmd = "rig.get_power"; break; case RIG_LEVEL_RFPOWER_METER_WATTS: case RIG_LEVEL_RFPOWER_METER: cmd = "rig.get_pwrmeter"; break; @@ -1972,6 +1978,11 @@ static int flrig_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) rig_debug(RIG_DEBUG_TRACE, "%s: val.i='%s'(%d)\n", __func__, value, val->i); break; + case RIG_LEVEL_RFPOWER: + val->f = atof(value) / 100.0 * priv->powermeter_scale; + rig_debug(RIG_DEBUG_TRACE, "%s: val.f='%s'(%g)\n", __func__, value, val->f); + break; + case RIG_LEVEL_RFPOWER_METER: val->f = atof(value) / 100.0 * priv->powermeter_scale; rig_debug(RIG_DEBUG_TRACE, "%s: val.f='%s'(%g)\n", __func__, value, val->f); ----------------------------------------------------------------------- Summary of changes: rigs/dummy/flrig.c | 27 +++++++++++++++++++-------- rigs/dummy/flrig.h | 2 +- rigs/yaesu/newcat.c | 38 +++++++++++++++++++++++++++++--------- rigs/yaesu/newcat.h | 2 +- 4 files changed, 50 insertions(+), 19 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |