[Hamlib-commits] Hamlib -- Ham radio control libraries branch master updated. aa1cf567f67febd90e6d6
Library to control radio transceivers and receivers
Brought to you by:
n0nb
From: n0nb <n0...@us...> - 2023-01-10 00:57:01
|
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 aa1cf567f67febd90e6d6a804ba2950fd9f2b6cf (commit) via 7cc477869f195b1da5f536ad118bf45d8fe69e11 (commit) via 3eedc5a5af3ed6b374ccc13d8d43b6111aa0f34b (commit) via 56c87cfa9a4f88381cb01384215a0f1d4ae86ac3 (commit) via 7c5b095ff3618ba8b25370d15cea1fe8f11e2227 (commit) via 58621995f3c28529ba2f86b0b6fe071d288a212a (commit) via d2ef9d5edaa843d0a9cd653eb39245c243f300c4 (commit) via 89fadca3bdbcbc288e0b3db02d1a7143be8a95f1 (commit) via 93e3aec58863b87b41dd68fcef4f11f4838f418a (commit) via 57522f0b93958262225827088667035735503f25 (commit) via 8be3fcbef500df7c1ce6d14fdb1a06dbd5015c10 (commit) via 0a2dddfce05043eb1e0c1137e32b15e153a966e3 (commit) via e3ac42a6b65246114d5fdc6e98d708f45879d3fb (commit) via 02312ef322a7664e25c50eb993e04f0b2607500d (commit) via 6cb7a8c56080218c61de8f0322df04639d0f0147 (commit) via 7978d74750db62ce36190bd97f160395e41c6f3f (commit) via eb904148b5a35dc1b13d70076370125658671778 (commit) via 22df154486fa59489d9bc51ff220ab70e2961c66 (commit) via 79255fa27cba9ea1884e29df700466ef5f946566 (commit) via 4a487ffdcceb2789930fd1e941810a9f5cd4aaf8 (commit) via db218e9e73e6763dafb7a7137656c4faf11ef360 (commit) via 86771a95575116f31f498a8912d36e114f1109bc (commit) via e6c5c15452bad475ddf69c0ae74cd63e6bc347b3 (commit) via bbd0f856ca3f26b5d6367c4ca3d8519e58458e08 (commit) via 31d2939acc21fe58b5f203fa5a1c1e6bebb947c4 (commit) via 589736e8f7e8e8def8f136436a8b9af72c32d31b (commit) via 6dbd2cff5e1b5be4aefeb463f00391e5d05d89a5 (commit) via 902be172c1613d97bcba8f90e9199100c0578b0b (commit) via f1b6d322ba549a245ff9e488b3e02b755512e1aa (commit) via 87cc9a8c3d133ab18a6f4b9758e98836bd0fd101 (commit) via 383c95b9c4cfce2cc7b3ad243c997953b716994c (commit) via af9a7a6938f0f7a7ea7c329b110241480f474577 (commit) via cceffce4a50bf4413dfcca0e1ba3d2ada7aa48a6 (commit) via 0404b43bd8225608d443dab3a48f1161b12b2486 (commit) via 138795668f66c472bcaf16f3b1eb7076dfad88ba (commit) via 9c5809ffba8712c314a78dcadcfe8ae75a1beaa7 (commit) via 1b6b78f54a98f9450a621895fd759d89435fb060 (commit) via 4c09344f32cff0eb27333b904db017324aef4be7 (commit) from 9f0bd7b310e7d21c857052cb6249d6210caabd61 (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 aa1cf567f67febd90e6d6a804ba2950fd9f2b6cf Author: Mike Black W9MDB <mdb...@ya...> Date: Mon Jan 9 12:34:22 2023 -0600 Fix Icom poweron behavior https://github.com/Hamlib/Hamlib/issues/1212 diff --git a/NEWS b/NEWS index 369326eb..b2909aaa 100644 --- a/NEWS +++ b/NEWS @@ -27,6 +27,7 @@ Version 4.6 Version 4.5.4 * 2023-XX-XX * Fix CM108 ptt setting for non-default usage + * Fix power on/off for Icom rigs with rigctld power_on=0 * Fix get_powerstat status return for non-PS kenwood rigs * Fix FT-710, FTDX10, FTDX101D/MP usage on 60M * Fix timing on NRD-535D diff --git a/rigs/icom/icom.c b/rigs/icom/icom.c index 2b101cc1..d912ad97 100644 --- a/rigs/icom/icom.c +++ b/rigs/icom/icom.c @@ -7979,8 +7979,8 @@ int icom_set_powerstat(RIG *rig, powerstat_t status) write_block(&rs->rigport, fe_buf, fe_max); // close and re-open the rig // on linux the USB gets reset during power on - sleep(1); // let serial bus idle for a while rig_close(rig); + sleep(1); // let serial bus idle for a while rig_open(rig); // we'll try 0x18 0x01 now -- should work on STBY rigs too commit 7cc477869f195b1da5f536ad118bf45d8fe69e11 Author: Mike Black W9MDB <mdb...@ya...> Date: Mon Jan 9 12:21:33 2023 -0600 Revert "Close rig on set_powerstat 0 -- Linux was unable to reconnect to IC-7300" This reverts commit 93e3aec58863b87b41dd68fcef4f11f4838f418a. diff --git a/NEWS b/NEWS index a430b0f4..369326eb 100644 --- a/NEWS +++ b/NEWS @@ -28,7 +28,6 @@ Version 4.5.4 * 2023-XX-XX * Fix CM108 ptt setting for non-default usage * Fix get_powerstat status return for non-PS kenwood rigs - * Fix set_powerstat 0 to reopen with IC-7300 (and others?) on Linux * Fix FT-710, FTDX10, FTDX101D/MP usage on 60M * Fix timing on NRD-535D * Fix AGC levels with rigctld diff --git a/src/rig.c b/src/rig.c index aa3be50d..d4cff0ae 100644 --- a/src/rig.c +++ b/src/rig.c @@ -6019,9 +6019,6 @@ int HAMLIB_API rig_set_powerstat(RIG *rig, powerstat_t status) HAMLIB_TRACE; retcode = rig->caps->set_powerstat(rig, status); rig_flush(&rig->state.rigport); // if anything is queued up flush it - - if (status == RIG_POWER_OFF) { rig_close(rig); } - RETURNFUNC(retcode); } commit 3eedc5a5af3ed6b374ccc13d8d43b6111aa0f34b Author: Mike Black W9MDB <mdb...@ya...> Date: Mon Jan 9 11:24:34 2023 -0600 Update NEWS https://github.com/Hamlib/Hamlib/issues/1203 diff --git a/NEWS b/NEWS index 632ff66b..a430b0f4 100644 --- a/NEWS +++ b/NEWS @@ -26,6 +26,7 @@ Version 4.6 Version 4.5.4 * 2023-XX-XX + * Fix CM108 ptt setting for non-default usage * Fix get_powerstat status return for non-PS kenwood rigs * Fix set_powerstat 0 to reopen with IC-7300 (and others?) on Linux * Fix FT-710, FTDX10, FTDX101D/MP usage on 60M commit 56c87cfa9a4f88381cb01384215a0f1d4ae86ac3 Author: Mike Black W9MDB <mdb...@ya...> Date: Mon Jan 9 11:03:50 2023 -0600 Fix CM108 ptt setting https://github.com/Hamlib/Hamlib/issues/1203 diff --git a/src/conf.c b/src/conf.c index 92f067a3..f0612783 100644 --- a/src/conf.c +++ b/src/conf.c @@ -559,6 +559,7 @@ static int frontend_set_conf(RIG *rig, token_t token, const char *val) } rs->pttport.parm.cm108.ptt_bitnum = val_i; + rs->rigport.parm.cm108.ptt_bitnum = val_i; rs->pttport_deprecated.parm.cm108.ptt_bitnum = val_i; break; diff --git a/src/rig.c b/src/rig.c index b65a5419..aa3be50d 100644 --- a/src/rig.c +++ b/src/rig.c @@ -588,8 +588,13 @@ RIG *HAMLIB_API rig_init(rig_model_t rig_model) */ case RIG_PORT_CM108: strncpy(rs->rigport.pathname, DEFAULT_CM108_PORT, HAMLIB_FILPATHLEN); - rs->rigport.parm.cm108.ptt_bitnum = DEFAULT_CM108_PTT_BITNUM; - rs->pttport.parm.cm108.ptt_bitnum = DEFAULT_CM108_PTT_BITNUM; + + if (rs->rigport.parm.cm108.ptt_bitnum == 0) + { + rs->rigport.parm.cm108.ptt_bitnum = DEFAULT_CM108_PTT_BITNUM; + rs->pttport.parm.cm108.ptt_bitnum = DEFAULT_CM108_PTT_BITNUM; + } + break; case RIG_PORT_GPIO: commit 7c5b095ff3618ba8b25370d15cea1fe8f11e2227 Author: Mike Black W9MDB <mdb...@ya...> Date: Mon Jan 9 10:44:27 2023 -0600 Update NEWS diff --git a/NEWS b/NEWS index ca819542..632ff66b 100644 --- a/NEWS +++ b/NEWS @@ -28,7 +28,7 @@ Version 4.5.4 * 2023-XX-XX * Fix get_powerstat status return for non-PS kenwood rigs * Fix set_powerstat 0 to reopen with IC-7300 (and others?) on Linux - * Fix FT-710 usage on 60M + * Fix FT-710, FTDX10, FTDX101D/MP usage on 60M * Fix timing on NRD-535D * Fix AGC levels with rigctld * Fix FTDX3000 EX039 error commit 58621995f3c28529ba2f86b0b6fe071d288a212a Author: Mike Black W9MDB <mdb...@ya...> Date: Mon Jan 9 10:42:57 2023 -0600 Fix FT-710, FTDX10, FTDX101D/MP 60M operations https://github.com/Hamlib/Hamlib/issues/1211 diff --git a/rigs/yaesu/newcat.c b/rigs/yaesu/newcat.c index a3d5045d..703b7fb6 100644 --- a/rigs/yaesu/newcat.c +++ b/rigs/yaesu/newcat.c @@ -799,43 +799,88 @@ int newcat_get_conf2(RIG *rig, token_t token, char *val, int val_len) RETURNFUNC(ret); } +static int freq_60m[] = { 5332000, 5348000, 5358500, 5373000, 5405000 }; + /* returns 0 if no exeption or 1 if rig needs special handling */ -int newcat_60m_exception(RIG *rig, freq_t freq) +int newcat_60m_exception(RIG *rig, freq_t freq, mode_t mode) { struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv; int err; - int is_exception = 0; + int channel = -1; + int i; + rmode_t tmode; + pbwidth_t twidth; if (!(freq > 5.2 && freq < 5.5)) // we're not on 60M { return 0; } - if (is_ftdx10) { is_exception = 1; } - else if (is_ft710) + if (mode != RIG_MODE_CW && mode != RIG_MODE_USB && mode != RIG_MODE_PKTUSB + && mode != RIG_MODE_RTTYR) + { + rig_debug(RIG_DEBUG_ERR, + "%s: only USB, PKTUSB, RTTYR, and CW allowed for 60M operations\n", __func__); + return -RIG_EINVAL; + } + + if (!is_ftdx10 && !is_ft710 && !is_ftdx101d && !is_ftdx101mp) { return 0; } + + rig_debug(RIG_DEBUG_VERBOSE, "%s: 60M exception ignoring freq/mode commands\n", + __func__); + // If US mode we need to use memory channels + SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "EX0301%c", cat_term); + + if ((err = newcat_get_cmd(rig)) != RIG_OK) { - // If US mode we need to use memory channels - SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "EX0301%c", cat_term); + RETURNFUNC2(err); + } + + // 01 is the only exception so far -- others may be like UK and have full control too + if (strncmp(&priv->ret_data[6], "01", 2) != 0) { return 0; } // no exception - if ((err = newcat_get_cmd(rig)) != RIG_OK) + // so now we should have a rig that has fixed memory channels 501-510 in USB/CW-U mode + + // toggle vfo mode if we need to + + rig_debug(RIG_DEBUG_VERBOSE, "%s: 60M exception ignoring freq/mode commands\n", + __func__); + + rig_get_mode(rig, RIG_VFO_A, &tmode, &twidth); + if (tmode != RIG_VFO_MEM) + { + err = newcat_vfomem_toggle(rig); + if (err != RIG_OK) { - RETURNFUNC2(err); + rig_debug(RIG_DEBUG_ERR, "%s: Error toggling VFO_MEM\n", __func__); + return -err; } + } + // find the nearest slot below what is requested + for (i = 0; i < 5; ++i) + { + if ((long)freq == freq_60m[i]) { channel = i; } + } - // 01 is the only exception so far -- others may be like UK and have full control too - if (strncmp(&priv->ret_data[6], "01", 2) != 0) { return 0; } // no exception - - is_exception = 1; + if (channel < 0) + { + rig_debug(RIG_DEBUG_ERR, + "%s: 60M allowed frequencies are 5.332, 5.348, 5.3585, 5.373,5.405, got %g\n", + __func__, freq / 1000); + return -RIG_EINVAL; } - if (is_exception) + if (mode == RIG_MODE_CW) { channel += 5; } + + SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "MC%3d%c", channel + 501, + cat_term); + + if ((err = newcat_set_cmd(rig)) != RIG_OK) { - rig_debug(RIG_DEBUG_VERBOSE, "%s: 60M exception ignoring freq/mode commands\n", - __func__); - return 1; + RETURNFUNC2(err); } - return 0; + return 1; } /* @@ -854,10 +899,12 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq) const struct rig_caps *caps; struct newcat_priv_data *priv; int special_60m = 0; + rmode_t tmode; + pbwidth_t twidth; ENTERFUNC; - if (newcat_60m_exception(rig, freq)) + if (newcat_60m_exception(rig, freq, rig->state.cache.modeMainA)) { // we don't try to set freq on 60m for some rigs since we must be in memory mode // and we can't run split mode on 60M memory mode either @@ -882,6 +929,13 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq) priv = (struct newcat_priv_data *)rig->state.priv; caps = rig->caps; + rig_get_mode(rig, RIG_VFO_A, &tmode, &twidth); + if (tmode == RIG_VFO_MEM) + { + // then we need to toggle back to VFO mode + newcat_vfomem_toggle(rig); + } + rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = %s\n", __func__, rig_strvfo(vfo)); // rig_debug(RIG_DEBUG_TRACE, "%s: translated vfo = %s\n", __func__, rig_strvfo(tvfo)); rig_debug(RIG_DEBUG_TRACE, "%s: passed freq = %"PRIfreq" Hz\n", __func__, freq); @@ -1386,7 +1440,7 @@ int newcat_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) ENTERFUNC; - if (newcat_60m_exception(rig, rig->state.cache.freqMainA)) { RETURNFUNC(RIG_OK); } // we don't set mode in this case + if (newcat_60m_exception(rig, rig->state.cache.freqMainA, mode)) { RETURNFUNC(RIG_OK); } // we don't set mode in this case if (!newcat_valid_command(rig, "MD")) { diff --git a/rigs/yaesu/newcat.h b/rigs/yaesu/newcat.h index a0602bc0..5202dcfd 100644 --- a/rigs/yaesu/newcat.h +++ b/rigs/yaesu/newcat.h @@ -50,7 +50,7 @@ typedef char ncboolean; /* shared function version */ -#define NEWCAT_VER "20230108" +#define NEWCAT_VER "20230109" /* Hopefully large enough for future use, 128 chars plus '\0' */ #define NEWCAT_DATA_LEN 129 commit d2ef9d5edaa843d0a9cd653eb39245c243f300c4 Author: Mike Black W9MDB <mdb...@ya...> Date: Mon Jan 9 10:28:43 2023 -0600 Fix get_powerstat status return to always show POWER_ON for kenwood non-PS rigs https://github.com/Hamlib/Hamlib/issues/1213 diff --git a/NEWS b/NEWS index dec67ca5..ca819542 100644 --- a/NEWS +++ b/NEWS @@ -26,6 +26,7 @@ Version 4.6 Version 4.5.4 * 2023-XX-XX + * Fix get_powerstat status return for non-PS kenwood rigs * Fix set_powerstat 0 to reopen with IC-7300 (and others?) on Linux * Fix FT-710 usage on 60M * Fix timing on NRD-535D diff --git a/rigs/kenwood/kenwood.c b/rigs/kenwood/kenwood.c index 223adfae..fe41cdbf 100644 --- a/rigs/kenwood/kenwood.c +++ b/rigs/kenwood/kenwood.c @@ -4878,6 +4878,7 @@ int kenwood_get_powerstat(RIG *rig, powerstat_t *status) if (!priv->has_ps) { + *status = RIG_POWER_ON; RETURNFUNC(RIG_OK); // fake the OK return for these rigs } diff --git a/rigs/kenwood/kenwood.h b/rigs/kenwood/kenwood.h index 4787ae93..69106804 100644 --- a/rigs/kenwood/kenwood.h +++ b/rigs/kenwood/kenwood.h @@ -29,7 +29,7 @@ #include "misc.h" #include "idx_builtin.h" -#define BACKEND_VER "20221230" +#define BACKEND_VER "20230109" #define EOM_KEN ';' #define EOM_TH '\r' commit 89fadca3bdbcbc288e0b3db02d1a7143be8a95f1 Author: Mike Black W9MDB <mdb...@ya...> Date: Mon Jan 9 09:50:25 2023 -0600 For Icom rigs close and reopen rig after set_powerstat=1 -- Linux resets the usb device https://github.com/Hamlib/Hamlib/issues/1212 diff --git a/rigs/icom/icom.c b/rigs/icom/icom.c index e806c3cf..2b101cc1 100644 --- a/rigs/icom/icom.c +++ b/rigs/icom/icom.c @@ -7977,6 +7977,11 @@ int icom_set_powerstat(RIG *rig, powerstat_t status) memset(fe_buf, 0xfe, fe_max); // sending more than enough 0xfe's to wake up the rs232 write_block(&rs->rigport, fe_buf, fe_max); + // close and re-open the rig + // on linux the USB gets reset during power on + sleep(1); // let serial bus idle for a while + rig_close(rig); + rig_open(rig); // we'll try 0x18 0x01 now -- should work on STBY rigs too pwr_sc = S_PWR_ON; diff --git a/rigs/icom/icom.h b/rigs/icom/icom.h index 254d89f9..3f4c3c18 100644 --- a/rigs/icom/icom.h +++ b/rigs/icom/icom.h @@ -31,7 +31,7 @@ #include <sys/time.h> #endif -#define BACKEND_VER "20230104" +#define BACKEND_VER "20230109" #define ICOM_IS_ID31 rig_is_model(rig, RIG_MODEL_ID31) #define ICOM_IS_ID51 rig_is_model(rig, RIG_MODEL_ID51) commit 93e3aec58863b87b41dd68fcef4f11f4838f418a Author: Mike Black W9MDB <mdb...@ya...> Date: Sun Jan 8 16:48:35 2023 -0600 Close rig on set_powerstat 0 -- Linux was unable to reconnect to IC-7300 https://github.com/Hamlib/Hamlib/issues/1212 diff --git a/NEWS b/NEWS index 6c17f323..dec67ca5 100644 --- a/NEWS +++ b/NEWS @@ -26,6 +26,7 @@ Version 4.6 Version 4.5.4 * 2023-XX-XX + * Fix set_powerstat 0 to reopen with IC-7300 (and others?) on Linux * Fix FT-710 usage on 60M * Fix timing on NRD-535D * Fix AGC levels with rigctld diff --git a/src/rig.c b/src/rig.c index eaac46ec..b65a5419 100644 --- a/src/rig.c +++ b/src/rig.c @@ -6014,6 +6014,9 @@ int HAMLIB_API rig_set_powerstat(RIG *rig, powerstat_t status) HAMLIB_TRACE; retcode = rig->caps->set_powerstat(rig, status); rig_flush(&rig->state.rigport); // if anything is queued up flush it + + if (status == RIG_POWER_OFF) { rig_close(rig); } + RETURNFUNC(retcode); } commit 57522f0b93958262225827088667035735503f25 Author: Mike Black W9MDB <mdb...@ya...> Date: Sun Jan 8 10:28:34 2023 -0600 Ensure 60M exception for FT710 is only for US language setting https://github.com/Hamlib/Hamlib/issues/1211 diff --git a/rigs/yaesu/newcat.c b/rigs/yaesu/newcat.c index 3a5bf33c..a3d5045d 100644 --- a/rigs/yaesu/newcat.c +++ b/rigs/yaesu/newcat.c @@ -799,22 +799,36 @@ int newcat_get_conf2(RIG *rig, token_t token, char *val, int val_len) RETURNFUNC(ret); } +/* returns 0 if no exeption or 1 if rig needs special handling */ +int newcat_60m_exception(RIG *rig, freq_t freq) +{ + struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv; + int err; + int is_exception = 0; + if (!(freq > 5.2 && freq < 5.5)) // we're not on 60M + { + return 0; + } + if (is_ftdx10) { is_exception = 1; } + else if (is_ft710) + { + // If US mode we need to use memory channels + SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "EX0301%c", cat_term); -/* - * newcat_set_freq - * - * Set frequency for a given VFO - * RIG_TARGETABLE_VFO - * Does not SET priv->current_vfo - * - */ + if ((err = newcat_get_cmd(rig)) != RIG_OK) + { + RETURNFUNC2(err); + } -int newcat_60m_exception(RIG *rig, freq_t freq) -{ - // can we improve this to set memory mode and pick the memory slot? - if ((is_ftdx10 || is_ft710) && freq > 5.2 && freq < 5.5) + // 01 is the only exception so far -- others may be like UK and have full control too + if (strncmp(&priv->ret_data[6], "01", 2) != 0) { return 0; } // no exception + + is_exception = 1; + } + + if (is_exception) { rig_debug(RIG_DEBUG_VERBOSE, "%s: 60M exception ignoring freq/mode commands\n", __func__); @@ -824,6 +838,14 @@ int newcat_60m_exception(RIG *rig, freq_t freq) return 0; } +/* + * newcat_set_freq + * + * Set frequency for a given VFO + * RIG_TARGETABLE_VFO + * Does not SET priv->current_vfo + * + */ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { char c; commit 8be3fcbef500df7c1ce6d14fdb1a06dbd5015c10 Author: Mike Black W9MDB <mdb...@ya...> Date: Sun Jan 8 07:58:57 2023 -0600 Add FT-710 to 60M exception in newcat.c to allow some ability to work with WSJT-X https://github.com/Hamlib/Hamlib/issues/1211 diff --git a/NEWS b/NEWS index 187b734f..6c17f323 100644 --- a/NEWS +++ b/NEWS @@ -26,6 +26,7 @@ Version 4.6 Version 4.5.4 * 2023-XX-XX + * Fix FT-710 usage on 60M * Fix timing on NRD-535D * Fix AGC levels with rigctld * Fix FTDX3000 EX039 error diff --git a/rigs/yaesu/newcat.c b/rigs/yaesu/newcat.c index 281a2d33..3a5bf33c 100644 --- a/rigs/yaesu/newcat.c +++ b/rigs/yaesu/newcat.c @@ -814,7 +814,7 @@ int newcat_get_conf2(RIG *rig, token_t token, char *val, int val_len) int newcat_60m_exception(RIG *rig, freq_t freq) { // can we improve this to set memory mode and pick the memory slot? - if (is_ftdx10 && freq > 5.2 && freq < 5.5) + if ((is_ftdx10 || is_ft710) && freq > 5.2 && freq < 5.5) { rig_debug(RIG_DEBUG_VERBOSE, "%s: 60M exception ignoring freq/mode commands\n", __func__); diff --git a/rigs/yaesu/newcat.h b/rigs/yaesu/newcat.h index 78aa63aa..a0602bc0 100644 --- a/rigs/yaesu/newcat.h +++ b/rigs/yaesu/newcat.h @@ -50,7 +50,7 @@ typedef char ncboolean; /* shared function version */ -#define NEWCAT_VER "20230107" +#define NEWCAT_VER "20230108" /* Hopefully large enough for future use, 128 chars plus '\0' */ #define NEWCAT_DATA_LEN 129 commit 0a2dddfce05043eb1e0c1137e32b15e153a966e3 Author: Mike Black W9MDB <mdb...@ya...> Date: Sat Jan 7 22:20:06 2023 -0600 Update NEWS diff --git a/NEWS b/NEWS index 2c6b975d..187b734f 100644 --- a/NEWS +++ b/NEWS @@ -26,6 +26,7 @@ Version 4.6 Version 4.5.4 * 2023-XX-XX + * Fix timing on NRD-535D * Fix AGC levels with rigctld * Fix FTDX3000 EX039 error * Fix Elecraft power2mW operation commit e3ac42a6b65246114d5fdc6e98d708f45879d3fb Author: Mike Black W9MDB <mdb...@ya...> Date: Sat Jan 7 22:17:24 2023 -0600 Update timing in nrd535.c based on testing thanks to markjfine diff --git a/rigs/jrc/nrd535.c b/rigs/jrc/nrd535.c index d4b0a707..a31e1700 100644 --- a/rigs/jrc/nrd535.c +++ b/rigs/jrc/nrd535.c @@ -96,7 +96,7 @@ const struct rig_caps nrd535_caps = RIG_MODEL(RIG_MODEL_NRD535), .model_name = "NRD-535D", .mfg_name = "JRC", - .version = BACKEND_VER ".0", + .version = BACKEND_VER ".1", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_RECEIVER, @@ -110,8 +110,8 @@ const struct rig_caps nrd535_caps = .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = 0, - .post_write_delay = 20, - .timeout = 200, + .post_write_delay = 21, + .timeout = 250, .retry = 3, .has_get_func = NRD535_FUNC, commit 02312ef322a7664e25c50eb993e04f0b2607500d Author: Mike Black W9MDB <mdb...@ya...> Date: Sat Jan 7 17:30:09 2023 -0600 Update NEWS diff --git a/NEWS b/NEWS index ac1b0756..2c6b975d 100644 --- a/NEWS +++ b/NEWS @@ -27,6 +27,8 @@ Version 4.6 Version 4.5.4 * 2023-XX-XX * Fix AGC levels with rigctld + * Fix FTDX3000 EX039 error + * Fix Elecraft power2mW operation * Fix rig_power2mW so it checks all ranges * Allow rigctld to start with autopower_on=0 to avoid startup timeouts when rig is powered off * Fix dummy device to work with grig by disallowing empty "u" call commit 6cb7a8c56080218c61de8f0322df04639d0f0147 Author: Mike Black W9MDB <mdb...@ya...> Date: Sat Jan 7 16:03:34 2023 -0600 Fix FTDX3000 EX039 error https://github.com/Hamlib/Hamlib/issues/1206 diff --git a/rigs/yaesu/newcat.c b/rigs/yaesu/newcat.c index 2d611638..281a2d33 100644 --- a/rigs/yaesu/newcat.c +++ b/rigs/yaesu/newcat.c @@ -546,6 +546,7 @@ int newcat_open(RIG *rig) struct rig_state *rig_s = &rig->state; const char *handshake[3] = {"None", "Xon/Xoff", "Hardware"}; int err; + int set_only = 0; ENTERFUNC; @@ -611,15 +612,24 @@ int newcat_open(RIG *rig) else if (priv->rig_id == NC_RIGID_FT991A || rig->caps->rig_model == RIG_MODEL_FT991) { cmd = "EX0321;EX032;"; } else if (priv->rig_id == NC_RIGID_FTDX3000 - || rig->caps->rig_model == RIG_MODEL_FTDX3000) { cmd = "EX0391;"; } + || rig->caps->rig_model == RIG_MODEL_FTDX3000) { cmd = "EX0391;"; set_only = 1; } else if (priv->rig_id == NC_RIGID_FTDX3000DM - || rig->caps->rig_model == RIG_MODEL_FTDX3000) { cmd = "EX0391;"; } + || rig->caps->rig_model == RIG_MODEL_FTDX3000) { cmd = "EX0391;"; set_only = 1; } else if (priv->rig_id == NC_RIGID_FTDX5000 || rig->caps->rig_model == RIG_MODEL_FTDX5000) { cmd = "EX0331;EX033"; } SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "%s", cmd); - if (RIG_OK != (err = newcat_get_cmd(rig))) + if (set_only) + { + err = newcat_set_cmd(rig); + } + else + { + err = newcat_get_cmd(rig); + } + + if (err != RIG_OK) { RETURNFUNC(err); } @@ -636,9 +646,17 @@ int newcat_open(RIG *rig) // Remember EX103 status SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "EX103;"); rig_debug(RIG_DEBUG_TRACE, "%s: cmd_str = %s\n", __func__, priv->cmd_str); - err = newcat_get_cmd(rig); - if (RIG_OK != (err = newcat_get_cmd(rig))) + if (set_only) + { + err = newcat_set_cmd(rig); + } + else + { + err = newcat_get_cmd(rig); + } + + if (err != RIG_OK) { RETURNFUNC(err); } diff --git a/rigs/yaesu/newcat.h b/rigs/yaesu/newcat.h index 7e196a9d..78aa63aa 100644 --- a/rigs/yaesu/newcat.h +++ b/rigs/yaesu/newcat.h @@ -50,7 +50,7 @@ typedef char ncboolean; /* shared function version */ -#define NEWCAT_VER "20230106" +#define NEWCAT_VER "20230107" /* Hopefully large enough for future use, 128 chars plus '\0' */ #define NEWCAT_DATA_LEN 129 commit 7978d74750db62ce36190bd97f160395e41c6f3f Author: Mike Black W9MDB <mdb...@ya...> Date: Sat Jan 7 11:46:56 2023 -0600 Force K22 mode on Elecraft rigs to get PC power level in .1W intervals for low power operations https://github.com/Hamlib/Hamlib/issues/1205 diff --git a/rigs/kenwood/elecraft.c b/rigs/kenwood/elecraft.c index ad3d4171..077a4aa4 100644 --- a/rigs/kenwood/elecraft.c +++ b/rigs/kenwood/elecraft.c @@ -165,6 +165,18 @@ int elecraft_open(RIG *rig) } } + if (rig->caps->rig_model != RIG_MODEL_XG3) // XG3 doesn't have extended + { + // turn on k2 extended to get PC values in more resolution + err = kenwood_transaction(rig, "K22;", NULL, 0); + + if (err != RIG_OK) + { + rig_debug(RIG_DEBUG_ERR, "%s: error setting K22='%s'...continuing\n", __func__, + rigerror(err)); + } + } + switch (rig->caps->rig_model) { case RIG_MODEL_K2: @@ -310,8 +322,8 @@ int elecraft_open(RIG *rig) kenwood_get_trn(rig, &priv->trn_state); /* ignore errors */ /* Currently we cannot cope with AI mode so turn it off in case last client left it on */ - kenwood_set_trn(rig, RIG_TRN_OFF); /* ignore status in case - it's not supported */ + kenwood_set_trn(rig, + RIG_TRN_OFF); /* ignore status in case it's not supported */ } // For rigs like K3X vfo emulation need to set VFO_A to start diff --git a/rigs/kenwood/k3.c b/rigs/kenwood/k3.c index 3847cd81..a9b0a1f6 100644 --- a/rigs/kenwood/k3.c +++ b/rigs/kenwood/k3.c @@ -160,7 +160,8 @@ int kx3_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); int kx3_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); int k3_set_func(RIG *rig, vfo_t vfo, setting_t func, int status); int k3_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status); -int k3_power2mW(RIG *rig, unsigned int *mwpower, float power, freq_t freq, rmode_t mode); +int k3_power2mW(RIG *rig, unsigned int *mwpower, float power, freq_t freq, + rmode_t mode); /* Private helper functions */ int set_rit_xit(RIG *rig, shortfreq_t rit); @@ -1825,6 +1826,7 @@ static int k3_get_maxpower(RIG *rig) break; } } + #endif rig_debug(RIG_DEBUG_TRACE, "%s: maxpower=%d\n", __func__, maxpower); @@ -1944,8 +1946,9 @@ int k3_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) break; case RIG_LEVEL_RFPOWER: - SNPRINTF(levelbuf, sizeof(levelbuf), "PC%03d", - (int)(val.f * k3_get_maxpower(rig))); + kenwood_val = (int)(val.f * k3_get_maxpower(rig)); + SNPRINTF(levelbuf, sizeof(levelbuf), "PC%03d%s", kenwood_val, + kenwood_val > 15 ? "1" : "0"); break; default: @@ -2247,7 +2250,15 @@ int k3_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) return RIG_EPROTO; } - val->f = (float) lvl / k3_get_maxpower(rig); + // extended K22 format PCnnnx where 0=.1W units and 1=1W units + if (len == 6 && levelbuf[5] == '0') + { + val->f = (float) lvl / 10.0 / k3_get_maxpower(rig); + } + else + { + val->f = (float) lvl / k3_get_maxpower(rig); + } break; diff --git a/simulators/simelecraft.c b/simulators/simelecraft.c index 661095a9..ea82a0a3 100644 --- a/simulators/simelecraft.c +++ b/simulators/simelecraft.c @@ -132,7 +132,8 @@ int main(int argc, char *argv[]) { printf("%s\n", buf); usleep(50 * 1000); - pbuf = "IF059014200000+000000700000;"; + //pbuf = "IF059014200000+000000700000;"; + pbuf = "IF00007230000 -000000 0001000001 ;" ; n = write(fd, pbuf, strlen(pbuf)); printf("n=%d\n", n); @@ -280,7 +281,7 @@ int main(int argc, char *argv[]) } else if (strncmp(buf, "PC;", 3) == 0) { - SNPRINTF(buf, sizeof(buf), "PC005;"); + SNPRINTF(buf, sizeof(buf), "PC0150;"); n = write(fd, buf, strlen(buf)); } else if (strlen(buf) > 0) commit eb904148b5a35dc1b13d70076370125658671778 Author: Mike Black W9MDB <mdb...@ya...> Date: Fri Jan 6 23:31:18 2023 -0600 Fix elecraft power2mW by scaling power to either 15W or 100W based on KPA availability We are ignoring the tx_range values for the Kn series https://github.com/Hamlib/Hamlib/issues/1205 diff --git a/rigs/kenwood/k3.c b/rigs/kenwood/k3.c index fa85a7d6..3847cd81 100644 --- a/rigs/kenwood/k3.c +++ b/rigs/kenwood/k3.c @@ -160,6 +160,7 @@ int kx3_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); int kx3_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); int k3_set_func(RIG *rig, vfo_t vfo, setting_t func, int status); int k3_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status); +int k3_power2mW(RIG *rig, unsigned int *mwpower, float power, freq_t freq, rmode_t mode); /* Private helper functions */ int set_rit_xit(RIG *rig, shortfreq_t rit); @@ -188,7 +189,7 @@ const struct rig_caps k3_caps = RIG_MODEL(RIG_MODEL_K3), .model_name = "K3", .mfg_name = "Elecraft", - .version = BACKEND_VER ".24", + .version = BACKEND_VER ".25", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, @@ -331,6 +332,7 @@ const struct rig_caps k3_caps = .get_ant = kenwood_get_ant, .send_morse = kenwood_send_morse, .wait_morse = rig_wait_morse, + .power2mW = k3_power2mW, .hamlib_check_rig_caps = HAMLIB_CHECK_RIG_CAPS }; @@ -340,7 +342,7 @@ const struct rig_caps k3s_caps = RIG_MODEL(RIG_MODEL_K3S), .model_name = "K3S", .mfg_name = "Elecraft", - .version = BACKEND_VER ".18", + .version = BACKEND_VER ".19", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, @@ -482,6 +484,7 @@ const struct rig_caps k3s_caps = .get_ant = kenwood_get_ant, .send_morse = kenwood_send_morse, .wait_morse = rig_wait_morse, + .power2mW = k3_power2mW, .hamlib_check_rig_caps = HAMLIB_CHECK_RIG_CAPS }; @@ -491,7 +494,7 @@ const struct rig_caps k4_caps = RIG_MODEL(RIG_MODEL_K4), .model_name = "K4", .mfg_name = "Elecraft", - .version = BACKEND_VER ".24", + .version = BACKEND_VER ".25", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, @@ -633,6 +636,7 @@ const struct rig_caps k4_caps = .get_ant = kenwood_get_ant, .send_morse = kenwood_send_morse, .wait_morse = rig_wait_morse, + .power2mW = k3_power2mW, .hamlib_check_rig_caps = HAMLIB_CHECK_RIG_CAPS }; @@ -641,7 +645,7 @@ const struct rig_caps kx3_caps = RIG_MODEL(RIG_MODEL_KX3), .model_name = "KX3", .mfg_name = "Elecraft", - .version = BACKEND_VER ".17", + .version = BACKEND_VER ".18", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, @@ -783,6 +787,7 @@ const struct rig_caps kx3_caps = .get_ant = kenwood_get_ant, .send_morse = kenwood_send_morse, .wait_morse = rig_wait_morse, + .power2mW = k3_power2mW, .hamlib_check_rig_caps = HAMLIB_CHECK_RIG_CAPS }; @@ -791,7 +796,7 @@ const struct rig_caps kx2_caps = RIG_MODEL(RIG_MODEL_KX2), .model_name = "KX2", .mfg_name = "Elecraft", - .version = BACKEND_VER ".16", + .version = BACKEND_VER ".17", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, @@ -840,8 +845,8 @@ const struct rig_caps kx2_caps = RIG_FRNG_END, }, /* rx range */ .tx_range_list1 = { - FRQ_RNG_HF(1, K3_MODES, mW(10), W(10), K3_VFO, K3_ANTS), - FRQ_RNG_6m(1, K3_MODES, mW(10), W(10), K3_VFO, K3_ANTS), + FRQ_RNG_HF(1, K3_MODES, mW(10), W(12), K3_VFO, K3_ANTS), + FRQ_RNG_6m(1, K3_MODES, mW(10), W(12), K3_VFO, K3_ANTS), RIG_FRNG_END, }, /* tx range */ @@ -851,8 +856,8 @@ const struct rig_caps kx2_caps = RIG_FRNG_END, }, /* rx range */ .tx_range_list2 = { - FRQ_RNG_HF(2, K3_MODES, mW(10), W(10), K3_VFO, K3_ANTS), - FRQ_RNG_6m(2, K3_MODES, mW(10), W(10), K3_VFO, K3_ANTS), + FRQ_RNG_HF(2, K3_MODES, mW(10), W(12), K3_VFO, K3_ANTS), + FRQ_RNG_6m(2, K3_MODES, mW(10), W(12), K3_VFO, K3_ANTS), RIG_FRNG_END, }, /* tx range */ .tuning_steps = { @@ -933,6 +938,7 @@ const struct rig_caps kx2_caps = .get_ant = kenwood_get_ant, .send_morse = kenwood_send_morse, .wait_morse = rig_wait_morse, + .power2mW = k3_power2mW, .hamlib_check_rig_caps = HAMLIB_CHECK_RIG_CAPS }; @@ -1768,17 +1774,20 @@ int k3_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode, static int k3_get_maxpower(RIG *rig) { - int retval; - int maxpower = 12; // K3 default power level - char levelbuf[KENWOOD_MAX_BUF_LEN]; + //int retval; + int maxpower = 15; // K3 default power level + //char levelbuf[KENWOOD_MAX_BUF_LEN]; struct kenwood_priv_data *priv = rig->state.priv; - // default range is 0-12 if there is no KPA3 installed + // default range is 0-15 if there is no KPA3 installed if (priv->has_kpa3 || priv->has_kpa100) { maxpower = 110; } +// Elecraft makes max power pretty variable +// So we will stick with 15W or 110W and scale everything to that +#if 0 else if (RIG_IS_KX2 || RIG_IS_KX3) { @@ -1816,11 +1825,22 @@ static int k3_get_maxpower(RIG *rig) break; } } +#endif rig_debug(RIG_DEBUG_TRACE, "%s: maxpower=%d\n", __func__, maxpower); return maxpower; } +int k3_power2mW(RIG *rig, + unsigned int *mwpower, + float power, + freq_t freq, + rmode_t mode) +{ + *mwpower = power * k3_get_maxpower(rig) * 1000; + return RIG_OK; +} + int k3_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { char levelbuf[16]; @@ -2220,13 +2240,7 @@ int k3_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) if (len == 5 || len == 6) { - sscanf(levelbuf + 2, "%d", &lvl); - - if (len == 6) - { - // K2 extended reply - lvl /= 10; - } + sscanf(levelbuf + 2, "%3d", &lvl); } else { diff --git a/simulators/simelecraft.c b/simulators/simelecraft.c index 1d34c05b..661095a9 100644 --- a/simulators/simelecraft.c +++ b/simulators/simelecraft.c @@ -278,6 +278,11 @@ int main(int argc, char *argv[]) SNPRINTF(buf, sizeof(buf), "TQ0;"); n = write(fd, buf, strlen(buf)); } + else if (strncmp(buf, "PC;", 3) == 0) + { + SNPRINTF(buf, sizeof(buf), "PC005;"); + n = write(fd, buf, strlen(buf)); + } else if (strlen(buf) > 0) { fprintf(stderr, "Unknown command: %s\n", buf); commit 22df154486fa59489d9bc51ff220ab70e2961c66 Author: Mike Black W9MDB <mdb...@ya...> Date: Fri Jan 6 22:22:25 2023 -0600 Remove EX039 check from FTDX3000/3000DM https://github.com/Hamlib/Hamlib/issues/1206 diff --git a/rigs/yaesu/newcat.c b/rigs/yaesu/newcat.c index bf219832..2d611638 100644 --- a/rigs/yaesu/newcat.c +++ b/rigs/yaesu/newcat.c @@ -611,9 +611,9 @@ int newcat_open(RIG *rig) else if (priv->rig_id == NC_RIGID_FT991A || rig->caps->rig_model == RIG_MODEL_FT991) { cmd = "EX0321;EX032;"; } else if (priv->rig_id == NC_RIGID_FTDX3000 - || rig->caps->rig_model == RIG_MODEL_FTDX3000) { cmd = "EX0391;EX039;"; } + || rig->caps->rig_model == RIG_MODEL_FTDX3000) { cmd = "EX0391;"; } else if (priv->rig_id == NC_RIGID_FTDX3000DM - || rig->caps->rig_model == RIG_MODEL_FTDX3000) { cmd = "EX0391;EX039;"; } + || rig->caps->rig_model == RIG_MODEL_FTDX3000) { cmd = "EX0391;"; } else if (priv->rig_id == NC_RIGID_FTDX5000 || rig->caps->rig_model == RIG_MODEL_FTDX5000) { cmd = "EX0331;EX033"; } diff --git a/rigs/yaesu/newcat.h b/rigs/yaesu/newcat.h index 914c535f..7e196a9d 100644 --- a/rigs/yaesu/newcat.h +++ b/rigs/yaesu/newcat.h @@ -50,7 +50,7 @@ typedef char ncboolean; /* shared function version */ -#define NEWCAT_VER "20221228" +#define NEWCAT_VER "20230106" /* Hopefully large enough for future use, 128 chars plus '\0' */ #define NEWCAT_DATA_LEN 129 commit 79255fa27cba9ea1884e29df700466ef5f946566 Author: Mike Black W9MDB <mdb...@ya...> Date: Fri Jan 6 16:41:45 2023 -0600 Remove unnecessary check from netrigctl.c https://github.com/Hamlib/Hamlib/issues/1155 diff --git a/rigs/dummy/netrigctl.c b/rigs/dummy/netrigctl.c index 6ad737fc..03976838 100644 --- a/rigs/dummy/netrigctl.c +++ b/rigs/dummy/netrigctl.c @@ -824,7 +824,6 @@ static int netrigctl_open(RIG *rig) if (n == 2) { - if (agc_code == RIG_AGC_OFF) { p = strtok(NULL, " "); continue; } ; rig->caps->agc_levels[i++] = agc_code; rig->caps->agc_level_count++; rig_debug(RIG_DEBUG_VERBOSE, "%s: rig has agc code=%d, level=%s\n", __func__, commit 4a487ffdcceb2789930fd1e941810a9f5cd4aaf8 Author: Mike Black W9MDB <mdb...@ya...> Date: Fri Jan 6 16:21:58 2023 -0600 Fix rigctld agc level readings -- allow for rig backedn to specify "RIG_AGC_NONE" now for clarity if desired https://github.com/Hamlib/Hamlib/issues/1155 diff --git a/NEWS b/NEWS index 0924a332..ac1b0756 100644 --- a/NEWS +++ b/NEWS @@ -26,6 +26,7 @@ Version 4.6 Version 4.5.4 * 2023-XX-XX + * Fix AGC levels with rigctld * Fix rig_power2mW so it checks all ranges * Allow rigctld to start with autopower_on=0 to avoid startup timeouts when rig is powered off * Fix dummy device to work with grig by disallowing empty "u" call diff --git a/include/hamlib/rig.h b/include/hamlib/rig.h index a55ef92f..438040ef 100644 --- a/include/hamlib/rig.h +++ b/include/hamlib/rig.h @@ -332,7 +332,7 @@ typedef enum { */ /* TODO: kill me, and replace by real AGC delay */ enum agc_level_e { - RIG_AGC_OFF = 0, + RIG_AGC_OFF = 0, RIG_AGC_SUPERFAST, RIG_AGC_FAST, RIG_AGC_SLOW, @@ -340,7 +340,8 @@ enum agc_level_e { RIG_AGC_MEDIUM, RIG_AGC_AUTO, RIG_AGC_LONG, - RIG_AGC_ON /*< Turns AGC ON -- Kenwood -- restores last level set */ + RIG_AGC_ON, /*< Turns AGC ON -- Kenwood -- restores last level set */ + RIG_AGC_NONE /*< Rig does not have CAT AGC control */ }; diff --git a/rigs/dummy/netrigctl.c b/rigs/dummy/netrigctl.c index 393b1ea9..6ad737fc 100644 --- a/rigs/dummy/netrigctl.c +++ b/rigs/dummy/netrigctl.c @@ -811,9 +811,10 @@ static int netrigctl_open(RIG *rig) } else if (strcmp(setting, "agc_levels") == 0) { - int i = 1; + int i = 0; char *p = strtok(value, " "); - rig->caps->agc_levels[0] = RIG_AGC_OFF; + rig->caps->agc_levels[0] = RIG_AGC_NONE; // default value gets overwritten + rig->caps->agc_level_count = 1; while (p) { @@ -823,7 +824,9 @@ static int netrigctl_open(RIG *rig) if (n == 2) { + if (agc_code == RIG_AGC_OFF) { p = strtok(NULL, " "); continue; } ; rig->caps->agc_levels[i++] = agc_code; + rig->caps->agc_level_count++; rig_debug(RIG_DEBUG_VERBOSE, "%s: rig has agc code=%d, level=%s\n", __func__, agc_code, agc_string); } @@ -835,8 +838,6 @@ static int netrigctl_open(RIG *rig) rig_debug(RIG_DEBUG_VERBOSE, "%d=%s\n", agc_code, agc_string); p = strtok(NULL, " "); } - - rig->caps->agc_level_count = i; } else { @@ -2735,7 +2736,7 @@ struct rig_caps netrigctl_caps = RIG_MODEL(RIG_MODEL_NETRIGCTL), .model_name = "NET rigctl", .mfg_name = "Hamlib", - .version = "20230104.0", + .version = "20230106.0", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_OTHER, diff --git a/simulators/simft991.c b/simulators/simft991.c index 83ebc2e7..965deb4f 100644 --- a/simulators/simft991.c +++ b/simulators/simft991.c @@ -12,6 +12,10 @@ float freqA = 14074000; float freqB = 14074500; +char tx_vfo = '0'; +char rx_vfo = '0'; +char modeA = '0'; +char modeB = '0'; // ID 0310 == 310, Must drop leading zero typedef enum nc_rigid_e @@ -104,7 +108,7 @@ int main(int argc, char *argv[]) { printf("Cmd:%s\n", buf); } - else { return 0; } + else { continue; } if (strcmp(buf, "RM5;") == 0) { @@ -137,6 +141,24 @@ int main(int argc, char *argv[]) if (n <= 0) { perror("IF"); } } + else if (strcmp(buf, "FA;") == 0) + { + SNPRINTF(buf, sizeof(buf), "FA%08.0f;", freqA); + n = write(fd, buf, strlen(buf)); + } + else if (strncmp(buf, "FA", 2) == 0) + { + sscanf(buf, "FA%f", &freqA); + } + else if (strcmp(buf, "FB;") == 0) + { + SNPRINTF(buf, sizeof(buf), "FB%08.0f;", freqB); + n = write(fd, buf, strlen(buf)); + } + else if (strncmp(buf, "FB", 2) == 0) + { + sscanf(buf, "FB%f", &freqB); + } else if (strcmp(buf, "ID;") == 0) { printf("%s\n", buf); @@ -148,6 +170,11 @@ int main(int argc, char *argv[]) if (n <= 0) { perror("ID"); } } + else if (strcmp(buf, "PS;") == 0) + { + SNPRINTF(buf, sizeof(buf), "PS1;"); + n = write(fd, buf, strlen(buf)); + } else if (strcmp(buf, "AI;") == 0) { printf("%s\n", buf); @@ -158,6 +185,54 @@ int main(int argc, char *argv[]) if (n <= 0) { perror("ID"); } } + else if (strcmp(buf, "AI0;") == 0) + { + usleep(50 * 1000); + } + else if (strcmp(buf, "FT;") == 0) + { + usleep(50 * 1000); + SNPRINTF(buf, sizeof(buf), "FT%c;", tx_vfo); + printf(" FT response#1=%s, tx_vfo=%c\n", buf, tx_vfo); + n = write(fd, buf, strlen(buf)); + printf(" FT response#2=%s\n", buf); + + if (n < 0) { perror("FT"); } + } + else if (strncmp(buf, "FT", 2) == 0) + { + tx_vfo = buf[2]; + + if (tx_vfo == '3') { tx_vfo = '1'; } + else if (tx_vfo == '2') { tx_vfo = '0'; } + else { perror("Expected 2 or 3"); } + } + else if (strcmp(buf, "MD0;") == 0) + { + usleep(50 * 1000); + SNPRINTF(buf, sizeof(buf), "MD0%c;", modeA); + n = write(fd, buf, strlen(buf)); + + if (n < 0) { perror("MD0;"); } + } + else if (strncmp(buf, "MD0", 3) == 0) + { + modeA = buf[3]; + } + else if (strcmp(buf, "MD1;") == 0) + { + usleep(50 * 1000); + SNPRINTF(buf, sizeof(buf), "MD1%c;", modeB); + n = write(fd, buf, strlen(buf)); + + if (n < 0) { perror("MD0;"); } + } + else if (strncmp(buf, "MD1", 3) == 0) + { + modeB = buf[3]; + } + + #if 0 else if (strncmp(buf, "AI", 2) == 0) diff --git a/src/misc.c b/src/misc.c index bab1b104..a82a2360 100644 --- a/src/misc.c +++ b/src/misc.c @@ -1282,6 +1282,7 @@ static const struct { RIG_AGC_AUTO, "AUTO" }, { RIG_AGC_LONG, "LONG" }, { RIG_AGC_ON, "ON" }, + { RIG_AGC_NONE, "NONE" }, { -1, "" }, }; diff --git a/tests/dumpcaps.c b/tests/dumpcaps.c index 19811bde..0100c113 100644 --- a/tests/dumpcaps.c +++ b/tests/dumpcaps.c @@ -296,7 +296,6 @@ int dumpcaps(RIG *rig, FILE *fout) fprintf(fout, "\n"); -#if 0 fprintf(fout, "AGC levels:"); const struct icom_priv_caps *priv_caps = (const struct icom_priv_caps *) rig->caps->priv; @@ -313,6 +312,7 @@ int dumpcaps(RIG *rig, FILE *fout) } else { + for (i = 0; i < HAMLIB_MAX_AGC_LEVELS && i < caps->agc_level_count; i++) { fprintf(fout, " %d=%s", caps->agc_levels[i], @@ -320,16 +320,13 @@ int dumpcaps(RIG *rig, FILE *fout) } } -#else - //fprintf(fout, "\n"); - fprintf(fout, "AGC levels: "); - char buf[1024]; - rig_sprintf_agc_levels(rig, buf, (int)sizeof(buf)); - fprintf(fout, "%s", buf); -#endif + fprintf(fout, "\n"); if (i == 0) { + rig_debug(RIG_DEBUG_WARN, + "%s: defaulting to all levels since rig does not have any\n", __func__); + // Fall back to printing out all levels for backwards-compatibility for (i = RIG_AGC_OFF; i <= RIG_AGC_LAST; i++) { commit db218e9e73e6763dafb7a7137656c4faf11ef360 Author: Mike Black W9MDB <mdb...@ya...> Date: Fri Jan 6 10:30:32 2023 -0600 Update man pages to clarify upper/lower case for set/get commands diff --git a/doc/man1/rigctl.1 b/doc/man1/rigctl.1 index d68fae78..3d95cc5e 100644 --- a/doc/man1/rigctl.1 +++ b/doc/man1/rigctl.1 @@ -373,12 +373,12 @@ Since most of the .B Hamlib operations have a .BR set " and a " get -method, an upper case letter will often be used for a +method, a single upper case letter will often be used for a .B set -method whereas the corresponding lower case letter refers to the +method whereas the corresponding single lower case letter refers to the .B get method. Each operation also has a long name; in interactive mode, prepend a -backslash, \(oq\\\(cq, to enter a long command name. +backslash, \(oq\\\(cq, to enter a long command name all lower case. . .PP Example: Use \(lq\\dump_caps\(rq to see what capabilities this radio and diff --git a/doc/man1/rigctld.1 b/doc/man1/rigctld.1 index 0e82f40d..6b55bf59 100644 --- a/doc/man1/rigctld.1 +++ b/doc/man1/rigctld.1 @@ -436,12 +436,12 @@ Since most of the .B Hamlib operations have a .BR set " and a " get -method, an upper case letter will be used for +method, a single pper case letter will be used for .B set -methods whereas the corresponding lower case letter refers to the +methods whereas the corresponding single lower case letter refers to the .B get method. Each operation also has a long name; prepend a backslash, \(oq\\\(cq, -to send a long command name. +to send a long command name all in lower case. . .PP Example (Perl): \(lqprint $socket "\\\\dump_caps\\n";\(rq to see what the commit 86771a95575116f31f498a8912d36e114f1109bc Author: Mike Black W9MDB <mdb...@ya...> Date: Fri Jan 6 07:56:11 2023 -0600 Update simelecraft.c diff --git a/simulators/simelecraft.c b/simulators/simelecraft.c index 0be6800e..1d34c05b 100644 --- a/simulators/simelecraft.c +++ b/simulators/simelecraft.c @@ -105,7 +105,7 @@ int main(int argc, char *argv[]) buf[0] = 0; if (getmyline(fd, buf) > 0) { printf("Cmd:%s\n", buf); } - else { return 0; } + else {continue; } if (strcmp(buf, "RM5;") == 0) { @@ -149,6 +149,22 @@ int main(int argc, char *argv[]) if (n <= 0) { perror("ID"); } } + else if (strcmp(buf, "PS;") == 0) + { + SNPRINTF(buf, sizeof(buf), "PS1;"); + n = write(fd, buf, strlen(buf)); + } + else if (strcmp(buf, "BW;") == 0) + { + SNPRINTF(buf, sizeof(buf), "BW0190;"); + n = write(fd, buf, strlen(buf)); + } + else if (strcmp(buf, "BN;") == 0) + { + SNPRINTF(buf, sizeof(buf), "BN03;"); + n = write(fd, buf, strlen(buf)); + } + #if 0 else if (strncmp(buf, "AI", 2) == 0) @@ -199,29 +215,29 @@ int main(int argc, char *argv[]) } else if (strcmp(buf, "K2;") == 0) { - write(fd, "K20;", 4); + n = write(fd, "K20;", 4); } else if (strcmp(buf, "K3;") == 0) { - write(fd, "K30;", 4); + n = write(fd, "K30;", 4); } else if (strcmp(buf, "RVM;") == 0) { - write(fd, "RV02.37;", 8); + n = write(fd, "RV02.37;", 8); } else if (strcmp(buf, "AI;") == 0) { - write(fd, "AI0;", 4); + n = write(fd, "AI0;", 4); } else if (strcmp(buf, "MD;") == 0) { SNPRINTF(buf, sizeof(buf), "MD%d;", modea); - write(fd, buf, strlen(buf)); + n = write(fd, buf, strlen(buf)); } else if (strcmp(buf, "MD$;") == 0) { SNPRINTF(buf, sizeof(buf), "MD$%d;", modeb); - write(fd, buf, strlen(buf)); + n = write(fd, buf, strlen(buf)); } else if (strncmp(buf, "MD", 2) == 0) { @@ -231,12 +247,12 @@ int main(int argc, char *argv[]) else if (strcmp(buf, "FA;") == 0) { SNPRINTF(buf, sizeof(buf), "FA%011d;", freqa); - write(fd, buf, strlen(buf)); + n = write(fd, buf, strlen(buf)); } else if (strcmp(buf, "FB;") == 0) { SNPRINTF(buf, sizeof(buf), "FB%011d;", freqb); - write(fd, buf, strlen(buf)); + n = write(fd, buf, strlen(buf)); } else if (strncmp(buf, "FA", 2) == 0) @@ -250,17 +266,17 @@ int main(int argc, char *argv[]) else if (strncmp(buf, "FR;", 3) == 0) { SNPRINTF(buf, sizeof(buf), "FR0;"); - write(fd, buf, strlen(buf)); + n = write(fd, buf, strlen(buf)); } else if (strncmp(buf, "FT;", 3) == 0) { SNPRINTF(buf, sizeof(buf), "FT0;"); - write(fd, buf, strlen(buf)); + n = write(fd, buf, strlen(buf)); } else if (strncmp(buf, "TQ;", 3) == 0) { SNPRINTF(buf, sizeof(buf), "TQ0;"); - write(fd, buf, strlen(buf)); + n = write(fd, buf, strlen(buf)); } else if (strlen(buf) > 0) { commit e6c5c15452bad475ddf69c0ae74cd63e6bc347b3 Author: Mike Black W9MDB <mdb...@ya...> Date: Thu Jan 5 23:32:41 2023 -0600 Update NEWS diff --git a/NEWS b/NEWS index ae716d06..0924a332 100644 --- a/NEWS +++ b/NEWS @@ -26,6 +26,7 @@ Version 4.6 Version 4.5.4 * 2023-XX-XX + * Fix rig_power2mW so it checks all ranges * Allow rigctld to start with autopower_on=0 to avoid startup timeouts when rig is powered off * Fix dummy device to work with grig by disallowing empty "u" call * Fix ID5100 and promote to stable and hopefully ID4100 too commit bbd0f856ca3f26b5d6367c4ca3d8519e58458e08 Author: Mike Black W9MDB <mdb...@ya...> Date: Thu Jan 5 23:31:15 2023 -0600 Fix rig_getpower2mW so it checks all range lists https://github.com/Hamlib/Hamlib/issues/1205 diff --git a/src/rig.c b/src/rig.c index 7422fd27..eaac46ec 100644 --- a/src/rig.c +++ b/src/rig.c @@ -5851,11 +5851,23 @@ int HAMLIB_API rig_power2mW(RIG *rig, txrange = rig_get_range(rig->state.tx_range_list, freq, mode); - if (!txrange) + // check all the range lists + if (txrange == NULL) { rig_get_range(rig->caps->tx_range_list1, freq, mode); } + + if (txrange == NULL) { rig_get_range(rig->caps->tx_range_list2, freq, mode); } + + if (txrange == NULL) { rig_get_range(rig->caps->tx_range_list3, freq, mode); } + + if (txrange == NULL) { rig_get_range(rig->caps->tx_range_list4, freq, mode); } + + if (txrange == NULL) { rig_get_range(rig->caps->tx_range_list5, freq, mode); } + + if (txrange == NULL) { /* * freq is not on the tx range! */ + rig_debug(RIG_DEBUG_ERR, "%s: freq not in tx range\n", __func__); RETURNFUNC(-RIG_EINVAL); } @@ -6847,7 +6859,7 @@ const freq_range_t *HAMLIB_API rig_get_range(const freq_range_t *range_list, { int i; - if (!range_list) + if (range_list == NULL) { return (NULL); } commit 31d2939acc21fe58b5f203fa5a1c1e6bebb947c4 Author: Mike Black W9MDB <mdb...@ya...> Date: Thu Jan 5 10:02:46 2023 -0600 Fix auto_power_on check in rigctld.c diff --git a/tests/rigctld.c b/tests/rigctld.c index e52f57f1..f61c9ff0 100644 --- a/tests/rigctld.c +++ b/tests/rigctld.c @@ -510,7 +510,7 @@ int main(int argc, char *argv[]) exit(1); } - if (strcmp(optarg, "autopower_on=0") == 0) + if (strcmp(optarg, "auto_power_on=0") == 0) { rig_debug(RIG_DEBUG_ERR, "%s: skipping rig_open\n", __func__); skip_open = 1; commit 589736e8f7e8e8def8f136436a8b9af72c32d31b Author: Mike Black W9MDB <mdb...@ya...> Date: Wed Jan 4 17:33:55 2023 -0600 Add simid5100.c diff --git a/simulators/simid5100.c b/simulators/simid5100.c new file mode 100644 index 00000000..3db0a01f --- /dev/null +++ b/simulators/simid5100.c @@ -0,0 +1,476 @@ +// simicom will show the pts port to use for rigctl on Unix +// using virtual serial ports on Windows is to be developed yet +// Needs a lot of improvement to work on all Icoms +// gcc -g -Wall -o simicom simicom.c -lhamlib +// On mingw in the hamlib src directory +// gcc -static -I../include -g -Wall -o simicom simicom.c -L../../build/src/.libs -lhamlib -lwsock32 -lws2_32 +#define _XOPEN_SOURCE 600 +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <fcntl.h> +#include <sys/time.h> +#include <hamlib/rig.h> +#include "../src/misc.h" +#include <termios.h> +#include <unistd.h> + + +#define BUFSIZE 256 + +int civ_731_mode = 0; +vfo_t current_vfo = RIG_VFO_A; +int split = 0; + +// we make B different from A to ensure we see a difference at startup +float freqA = 145000000; +float freqB = 14074500; +mode_t modeA = RIG_MODE_PKTUSB; +mode_t modeB = RIG_MODE_PKTUSB; +int datamodeA = 0; +int datamodeB = 0; +int filterA = 0; +ant_t ant_curr = 0; +int ant_option = 0; +int ptt = 0; +int satmode = 0; +int agc_time = 1; +int ovf_status = 0; +int powerstat = 1; + +void dumphex(unsigned char *buf, int n) +{ + for (int i = 0; i < n; ++i) { printf("%02x ", buf[i]); } + + printf("\n"); +} + +int +frameGet(int fd, unsigned char *buf) +{ + int i = 0; + memset(buf, 0, BUFSIZE); + unsigned char c; + +again: + + while (read(fd, &c, 1) > 0) + { + buf[i++] = c; + //printf("i=%d, c=0x%02x\n",i,c); + + if (c == 0xfd) + { + dumphex(buf, i); + return i; + } + + if (i > 2 && c == 0xfe) + { + printf("Turning power on due to 0xfe string\n"); + powerstat = 1; + int j; + + for (j = i; j < 175; ++j) + { + if (read(fd, &c, 1) < 0) { break; } + } + + i = 0; + goto again; + } + } + + printf("Error???\n"); + + return 0; +} + +void frameParse(int fd, unsigned char *frame, int len) +{ + double freq; + int n = 0; + + dumphex(frame, len); + + if (frame[0] != 0xfe && frame[1] != 0xfe) + { + printf("expected fe fe, got "); + dumphex(frame, len); + return; + } + + switch (frame[4]) + { + case 0x00: + freq = from_bcd(&frame[5], 5 * 2); + freqA = freq; + printf("freq=%lf\n", freqA); + break; + case 0x03: + + //from_bcd(frameackbuf[2], (civ_731_mode ? 4 : 5) * 2); + if (current_vfo == RIG_VFO_A || current_vfo == RIG_VFO_MAIN) + { + printf("get_freqA\n"); + to_bcd(&frame[5], (long long)freqA/10000, 3 * 2); + dump_hex(frame,11); + } + else + { + printf("get_freqB\n"); + to_bcd(&frame[5], (long long)freqB/10000, 3 * 2); + } + + frame[8] = 0xfd; + dump_hex(frame,9); + + n = write(fd, frame, 9); + + break; + + case 0x04: + if (current_vfo == RIG_VFO_A || current_vfo == RIG_VFO_MAIN) + { + printf("get_modeA\n"); + frame[5] = modeA; + frame[6] = filterA; + } + else + { + printf("get_modeB\n"); + frame[5] = modeB; + frame[6] = filterA; + } + + frame[7] = 0xfd; + n = write(fd, frame, 8); + break; + + case 0x05: + freq = from_bcd(&frame[5], (civ_731_mode ? 4 : 5) * 2); + printf("set_freq to %.0f\n", freq); + + if (current_vfo == RIG_VFO_A || current_vfo == RIG_VFO_MAIN) { freqA = freq; } + else { freqB = freq; } + + frame[4] = 0xfb; + frame[5] = 0xfd; + n = write(fd, frame, 6); + break; + + case 0x06: + if (current_vfo == RIG_VFO_A || current_vfo == RIG_VFO_MAIN) { modeA = frame[6]; } + else { modeB = frame[6]; } + + frame[4] = 0xfb; + frame[5] = 0xfd; + n = write(fd, frame, 6); + break; + + case 0x07: + + switch (frame[5]) + { + case 0x00: current_vfo = RIG_VFO_A; break; + + case 0x01: current_vfo = RIG_VFO_B; break; + + case 0xd0: current_vfo = RIG_VFO_MAIN; break; + + case 0xd1: current_vfo = RIG_VFO_SUB; break; + } + + printf("set_vfo to %s\n", rig_strvfo(current_vfo)); + + frame[4] = 0xfb; + frame[5] = 0xfd; + n = write(fd, frame, 6); + break; + + case 0x0f: + if (frame[5] == 0) { split = 0; } + else if (frame[5] == 1) { split = 1; } + else { frame[6] = split; } + + if (frame[5] == 0xfd) + { + printf("get split %d\n", 1); + frame[7] = 0xfd; + n = write(fd, frame, 8); + } + else + { + printf("set split %d\n", 1); + frame[4] = 0xfb; + frame[5] = 0xfd; + n = write(fd, frame, 6); + } + + break; + + case 0x12: // we're simulating the 3-byte version -- not the 2-... [truncated message content] |