[Hamlib-commits] Hamlib -- Ham radio control libraries branch master updated. 1b52a009ef59424e53819
Library to control radio transceivers and receivers
Brought to you by:
n0nb
From: Michael B. <mdb...@us...> - 2021-08-28 14:11:17
|
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 1b52a009ef59424e53819bbafd2f2f0cda95bd99 (commit) via 4653aa2f6e952cd387b24fc592aa14cd70a1a217 (commit) via 4e1d243156c3043d3ca7d5ace439c8f4445b662a (commit) via 574f22b096cf4e30a698e0784ef5d2cc876d0de7 (commit) via 7bddd99cd835a14bf84d55c7ca577755430e2c80 (commit) via 06513a68692166725dfe4c7ff0399c39e7585de1 (commit) via b41f706edafc0bbd586ffa241b67c438fd8ebf71 (commit) via f6b54df7c74ad31d043b6eef72a88ec5ad01d39f (commit) via fe8c02bba0dbd2502782f45f4c7f3b3356b64832 (commit) via 5a0590d421117d154f8851731da7c56ea7036bbf (commit) via 0016d5a93390636b6c453b75865f91e1cab9a697 (commit) via 0d9bcbf9bf64e6d7a2b2921fc98e9d0f80e6a3c6 (commit) via 03fe6f650040e6ac1f58090f8dfc8d3df8cc5a62 (commit) from 49e59083f02d0a307aa1fad5ca69ed392172f548 (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 1b52a009ef59424e53819bbafd2f2f0cda95bd99 Author: Mike Black W9MDB <mdb...@ya...> Date: Sat Aug 28 09:10:35 2021 -0500 Move Startup debug line after set_debug_level diff --git a/tests/rigctl.c b/tests/rigctl.c index 5286778c..6e027faf 100644 --- a/tests/rigctl.c +++ b/tests/rigctl.c @@ -155,12 +155,6 @@ int main(int argc, char *argv[]) char resp_sep = '\n'; int i; - rig_debug(RIG_DEBUG_VERBOSE, "%s(%d) Startup:", __FILE__, __LINE__); - - for (i = 0; i < argc; ++i) { rig_debug(RIG_DEBUG_VERBOSE, " %s", argv[i]); } - - rig_debug(RIG_DEBUG_VERBOSE, "%s", "\n"); - while (1) { int c; @@ -446,6 +440,13 @@ int main(int argc, char *argv[]) rig_set_debug(verbose); + rig_debug(RIG_DEBUG_VERBOSE, "%s(%d) Startup:", __FILE__, __LINE__); + + for (i = 0; i < argc; ++i) { rig_debug(RIG_DEBUG_VERBOSE, " %s", argv[i]); } + + rig_debug(RIG_DEBUG_VERBOSE, "%s", "\n"); + + rig_debug(RIG_DEBUG_VERBOSE, "rigctl %s\n", hamlib_version2); rig_debug(RIG_DEBUG_VERBOSE, "%s", "Report bugs to <ham...@li...>\n\n"); commit 4653aa2f6e952cd387b24fc592aa14cd70a1a217 Author: Mike Black W9MDB <mdb...@ya...> Date: Fri Aug 27 22:25:53 2021 -0500 astyle files diff --git a/rigs/kenwood/kenwood.c b/rigs/kenwood/kenwood.c index 245325d2..589c2150 100644 --- a/rigs/kenwood/kenwood.c +++ b/rigs/kenwood/kenwood.c @@ -1257,7 +1257,7 @@ int kenwood_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t txvfo) // FR can turn off split on some Kenwood rigs // So we'll turn it back on just in case - if (split && vfo_function=='0') { strcat(cmdbuf, ";FT1"); } + if (split && vfo_function == '0') { strcat(cmdbuf, ";FT1"); } retval = kenwood_transaction(rig, cmdbuf, NULL, 0); diff --git a/rigs/yaesu/ft736.c b/rigs/yaesu/ft736.c index 6f3edce0..a16ed49e 100644 --- a/rigs/yaesu/ft736.c +++ b/rigs/yaesu/ft736.c @@ -311,7 +311,7 @@ int ft736_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) */ switch (mode) { - case RIG_MODE_CW: md = MD_CW; break; + case RIG_MODE_CW: md = MD_CW; break; case RIG_MODE_CWN: md = MD_CWN; break; @@ -319,7 +319,7 @@ int ft736_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) case RIG_MODE_LSB: md = MD_LSB; break; - case RIG_MODE_FM: md = MD_FM; break; + case RIG_MODE_FM: md = MD_FM; break; case RIG_MODE_FMN: md = MD_FMN; break; diff --git a/src/rig.c b/src/rig.c index 9241c90b..75885e8b 100644 --- a/src/rig.c +++ b/src/rig.c @@ -2951,6 +2951,7 @@ int HAMLIB_API rig_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) TRACE; rc2 = RIG_OK; + if (!targetable_ptt) { rc2 = caps->set_vfo(rig, curr_vfo); commit 4e1d243156c3043d3ca7d5ace439c8f4445b662a Merge: 7bddd99c 574f22b0 Author: Michael Black <mdb...@ya...> Date: Fri Aug 27 22:23:10 2021 -0500 Merge pull request #776 from KaComet/master Corrected modes for FT-736R. commit 574f22b096cf4e30a698e0784ef5d2cc876d0de7 Author: kacomet <cat...@sb...> Date: Fri Aug 27 19:41:38 2021 -0500 Corrected modes for FT-736R. The FT-736 supports SSB, CW, FM, FM-N (narrowband FM,) CW-N (narrowband CW.) Now, the FM-N and CW-N modes can be set from rigctl. Passbands have also been corrected to the values in the manual. diff --git a/include/hamlib/rig.h b/include/hamlib/rig.h index b5d8a891..352d503e 100644 --- a/include/hamlib/rig.h +++ b/include/hamlib/rig.h @@ -1224,7 +1224,7 @@ typedef uint64_t rmode_t; #define RIG_MODE_C4FM CONSTANT_64BIT_FLAG (33) /*!< \c Yaesu C4FM mode */ #define RIG_MODE_PKTFMN CONSTANT_64BIT_FLAG (34) /*!< \c Yaesu DATA-FM-N */ #define RIG_MODE_SPEC CONSTANT_64BIT_FLAG (35) /*!< \c Unfiltered as in PowerSDR */ -#define RIG_MODE_BIT36 CONSTANT_64BIT_FLAG (36) /*!< \c reserved for future expansion */ +#define RIG_MODE_CWN CONSTANT_64BIT_FLAG (36) /*!< \c CWN -- Narrow band CW (FT-736R) */ #define RIG_MODE_BIT37 CONSTANT_64BIT_FLAG (37) /*!< \c reserved for future expansion */ #define RIG_MODE_BIT38 CONSTANT_64BIT_FLAG (38) /*!< \c reserved for future expansion */ #define RIG_MODE_BIT39 CONSTANT_64BIT_FLAG (39) /*!< \c reserved for future expansion */ diff --git a/rigs/yaesu/ft736.c b/rigs/yaesu/ft736.c index ec4a023e..6f3edce0 100644 --- a/rigs/yaesu/ft736.c +++ b/rigs/yaesu/ft736.c @@ -38,7 +38,7 @@ -#define FT736_MODES (RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_FM) +#define FT736_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_FMN|RIG_MODE_CWN) #define FT736_VFOS (RIG_VFO_A) @@ -181,10 +181,10 @@ const struct rig_caps ft736_caps = /* mode/filter list, remember: order matters! */ .filters = { - {RIG_MODE_SSB | RIG_MODE_CW | RIG_MODE_CWR, kHz(2.2)}, - {RIG_MODE_CW | RIG_MODE_CWR, Hz(600)}, - {RIG_MODE_FM, kHz(12)}, - {RIG_MODE_FM, kHz(8)}, + {RIG_MODE_CW | RIG_MODE_SSB, kHz(2.2)}, + {RIG_MODE_FM, kHz(12)}, + {RIG_MODE_FMN, kHz(8)}, + {RIG_MODE_CWN, Hz(600)}, RIG_FLT_END, }, @@ -291,9 +291,9 @@ int ft736_set_freq(RIG *rig, vfo_t vfo, freq_t freq) #define MD_LSB 0x00 #define MD_USB 0x01 #define MD_CW 0x02 -#define MD_CWR 0x03 -#define MD_AM 0x04 +#define MD_CWN 0x82 #define MD_FM 0x08 +#define MD_FMN 0x88 int ft736_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { @@ -311,17 +311,17 @@ int ft736_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) */ switch (mode) { - case RIG_MODE_CW: md = MD_CW; break; + case RIG_MODE_CW: md = MD_CW; break; - case RIG_MODE_CWR: md = MD_CWR; break; + case RIG_MODE_CWN: md = MD_CWN; break; case RIG_MODE_USB: md = MD_USB; break; case RIG_MODE_LSB: md = MD_LSB; break; - case RIG_MODE_FM: md = MD_FM; break; + case RIG_MODE_FM: md = MD_FM; break; - case RIG_MODE_AM: md = MD_AM; break; + case RIG_MODE_FMN: md = MD_FMN; break; default: return -RIG_EINVAL; /* sorry, wrong MODE */ @@ -397,17 +397,17 @@ int ft736_set_split_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) */ switch (mode) { - case RIG_MODE_CW: md = MD_CW; break; + case RIG_MODE_CW: md = MD_CW; break; - case RIG_MODE_CWR: md = MD_CWR; break; + case RIG_MODE_CWN: md = MD_CWN; break; case RIG_MODE_USB: md = MD_USB; break; case RIG_MODE_LSB: md = MD_LSB; break; - case RIG_MODE_FM: md = MD_FM; break; + case RIG_MODE_FM: md = MD_FM; break; - case RIG_MODE_AM: md = MD_AM; break; + case RIG_MODE_FMN: md = MD_FMN; break; default: return -RIG_EINVAL; /* sorry, wrong MODE */ diff --git a/src/misc.c b/src/misc.c index 08f6d413..bc679198 100644 --- a/src/misc.c +++ b/src/misc.c @@ -453,6 +453,7 @@ static const struct { RIG_MODE_PSKR, "PSKR"}, { RIG_MODE_C4FM, "C4FM"}, { RIG_MODE_SPEC, "SPEC"}, + { RIG_MODE_CWN, "CWN"}, { RIG_MODE_NONE, "" }, }; commit 7bddd99cd835a14bf84d55c7ca577755430e2c80 Author: Mike Black W9MDB <mdb...@ya...> Date: Fri Aug 27 18:00:11 2021 -0500 Remove RX from kenwood.c -- did not put rig on VFOA https://github.com/Hamlib/Hamlib/issues/746 diff --git a/rigs/kenwood/kenwood.c b/rigs/kenwood/kenwood.c index 7a3422cc..245325d2 100644 --- a/rigs/kenwood/kenwood.c +++ b/rigs/kenwood/kenwood.c @@ -1118,10 +1118,6 @@ int kenwood_set_vfo(RIG *rig, vfo_t vfo) snprintf(cmdbuf, sizeof(cmdbuf), "FR%c", vfo_function); - // FR can turn off split on some Kenwood rigs - // So we'll turn it back on just in case - if (priv->split && vfo_function == '0') { strcat(cmdbuf, ";FT1;RX"); } - if (RIG_IS_TS50 || RIG_IS_TS940) { cmdbuf[1] = 'N'; @@ -1261,7 +1257,7 @@ int kenwood_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t txvfo) // FR can turn off split on some Kenwood rigs // So we'll turn it back on just in case - if (split && vfo_function=='0') { strcat(cmdbuf, ";FT1;RX"); } + if (split && vfo_function=='0') { strcat(cmdbuf, ";FT1"); } retval = kenwood_transaction(rig, cmdbuf, NULL, 0); commit 06513a68692166725dfe4c7ff0399c39e7585de1 Author: Mike Black W9MDB <mdb...@ya...> Date: Fri Aug 27 17:24:31 2021 -0500 Remove another unneeded vfo swap from icom rigs https://github.com/Hamlib/Hamlib/issues/762 https://github.com/Hamlib/Hamlib/issues/430 diff --git a/rigs/icom/icom.c b/rigs/icom/icom.c index 0ce03fda..7880b04f 100644 --- a/rigs/icom/icom.c +++ b/rigs/icom/icom.c @@ -1973,8 +1973,12 @@ int icom_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) || rig->state.current_vfo == RIG_VFO_CURR)) { TRACE; - swapvfos = 1; - rig_set_vfo(rig, RIG_VFO_B); + + if (!(rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)) + { + swapvfos = 1; + rig_set_vfo(rig, RIG_VFO_B); + } } rig_debug(RIG_DEBUG_VERBOSE, "%s: #2 icmode=%d, icmode_ext=%d\n", __func__, diff --git a/rigs/icom/icom.h b/rigs/icom/icom.h index c937844c..b765dcaf 100644 --- a/rigs/icom/icom.h +++ b/rigs/icom/icom.h @@ -30,7 +30,7 @@ #include <sys/time.h> #endif -#define BACKEND_VER "20210822" +#define BACKEND_VER "20210824" #define ICOM_IS_SECONDARY_VFO(vfo) ((vfo) & (RIG_VFO_B | RIG_VFO_SUB | RIG_VFO_SUB_B | RIG_VFO_MAIN_B)) #define ICOM_GET_VFO_NUMBER(vfo) (ICOM_IS_SECONDARY_VFO(vfo) ? 0x01 : 0x00) commit b41f706edafc0bbd586ffa241b67c438fd8ebf71 Author: Mike Black W9MDB <mdb...@ya...> Date: Fri Aug 27 15:51:02 2021 -0500 Fix uninitialized warning in rig.c https://github.com/Hamlib/Hamlib/issues/762 https://github.com/Hamlib/Hamlib/issues/430 diff --git a/src/rig.c b/src/rig.c index c3a4e48a..9241c90b 100644 --- a/src/rig.c +++ b/src/rig.c @@ -2950,6 +2950,7 @@ int HAMLIB_API rig_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) /* try and revert even if we had an error above */ TRACE; + rc2 = RIG_OK; if (!targetable_ptt) { rc2 = caps->set_vfo(rig, curr_vfo); commit f6b54df7c74ad31d043b6eef72a88ec5ad01d39f Author: Mike Black W9MDB <mdb...@ya...> Date: Fri Aug 27 15:46:23 2021 -0500 Fix some more unnecessary vfo swapping https://github.com/Hamlib/Hamlib/issues/762 https://github.com/Hamlib/Hamlib/issues/430 diff --git a/src/rig.c b/src/rig.c index 9e8288d1..c3a4e48a 100644 --- a/src/rig.c +++ b/src/rig.c @@ -3815,7 +3815,8 @@ int HAMLIB_API rig_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq) if (caps->set_split_freq && (vfo == RIG_VFO_CURR || vfo == RIG_VFO_TX - || tx_vfo == rig->state.current_vfo)) + || tx_vfo == rig->state.current_vfo + || (caps->targetable_vfo & RIG_TARGETABLE_FREQ))) { TRACE; retcode = caps->set_split_freq(rig, vfo, tx_freq); @@ -3828,7 +3829,7 @@ int HAMLIB_API rig_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq) /* Assisted mode */ curr_vfo = rig->state.current_vfo; - if (caps->set_freq && (caps->targetable_vfo & RIG_TARGETABLE_FREQ)) + if (caps->set_freq) { int retry = 3; freq_t tfreq; @@ -3856,10 +3857,7 @@ int HAMLIB_API rig_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq) TRACE; retcode = RIG_OK; - if (!(caps->targetable_vfo & RIG_TARGETABLE_FREQ)) - { - retcode = caps->set_vfo(rig, tx_vfo); - } + retcode = caps->set_vfo(rig, tx_vfo); } else if (rig_has_vfo_op(rig, RIG_OP_TOGGLE) && caps->vfo_op) { @@ -3994,7 +3992,8 @@ int HAMLIB_API rig_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq) if (caps->set_vfo) { // if the underlying rig has OP_XCHG we don't need to set VFO - if (!rig_has_vfo_op(rig, RIG_OP_XCHG)) + if (!rig_has_vfo_op(rig, RIG_OP_XCHG) + && !(caps->targetable_vfo & RIG_TARGETABLE_FREQ)) { TRACE; retcode = caps->set_vfo(rig, tx_vfo); @@ -4040,7 +4039,16 @@ int HAMLIB_API rig_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq) rig_debug(RIG_DEBUG_TRACE, "%s: restoring vfo=%s\n", __func__, rig_strvfo(save_vfo)); TRACE; - rc2 = caps->set_vfo(rig, save_vfo); + + if (!rig_has_vfo_op(rig, RIG_OP_XCHG) + && !(caps->targetable_vfo & RIG_TARGETABLE_FREQ)) + { + rc2 = caps->set_vfo(rig, save_vfo); + } + else + { + rc2 = RIG_OK; + } } else { commit fe8c02bba0dbd2502782f45f4c7f3b3356b64832 Author: Mike Black W9MDB <mdb...@ya...> Date: Fri Aug 27 13:08:15 2021 -0500 Add RX command to kenwood rigs hopefully setting VFO to VFOA after split set FT450 and others turn split off doing FR0 and FT1; leaves the rig on VFOB https://github.com/Hamlib/Hamlib/issues/746 diff --git a/rigs/kenwood/kenwood.c b/rigs/kenwood/kenwood.c index 46774940..7a3422cc 100644 --- a/rigs/kenwood/kenwood.c +++ b/rigs/kenwood/kenwood.c @@ -1120,7 +1120,7 @@ int kenwood_set_vfo(RIG *rig, vfo_t vfo) // FR can turn off split on some Kenwood rigs // So we'll turn it back on just in case - if (priv->split && vfo_function == '0') { strcat(cmdbuf, ";FT1"); } + if (priv->split && vfo_function == '0') { strcat(cmdbuf, ";FT1;RX"); } if (RIG_IS_TS50 || RIG_IS_TS940) { @@ -1261,7 +1261,7 @@ int kenwood_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t txvfo) // FR can turn off split on some Kenwood rigs // So we'll turn it back on just in case - if (split && vfo_function=='0') { strcat(cmdbuf, ";FT1"); } + if (split && vfo_function=='0') { strcat(cmdbuf, ";FT1;RX"); } retval = kenwood_transaction(rig, cmdbuf, NULL, 0); diff --git a/rigs/kenwood/kenwood.h b/rigs/kenwood/kenwood.h index 0781eea8..a5c0242a 100644 --- a/rigs/kenwood/kenwood.h +++ b/rigs/kenwood/kenwood.h @@ -28,7 +28,7 @@ #include "token.h" #include "misc.h" -#define BACKEND_VER "20210826" +#define BACKEND_VER "20210827" #define EOM_KEN ';' #define EOM_TH '\r' commit 5a0590d421117d154f8851731da7c56ea7036bbf Author: Mike Black W9MDB <mdb...@ya...> Date: Fri Aug 27 12:50:53 2021 -0500 Finish up targetable_ptt logic Was causing unnecessary vfo swapping https://github.com/Hamlib/Hamlib/issues/762 https://github.com/Hamlib/Hamlib/issues/430 diff --git a/src/rig.c b/src/rig.c index bd88b0ed..9e8288d1 100644 --- a/src/rig.c +++ b/src/rig.c @@ -2896,6 +2896,8 @@ int HAMLIB_API rig_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) else { vfo_t curr_vfo; + int backend_num; + int targetable_ptt; if (!caps->set_vfo) { @@ -2904,7 +2906,22 @@ int HAMLIB_API rig_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) curr_vfo = rig->state.current_vfo; TRACE; - retcode = caps->set_vfo(rig, vfo); + backend_num = RIG_BACKEND_NUM(rig->caps->rig_model); + + switch (backend_num) + { + // most rigs have only one PTT VFO so we can set that flag here + case RIG_ICOM: + case RIG_KENWOOD: + case RIG_YAESU: + targetable_ptt = 1; + } + + + if (!targetable_ptt) + { + retcode = caps->set_vfo(rig, vfo); + } if (retcode == RIG_OK) { @@ -2932,7 +2949,11 @@ int HAMLIB_API rig_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) /* try and revert even if we had an error above */ TRACE; - rc2 = caps->set_vfo(rig, curr_vfo); + + if (!targetable_ptt) + { + rc2 = caps->set_vfo(rig, curr_vfo); + } /* return the first error code */ if (RIG_OK == retcode) @@ -3134,21 +3155,10 @@ int HAMLIB_API rig_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) *ptt = rs->transmit ? RIG_PTT_ON : RIG_PTT_OFF; RETURNFUNC(RIG_OK); } - backend_num = RIG_BACKEND_NUM(rig->caps->rig_model); - - switch (backend_num) - { - // most rigs have only one PTT VFO so we can set that flag here - case RIG_ICOM: - case RIG_KENWOOD: - case RIG_YAESU: - targetable_ptt = 1; - } if ((caps->targetable_vfo & RIG_TARGETABLE_PTT) || vfo == RIG_VFO_CURR - || vfo == rig->state.current_vfo - || targetable_ptt) + || vfo == rig->state.current_vfo) { TRACE; retcode = caps->get_ptt(rig, vfo, ptt); @@ -3169,7 +3179,22 @@ int HAMLIB_API rig_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) curr_vfo = rig->state.current_vfo; TRACE; - retcode = caps->set_vfo(rig, vfo); + backend_num = RIG_BACKEND_NUM(rig->caps->rig_model); + + switch (backend_num) + { + // most rigs have only one PTT VFO so we can set that flag here + case RIG_ICOM: + case RIG_KENWOOD: + case RIG_YAESU: + targetable_ptt = 1; + } + + + if (!targetable_ptt) + { + retcode = caps->set_vfo(rig, vfo); + } if (retcode != RIG_OK) { @@ -3178,15 +3203,19 @@ int HAMLIB_API rig_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) TRACE; retcode = caps->get_ptt(rig, vfo, ptt); - /* try and revert even if we had an error above */ - rc2 = caps->set_vfo(rig, curr_vfo); - if (RIG_OK == retcode) + /* try and revert even if we had an error above */ + if (!targetable_ptt) { - /* return the first error code */ - retcode = rc2; - rig->state.cache.ptt = *ptt; - elapsed_ms(&rig->state.cache.time_ptt, HAMLIB_ELAPSED_SET); + rc2 = caps->set_vfo(rig, curr_vfo); + + if (RIG_OK == retcode) + { + /* return the first error code */ + retcode = rc2; + rig->state.cache.ptt = *ptt; + elapsed_ms(&rig->state.cache.time_ptt, HAMLIB_ELAPSED_SET); + } } RETURNFUNC(retcode); commit 0016d5a93390636b6c453b75865f91e1cab9a697 Author: Mike Black W9MDB <mdb...@ya...> Date: Fri Aug 27 12:32:37 2021 -0500 Move TARGETABLE_PTT logic to the set_ptt routine https://github.com/Hamlib/Hamlib/issues/762 https://github.com/Hamlib/Hamlib/issues/430 diff --git a/src/rig.c b/src/rig.c index 75b1613d..bd88b0ed 100644 --- a/src/rig.c +++ b/src/rig.c @@ -1098,17 +1098,6 @@ int HAMLIB_API rig_open(RIG *rig) // freq_t freq; // if (caps->get_freq) rig_get_freq(rig, RIG_VFO_A, &freq); // if (caps->get_freq) rig_get_freq(rig, RIG_VFO_B, &freq); - int backend_num = RIG_BACKEND_NUM(rig->caps->rig_model); - - switch (backend_num) - { - // most rigs have only one PTT VFO so we can set that flag here - case RIG_ICOM: - case RIG_KENWOOD: - case RIG_YAESU: - if (rig->caps->targetable_vfo) rig->caps->targetable_vfo |= RIG_TARGETABLE_PTT; - break; - } RETURNFUNC(RIG_OK); } @@ -3105,6 +3094,8 @@ int HAMLIB_API rig_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) int rc2, status; vfo_t curr_vfo; int cache_ms; + int targetable_ptt = 0; + int backend_num; ENTERFUNC; @@ -3143,10 +3134,21 @@ int HAMLIB_API rig_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) *ptt = rs->transmit ? RIG_PTT_ON : RIG_PTT_OFF; RETURNFUNC(RIG_OK); } + backend_num = RIG_BACKEND_NUM(rig->caps->rig_model); + + switch (backend_num) + { + // most rigs have only one PTT VFO so we can set that flag here + case RIG_ICOM: + case RIG_KENWOOD: + case RIG_YAESU: + targetable_ptt = 1; + } if ((caps->targetable_vfo & RIG_TARGETABLE_PTT) || vfo == RIG_VFO_CURR - || vfo == rig->state.current_vfo) + || vfo == rig->state.current_vfo + || targetable_ptt) { TRACE; retcode = caps->get_ptt(rig, vfo, ptt); commit 0d9bcbf9bf64e6d7a2b2921fc98e9d0f80e6a3c6 Author: Mike Black W9MDB <mdb...@ya...> Date: Fri Aug 27 12:16:35 2021 -0500 Fix possilbe segfault last patch https://github.com/Hamlib/Hamlib/issues/762 https://github.com/Hamlib/Hamlib/issues/430 diff --git a/src/rig.c b/src/rig.c index aef85ab0..75b1613d 100644 --- a/src/rig.c +++ b/src/rig.c @@ -1106,7 +1106,7 @@ int HAMLIB_API rig_open(RIG *rig) case RIG_ICOM: case RIG_KENWOOD: case RIG_YAESU: - rig->caps->targetable_vfo |= RIG_TARGETABLE_PTT; + if (rig->caps->targetable_vfo) rig->caps->targetable_vfo |= RIG_TARGETABLE_PTT; break; } commit 03fe6f650040e6ac1f58090f8dfc8d3df8cc5a62 Author: Mike Black W9MDB <mdb...@ya...> Date: Fri Aug 27 12:04:16 2021 -0500 Allow all Icom, Kenwood, Yaesu to avoid VFO swapping https://github.com/Hamlib/Hamlib/issues/762 https://github.com/Hamlib/Hamlib/issues/430 diff --git a/src/rig.c b/src/rig.c index 2c48b619..aef85ab0 100644 --- a/src/rig.c +++ b/src/rig.c @@ -1098,6 +1098,18 @@ int HAMLIB_API rig_open(RIG *rig) // freq_t freq; // if (caps->get_freq) rig_get_freq(rig, RIG_VFO_A, &freq); // if (caps->get_freq) rig_get_freq(rig, RIG_VFO_B, &freq); + int backend_num = RIG_BACKEND_NUM(rig->caps->rig_model); + + switch (backend_num) + { + // most rigs have only one PTT VFO so we can set that flag here + case RIG_ICOM: + case RIG_KENWOOD: + case RIG_YAESU: + rig->caps->targetable_vfo |= RIG_TARGETABLE_PTT; + break; + } + RETURNFUNC(RIG_OK); } ----------------------------------------------------------------------- Summary of changes: include/hamlib/rig.h | 2 +- rigs/icom/icom.c | 8 +++-- rigs/icom/icom.h | 2 +- rigs/kenwood/kenwood.c | 6 +--- rigs/kenwood/kenwood.h | 2 +- rigs/yaesu/ft736.c | 30 ++++++++--------- src/misc.c | 1 + src/rig.c | 89 ++++++++++++++++++++++++++++++++++++++++---------- tests/rigctl.c | 13 ++++---- 9 files changed, 104 insertions(+), 49 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |