[Hamlib-commits] Hamlib -- Ham radio control libraries branch Hamlib-4.5.4 created. 4.5.2-57-g921cc
Library to control radio transceivers and receivers
Brought to you by:
n0nb
From: n0nb <n0...@us...> - 2023-01-10 01:32:40
|
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.5.4 has been created at 921cc52eb95cb67cada35a8d68d7f228a50a4479 (commit) - Log ----------------------------------------------------------------- commit 921cc52eb95cb67cada35a8d68d7f228a50a4479 Author: Nate Bargmann <n0...@n0...> Date: Mon Jan 9 19:31:41 2023 -0600 Set release date in NEWS diff --git a/NEWS b/NEWS index b2909aaa..3c18ed21 100644 --- a/NEWS +++ b/NEWS @@ -25,7 +25,7 @@ Version 4.6 * Fix FTDX3000 rig split Version 4.5.4 - * 2023-XX-XX + * 2023-01-10 * 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 commit 1f56a1104e494557be3592f574e93d5892c2645a Author: Nate Bargmann <n0...@n0...> Date: Mon Jan 9 19:10:32 2023 -0600 Bump to version 4.5.4 diff --git a/configure.ac b/configure.ac index 7f2a7007..ff6db5d6 100644 --- a/configure.ac +++ b/configure.ac @@ -14,7 +14,7 @@ dnl Please do not use '-' in the version number, as package managers will fail, dnl however, the use of '~' should be fine as apt (others?) will treat dnl it as an earlier version than the actual release. TNX KA6MAL dnl PACKAGE_NAME + " " + PACKAGE_VERSION must not exceed 20 chars! -AC_INIT([Hamlib],[4.5.2],[ham...@li...],[hamlib],[http://www.hamlib.org]) +AC_INIT([Hamlib],[4.5.4],[ham...@li...],[hamlib],[http://www.hamlib.org]) AC_CONFIG_SRCDIR([include/hamlib/rig.h]) AC_CONFIG_MACRO_DIR([macros]) commit 59131c4496a0b07ff78a35ede5c8ec554fe1ad7b 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 427237389098a9e608532ae95c686324ad9deb78 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 fec3d8bc..d7462153 100644 --- a/src/rig.c +++ b/src/rig.c @@ -6015,9 +6015,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 6db1e36b4650e3d3aee7a1c14b594e16430cc5d0 Author: Mike Black W9MDB <mdb...@ya...> Date: Mon Jan 9 11:46:49 2023 -0600 Add simjupiter diff --git a/simulators/simjupiter.c b/simulators/simjupiter.c new file mode 100644 index 00000000..6d4849d4 --- /dev/null +++ b/simulators/simjupiter.c @@ -0,0 +1,117 @@ +// can run this using rigctl/rigctld and socat pty devices +// gcc -o simft897 simft897.c +#define _XOPEN_SOURCE 600 +#include <stdio.h> +#include <stdlib.h> +#include <fcntl.h> +#include <string.h> +#include <unistd.h> +#include "../include/hamlib/rig.h" + +#define BUFSIZE 256 + +float freqA = 14074000; +float freqB = 14074500; +char tx_vfo = '0'; +char rx_vfo = '0'; +char modeA = '1'; +char modeB = '1'; +int width_main = 500; +int width_sub = 700; + + +int +getmyline(int fd, unsigned char *buf) +{ + unsigned char c; + int i = 0; + int n = 0; + memset(buf, 0, BUFSIZE); + + while (i < 5 && read(fd, &c, 1) > 0) + { + buf[i++] = c; + n++; + } + + printf("n=%d %02x %02x %02x %02x %02x\n", n, buf[0], buf[1], buf[2], buf[3], + buf[4]); + return n; +} + +#if defined(WIN32) || defined(_WIN32) +int openPort(char *comport) // doesn't matter for using pts devices +{ + int fd; + fd = open(comport, O_RDWR); + + if (fd < 0) + { + perror(comport); + } + + return fd; +} + +#else +int openPort(char *comport) // doesn't matter for using pts devices +{ + int fd = posix_openpt(O_RDWR); + char *name = ptsname(fd); + + if (name == NULL) + { + perror("pstname"); + return -1; + } + + printf("name=%s\n", name); + + if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1) + { + perror("posix_openpt"); + return -1; + } + + return fd; +} +#endif + + + +int main(int argc, char *argv[]) +{ + unsigned char buf[256]; + unsigned char *pbuf; + int n; + + +again: + int fd = openPort(argv[1]); + + while (1) + { + int bytes = getmyline(fd, buf); + + if (bytes == 0) + { + close(fd); + goto again; + } + + if (bytes != 5) + { + printf("Not 5 bytes? bytes=%d\n", bytes); + } + + switch (buf[0]) + { + case '?': printf("Query %c\n", buf[1]);break; + case '*': printf("Set %c\n", buf[1]);break; + + default: printf("Unknown cmd=%02x\n", buf[4]); + } + } + + return 0; +} commit 63f9ac46895f6c33968df5cfff4caf8c9edee690 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 bfc6d19a4b29bedc6567c7ddcc506c099a2bf8ac 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 e2149692..9667351e 100644 --- a/src/conf.c +++ b/src/conf.c @@ -554,6 +554,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 5b872eaa..fec3d8bc 100644 --- a/src/rig.c +++ b/src/rig.c @@ -586,8 +586,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 ccca746fa7f7ac3183a8290ec41371ffbe8d021f 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 2570c273abf8605b84a860cb1a6e187db294772e 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 eea990150204ee6f0ad2099ad436f9d25651ddb9 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 5f9fc933f5f05070ca6310b5c26cda8f5a916463 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 df2aa87a19b9d9dd9581a9f11f94f5ec444891d5 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 be9ca6d6..5b872eaa 100644 --- a/src/rig.c +++ b/src/rig.c @@ -6010,6 +6010,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 0fce421845b593ce59f9ca71fb069f7afae474fd 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 e3926a2e139f301f508d7236ca72e4fc0a0fbcac 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 c653d5effdfaa734b94b745ce6e3802dc9319866 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 771075445f91d20e84b932ec6bfbd52dc9a938f4 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 8296a7f6cae251beac807ee3fca2a6e43a3ea171 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 7b2abebeea8373475076860da0582edfd99f65fd 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 09b71a11d0ef9e1b7c5ab330985d084a1da9e194 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 1c71ce6f..e5af7a66 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); @@ -264,7 +265,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 3e5080ebff5a98a52527c1c2fa4fc3818dbf7558 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 0be6800e..1c71ce6f 100644 --- a/simulators/simelecraft.c +++ b/simulators/simelecraft.c @@ -262,6 +262,11 @@ int main(int argc, char *argv[]) SNPRINTF(buf, sizeof(buf), "TQ0;"); 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 b9ee776e5b58d7225730687b65e548423c241cef 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 efc295159987f88d22d2f1c52081a77775bc2293 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 61c15d76..c0ce157a 100644 --- a/rigs/dummy/netrigctl.c +++ b/rigs/dummy/netrigctl.c @@ -825,7 +825,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 df8c625cc9723a5200bf8e4cd27fc993687ab656 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 73bc1320..3eb537ef 100644 --- a/doc/man1/rigctl.1 +++ b/doc/man1/rigctl.1 @@ -351,12 +351,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 391920a7..fd9469fc 100644 --- a/doc/man1/rigctld.1 +++ b/doc/man1/rigctld.1 @@ -414,12 +414,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 23e4eb2885809e087cb656a34ae6f9faee13aa7a 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 4279bb15..37f85267 100644 --- a/include/hamlib/rig.h +++ b/include/hamlib/rig.h @@ -333,7 +333,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, @@ -341,7 +341,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 0477306d..61c15d76 100644 --- a/rigs/dummy/netrigctl.c +++ b/rigs/dummy/netrigctl.c @@ -812,9 +812,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) { @@ -824,7 +825,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); } @@ -836,8 +839,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 { @@ -2736,7 +2737,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 008b1754..e38d35a5 100644 --- a/src/misc.c +++ b/src/misc.c @@ -1284,6 +1284,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 852440b0fa14cb52fef0d84c88522c6fe8dbcb99 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 990c1768f8d3a2117e94880c213ddfa7ef3c57c6 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 736cf818..be9ca6d6 100644 --- a/src/rig.c +++ b/src/rig.c @@ -5847,11 +5847,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); } @@ -6843,7 +6855,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 5c478c922232eb30fadc50854c1a6e65f75a63d3 Author: Mike Black W9MDB <mdb...@ya...> Date: Wed Jan 4 17:23:49 2023 -0600 Update NEWS diff --git a/NEWS b/NEWS index 0facc972..ae716d06 100644 --- a/NEWS +++ b/NEWS @@ -26,6 +26,9 @@ Version 4.6 Version 4.5.4 * 2023-XX-XX + * 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 * Remove get_powerstat from Icom ID-5100,ID-4100,ID-31,ID-51 and fix get/set freq in all Version 4.5.3 commit 9e74696a427d3b455c78cade2ea8b49d258c896e Author: Mike Black W9MDB <mdb...@ya...> Date: Wed Jan 4 17:22:56 2023 -0600 Allow rigctld to start with autopower_on=0 and avoid timeouts at startup diff --git a/tests/rigctld.c b/tests/rigctld.c index 9bc906b2..e52f57f1 100644 --- a/tests/rigctld.c +++ b/tests/rigctld.c @@ -156,6 +156,7 @@ extern int lock_mode; extern powerstat_t rig_powerstat; static int rigctld_idle = 0; // if true then rig will close when no clients are connected +static int skip_open = 0; #define MAXCONFLEN 1024 @@ -509,19 +510,29 @@ int main(int argc, char *argv[]) exit(1); } - if (*conf_parms != '\0') + if (strcmp(optarg, "autopower_on=0") == 0) { - strcat(conf_parms, ","); + rig_debug(RIG_DEBUG_ERR, "%s: skipping rig_open\n", __func__); + skip_open = 1; } - - if (strlen(conf_parms) + strlen(optarg) > MAXCONFLEN - 24) + else { - printf("Length of conf_parms exceeds internal maximum of %d\n", - MAXCONFLEN - 24); - return 1; + + if (*conf_parms != '\0') + { + strcat(conf_parms, ","); + } + + if (strlen(conf_parms) + strlen(optarg) > MAXCONFLEN - 24) + { + printf("Length of conf_parms exceeds internal maximum of %d\n", + MAXCONFLEN - 24); + return 1; + } + + strncat(conf_parms, optarg, MAXCONFLEN - strlen(conf_parms)); } - strncat(conf_parms, optarg, MAXCONFLEN - strlen(conf_parms)); break; case 't': @@ -758,8 +769,15 @@ int main(int argc, char *argv[]) } /* attempt to open rig to check early for issues */ - retcode = rig_open(my_rig); - rig_opened = retcode == RIG_OK ? 1 : 0; + if (skip_open) + { + rig_opened = 0; + } + else + { + retcode = rig_open(my_rig); + rig_opened = retcode == RIG_OK ? 1 : 0; + } if (retcode != RIG_OK) { commit 41ad82139f954913090aa83d2e322a6e58412542 Author: Mike Black W9MDB <mdb...@ya...> Date: Wed Jan 4 15:40:36 2023 -0600 Update ID5100 and ID4100 Promote ID5100 to stable https://github.com/Hamlib/Hamlib/issues/1204 https://github.com/Hamlib/Hamlib/issues/1202 https://github.com/Hamlib/Hamlib/issues/1202 diff --git a/rigs/icom/icom.c b/rigs/icom/icom.c index c5dd7dcf..e806c3cf 100644 --- a/rigs/icom/icom.c +++ b/rigs/icom/icom.c @@ -1363,16 +1363,22 @@ int icom_set_freq(RIG *rig, vfo_t vfo, freq_t freq) else { cmd = C_SET_FREQ; + subcmd = -1; if (ICOM_IS_ID5100 || ICOM_IS_ID4100 || ICOM_IS_ID31 || ICOM_IS_ID51) { // for these rigs 0x00 is setting the freq and 0x03 is just for reading cmd = 0x00; + // temporary fix for ID5100 not giving ACK/NAK on 0x00 freq on E8 firmware + retval = icom_transaction(rig, cmd, subcmd, freqbuf, freq_len, NULL, + NULL); + return RIG_OK; + } + else + { + retval = icom_transaction(rig, cmd, subcmd, freqbuf, freq_len, ackbuf, + &ack_len); } - - subcmd = -1; - retval = icom_transaction(rig, cmd, subcmd, freqbuf, freq_len, ackbuf, - &ack_len); } hl_usleep(50 * 1000); // pause for transceive message and we'll flush it @@ -1699,7 +1705,8 @@ int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) if (freq_len == 3 && (ICOM_IS_ID5100 || ICOM_IS_ID4100 || ICOM_IS_ID31 || ICOM_IS_ID51)) { - rig_debug(RIG_DEBUG_ERR, "%s: 3-byte ID5100/4100 length - turn off XONXOFF flow control\n", __func__); + rig_debug(RIG_DEBUG_ERR, + "%s: 3-byte ID5100/4100 length - turn off XONXOFF flow control\n", __func__); } else if (freq_len != 4 && freq_len != 5) { diff --git a/rigs/icom/id4100.c b/rigs/icom/id4100.c index 52837820..6b4a46ac 100644 --- a/rigs/icom/id4100.c +++ b/rigs/icom/id4100.c @@ -98,7 +98,6 @@ const struct rig_caps id4100_caps = .serial_data_bits = 8, .serial_stop_bits = 1, .serial_parity = RIG_PARITY_NONE, - //.serial_handshake = RIG_HANDSHAKE_XONXOFF, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = 0, .post_write_delay = 0, diff --git a/rigs/icom/id5100.c b/rigs/icom/id5100.c index 3c04551e..d0de207d 100644 --- a/rigs/icom/id5100.c +++ b/rigs/icom/id5100.c @@ -90,13 +90,16 @@ int id5100_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) case RIG_MODE_FMN: icmode = 5; modebuf = 2; break; - case RIG_MODE_DSTAR: icmode = 17; modebuf = 1; break; + case RIG_MODE_DSTAR: icmode = 0x17; modebuf = 1; break; default: rig_debug(RIG_DEBUG_ERR, "%s: Unknown mode=%s\n", __func__, rig_strrmode(mode)); return -RIG_EINVAL; } + rig_debug(RIG_DEBUG_VERBOSE, "%s: mode=%d, modebuf=%c\n", __func__, icmode, + modebuf); + retval = icom_transaction(rig, C_SET_MODE, icmode, &modebuf, 1, ackbuf, &ack_len); @@ -118,11 +121,17 @@ int id5100_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) switch (modebuf[1]) { - case 2: *mode = modebuf[3] == 1 ? RIG_MODE_AM : RIG_MODE_AMN; break; + case 2: + *mode = modebuf[2] == 1 ? RIG_MODE_AM : RIG_MODE_AMN; + *width = modebuf[2] == 1 ? 12000 : 6000; break; - case 5: *mode = modebuf[3] == 1 ? RIG_MODE_FM : RIG_MODE_FMN; break; + case 5: + *mode = modebuf[2] == 1 ? RIG_MODE_FM : RIG_MODE_FMN; + *width = modebuf[2] == 1 ? 10000 : 5000; break; - case 17: *mode = RIG_MODE_DSTAR; break; + case 0x17: + *mode = RIG_MODE_DSTAR; + *width = 6000; break; } return RIG_OK; @@ -144,7 +153,7 @@ const struct rig_caps id5100_caps = .mfg_name = "Icom", .version = BACKEND_VER ".2", .copyright = "LGPL", - .status = RIG_STATUS_BETA, + .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_MOBILE, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, @@ -154,8 +163,6 @@ const struct rig_caps id5100_caps = .serial_data_bits = 8, .serial_stop_bits = 1, .serial_parity = RIG_PARITY_NONE, - // XONXOFF is not working on Firmware E8 - //.serial_handshake = RIG_HANDSHAKE_XONXOFF, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = 0, .post_write_delay = 0, diff --git a/simulators/Makefile.am b/simulators/Makefile.am index e0002914..eebddedd 100644 --- a/simulators/Makefile.am +++ b/simulators/Makefile.am @@ -8,12 +8,13 @@ DISTCLEANFILES = bin_PROGRAMS = -check_PROGRAMS = simelecraft simicom simkenwood simyaesu simicom9700 +check_PROGRAMS = simelecraft simicom simkenwood simyaesu simicom9700 simft991 simftdx1200 simftdx3000 simjupiter simpowersdr simelecraft_SOURCES = simelecraft.c simicom_SOURCES = simicom.c simkenwood_SOURCES = simkenwood.c simyaesu_SOURCES = simyaesu.c +simid5100_SOURCES = simid5100.c # include generated include files ahead of any in sources #rigctl_CPPFLAGS = -I$(top_builddir)/tests -I$(top_builddir)/src -I$(srcdir) $(AM_CPPFLAGS) @@ -25,17 +26,20 @@ simelecraft_CFL... [truncated message content] |