[Hamlib-commits] Hamlib -- Ham radio control libraries branch Hamlib-4.0 updated. e53d1092de6d0be00
Library to control radio transceivers and receivers
Brought to you by:
n0nb
From: Nate B. <n0...@us...> - 2020-12-25 02:27:45
|
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, Hamlib-4.0 has been updated via e53d1092de6d0be007270ca9e73adb9c8fe39129 (commit) via 9d6e0fb73089b4343ecf14fb2da8f454fdb09ec8 (commit) via 3c270f3a2920c592876d4b4849a87fc2cb16172b (commit) via 030f0fbe878715c199711f6aec599e4ee742faad (commit) via e1d71692d6f6cefd9ce3248fcd02a3c9a3ae96cd (commit) via 21dd5f6ce0d999e563e1c67988864d70f17df2d9 (commit) via 0fe2dd8e0ea9fe14fdb01e68b3573c50522824d3 (commit) via 93df854a5b403809dc0fcc41283616eae7cbd1ea (commit) via bd6652e7ddbf3ea59dad5aa69a629e766c1681d7 (commit) via d1a1247cdba10e7647a972eaec7de245c4c45db9 (commit) via 2ad464fe3d16f041b91db8c88a45ce762d64d970 (commit) via 42cfa891f3119ab4c5753e4ce8f405b56f789e3b (commit) via d8079adeb44b2ae496240821604cabb265c42a48 (commit) via e3d74c89e4c1832bdcee1d9b22f599b96cdbd1ed (commit) via c60b9889282a3f77032171866375df0fff928205 (commit) via eaeb367af95c6f2408f3071bd8921e3ca5113e71 (commit) via 28237deeb0eceb6703ba6a668328f80ac1dacce2 (commit) via 9205dd15211f0178646e5760b4c54a3807398aa2 (commit) via 383b5cb4d549c220687cc3832c17684b0e3fe81c (commit) via a272d3d73073c7bb2ec33c48444460175825923c (commit) via bcc12a4c5a8c108af431cb8125192737f85e5f40 (commit) via d35dc1348063a275e496423b96a6824ac79190e8 (commit) via b9673b7f31cf348569b4e116028c28d9a646fcc3 (commit) via 879b7f3f8a9638ac33ec603952d8bf31ed559770 (commit) via f317b49e6c106993173d76105db5d8f70997ac75 (commit) via e730dcde9507fc2f32bd7a5127bed44cb9578215 (commit) via 392e5063402133664e207c029e52fd3878c00ff0 (commit) via 3fcb57373120c866fcd44af5ba500d869c3ce046 (commit) via 4dbe3a7528161244da689efe038130dcfe23b6aa (commit) via 0f4fbefafc9e03e409c0a683149ba161c599e6ec (commit) via 61aff573a00bceab4ae02cdd94a4247c32158226 (commit) via c32ebf67b12420ee91b1f3d7bc849ee098e99d42 (commit) via ecb099507c7bd4a4236180f8b6ec2725a7d1694e (commit) from af1a0828c327cff27ddd281e6a050ca5d21939d7 (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 e53d1092de6d0be007270ca9e73adb9c8fe39129 Author: Michael Black W9MDB <mdb...@ya...> Date: Tue Dec 22 17:01:06 2020 -0600 Add some debug for set_mode stuff (cherry picked from commit 18e9d56b4745097be56ac3899e4237afbf3f1736) diff --git a/rigs/kenwood/kenwood.c b/rigs/kenwood/kenwood.c index c366f3b1..73370375 100644 --- a/rigs/kenwood/kenwood.c +++ b/rigs/kenwood/kenwood.c @@ -637,7 +637,7 @@ rmode_t kenwood2rmode(unsigned char mode, const rmode_t mode_table[]) char rmode2kenwood(rmode_t mode, const rmode_t mode_table[]) { - rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); + rig_debug(RIG_DEBUG_VERBOSE, "%s called, mode=%s\n", __func__, rig_strrmode(mode)); if (mode != RIG_MODE_NONE) { @@ -647,6 +647,7 @@ char rmode2kenwood(rmode_t mode, const rmode_t mode_table[]) { if (mode_table[i] == mode) { + rig_debug(RIG_DEBUG_VERBOSE, "%s: returning %d\n", __func__, i); return i; } } @@ -1839,7 +1840,7 @@ int kenwood_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) struct kenwood_priv_caps *caps = kenwood_caps(rig); - rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); + rig_debug(RIG_DEBUG_VERBOSE, "%s called, vfo=%s, mode=%s, width=%d\n", __func__, rig_strvfo(vfo), rig_strrmode(mode), (int)width); if (RIG_IS_TS590S || RIG_IS_TS590SG || RIG_IS_TS950S || RIG_IS_TS950SDX) { @@ -1891,6 +1892,7 @@ int kenwood_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { c = 'A' + kmode - 10; } + rig_debug(RIG_DEBUG_VERBOSE, "%s: kmode=%d, cmode=%c\n", __func__, kmode, c); if (RIG_IS_TS990S) { diff --git a/src/rig.c b/src/rig.c index 0a3a4cc5..6f2771ee 100644 --- a/src/rig.c +++ b/src/rig.c @@ -1727,7 +1727,7 @@ int HAMLIB_API rig_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) const struct rig_caps *caps; int retcode; - rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); + rig_debug(RIG_DEBUG_VERBOSE, "%s called, vfo=%s, mode=%s, width=%d\n", __func__, rig_strvfo(vfo), rig_strrmode(mode), (int)width); if (CHECK_RIG_ARG(rig)) { commit 9d6e0fb73089b4343ecf14fb2da8f454fdb09ec8 Author: Michael Black W9MDB <mdb...@ya...> Date: Tue Dec 22 08:34:04 2020 -0600 Fix newcat.c uninitialized var (cherry picked from commit 5d2f5012c0623411be02308167a85cab64a7e328) diff --git a/rigs/yaesu/newcat.c b/rigs/yaesu/newcat.c index 7099384b..7c231116 100644 --- a/rigs/yaesu/newcat.c +++ b/rigs/yaesu/newcat.c @@ -2857,7 +2857,7 @@ int newcat_set_powerstat(RIG *rig, powerstat_t status) struct rig_state *state = &rig->state; struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv; int retval; - int i; + int i = 0; int retry_save; char ps; diff --git a/rigs/yaesu/newcat.h b/rigs/yaesu/newcat.h index f784d321..bf8b796a 100644 --- a/rigs/yaesu/newcat.h +++ b/rigs/yaesu/newcat.h @@ -50,7 +50,7 @@ typedef char ncboolean; /* shared function version */ -#define NEWCAT_VER "20201219" +#define NEWCAT_VER "20201222" /* Hopefully large enough for future use, 128 chars plus '\0' */ #define NEWCAT_DATA_LEN 129 commit 3c270f3a2920c592876d4b4849a87fc2cb16172b Author: Michael Black W9MDB <mdb...@ya...> Date: Mon Dec 21 23:50:29 2020 -0600 astyle files (cherry picked from commit 3211e3aea18f0669344d51e74c5a72f1a273f794) diff --git a/rigs/icom/icom.c b/rigs/icom/icom.c index 870a1be4..5bfa1c8b 100644 --- a/rigs/icom/icom.c +++ b/rigs/icom/icom.c @@ -1573,18 +1573,18 @@ int icom_set_mode_with_data(RIG *rig, vfo_t vfo, rmode_t mode, int ack_len = sizeof(ackbuf); rmode_t icom_mode; unsigned char dm_sub_cmd = - rig->caps->rig_model == RIG_MODEL_IC7200 ? 0x04 : S_MEM_DATA_MODE; + rig->caps->rig_model == RIG_MODEL_IC7200 ? 0x04 : S_MEM_DATA_MODE; int filter_byte = rig->caps->rig_model == RIG_MODEL_IC7100 - || rig->caps->rig_model == RIG_MODEL_IC7200 - || rig->caps->rig_model == RIG_MODEL_IC7300 - || rig->caps->rig_model == RIG_MODEL_IC7600 - || rig->caps->rig_model == RIG_MODEL_IC7610 - || rig->caps->rig_model == RIG_MODEL_IC7700 - || rig->caps->rig_model == RIG_MODEL_IC7800 - || rig->caps->rig_model == RIG_MODEL_IC785x - || rig->caps->rig_model == RIG_MODEL_IC9100 - || rig->caps->rig_model == RIG_MODEL_IC9700 - || rig->caps->rig_model == RIG_MODEL_IC705; + || rig->caps->rig_model == RIG_MODEL_IC7200 + || rig->caps->rig_model == RIG_MODEL_IC7300 + || rig->caps->rig_model == RIG_MODEL_IC7600 + || rig->caps->rig_model == RIG_MODEL_IC7610 + || rig->caps->rig_model == RIG_MODEL_IC7700 + || rig->caps->rig_model == RIG_MODEL_IC7800 + || rig->caps->rig_model == RIG_MODEL_IC785x + || rig->caps->rig_model == RIG_MODEL_IC9100 + || rig->caps->rig_model == RIG_MODEL_IC9700 + || rig->caps->rig_model == RIG_MODEL_IC705; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); @@ -1641,6 +1641,7 @@ int icom_set_mode_with_data(RIG *rig, vfo_t vfo, rmode_t mode, } rig2icom_mode(rig, vfo, mode, width, &mode_icom, &width_icom); + if (filter_byte && width_icom != -1) // then we need the width byte too { // since width_icom is 0-2 for rigs that need this here we have to make it 1-3 diff --git a/rigs/yaesu/newcat.c b/rigs/yaesu/newcat.c index 153ac092..7099384b 100644 --- a/rigs/yaesu/newcat.c +++ b/rigs/yaesu/newcat.c @@ -7438,7 +7438,8 @@ int newcat_set_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { // some rigs now require the bandwidth be turned "on" int on = is_ft891; - snprintf(priv->cmd_str, sizeof(priv->cmd_str), "SH%c%d%02d;", main_sub_vfo, on, w); + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "SH%c%d%02d;", main_sub_vfo, on, + w); } else { @@ -7627,7 +7628,8 @@ int newcat_get_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t *width) char cmd[] = "SH"; char main_sub_vfo = '0'; - rig_debug(RIG_DEBUG_VERBOSE, "%s called, vfo=%s, mode=%s\n", __func__, rig_strvfo(vfo), rig_strrmode(mode)); + rig_debug(RIG_DEBUG_VERBOSE, "%s called, vfo=%s, mode=%s\n", __func__, + rig_strvfo(vfo), rig_strrmode(mode)); if (!newcat_valid_command(rig, cmd)) { @@ -7682,12 +7684,14 @@ int newcat_get_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t *width) int on; // do we need to pay attention to the Main/Sub here? int n = sscanf(priv->ret_data, "SH%*1d%1d%3d", &on, &w); + if (n != 2) { err = -RIG_EPROTO; } #if 0 // this may apply to another Yaesu rig + if (n == 2) { if (!on) { w = 0; } @@ -7696,6 +7700,7 @@ int newcat_get_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t *width) { err = -RIG_EPROTO; } + #endif } else if (strlen(priv->ret_data) == 6) diff --git a/src/rig.c b/src/rig.c index b2397fe4..0a3a4cc5 100644 --- a/src/rig.c +++ b/src/rig.c @@ -1941,12 +1941,15 @@ pbwidth_t HAMLIB_API rig_passband_normal(RIG *rig, rmode_t mode) { if (rs->filters[i].modes & mode) { - rig_debug(RIG_DEBUG_VERBOSE, "%s: return filter#%d, width=%d\n", __func__, i, (int)rs->filters[i].width); + rig_debug(RIG_DEBUG_VERBOSE, "%s: return filter#%d, width=%d\n", __func__, i, + (int)rs->filters[i].width); return rs->filters[i].width; } } - rig_debug(RIG_DEBUG_VERBOSE, "%s: filter not found...return RIG_PASSBAND_NORMAL=%d\n", __func__, (int)RIG_PASSBAND_NORMAL); + rig_debug(RIG_DEBUG_VERBOSE, + "%s: filter not found...return RIG_PASSBAND_NORMAL=%d\n", __func__, + (int)RIG_PASSBAND_NORMAL); return RIG_PASSBAND_NORMAL; } commit 030f0fbe878715c199711f6aec599e4ee742faad Author: Steve Mobley <wb...@mi...> Date: Tue Dec 22 00:13:05 2020 -0500 Add bank select to IC-7100 (cherry picked from commit 61956faeb3bca79f68510e3bda45a95c556073a9) diff --git a/rigs/icom/ic7100.c b/rigs/icom/ic7100.c index 4cd27a21..50032220 100644 --- a/rigs/icom/ic7100.c +++ b/rigs/icom/ic7100.c @@ -243,7 +243,7 @@ const struct rig_caps ic7100_caps = .vfo_ops = IC7100_VFO_OPS, .scan_ops = IC7100_SCAN_OPS, .transceive = RIG_TRN_RIG, - .bank_qty = 0, + .bank_qty = 5, .chan_desc_sz = 9, /* TODO */ .chan_list = { /* TBC */ @@ -380,6 +380,7 @@ const struct rig_caps ic7100_caps = .set_ext_func = icom_set_ext_func, .get_ext_func = icom_get_ext_func, .set_mem = icom_set_mem, + .set_bank = icom_set_bank, .vfo_op = icom_vfo_op, .scan = icom_scan, .get_dcd = icom_get_dcd, commit e1d71692d6f6cefd9ce3248fcd02a3c9a3ae96cd Author: Mikael Nousiainen <mik...@ik...> Date: Mon Dec 21 18:15:15 2020 +0200 Fix RIG_PASSBAND_NOCHANGE use with Icom data modes. Allow selecting FIL2 as normal passband when in data mode. Add new Icom rigs to list that determines whether Icom data mode command supports setting filter too. (cherry picked from commit 9e62b2783ff5e60d4d8ab19a8a8beb2f091c6e8a) diff --git a/rigs/icom/frame.c b/rigs/icom/frame.c index 5d272eea..861347a0 100644 --- a/rigs/icom/frame.c +++ b/rigs/icom/frame.c @@ -414,6 +414,8 @@ int rig2icom_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width, { case RIG_MODE_AM: icmode = S_AM; break; + case RIG_MODE_PKTAM: icmode = S_AM; break; + case RIG_MODE_AMN: icmode = S_AMN; break; case RIG_MODE_AMS: icmode = S_AMS; break; @@ -440,8 +442,12 @@ int rig2icom_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width, case RIG_MODE_FM: icmode = S_FM; break; + case RIG_MODE_PKTFM: icmode = S_FM; break; + case RIG_MODE_FMN: icmode = S_FMN; break; + case RIG_MODE_PKTFMN: icmode = S_FMN; break; + case RIG_MODE_WFM: icmode = S_WFM; break; case RIG_MODE_P25: icmode = S_P25; break; @@ -468,15 +474,19 @@ int rig2icom_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width, { pbwidth_t medium_width = rig_passband_normal(rig, mode); - if (width == medium_width || width == RIG_PASSBAND_NORMAL) + if (width == RIG_PASSBAND_NORMAL) { - icmode_ext = - -1; /* medium, no passband data-> rig default. Is medium always the default? */ + // Use rig default for "normal" passband + icmode_ext = -1; } else if (width < medium_width) { icmode_ext = PD_NARROW_3; } + else if (width == medium_width) + { + icmode_ext = PD_MEDIUM_3; + } else { icmode_ext = PD_WIDE_3; diff --git a/rigs/icom/icom.c b/rigs/icom/icom.c index 22831206..870a1be4 100644 --- a/rigs/icom/icom.c +++ b/rigs/icom/icom.c @@ -1572,10 +1572,19 @@ int icom_set_mode_with_data(RIG *rig, vfo_t vfo, rmode_t mode, unsigned char ackbuf[MAXFRAMELEN]; int ack_len = sizeof(ackbuf); rmode_t icom_mode; - unsigned char dm_sub_cmd = RIG_MODEL_IC7200 == rig->caps->rig_model ? 0x04 : - S_MEM_DATA_MODE; - int filter_byte = rig->caps->rig_model == RIG_MODEL_IC7300 - || rig->caps->rig_model == RIG_MODEL_IC7610; + unsigned char dm_sub_cmd = + rig->caps->rig_model == RIG_MODEL_IC7200 ? 0x04 : S_MEM_DATA_MODE; + int filter_byte = rig->caps->rig_model == RIG_MODEL_IC7100 + || rig->caps->rig_model == RIG_MODEL_IC7200 + || rig->caps->rig_model == RIG_MODEL_IC7300 + || rig->caps->rig_model == RIG_MODEL_IC7600 + || rig->caps->rig_model == RIG_MODEL_IC7610 + || rig->caps->rig_model == RIG_MODEL_IC7700 + || rig->caps->rig_model == RIG_MODEL_IC7800 + || rig->caps->rig_model == RIG_MODEL_IC785x + || rig->caps->rig_model == RIG_MODEL_IC9100 + || rig->caps->rig_model == RIG_MODEL_IC9700 + || rig->caps->rig_model == RIG_MODEL_IC705; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); @@ -1611,6 +1620,8 @@ int icom_set_mode_with_data(RIG *rig, vfo_t vfo, rmode_t mode, if (RIG_OK == retval) { unsigned char datamode[2]; + unsigned char mode_icom; // Not used, we only need the width + signed char width_icom; switch (mode) { @@ -1629,31 +1640,21 @@ int icom_set_mode_with_data(RIG *rig, vfo_t vfo, rmode_t mode, break; } - if (width != RIG_PASSBAND_NOCHANGE) + rig2icom_mode(rig, vfo, mode, width, &mode_icom, &width_icom); + if (filter_byte && width_icom != -1) // then we need the width byte too { - unsigned char mode_icom; // not usb as it will map to USB/LSB - signed char width_icom; - rig2icom_mode(rig, vfo, mode, width, &mode_icom, &width_icom); - if (filter_byte && width_icom != -1) // then we need the width byte too - { - // since width_icom is 0-2 for rigs that need this here we have to make it 1-3 - datamode[1] = datamode[0] ? width_icom : 0; - retval = - icom_transaction(rig, C_CTL_MEM, dm_sub_cmd, datamode, 2, - ackbuf, - &ack_len); - } - else - { - retval = - icom_transaction(rig, C_CTL_MEM, dm_sub_cmd, datamode, 1, ackbuf, - &ack_len); - } + // since width_icom is 0-2 for rigs that need this here we have to make it 1-3 + datamode[1] = datamode[0] ? width_icom : 0; + retval = + icom_transaction(rig, C_CTL_MEM, dm_sub_cmd, datamode, 2, + ackbuf, + &ack_len); } else { - rig_debug(RIG_DEBUG_TRACE, "%s RIG_PASSBAND_NOCHANGE\n", __func__); - return RIG_OK; + retval = + icom_transaction(rig, C_CTL_MEM, dm_sub_cmd, datamode, 1, ackbuf, + &ack_len); } if (retval != RIG_OK) commit 21dd5f6ce0d999e563e1c67988864d70f17df2d9 Author: Michael Black W9MDB <mdb...@ya...> Date: Sat Dec 19 16:48:21 2020 -0600 Do not band select on FT891 as it does not remember bandwidth (cherry picked from commit 1d15625757a8abea22794f2efb00be2ed13b9c8f) diff --git a/rigs/yaesu/ft891.c b/rigs/yaesu/ft891.c index 0740f055..adc5efa4 100644 --- a/rigs/yaesu/ft891.c +++ b/rigs/yaesu/ft891.c @@ -50,7 +50,7 @@ const struct rig_caps ft891_caps = RIG_MODEL(RIG_MODEL_FT891), .model_name = "FT-891", .mfg_name = "Yaesu", - .version = NEWCAT_VER ".2", + .version = NEWCAT_VER ".3", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, diff --git a/rigs/yaesu/newcat.c b/rigs/yaesu/newcat.c index 1fc323fe..153ac092 100644 --- a/rigs/yaesu/newcat.c +++ b/rigs/yaesu/newcat.c @@ -786,7 +786,8 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq) // And only when not in split mode if (newcat_valid_command(rig, "BS") && newcat_band_index(freq) != newcat_band_index(rig->state.current_freq) - && !rig->state.cache.split) + && !rig->state.cache.split + && !is_ft891) // 891 does not remember bandwidth so don't do this { snprintf(priv->cmd_str, sizeof(priv->cmd_str), "BS%02d%c", newcat_band_index(freq), cat_term); @@ -7626,7 +7627,7 @@ int newcat_get_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t *width) char cmd[] = "SH"; char main_sub_vfo = '0'; - rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); + rig_debug(RIG_DEBUG_VERBOSE, "%s called, vfo=%s, mode=%s\n", __func__, rig_strvfo(vfo), rig_strrmode(mode)); if (!newcat_valid_command(rig, cmd)) { commit 0fe2dd8e0ea9fe14fdb01e68b3573c50522824d3 Author: Michael Black W9MDB <mdb...@ya...> Date: Sat Dec 19 14:30:31 2020 -0600 Fix icom default filter settings https://github.com/Hamlib/Hamlib/issues/471 (cherry picked from commit 2b1bce89bf0834c35619442d5623be3c45cb0974) diff --git a/rigs/icom/frame.c b/rigs/icom/frame.c index fbff3dda..5d272eea 100644 --- a/rigs/icom/frame.c +++ b/rigs/icom/frame.c @@ -297,6 +297,10 @@ int icom_transaction(RIG *rig, int cmd, int subcmd, { int retval, retry; + rig_debug(RIG_DEBUG_VERBOSE, + "%s: cmd=0x%02x, subcmd=0x%02x, payload_len=%d, data_len=%d\n", __func__, + cmd, subcmd, payload_len, *data_len); + retry = rig->state.rigport.retry; do diff --git a/rigs/icom/icom.c b/rigs/icom/icom.c index c83d5a7f..22831206 100644 --- a/rigs/icom/icom.c +++ b/rigs/icom/icom.c @@ -1631,11 +1631,11 @@ int icom_set_mode_with_data(RIG *rig, vfo_t vfo, rmode_t mode, if (width != RIG_PASSBAND_NOCHANGE) { - if (filter_byte) // then we need the width byte too + unsigned char mode_icom; // not usb as it will map to USB/LSB + signed char width_icom; + rig2icom_mode(rig, vfo, mode, width, &mode_icom, &width_icom); + if (filter_byte && width_icom != -1) // then we need the width byte too { - unsigned char mode_icom; // not used as it will map to USB/LSB - signed char width_icom; - rig2icom_mode(rig, vfo, mode, width, &mode_icom, &width_icom); // since width_icom is 0-2 for rigs that need this here we have to make it 1-3 datamode[1] = datamode[0] ? width_icom : 0; retval = diff --git a/rigs/icom/icom.h b/rigs/icom/icom.h index 7004bbfd..6b7dadec 100644 --- a/rigs/icom/icom.h +++ b/rigs/icom/icom.h @@ -30,7 +30,7 @@ #include <sys/time.h> #endif -#define BACKEND_VER "20201216" +#define BACKEND_VER "20201219" /* * defines used by comp_cal_str in rig.c diff --git a/src/rig.c b/src/rig.c index c7f48821..b2397fe4 100644 --- a/src/rig.c +++ b/src/rig.c @@ -1941,10 +1941,12 @@ pbwidth_t HAMLIB_API rig_passband_normal(RIG *rig, rmode_t mode) { if (rs->filters[i].modes & mode) { + rig_debug(RIG_DEBUG_VERBOSE, "%s: return filter#%d, width=%d\n", __func__, i, (int)rs->filters[i].width); return rs->filters[i].width; } } + rig_debug(RIG_DEBUG_VERBOSE, "%s: filter not found...return RIG_PASSBAND_NORMAL=%d\n", __func__, (int)RIG_PASSBAND_NORMAL); return RIG_PASSBAND_NORMAL; } commit 93df854a5b403809dc0fcc41283616eae7cbd1ea Author: Michael Black W9MDB <mdb...@ya...> Date: Fri Dec 18 23:57:38 2020 -0600 Reorder newcat_band_index to return 15 for 2M band instead of 14 https://github.com/Hamlib/Hamlib/issues/470 (cherry picked from commit 5a208a871d115b485b08b17ddcd3a2a23af09ebb) diff --git a/rigs/yaesu/newcat.c b/rigs/yaesu/newcat.c index fcc4654f..1fc323fe 100644 --- a/rigs/yaesu/newcat.c +++ b/rigs/yaesu/newcat.c @@ -399,10 +399,10 @@ static int newcat_band_index(freq_t freq) // does anybody work LSB or RTTYR at the upper band edge? // what about band 13 -- what is it? if (freq >= MHz(420) && freq < MHz(470)) { band = 16; } + else if (freq >= MHz(144) && freq < MHz(148)) { band = 15; } // band 14 is RX only + // override band 15 with 14 if needed else if (freq >= MHz(118) && freq < MHz(164)) { band = 14; } - // override band 14 with 15 if needed - else if (freq >= MHz(144) && freq < MHz(148)) { band = 15; } else if (freq >= MHz(70) && freq < MHz(70.5)) { band = 17; } else if (freq >= MHz(50) && freq < MHz(55)) { band = 10; } else if (freq >= MHz(28) && freq < MHz(29.7)) { band = 9; } @@ -9051,7 +9051,7 @@ int newcat_get_cmd(RIG *rig) __func__, priv->ret_data); // we were using BUSBUSY but microham devices need retries //rc = -RIG_BUSBUSY; /* don't write command again */ - rc = -RIG_EPROTO; + // rc = -RIG_EPROTO; /* we could decrement retry_count here but there is a danger of infinite looping so we just use up diff --git a/rigs/yaesu/newcat.h b/rigs/yaesu/newcat.h index 63b80501..f784d321 100644 --- a/rigs/yaesu/newcat.h +++ b/rigs/yaesu/newcat.h @@ -50,7 +50,7 @@ typedef char ncboolean; /* shared function version */ -#define NEWCAT_VER "20201218" +#define NEWCAT_VER "20201219" /* Hopefully large enough for future use, 128 chars plus '\0' */ #define NEWCAT_DATA_LEN 129 commit bd6652e7ddbf3ea59dad5aa69a629e766c1681d7 Author: Michael Black W9MDB <mdb...@ya...> Date: Fri Dec 18 12:41:25 2020 -0600 Fix gpredict behavior with cross band split Yaesu memory will be ignored for now when in split mode We may want to allow it when we allow for VFOA/B caching https://github.com/Hamlib/Hamlib/issues/470 (cherry picked from commit e5b7a5442d15fba365e6dc760b332c7e36dcabbf) diff --git a/rigs/yaesu/newcat.c b/rigs/yaesu/newcat.c index e92bca3c..fcc4654f 100644 --- a/rigs/yaesu/newcat.c +++ b/rigs/yaesu/newcat.c @@ -783,8 +783,10 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq) // // Restore band memory if we can and band is changing -- we do it before we set the frequency + // And only when not in split mode if (newcat_valid_command(rig, "BS") - && newcat_band_index(freq) != newcat_band_index(rig->state.current_freq)) + && newcat_band_index(freq) != newcat_band_index(rig->state.current_freq) + && !rig->state.cache.split) { snprintf(priv->cmd_str, sizeof(priv->cmd_str), "BS%02d%c", newcat_band_index(freq), cat_term); commit d1a1247cdba10e7647a972eaec7de245c4c45db9 Author: Michael Black W9MDB <mdb...@ya...> Date: Fri Dec 18 08:52:38 2020 -0600 Fix FT-891 bandwidth selection -- seems newer rigs now have an "on" value now https://github.com/Hamlib/Hamlib/issues/469 (cherry picked from commit aa58442e18d6ad51dc3914f0ecef149c20c0a2bd) diff --git a/rigs/yaesu/newcat.c b/rigs/yaesu/newcat.c index 858b4039..e92bca3c 100644 --- a/rigs/yaesu/newcat.c +++ b/rigs/yaesu/newcat.c @@ -7433,7 +7433,9 @@ int newcat_set_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) if (is_ftdx101 || is_ft891) { - snprintf(priv->cmd_str, sizeof(priv->cmd_str), "SH%c0%02d;", main_sub_vfo, w); + // some rigs now require the bandwidth be turned "on" + int on = is_ft891; + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "SH%c%d%02d;", main_sub_vfo, on, w); } else { diff --git a/rigs/yaesu/newcat.h b/rigs/yaesu/newcat.h index faa00a1b..63b80501 100644 --- a/rigs/yaesu/newcat.h +++ b/rigs/yaesu/newcat.h @@ -50,7 +50,7 @@ typedef char ncboolean; /* shared function version */ -#define NEWCAT_VER "20201217" +#define NEWCAT_VER "20201218" /* Hopefully large enough for future use, 128 chars plus '\0' */ #define NEWCAT_DATA_LEN 129 commit 2ad464fe3d16f041b91db8c88a45ce762d64d970 Author: Michael Black W9MDB <mdb...@ya...> Date: Thu Dec 17 23:57:25 2020 -0600 Fix SH command for FT-450 Comment out on/off flag for future possibilities CAT manual doesn't match what rig is returning...7 bytes vs 6 in the manual https://github.com/Hamlib/Hamlib/issues/469 (cherry picked from commit f43e190e0739f142c70d700c00d2c80503b06ce7) diff --git a/rigs/yaesu/newcat.c b/rigs/yaesu/newcat.c index c2515a76..858b4039 100644 --- a/rigs/yaesu/newcat.c +++ b/rigs/yaesu/newcat.c @@ -7675,8 +7675,14 @@ int newcat_get_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t *width) if (strlen(priv->ret_data) == 7) { int on; - int n = sscanf(priv->ret_data, "SH0%1d%3d", &on, &w); + // do we need to pay attention to the Main/Sub here? + int n = sscanf(priv->ret_data, "SH%*1d%1d%3d", &on, &w); + if (n != 2) + { + err = -RIG_EPROTO; + } +#if 0 // this may apply to another Yaesu rig if (n == 2) { if (!on) { w = 0; } @@ -7685,6 +7691,7 @@ int newcat_get_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t *width) { err = -RIG_EPROTO; } +#endif } else if (strlen(priv->ret_data) == 6) { diff --git a/rigs/yaesu/newcat.h b/rigs/yaesu/newcat.h index bf7b1dcd..faa00a1b 100644 --- a/rigs/yaesu/newcat.h +++ b/rigs/yaesu/newcat.h @@ -50,7 +50,7 @@ typedef char ncboolean; /* shared function version */ -#define NEWCAT_VER "20201216" +#define NEWCAT_VER "20201217" /* Hopefully large enough for future use, 128 chars plus '\0' */ #define NEWCAT_DATA_LEN 129 commit 42cfa891f3119ab4c5753e4ce8f405b56f789e3b Author: Michael Black W9MDB <mdb...@ya...> Date: Thu Dec 17 16:58:21 2020 -0600 Fix default powermeter_scale in flrig.c (cherry picked from commit b263ea1697ec6af19ffae763ec38797555ef72f3) diff --git a/rigs/dummy/flrig.c b/rigs/dummy/flrig.c index 668fd5ef..5dc4f823 100644 --- a/rigs/dummy/flrig.c +++ b/rigs/dummy/flrig.c @@ -742,7 +742,7 @@ static int flrig_open(RIG *rig) if (retval != RIG_OK) { return retval; } - priv->powermeter_scale = 100; // default + priv->powermeter_scale = 1; // default if (strlen(value) > 0) { commit d8079adeb44b2ae496240821604cabb265c42a48 Author: Michael Black W9MDB <mdb...@ya...> Date: Thu Dec 17 16:51:19 2020 -0600 Add powermeter_scale to flrig (cherry picked from commit 29c57bc5a7d8caa2a2c8d2a39f75e98accd34232) diff --git a/rigs/dummy/flrig.c b/rigs/dummy/flrig.c index a6ce6d93..668fd5ef 100644 --- a/rigs/dummy/flrig.c +++ b/rigs/dummy/flrig.c @@ -1923,7 +1923,7 @@ static int flrig_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) char value[MAXARGLEN]; char *cmd; int retval; - //struct flrig_priv_data *priv = (struct flrig_priv_data *) rig->state.priv; + struct flrig_priv_data *priv = (struct flrig_priv_data *) rig->state.priv; rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s\n", __func__, rig_strvfo(vfo)); @@ -1964,12 +1964,12 @@ 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); case RIG_LEVEL_RFPOWER_METER: - val->f = atof(value) / 100.0; + 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_WATTS: - val->f = atof(value); + val->f = atof(value) * priv->powermeter_scale; rig_debug(RIG_DEBUG_TRACE, "%s: val.f='%s'(%g)\n", __func__, value, val->f); break; diff --git a/rigs/dummy/flrig.h b/rigs/dummy/flrig.h index 5eac365b..ad0e0f74 100644 --- a/rigs/dummy/flrig.h +++ b/rigs/dummy/flrig.h @@ -28,7 +28,7 @@ #include <sys/time.h> #endif -#define BACKEND_VER "20201216" +#define BACKEND_VER "20201217" #define EOM "\r" #define TRUE 1 commit e3d74c89e4c1832bdcee1d9b22f599b96cdbd1ed Author: Michael Black W9MDB <mdb...@ya...> Date: Thu Dec 17 16:37:53 2020 -0600 Fix RIG_LEVEL_RFPOWER_METER_WATTS for flrig #2 (cherry picked from commit 0242df5098d3e3efc1c00cd4bbe7fa873c887ee2) diff --git a/rigs/dummy/flrig.c b/rigs/dummy/flrig.c index 2934b9c2..a6ce6d93 100644 --- a/rigs/dummy/flrig.c +++ b/rigs/dummy/flrig.c @@ -1939,6 +1939,7 @@ static int flrig_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) case RIG_LEVEL_STRENGTH: cmd = "rig.get_power"; break; + case RIG_LEVEL_RFPOWER_METER_WATTS: case RIG_LEVEL_RFPOWER_METER: cmd = "rig.get_pwrmeter"; break; default: commit c60b9889282a3f77032171866375df0fff928205 Author: Michael Black W9MDB <mdb...@ya...> Date: Thu Dec 17 16:16:45 2020 -0600 Fix RIG_LEVEL_RFPOWER_METER_WATTS for flrig (cherry picked from commit cb7f5ca120298328a82eff1ac6297a9e7e366258) diff --git a/rigs/dummy/flrig.c b/rigs/dummy/flrig.c index 3b38a0b2..2934b9c2 100644 --- a/rigs/dummy/flrig.c +++ b/rigs/dummy/flrig.c @@ -57,7 +57,7 @@ RIG_MODE_SSB | RIG_MODE_LSB | RIG_MODE_USB |\ RIG_MODE_FM | RIG_MODE_WFM | RIG_MODE_FMN |RIG_MODE_PKTFM ) -#define FLRIG_LEVELS (RIG_LEVEL_AF | RIG_LEVEL_RF | RIG_LEVEL_MICGAIN | RIG_LEVEL_STRENGTH | RIG_LEVEL_RFPOWER_METER) +#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 streq(s1,s2) (strcmp(s1,s2)==0) commit eaeb367af95c6f2408f3071bd8921e3ca5113e71 Author: Michael Black W9MDB <mdb...@ya...> Date: Thu Dec 17 15:07:04 2020 -0600 astyle files (cherry picked from commit 263f1cde72081e4e6bdf1c02eca5253a9445fe99) diff --git a/rigs/dummy/flrig.c b/rigs/dummy/flrig.c index a34da5ad..3b38a0b2 100644 --- a/rigs/dummy/flrig.c +++ b/rigs/dummy/flrig.c @@ -1963,7 +1963,7 @@ 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); case RIG_LEVEL_RFPOWER_METER: - val->f = atof(value)/100.0; + val->f = atof(value) / 100.0; rig_debug(RIG_DEBUG_TRACE, "%s: val.f='%s'(%g)\n", __func__, value, val->f); break; diff --git a/rigs/dummy/rot_dummy.c b/rigs/dummy/rot_dummy.c index d5b8b994..974f9caf 100644 --- a/rigs/dummy/rot_dummy.c +++ b/rigs/dummy/rot_dummy.c @@ -165,7 +165,7 @@ static int dummy_rot_init(ROT *rot) static int dummy_rot_cleanup(ROT *rot) { struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *) - rot->state.priv; + rot->state.priv; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); @@ -261,7 +261,7 @@ static int dummy_rot_set_position(ROT *rot, azimuth_t az, elevation_t el) static void dummy_rot_simulate_rotation(ROT *rot) { - struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *) + struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *) rot->state.priv; struct timeval tv; unsigned elapsed; /* ms */ @@ -280,7 +280,8 @@ static void dummy_rot_simulate_rotation(ROT *rot) { /* target reached */ priv->az = priv->target_az; - priv->status &= ~(ROT_STATUS_MOVING_AZ | ROT_STATUS_MOVING_LEFT | ROT_STATUS_MOVING_RIGHT); + priv->status &= ~(ROT_STATUS_MOVING_AZ | ROT_STATUS_MOVING_LEFT | + ROT_STATUS_MOVING_RIGHT); } else { @@ -300,7 +301,8 @@ static void dummy_rot_simulate_rotation(ROT *rot) { /* target reached */ priv->el = priv->target_el; - priv->status &= ~(ROT_STATUS_MOVING_EL | ROT_STATUS_MOVING_UP | ROT_STATUS_MOVING_DOWN); + priv->status &= ~(ROT_STATUS_MOVING_EL | ROT_STATUS_MOVING_UP | + ROT_STATUS_MOVING_DOWN); } else { @@ -316,9 +318,12 @@ static void dummy_rot_simulate_rotation(ROT *rot) } } - if (priv->status & (ROT_STATUS_MOVING_AZ | ROT_STATUS_MOVING_EL)) { + if (priv->status & (ROT_STATUS_MOVING_AZ | ROT_STATUS_MOVING_EL)) + { priv->status |= ROT_STATUS_MOVING; - } else { + } + else + { priv->status &= ~(ROT_STATUS_MOVING); } @@ -427,7 +432,8 @@ static const char *dummy_rot_get_info(ROT *rot) static int dummy_set_func(ROT *rot, setting_t func, int status) { - struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)rot->state.priv; + struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *) + rot->state.priv; rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s %d\n", __func__, rot_strfunc(func), status); @@ -447,7 +453,8 @@ static int dummy_set_func(ROT *rot, setting_t func, int status) static int dummy_get_func(ROT *rot, setting_t func, int *status) { - struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)rot->state.priv; + struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *) + rot->state.priv; *status = (priv->funcs & func) ? 1 : 0; @@ -460,7 +467,8 @@ static int dummy_get_func(ROT *rot, setting_t func, int *status) static int dummy_set_level(ROT *rot, setting_t level, value_t val) { - struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)rot->state.priv; + struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *) + rot->state.priv; int idx; char lstr[32]; @@ -491,7 +499,8 @@ static int dummy_set_level(ROT *rot, setting_t level, value_t val) static int dummy_get_level(ROT *rot, setting_t level, value_t *val) { - struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)rot->state.priv; + struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *) + rot->state.priv; int idx; idx = rig_setting2idx(level); @@ -511,7 +520,8 @@ static int dummy_get_level(ROT *rot, setting_t level, value_t *val) static int dummy_set_ext_level(ROT *rot, token_t token, value_t val) { - struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)rot->state.priv; + struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *) + rot->state.priv; char lstr[64]; const struct confparams *cfp; struct ext_list *elp; @@ -579,7 +589,8 @@ static int dummy_set_ext_level(ROT *rot, token_t token, value_t val) static int dummy_get_ext_level(ROT *rot, token_t token, value_t *val) { - struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)rot->state.priv; + struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *) + rot->state.priv; const struct confparams *cfp; struct ext_list *elp; @@ -621,7 +632,8 @@ static int dummy_get_ext_level(ROT *rot, token_t token, value_t *val) static int dummy_set_ext_func(ROT *rot, token_t token, int status) { - struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)rot->state.priv; + struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *) + rot->state.priv; const struct confparams *cfp; struct ext_list *elp; @@ -672,7 +684,8 @@ static int dummy_set_ext_func(ROT *rot, token_t token, int status) static int dummy_get_ext_func(ROT *rot, token_t token, int *status) { - struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)rot->state.priv; + struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *) + rot->state.priv; const struct confparams *cfp; struct ext_list *elp; @@ -711,7 +724,8 @@ static int dummy_get_ext_func(ROT *rot, token_t token, int *status) static int dummy_set_parm(ROT *rot, setting_t parm, value_t val) { - struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)rot->state.priv; + struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *) + rot->state.priv; int idx; char pstr[32]; @@ -742,7 +756,8 @@ static int dummy_set_parm(ROT *rot, setting_t parm, value_t val) static int dummy_get_parm(ROT *rot, setting_t parm, value_t *val) { - struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)rot->state.priv; + struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *) + rot->state.priv; int idx; idx = rig_setting2idx(parm); @@ -762,7 +777,8 @@ static int dummy_get_parm(ROT *rot, setting_t parm, value_t *val) static int dummy_set_ext_parm(ROT *rot, token_t token, value_t val) { - struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)rot->state.priv; + struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *) + rot->state.priv; char lstr[64]; const struct confparams *cfp; struct ext_list *epp; @@ -827,7 +843,8 @@ static int dummy_set_ext_parm(ROT *rot, token_t token, value_t val) static int dummy_get_ext_parm(ROT *rot, token_t token, value_t *val) { - struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)rot->state.priv; + struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *) + rot->state.priv; const struct confparams *cfp; struct ext_list *epp; @@ -866,7 +883,8 @@ static int dummy_get_ext_parm(ROT *rot, token_t token, value_t *val) static int dummy_rot_get_status(ROT *rot, rot_status_t *status) { - struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)rot->state.priv; + struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *) + rot->state.priv; dummy_rot_simulate_rotation(rot); diff --git a/rigs/icom/frame.c b/rigs/icom/frame.c index e52950ad..fbff3dda 100644 --- a/rigs/icom/frame.c +++ b/rigs/icom/frame.c @@ -490,6 +490,7 @@ int rig2icom_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width, icmode_ext = PD_WIDE_3; /* default to Wide */ } } + *pd = icmode_ext; } else diff --git a/rigs/icom/icom.c b/rigs/icom/icom.c index 738738df..c83d5a7f 100644 --- a/rigs/icom/icom.c +++ b/rigs/icom/icom.c @@ -1604,7 +1604,8 @@ int icom_set_mode_with_data(RIG *rig, vfo_t vfo, rmode_t mode, break; } - rig_debug(RIG_DEBUG_VERBOSE, "%s mode=%d, width=%d\n", __func__, (int)icom_mode, (int)width); + rig_debug(RIG_DEBUG_VERBOSE, "%s mode=%d, width=%d\n", __func__, (int)icom_mode, + (int)width); retval = icom_set_mode(rig, vfo, icom_mode, width); if (RIG_OK == retval) @@ -1627,6 +1628,7 @@ int icom_set_mode_with_data(RIG *rig, vfo_t vfo, rmode_t mode, datamode[0] = 0x00; break; } + if (width != RIG_PASSBAND_NOCHANGE) { if (filter_byte) // then we need the width byte too @@ -1704,7 +1706,8 @@ int icom_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { err = rig2icom_mode(rig, vfo, mode, width, &icmode, &icmode_ext); } - if (width == RIG_PASSBAND_NOCHANGE) icmode_ext = priv_data->filter; + + if (width == RIG_PASSBAND_NOCHANGE) { icmode_ext = priv_data->filter; } if (err < 0) { @@ -1712,7 +1715,9 @@ int icom_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) return err; } - rig_debug(RIG_DEBUG_VERBOSE, "%s: icmode=%d, icmode_ext=%d\n", __func__, icmode, icmode_ext); + rig_debug(RIG_DEBUG_VERBOSE, "%s: icmode=%d, icmode_ext=%d\n", __func__, icmode, + icmode_ext); + /* IC-731, IC-735, IC-7000 don't support passband data */ /* IC-726 & IC-475A/E also limited support - only on CW */ /* TODO: G4WJS CW wide/narrow are possible with above two radios */ @@ -1724,7 +1729,8 @@ int icom_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) icmode_ext = -1; } - rig_debug(RIG_DEBUG_VERBOSE, "%s: #2 icmode=%d, icmode_ext=%d\n", __func__, icmode, icmode_ext); + rig_debug(RIG_DEBUG_VERBOSE, "%s: #2 icmode=%d, icmode_ext=%d\n", __func__, + icmode, icmode_ext); retval = icom_transaction(rig, C_SET_MODE, icmode, (unsigned char *) &icmode_ext, (icmode_ext == -1 ? 0 : 1), ackbuf, &ack_len); @@ -1775,6 +1781,7 @@ int icom_get_mode_with_data(RIG *rig, vfo_t vfo, rmode_t *mode, retval = icom_get_mode(rig, vfo, mode, width); rig_debug(RIG_DEBUG_VERBOSE, "%s mode=%d\n", __func__, (int)*mode); + if (retval != RIG_OK) { return retval; @@ -1820,7 +1827,9 @@ int icom_get_mode_with_data(RIG *rig, vfo_t vfo, rmode_t *mode, return -RIG_ERJCTED; } - rig_debug(RIG_DEBUG_VERBOSE, "%s databuf[2]=%d, mode=%d\n", __func__, (int)databuf[2], (int)*mode); + rig_debug(RIG_DEBUG_VERBOSE, "%s databuf[2]=%d, mode=%d\n", __func__, + (int)databuf[2], (int)*mode); + if (databuf[2]) /* 0x01/0x02/0x03 -> data mode, 0x00 -> not data mode */ { switch (*mode) @@ -3084,16 +3093,17 @@ int icom_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) break; case RIG_LEVEL_RFPOWER_METER_WATTS: + // eventually we should change all the Icom tables to watts if (rig->caps->rfpower_meter_cal.size == 0) { val->f = - rig_raw2val_float(icom_val, &icom_default_rfpower_meter_cal)*100; + rig_raw2val_float(icom_val, &icom_default_rfpower_meter_cal) * 100; } else { val->f = - rig_raw2val_float(icom_val, &rig->caps->rfpower_meter_cal)*100; + rig_raw2val_float(icom_val, &rig->caps->rfpower_meter_cal) * 100; } break; diff --git a/rigs/kenwood/flex6xxx.c b/rigs/kenwood/flex6xxx.c index 1da17bad..492d5205 100644 --- a/rigs/kenwood/flex6xxx.c +++ b/rigs/kenwood/flex6xxx.c @@ -774,10 +774,13 @@ int powersdr_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) case RIG_LEVEL_RFPOWER_METER: case RIG_LEVEL_RFPOWER_METER_WATTS: flex6k_get_ptt(rig, vfo, &ptt); - if (!ptt) { + + if (!ptt) + { val->f = 0; return RIG_OK; } + cmd = "ZZRM5"; len = 5; ans = 3; @@ -844,6 +847,7 @@ int powersdr_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) case RIG_LEVEL_RFPOWER_METER: case RIG_LEVEL_RFPOWER_METER_WATTS: n = sscanf(lvlbuf, "ZZRM%f", &val->f); + if (n != 1) { rig_debug(RIG_DEBUG_ERR, "%s: Error parsing value from lvlbuf='%s'\n", @@ -851,10 +855,12 @@ int powersdr_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) val->f = 0; return -RIG_EPROTO; } + if (level != RIG_LEVEL_RFPOWER_METER_WATTS) { val->f /= 100; } + break; case RIG_LEVEL_RF: diff --git a/rigs/kenwood/k3.c b/rigs/kenwood/k3.c index e371c1a8..abe1f491 100644 --- a/rigs/kenwood/k3.c +++ b/rigs/kenwood/k3.c @@ -1864,10 +1864,12 @@ int k3_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) } val->f = pwr; + if (level == RIG_LEVEL_RFPOWER_METER_WATTS) { val->f *= 100; } + break; } diff --git a/rigs/kenwood/kenwood.c b/rigs/kenwood/kenwood.c index 685aeb3b..c366f3b1 100644 --- a/rigs/kenwood/kenwood.c +++ b/rigs/kenwood/kenwood.c @@ -2398,8 +2398,11 @@ int kenwood_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) // https://github.com/Hamlib/Hamlib/issues/465 kenwood_val = val.f * power_max; - if (kenwood_val < power_min) kenwood_val = power_min; - if (kenwood_val > power_max) kenwood_val = power_max; + + if (kenwood_val < power_min) { kenwood_val = power_min; } + + if (kenwood_val > power_max) { kenwood_val = power_max; } + snprintf(levelbuf, sizeof(levelbuf), "PC%03d", kenwood_val); break; } @@ -3888,8 +3891,8 @@ int kenwood_set_powerstat(RIG *rig, powerstat_t status) sleep(1); retval = rig_get_freq(rig, RIG_VFO_A, &freq); - if (retval == RIG_OK) - { + if (retval == RIG_OK) + { rig->state.rigport.retry = retry_save; return retval; } diff --git a/rigs/yaesu/ft2000.c b/rigs/yaesu/ft2000.c index 03888f71..aeaa6af1 100644 --- a/rigs/yaesu/ft2000.c +++ b/rigs/yaesu/ft2000.c @@ -185,12 +185,12 @@ const struct rig_caps ft2000_caps = /* mode/filter list, .remember = order matters! */ .filters = { - {RIG_MODE_CW|RIG_MODE_CWR, Hz(500)}, /* Normal CW, RTTY, PKT/USER */ - {RIG_MODE_CW|RIG_MODE_CWR, Hz(200)}, /* Narrow CW, RTTY, PKT/USER */ - {RIG_MODE_CW|RIG_MODE_CWR, Hz(2400)}, /* Wide CW, RTTY, PKT/USER */ - {RIG_MODE_RTTY|RIG_MODE_RTTYR, Hz(500)}, /* Normal RTTY */ - {RIG_MODE_RTTY|RIG_MODE_RTTYR, Hz(300)}, /* Narrow RTTY */ - {RIG_MODE_RTTY|RIG_MODE_RTTYR, Hz(2400)}, /* Wide RTTY */ + {RIG_MODE_CW | RIG_MODE_CWR, Hz(500)}, /* Normal CW, RTTY, PKT/USER */ + {RIG_MODE_CW | RIG_MODE_CWR, Hz(200)}, /* Narrow CW, RTTY, PKT/USER */ + {RIG_MODE_CW | RIG_MODE_CWR, Hz(2400)}, /* Wide CW, RTTY, PKT/USER */ + {RIG_MODE_RTTY | RIG_MODE_RTTYR, Hz(500)}, /* Normal RTTY */ + {RIG_MODE_RTTY | RIG_MODE_RTTYR, Hz(300)}, /* Narrow RTTY */ + {RIG_MODE_RTTY | RIG_MODE_RTTYR, Hz(2400)}, /* Wide RTTY */ {RIG_MODE_SSB, Hz(2400)}, /* Normal SSB */ {RIG_MODE_SSB, Hz(1800)}, /* Narrow SSB */ {RIG_MODE_SSB, Hz(3000)}, /* Wide SSB */ diff --git a/rigs/yaesu/newcat.c b/rigs/yaesu/newcat.c index 1943adde..c2515a76 100644 --- a/rigs/yaesu/newcat.c +++ b/rigs/yaesu/newcat.c @@ -534,11 +534,14 @@ int newcat_open(RIG *rig) (void)newcat_get_rigid(rig); if (priv->rig_id == NC_RIGID_FT2000) - { // then we need to readjust rfpowermeter cal table in half + { + // then we need to readjust rfpowermeter cal table in half int i; - for(i=0;i<rig->caps->rfpower_meter_cal.size; ++i) - { // we may need a table for the FT2000 instead of this - rig->caps->rfpower_meter_cal.table[i].raw/=2; + + for (i = 0; i < rig->caps->rfpower_meter_cal.size; ++i) + { + // we may need a table for the FT2000 instead of this + rig->caps->rfpower_meter_cal.table[i].raw /= 2; } } @@ -2884,7 +2887,7 @@ int newcat_set_powerstat(RIG *rig, powerstat_t status) snprintf(priv->cmd_str, sizeof(priv->cmd_str), "PS%c%c", ps, cat_term); retval = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str)); - + retry_save = rig->state.rigport.retry; rig->state.rigport.retry = 0; @@ -2896,10 +2899,11 @@ int newcat_set_powerstat(RIG *rig, powerstat_t status) hl_usleep(1000000); retval = rig_get_freq(rig, RIG_VFO_A, &freq); - if (retval == RIG_OK) { + if (retval == RIG_OK) + { rig->state.rigport.retry = retry_save; - return retval; - } + return retval; + } rig_debug(RIG_DEBUG_TRACE, "%s: Wait #%d for power up\n", __func__, i + 1); } @@ -4182,6 +4186,7 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RM5%c", cat_term); } + break; case RIG_LEVEL_COMP_METER: @@ -4383,26 +4388,36 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) case RIG_LEVEL_RFPOWER_METER: case RIG_LEVEL_RFPOWER_METER_WATTS: rig_debug(RIG_DEBUG_VERBOSE, "%s: RFPOWER_METER retlvl=%s\n", __func__, retlvl); + if (retlvl_len > 3) { // Some rigs like FTDX101 have 6-byte return so we just truncate - rig_debug(RIG_DEBUG_VERBOSE, "%s: retlvl of %s getting truncated\n", __func__, retlvl); + rig_debug(RIG_DEBUG_VERBOSE, "%s: retlvl of %s getting truncated\n", __func__, + retlvl); retlvl[3] = 0; rig_debug(RIG_DEBUG_VERBOSE, "%s: retlvl truncated to %s\n", __func__, retlvl); } if (rig->caps->rfpower_meter_cal.size == 0) { - val->f = rig_raw2val_float(atoi(retlvl), &yaesu_default_rfpower_meter_cal)/(level == RIG_LEVEL_RFPOWER_METER_WATTS?1.0:100.0); + val->f = rig_raw2val_float(atoi(retlvl), + &yaesu_default_rfpower_meter_cal) / (level == RIG_LEVEL_RFPOWER_METER_WATTS ? + 1.0 : 100.0); } else { - val->f = rig_raw2val_float(atoi(retlvl), &rig->caps->rfpower_meter_cal)/(level == RIG_LEVEL_RFPOWER_METER_WATTS?1.0:100.0); + val->f = rig_raw2val_float(atoi(retlvl), + &rig->caps->rfpower_meter_cal) / (level == RIG_LEVEL_RFPOWER_METER_WATTS ? 1.0 : + 100.0); } - rig_debug(RIG_DEBUG_VERBOSE, "%s: RFPOWER_METER=%s, converted to %f\n", __func__, retlvl, val->f); - if (level == RIG_LEVEL_RFPOWER_METER && val->f > 1.0) + + rig_debug(RIG_DEBUG_VERBOSE, "%s: RFPOWER_METER=%s, converted to %f\n", + __func__, retlvl, val->f); + + if (level == RIG_LEVEL_RFPOWER_METER && val->f > 1.0) { - rig_debug(RIG_DEBUG_VERBOSE, "%s: val->f(%f) clipped at 1.0\n", __func__, val->f); + rig_debug(RIG_DEBUG_VERBOSE, "%s: val->f(%f) clipped at 1.0\n", __func__, + val->f); val->f = 1.0; } @@ -4417,11 +4432,11 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) if (rig->caps->comp_meter_cal.size == 0) { - val->f = rig_raw2val_float(atoi(retlvl), &yaesu_default_comp_meter_cal)/100; + val->f = rig_raw2val_float(atoi(retlvl), &yaesu_default_comp_meter_cal) / 100; } else { - val->f = rig_raw2val_float(atoi(retlvl), &rig->caps->comp_meter_cal)/100; + val->f = rig_raw2val_float(atoi(retlvl), &rig->caps->comp_meter_cal) / 100; } break; @@ -7656,11 +7671,14 @@ int newcat_get_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t *width) w = 0; // use default in case of error + if (strlen(priv->ret_data) == 7) { int on; int n = sscanf(priv->ret_data, "SH0%1d%3d", &on, &w); - if (n == 2) { + + if (n == 2) + { if (!on) { w = 0; } } else @@ -7671,14 +7689,15 @@ int newcat_get_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t *width) else if (strlen(priv->ret_data) == 6) { int n = sscanf(priv->ret_data, "SH%3d", &w); - if (n != 1) err = -RIG_EPROTO; + + if (n != 1) { err = -RIG_EPROTO; } } else { err = -RIG_EPROTO; } - rig_debug(RIG_DEBUG_TRACE, "%s: w=%d\n", __func__, w); + rig_debug(RIG_DEBUG_TRACE, "%s: w=%d\n", __func__, w); if (err != RIG_OK) { @@ -7878,7 +7897,7 @@ int newcat_get_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t *width) case 17: *width = 3000; break; - default: + default: rig_debug(RIG_DEBUG_ERR, "%s: unknown w=%d\n", __func__, w); return -RIG_EINVAL; } @@ -7933,7 +7952,7 @@ int newcat_get_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t *width) case 21: *width = 3200; break; - default: + default: rig_debug(RIG_DEBUG_ERR, "%s: unknown mode=%s\n", __func__, rig_strrmode(mode)); return -RIG_EINVAL; } @@ -8565,6 +8584,7 @@ int newcat_get_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t *width) { *width = 3000; } + break; case RIG_MODE_PKTUSB: @@ -8581,6 +8601,7 @@ int newcat_get_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t *width) { *width = 2400; } + break; case RIG_MODE_RTTY: @@ -8597,6 +8618,7 @@ int newcat_get_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t *width) { *width = 2400; } + break; case RIG_MODE_LSB: @@ -8617,6 +8639,7 @@ int newcat_get_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t *width) { *width = 4000; } + break; case RIG_MODE_AM: @@ -8665,6 +8688,7 @@ int newcat_get_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t *width) { *width = rig_passband_normal(rig, mode); } + break; case RIG_MODE_AM: @@ -9074,7 +9098,7 @@ int newcat_get_cmd(RIG *rig) */ rig_debug(RIG_DEBUG_ERR, "%s: Command rejected by the rig: '%s'\n", __func__, priv->cmd_str); - // return -RIG_ERJCTED; + // return -RIG_ERJCTED; } continue; diff --git a/rotators/easycomm/easycomm.c b/rotators/easycomm/easycomm.c index e2955c11..a75c2763 100644 --- a/rotators/easycomm/easycomm.c +++ b/rotators/easycomm/easycomm.c @@ -259,13 +259,16 @@ static int easycomm_rot_move_velocity(ROT *rot, int direction, int speed) rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__); - if (speed == ROT_SPEED_NOCHANGE) { + if (speed == ROT_SPEED_NOCHANGE) + { easycomm_speed = rs->current_speed; - } else { + } + else + { if (speed < 1 || speed > 100) { rig_debug(RIG_DEBUG_ERR, "%s: Invalid speed value (1-100)! (%d)\n", __func__, - speed); + speed); return -RIG_EINVAL; } @@ -314,12 +317,14 @@ static int easycomm_rot_get_level(ROT *rot, setting_t level, value_t *val) rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__, rot_strlevel(level)); - switch (level) { - case ROT_LEVEL_SPEED: - val->i = rs->current_speed; - break; - default: - return -RIG_ENAVAIL; + switch (level) + { + case ROT_LEVEL_SPEED: + val->i = rs->current_speed; + break; + + default: + return -RIG_ENAVAIL; } return RIG_OK; @@ -332,20 +337,27 @@ static int easycomm_rot_set_level(ROT *rot, setting_t level, value_t val) rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__, rot_strlevel(level)); - switch (level) { - case ROT_LEVEL_SPEED: { - int speed = val.i; - if (speed < 0) { - speed = 0; - } else if (speed > 9999) { - speed = 9999; - } - - rs->current_speed = speed; - break; + switch (level) + { + case ROT_LEVEL_SPEED: + { + int speed = val.i; + + if (speed < 0) + { + speed = 0; } - default: - return -RIG_ENAVAIL; + else if (speed > 9999) + { + speed = 9999; + } + + rs->current_speed = speed; + break; + } + + default: + return -RIG_ENAVAIL; } return RIG_OK; diff --git a/rotators/ether6/ether6.c b/rotators/ether6/ether6.c index 2a5c121a..10e65196 100644 --- a/rotators/ether6/ether6.c +++ b/rotators/ether6/ether6.c @@ -274,12 +274,16 @@ static int ether_rot_move(ROT *rot, int direction, int speed) rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); - if (speed == ROT_SPEED_NOCHANGE) { + if (speed == ROT_SPEED_NOCHANGE) + { ether_speed = rs->current_speed; - } else { + } + else + { if (speed < 1 || speed > 100) { - rig_debug(RIG_DEBUG_ERR, "%s: Invalid speed value (1-100)! (%d)\n", __func__, speed); + rig_debug(RIG_DEBUG_ERR, "%s: Invalid speed value (1-100)! (%d)\n", __func__, + speed); return -RIG_EINVAL; } @@ -315,12 +319,14 @@ static int ether_rot_get_level(ROT *rot, setting_t level, value_t *val) rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__, rot_strlevel(level)); - switch (level) { - case ROT_LEVEL_SPEED: - val->i = rs->current_speed; - break; - default: - return -RIG_ENAVAIL; + switch (level) + { + case ROT_LEVEL_SPEED: + val->i = rs->current_speed; + break; + + default: + return -RIG_ENAVAIL; } return RIG_OK; @@ -333,20 +339,27 @@ static int ether_rot_set_level(ROT *rot, setting_t level, value_t val) rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__, rot_strlevel(level)); - switch (level) { - case ROT_LEVEL_SPEED: { - int speed = val.i; - if (speed < 1) { - speed = 1; - } else if (speed > 100) { - speed = 100; - } - - rs->current_spe... [truncated message content] |