From 7dcb0ae88e94355bcc6a721ae77d84cc7c65e760 Mon Sep 17 00:00:00 2001 From: mdblack98 Date: Sat, 25 Apr 2020 11:28:38 -0500 Subject: [PATCH 1/2] astyle updates --- dummy/flrig.c | 7 +++++-- tests/rigctl_parse.c | 8 ++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/dummy/flrig.c b/dummy/flrig.c index 52d76d98b..64677374d 100644 --- a/dummy/flrig.c +++ b/dummy/flrig.c @@ -417,7 +417,7 @@ static int read_transaction(RIG *rig, char *xml, int xml_len) { rig_debug(RIG_DEBUG_ERR, "%s: read_string error=%d\n", __func__, len); //return -(100 + RIG_EPROTO); - continue; + continue; } if (strlen(xml) + strlen(tmp_buf) < xml_len - 1) @@ -1467,8 +1467,11 @@ static int flrig_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) } retval = read_transaction(rig, xml, sizeof(xml)); - if (retval < 0) { + + if (retval < 0) + { } + xml_parse(xml, value, sizeof(value)); retval = modeMapGetHamlib(value); diff --git a/tests/rigctl_parse.c b/tests/rigctl_parse.c index 55e1e2ec8..3f1631b21 100644 --- a/tests/rigctl_parse.c +++ b/tests/rigctl_parse.c @@ -614,7 +614,9 @@ int rigctl_parse(RIG *my_rig, FILE *fin, FILE *fout, char *argv[], int argc, char arg3[MAXARGSZ + 1], *p3 = NULL; vfo_t vfo = RIG_VFO_CURR; - rig_debug(RIG_DEBUG_TRACE, "%s: called, interactive=%d\n", __func__, interactive); + rig_debug(RIG_DEBUG_TRACE, "%s: called, interactive=%d\n", __func__, + interactive); + /* cmd, internal, rigctld */ if (!(interactive && prompt && have_rl)) { @@ -636,7 +638,9 @@ int rigctl_parse(RIG *my_rig, FILE *fin, FILE *fout, char *argv[], int argc, retcode); return -1; } - rig_debug(RIG_DEBUG_TRACE, "%s: cmd=%c(%02x)\n", __func__, isprint(cmd)?cmd:' ', cmd); + + rig_debug(RIG_DEBUG_TRACE, "%s: cmd=%c(%02x)\n", __func__, + isprint(cmd) ? cmd : ' ', cmd); /* Extended response protocol requested with leading '+' on command * string--rigctld only! From acc468fcfd34529c3d798f2661cc7e1e3f760af6 Mon Sep 17 00:00:00 2001 From: mdblack98 Date: Sun, 26 Apr 2020 08:45:16 -0500 Subject: [PATCH 2/2] Fix channel reading for civ_731 icom rigs I assume this is true on all such rigs that they return 5 bytes Writing and reading a channel should confirm it by returning the correct freq https://github.com/Hamlib/Hamlib/issues/217 --- rigs/icom/icom.c | 20 ++++++++++++++++++++ rigs/icom/icom.h | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/rigs/icom/icom.c b/rigs/icom/icom.c index c6a7faa1b..b0fa32b53 100644 --- a/rigs/icom/icom.c +++ b/rigs/icom/icom.c @@ -1016,6 +1016,7 @@ int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) int freq_len, retval; int cmd, subcmd; int ack_len = sizeof(ackbuf); + int civ_731_mode = 0; // even these rigs have 5-byte channels rig_debug(RIG_DEBUG_VERBOSE, "%s called for %s\n", __func__, rig_strvfo(vfo)); @@ -1034,6 +1035,14 @@ int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) cmd = C_RD_FREQ; subcmd = -1; + if (vfo == RIG_VFO_MEM && priv->civ_731_mode) + { + rig_debug(RIG_DEBUG_TRACE, "%s: VFO=MEM so turning off civ_731\n", __func__); + civ_731_mode = 1; + priv->civ_731_mode = 0; + + } + // Pick the appropriate VFO when VFO_TX is requested if (vfo == RIG_VFO_TX) { @@ -1070,6 +1079,8 @@ int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) if (retval != RIG_OK) { + if (vfo == RIG_VFO_MEM && civ_731_mode) { priv->civ_731_mode = 1; } + return retval; } @@ -1088,6 +1099,8 @@ int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) if (retval != RIG_OK) { + if (vfo == RIG_VFO_MEM && civ_731_mode) { priv->civ_731_mode = 1; } + return retval; } @@ -1103,6 +1116,8 @@ int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { *freq = RIG_FREQ_NONE; + if (vfo == RIG_VFO_MEM && civ_731_mode) { priv->civ_731_mode = 1; } + return RIG_OK; } @@ -1110,6 +1125,9 @@ int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { rig_debug(RIG_DEBUG_ERR, "%s: wrong frame len=%d\n", __func__, freq_len); + + if (vfo == RIG_VFO_MEM && civ_731_mode) { priv->civ_731_mode = 1; } + return -RIG_ERJCTED; } @@ -1124,6 +1142,8 @@ int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) */ *freq = from_bcd(freqbuf + 1, freq_len * 2); + if (vfo == RIG_VFO_MEM && civ_731_mode) { priv->civ_731_mode = 1; } + return RIG_OK; } diff --git a/rigs/icom/icom.h b/rigs/icom/icom.h index 91694d3de..420be1eba 100644 --- a/rigs/icom/icom.h +++ b/rigs/icom/icom.h @@ -30,7 +30,7 @@ #include #endif -#define BACKEND_VER "20200423" +#define BACKEND_VER "20200426" /* * defines used by comp_cal_str in rig.c