[Hamlib-commits] Hamlib -- Ham radio control libraries branch master updated. 02c085443485487e3a330
Library to control radio transceivers and receivers
Brought to you by:
n0nb
From: Michael B. <mdb...@us...> - 2021-01-06 23:06:02
|
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 02c085443485487e3a330494710cbb0d7d7bd1d1 (commit) via e9d6d751f26301c6b94b68d8b81ccc3a18129ee0 (commit) via b1f01708edc9d50c48155d06d6c6f88d12e62f1f (commit) from 08792f9295655521973589805e4f9ce6ba7e30a8 (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 02c085443485487e3a330494710cbb0d7d7bd1d1 Author: Michael Black W9MDB <mdb...@ya...> Date: Wed Jan 6 17:04:44 2021 -0600 In icom.c init() set priv->filter to RIG_PASSBAND_NOCHANGE to fix set_mode rigs with 2-byte cmds https://github.com/Hamlib/Hamlib/issues/490 diff --git a/rigs/icom/icom.c b/rigs/icom/icom.c index 5bfa1c8b..d61b10a2 100644 --- a/rigs/icom/icom.c +++ b/rigs/icom/icom.c @@ -655,6 +655,7 @@ icom_init(RIG *rig) priv->tx_vfo = RIG_VFO_NONE; priv->rx_vfo = RIG_VFO_NONE; rig->state.current_vfo = RIG_VFO_NONE; + priv->filter = RIG_PASSBAND_NOCHANGE; rig_debug(RIG_DEBUG_TRACE, "%s: done\n", __func__); diff --git a/rigs/icom/icom.h b/rigs/icom/icom.h index 6b7dadec..3a680edc 100644 --- a/rigs/icom/icom.h +++ b/rigs/icom/icom.h @@ -30,7 +30,7 @@ #include <sys/time.h> #endif -#define BACKEND_VER "20201219" +#define BACKEND_VER "20210106" /* * defines used by comp_cal_str in rig.c commit e9d6d751f26301c6b94b68d8b81ccc3a18129ee0 Author: Michael Black W9MDB <mdb...@ya...> Date: Tue Jan 5 09:49:20 2021 -0600 Change Barrett 950 version number https://github.com/Hamlib/Hamlib/issues/483 diff --git a/rigs/barrett/950.c b/rigs/barrett/950.c index 14a4d588..672da1ed 100644 --- a/rigs/barrett/950.c +++ b/rigs/barrett/950.c @@ -82,7 +82,7 @@ const struct rig_caps barrett950_caps = RIG_MODEL(RIG_MODEL_BARRETT_950), .model_name = "950", .mfg_name = "Barrett", - .version = BACKEND_VER "/20210105", + .version = BACKEND_VER ".0", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TRANSCEIVER, commit b1f01708edc9d50c48155d06d6c6f88d12e62f1f Author: Michael Black W9MDB <mdb...@ya...> Date: Tue Jan 5 09:28:53 2021 -0600 Fix Barret 950 set_freq Change Barrett 950 to use channels 441-450 for 10-band memory This will minimize EEPROM writes https://github.com/Hamlib/Hamlib/issues/483 diff --git a/rigs/barrett/950.c b/rigs/barrett/950.c index 2229f1b1..14a4d588 100644 --- a/rigs/barrett/950.c +++ b/rigs/barrett/950.c @@ -49,17 +49,40 @@ static int barrett950_set_freq(RIG *rig, vfo_t vfo, freq_t freq); static int barrett950_get_level(RIG *rig, vfo_t vfo, setting_t level, - value_t *val); + value_t *val); static const char *barrett950_get_info(RIG *rig); +// 10 band channel from 441 to 450 +#define CHANNEL_BASE 441 + +struct chan_map_s +{ + float lo, hi; + int chan_offset; +}; + +// Our 10 bands +struct chan_map_s chan_map[] = +{ + { 1.8, 2.0, 0}, + { 3.5, 4.0, 1}, + { 5.3, 5.4, 2}, + { 7.0, 7.3, 3}, + { 10.1, 10.15, 4}, + { 14.0, 14.35, 5}, + { 18.068, 18.168, 6}, + { 21.0, 21.45, 7}, + { 24.89, 24.99, 8}, + { 28.0, 29.7, 9} +}; const struct rig_caps barrett950_caps = { RIG_MODEL(RIG_MODEL_BARRETT_950), .model_name = "950", .mfg_name = "Barrett", - .version = BACKEND_VER ".0", + .version = BACKEND_VER "/20210105", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TRANSCEIVER, @@ -130,50 +153,79 @@ int barrett950_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { char cmd_buf[MAXCMDLEN]; int retval; - struct barrett_priv_data *priv = rig->state.priv; + int i; + int chan; + freq_t freq_rx, freq_tx; + freq_t freq_MHz; + char *response = NULL; + //struct barrett_priv_data *priv = rig->state.priv; rig_debug(RIG_DEBUG_VERBOSE, "%s: vfo=%s freq=%.0f\n", __func__, rig_strvfo(vfo), freq); - // If we are not explicitly asking for VFO_B then we'll set the receive side also - if (vfo != RIG_VFO_B) - { - char *response = NULL; - sprintf((char *) cmd_buf, "PR%08.0f", freq); - retval = barrett_transaction(rig, cmd_buf, 0, &response); + // 950 can only set freq via memory channel + // So we make a 10-channel memory from 441-450 by band + // And we don't care about VFO -- we set TX=RX to avoid doing split freq changes + // Trying to minimize writes to EEPROM + + // What band is being requested? + freq_MHz = freq / 1e6; - if (retval < 0) + for (i = 0; i < 10; ++i) + { + if (freq_MHz >= chan_map[i].lo && freq_MHz <= chan_map[i].hi) { - return retval; + chan = CHANNEL_BASE + chan_map[i].chan_offset; } + } - //dump_hex((unsigned char *)response, strlen(response)); + rig_debug(RIG_DEBUG_VERBOSE, "%s: using chan %d for freq %.0f \n", __func__, + chan, freq); - if (strncmp(response, "OK", 2) != 0) - { - rig_debug(RIG_DEBUG_ERR, "%s: Expected OK, got '%s'\n", __func__, response); - return -RIG_EPROTO; - } + // Set the channel + sprintf((char *) cmd_buf, "XC%04d", chan); + retval = barrett_transaction(rig, cmd_buf, 0, &response); + + if (retval < 0) + { + return retval; } - if (priv->split == 0 - || vfo == RIG_VFO_B) // if we aren't in split mode we have to set the TX VFO too + // Read the current channel for the requested freq to see if it needs changing + sprintf((char *) cmd_buf, "IDC%04d", chan); + retval = barrett_transaction(rig, cmd_buf, 0, &response); + + if (retval < 0) { + return retval; + } - char *response = NULL; - sprintf((char *) cmd_buf, "PT%08.0f", freq); - retval = barrett_transaction(rig, cmd_buf, 0, &response); + if (sscanf(response, "%4d%8lf%8lf", &chan, &freq_rx, &freq_tx) != 2) + { + rig_debug(RIG_DEBUG_ERR, "%s: unable to parse chan/freq from %s\n", __func__, + response); + return -RIG_EPROTO; + } - if (retval < 0) - { - return retval; - } + rig_debug(RIG_DEBUG_VERBOSE, "%s: got chan %d, freq_rx=%.0f, freq_tx=%.0f", + __func__, chan, + freq_rx, freq_tx); - if (strncmp(response, "OK", 2) != 0) - { - rig_debug(RIG_DEBUG_ERR, "%s: Expected OK, got '%s'\n", __func__, response); - return -RIG_EPROTO; - } + if (freq_rx == freq && freq_tx == freq) + { + rig_debug(RIG_DEBUG_VERBOSE, "%s: no freq change needed\n", __func__); + return RIG_OK; + } + + // New freq so let's update the channel + // We do not support split mode -- too many writes to EEPROM to support it + sprintf((char *) cmd_buf, "PC%04dR%08.0lfT%08.0lf", chan, freq, freq); + retval = barrett_transaction(rig, cmd_buf, 0, &response); + + if (strncmp(response, "OK", 2) != 0) + { + rig_debug(RIG_DEBUG_ERR, "%s: Expected OK, got '%s'\n", __func__, response); + return -RIG_EPROTO; } return RIG_OK; ----------------------------------------------------------------------- Summary of changes: rigs/barrett/950.c | 112 +++++++++++++++++++++++++++++++++++++++-------------- rigs/icom/icom.c | 1 + rigs/icom/icom.h | 2 +- 3 files changed, 84 insertions(+), 31 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |