[Hamlib-commits] Hamlib -- Ham radio control libraries branch master updated. d5a1b125cd8dd441adf97
Library to control radio transceivers and receivers
Brought to you by:
n0nb
From: Nate B. <n0...@us...> - 2021-10-10 22:38:06
|
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 d5a1b125cd8dd441adf974e7bc9685d9f7495cf1 (commit) via 7e6f948bf72c974de1cf57ddd9f67fdbb281011c (commit) via 75408098a4af8a9645413bb7873db8db8341e24e (commit) via 2ff6b5ebebac03a6e78b8d859a1169d6f65483e1 (commit) via d90d3eb0d0651706795e1c7965974f819d0f1ed0 (commit) via 4b77fc1eb36995abb4070973a4fac53783e90f40 (commit) via 2319d17389a9853fa8c243a8f25c10312daef99e (commit) via 2103428c37021af312900c18da81439d3961eab6 (commit) via 7f27917dbcbd07ac1fed1c72f0c85d447c82da09 (commit) via fecc7d42aa1b13e083a761fa1d8315224f0a7cf5 (commit) via ca9a45c93e36566a5a44b31664281cbfd2ad4966 (commit) via 486b9ac252c59ceb4b6fbd1264d875c9e80fbe6c (commit) via c85a4b9224c1f815a018a6b8496d209ef4902854 (commit) via 0b966412f4a9f319241c9625771dcfaa838b4158 (commit) via 068544eccbf3aaa6dfc3855bb6b243f5326f60ed (commit) via 0018422d4649e655b6d1c463483ef837214101bc (commit) via eadd1da0097faa40258ac9fb8920e7c56cca1491 (commit) via a5ad107c636cc56e57b52926ce10c5b9b1dfdfa9 (commit) via a2b3a8d67e82dc3b8475fbeecdc46434cc91a357 (commit) via dd1376becf82a05a30ac389051d0a00cbea621cc (commit) via da87903e3c16c0baea0b98faf2ce5a470504bf27 (commit) via 7c42d6ddb049c1ab44756b51064c683f55ee3aab (commit) via 43251254c50f25f399fd25c924c58c354ca0e9ea (commit) via 8399b4b4dc10541fb68d1cd265bfc718df202f5e (commit) via 3a76cb1b40d465e641a7f0d8032c0f7e8638b72b (commit) via f076d135bc4c30aeb709e339e27b6f1dd7d7dafc (commit) via de5cb713f08eeb1a37bab0331fca8dd0373946a0 (commit) via 9c272dd5f773268158a9f4bcaf83929d4761910f (commit) via aae3ec49960d0a3805057971d731ed18051165da (commit) from 7bd407beda8e3c020572cd39ae18a9bd2142ccde (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 d5a1b125cd8dd441adf974e7bc9685d9f7495cf1 Author: Mike Black W9MDB <mdb...@ya...> Date: Sun Oct 10 17:17:30 2021 -0500 Fix frame.c diff --git a/rigs/icom/frame.c b/rigs/icom/frame.c index 43c01d2f..1e44f194 100644 --- a/rigs/icom/frame.c +++ b/rigs/icom/frame.c @@ -439,8 +439,8 @@ int icom_transaction(RIG *rig, int cmd, int subcmd, } /* used in read_icom_frame as end of block */ -static const char icom_block_end[3] = { FA, FI, COL}; -#define icom_block_end_length 3 +static const char icom_block_end[2] = { FI, COL}; +#define icom_block_end_length 2 /* * read_icom_frame commit 7e6f948bf72c974de1cf57ddd9f67fdbb281011c Author: Mike Black W9MDB <mdb...@ya...> Date: Sun Oct 10 17:12:07 2021 -0500 Undo frame.c commit -- misunderstood use diff --git a/rigs/icom/frame.c b/rigs/icom/frame.c index bf525d77..43c01d2f 100644 --- a/rigs/icom/frame.c +++ b/rigs/icom/frame.c @@ -439,8 +439,8 @@ int icom_transaction(RIG *rig, int cmd, int subcmd, } /* used in read_icom_frame as end of block */ -static const char icom_block_end[1] = {COL}; -#define icom_block_end_length 1 +static const char icom_block_end[3] = { FA, FI, COL}; +#define icom_block_end_length 3 /* * read_icom_frame commit 75408098a4af8a9645413bb7873db8db8341e24e Author: Mike Black W9MDB <mdb...@ya...> Date: Sun Oct 10 16:27:58 2021 -0500 Change Icom frame.c to only look for 0xfd for end of frame. Was not seeing error frames] https://github.com/Hamlib/Hamlib/issues/818 diff --git a/rigs/icom/frame.c b/rigs/icom/frame.c index 79c67c7c..bf525d77 100644 --- a/rigs/icom/frame.c +++ b/rigs/icom/frame.c @@ -439,8 +439,8 @@ int icom_transaction(RIG *rig, int cmd, int subcmd, } /* used in read_icom_frame as end of block */ -static const char icom_block_end[2] = {FI, COL}; -#define icom_block_end_length 2 +static const char icom_block_end[1] = {COL}; +#define icom_block_end_length 1 /* * read_icom_frame @@ -469,7 +469,7 @@ int read_icom_frame(hamlib_port_t *p, unsigned char rxbuffer[], int i = read_string(p, rx_ptr, MAXFRAMELEN - read, icom_block_end, icom_block_end_length); - if (i < 0) /* die on errors */ + if (i < 0 && i != RIG_BUSBUSY) /* die on errors */ { RETURNFUNC(i); } @@ -483,8 +483,11 @@ int read_icom_frame(hamlib_port_t *p, unsigned char rxbuffer[], } /* OK, we got something. add it in and continue */ - read += i; - rx_ptr += i; + if (i > 0) + { + read += i; + rx_ptr += i; + } } while ((read < rxbuffer_len) && (rxbuffer[read - 1] != FI) && (rxbuffer[read - 1] != COL)); diff --git a/rigs/icom/icom.h b/rigs/icom/icom.h index fe150d2a..911ba548 100644 --- a/rigs/icom/icom.h +++ b/rigs/icom/icom.h @@ -30,7 +30,7 @@ #include <sys/time.h> #endif -#define BACKEND_VER "20211005" +#define BACKEND_VER "20211010" #define ICOM_IS_SECONDARY_VFO(vfo) ((vfo) & (RIG_VFO_B | RIG_VFO_SUB | RIG_VFO_SUB_B | RIG_VFO_MAIN_B)) #define ICOM_GET_VFO_NUMBER(vfo) (ICOM_IS_SECONDARY_VFO(vfo) ? 0x01 : 0x00) commit 2ff6b5ebebac03a6e78b8d859a1169d6f65483e1 Merge: d90d3eb0 2103428c Author: Mike Black W9MDB <mdb...@ya...> Date: Sun Oct 10 08:34:06 2021 -0500 Merge branch 'master' of https://github.com/Hamlib/Hamlib commit d90d3eb0d0651706795e1c7965974f819d0f1ed0 Author: Mike Black W9MDB <mdb...@ya...> Date: Sun Oct 10 08:33:31 2021 -0500 Use EAGAIN error to retry when serial port is unavailable https://github.com/Hamlib/Hamlib/issues/818 diff --git a/src/iofunc.c b/src/iofunc.c index 9e27c429..4114d57e 100644 --- a/src/iofunc.c +++ b/src/iofunc.c @@ -767,7 +767,7 @@ int HAMLIB_API read_string(hamlib_port_t *p, do { rd_count = port_read(p, &rxbuffer[total_count], 1); - if (errno == EBUSY) + if (errno == EAGAIN) { hl_usleep(5*1000); rig_debug(RIG_DEBUG_WARN, "%s: port_read is busy?\n", __func__); commit 4b77fc1eb36995abb4070973a4fac53783e90f40 Author: Mike Black W9MDB <mdb...@ya...> Date: Fri Oct 8 23:58:07 2021 -0500 Allow for EBUSY return during port read and retry 10x5ms for 50ms total before returning an error https://github.com/Hamlib/Hamlib/issues/818 diff --git a/src/iofunc.c b/src/iofunc.c index 9f210924..9e27c429 100644 --- a/src/iofunc.c +++ b/src/iofunc.c @@ -676,6 +676,7 @@ int HAMLIB_API read_string(hamlib_port_t *p, fd_set rfds, efds; struct timeval tv, tv_timeout, start_time, end_time, elapsed_time; int total_count = 0; + int i=0; rig_debug(RIG_DEBUG_TRACE, "%s called, rxmax=%d\n", __func__, (int)rxmax); @@ -763,7 +764,16 @@ int HAMLIB_API read_string(hamlib_port_t *p, * read 1 character from the rig, (check if in stop set) * The file descriptor must have been set up non blocking. */ - rd_count = port_read(p, &rxbuffer[total_count], 1); + do + { + rd_count = port_read(p, &rxbuffer[total_count], 1); + if (errno == EBUSY) + { + hl_usleep(5*1000); + rig_debug(RIG_DEBUG_WARN, "%s: port_read is busy?\n", __func__); + } + + } while( ++i < 10 && errno == EBUSY); // 50ms should be enough /* if we get 0 bytes or an error something is wrong */ if (rd_count <= 0) commit 2319d17389a9853fa8c243a8f25c10312daef99e Author: Mike Black W9MDB <mdb...@ya...> Date: Fri Oct 8 23:55:48 2021 -0500 Fix rigs so that VFOB/A split works as well as VFOA/B https://github.com/Hamlib/Hamlib/issues/745 diff --git a/rigs/kenwood/kenwood.c b/rigs/kenwood/kenwood.c index b4e981f8..5e48aa75 100644 --- a/rigs/kenwood/kenwood.c +++ b/rigs/kenwood/kenwood.c @@ -962,13 +962,6 @@ int kenwood_open(RIG *rig) rig->state.rigport.retry = retry_save; - // Default to 1st VFO and split off -- but only 1 time - if (rig->caps->set_vfo && priv->opened == 0) - { - rig_set_vfo(rig, vfo_fixup(rig, RIG_VFO_A, 0)); - priv->opened = 1; - } - RETURNFUNC(RIG_OK); } diff --git a/rigs/kenwood/kenwood.h b/rigs/kenwood/kenwood.h index 801fdb1b..e3c36b77 100644 --- a/rigs/kenwood/kenwood.h +++ b/rigs/kenwood/kenwood.h @@ -28,7 +28,7 @@ #include "token.h" #include "misc.h" -#define BACKEND_VER "20210911" +#define BACKEND_VER "20211008" #define EOM_KEN ';' #define EOM_TH '\r' diff --git a/src/misc.c b/src/misc.c index 3e79c6f9..d321bbd5 100644 --- a/src/misc.c +++ b/src/misc.c @@ -1768,7 +1768,7 @@ vfo_t HAMLIB_API vfo_fixup(RIG *rig, vfo_t vfo, split_t split) int satmode = rig->state.cache.satmode; - if (split && vfo == RIG_VFO_TX) { vfo = RIG_VFO_B; } + if (split && vfo == RIG_VFO_TX) { vfo = rig->state.tx_vfo; } if (VFO_HAS_MAIN_SUB_ONLY && !split && !satmode && vfo != RIG_VFO_B) { vfo = RIG_VFO_MAIN; } commit 2103428c37021af312900c18da81439d3961eab6 Merge: fecc7d42 7f27917d Author: Michael Black <mdb...@ya...> Date: Wed Oct 6 07:54:26 2021 -0500 Merge pull request #817 from AuroraRAS/androidsensor AndroidSensor codes improvement commit 7f27917dbcbd07ac1fed1c72f0c85d447c82da09 Author: AuroraRAS <ch...@gm...> Date: Wed Oct 6 13:45:33 2021 +0800 AndroidSensor codes improvement append rotctl CLI tool to android.mk file save target az/el to priv pointor, make them accessible more. remove some c++ warnings. bug fixes. codes optimization. Signed-off-by: AuroraRAS <ch...@gm...> diff --git a/rotators/androidsensor/androidsensor.cpp b/rotators/androidsensor/androidsensor.cpp index e53c1257..35049505 100644 --- a/rotators/androidsensor/androidsensor.cpp +++ b/rotators/androidsensor/androidsensor.cpp @@ -39,13 +39,21 @@ /* ************************************************************************* */ -static NdkImu *imu; +struct androidsensor_rot_priv_data +{ + NdkImu *imu; + azimuth_t target_az; + elevation_t target_el; +}; static int androidsensor_rot_set_position(ROT *rot, azimuth_t az, elevation_t el) { rig_debug(RIG_DEBUG_TRACE, "%s called: %f %f\n", __func__, az, el); - // To-Do + struct androidsensor_rot_priv_data *priv = (struct androidsensor_rot_priv_data *)rot->state.priv; + + priv->target_az = az; + priv->target_el = el; return RIG_OK; } @@ -53,31 +61,24 @@ static int androidsensor_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el) { rig_debug(RIG_DEBUG_TRACE, "%s called: ", __func__); + struct androidsensor_rot_priv_data *priv = (struct androidsensor_rot_priv_data *)rot->state.priv; - imu->update(); + priv->imu->update(); float accData[3], magData[3]; - imu->getAccData(accData); - imu->getMagData(magData); + priv->imu->getAccData(accData); + priv->imu->getMagData(magData); float R[9] = {0}, I[9] = {0}, orientation[3] = {0}; - bool status = imu->getRotationMatrix(R, 9, I, 9, accData, magData); + bool status = priv->imu->getRotationMatrix(R, 9, I, 9, accData, magData); if(status) - imu->getOrientation(R, 9, orientation); + priv->imu->getOrientation(R, 9, orientation); *az = (orientation[0] / M_PI * 180 ); *el = (orientation[1] / M_PI * 180 ) * -1; - rig_debug(RIG_DEBUG_TRACE, "%f %f\n", az, el); - - return RIG_OK; -} + rig_debug(RIG_DEBUG_TRACE, "%f %f\n", *az, *el); -static int -androidsensor_rot_stop(ROT *rot) -{ - rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__); - // To-Do return RIG_OK; } @@ -85,7 +86,17 @@ static int androidsensor_rot_init(ROT *rot) { rig_debug(RIG_DEBUG_TRACE, "%s called, make new NdkImu\n", __func__); - imu = new NdkImu(); + rot->state.priv = (struct androidsensor_rot_priv_data *)malloc(sizeof(struct androidsensor_rot_priv_data)); + struct androidsensor_rot_priv_data *priv = (struct androidsensor_rot_priv_data *)rot->state.priv; + + if (!rot->state.priv) + { + return -RIG_ENOMEM; + } + + priv->imu = new NdkImu(); + priv->target_az = 0; + priv->target_el = 0; return RIG_OK; } @@ -93,7 +104,10 @@ static int androidsensor_rot_cleanup(ROT *rot) { rig_debug(RIG_DEBUG_TRACE, "%s called, delete imu\n", __func__); - delete imu; + struct androidsensor_rot_priv_data *priv = (struct androidsensor_rot_priv_data *)rot->state.priv; + + delete priv->imu; + free(rot->state.priv); return RIG_OK; } @@ -104,7 +118,7 @@ const struct rot_caps androidsensor_rot_caps = ROT_MODEL(ROT_MODEL_ANDROIDSENSOR), .model_name = "ACC/MAG", .mfg_name = "Android Sensor", - .version = "20210925.0", + .version = "20211006.0", .copyright = "LGPL", .rot_type = ROT_TYPE_AZEL, .port_type = RIG_PORT_NONE, @@ -116,11 +130,10 @@ const struct rot_caps androidsensor_rot_caps = .priv = NULL, /* priv */ - .set_position = androidsensor_rot_set_position, - .get_position = androidsensor_rot_get_position, - .stop = androidsensor_rot_stop, .rot_init = androidsensor_rot_init, .rot_cleanup = androidsensor_rot_cleanup, + .set_position = androidsensor_rot_set_position, + .get_position = androidsensor_rot_get_position, }; /* ************************************************************************* */ diff --git a/tests/Android.mk b/tests/Android.mk index 785b6d6f..82208f94 100644 --- a/tests/Android.mk +++ b/tests/Android.mk @@ -10,3 +10,14 @@ LOCAL_C_INCLUDES := android include src LOCAL_LDLIBS := -lhamlib -Lobj/local/$(TARGET_ARCH_ABI) include $(BUILD_EXECUTABLE) + +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := rotctl.c rotctl_parse.c dumpcaps_rot.c ../src/rot_settings.c +LOCAL_MODULE := rotctl + +LOCAL_CFLAGS := -DHAVE_CONFIG_H +LOCAL_C_INCLUDES := android include src +LOCAL_LDLIBS := -lhamlib -Lobj/local/$(TARGET_ARCH_ABI) + +include $(BUILD_EXECUTABLE) commit fecc7d42aa1b13e083a761fa1d8315224f0a7cf5 Author: Mike Black W9MDB <mdb...@ya...> Date: Tue Oct 5 11:40:54 2021 -0500 Hopefully fixed auto_power_on for IC-7610 and IC-9700 But it takes ~4 seconds on IC-7300 to power on 14 seconds to time out when the rig does not respond at all https://github.com/Hamlib/Hamlib/issues/815 diff --git a/rigs/icom/icom.c b/rigs/icom/icom.c index 93b04403..0c67faeb 100644 --- a/rigs/icom/icom.c +++ b/rigs/icom/icom.c @@ -7629,13 +7629,13 @@ int icom_set_powerstat(RIG *rig, powerstat_t status) // sending more than enough 0xfe's to wake up the rs232 write_block(&rs->rigport, (char *) fe_buf, fe_max); - hl_usleep(100 * 1000); // we'll try 0x18 0x01 now -- should work on STBY rigs too pwr_sc = S_PWR_ON; fe_buf[0] = 0; priv->serial_USB_echo_off = 1; retval = icom_transaction(rig, C_SET_PWR, pwr_sc, NULL, 0, ackbuf, &ack_len); + hl_usleep(4000*1000); // give some time to wake up break; @@ -7647,7 +7647,7 @@ int icom_set_powerstat(RIG *rig, powerstat_t status) } i = 0; - retry = 2; + retry = 3; if (status == RIG_POWER_ON) // wait for wakeup only { @@ -7657,7 +7657,10 @@ int icom_set_powerstat(RIG *rig, powerstat_t status) // need to see if echo is on or not first // until such time as rig is awake we don't know retval = icom_get_usb_echo_off(rig); - if (retval == -RIG_ETIMEOUT) continue; + if (retval == -RIG_ETIMEOUT) { + rig_debug(RIG_DEBUG_WARN, "%s: get_usb_echo_off timeout...try#%d\n", __func__, i+1); + continue; + } // Use get_freq as all rigs should repond to this retval = rig_get_freq(rig, RIG_VFO_CURR, &freq); diff --git a/rigs/icom/icom.h b/rigs/icom/icom.h index ad352eef..fe150d2a 100644 --- a/rigs/icom/icom.h +++ b/rigs/icom/icom.h @@ -30,7 +30,7 @@ #include <sys/time.h> #endif -#define BACKEND_VER "20211004" +#define BACKEND_VER "20211005" #define ICOM_IS_SECONDARY_VFO(vfo) ((vfo) & (RIG_VFO_B | RIG_VFO_SUB | RIG_VFO_SUB_B | RIG_VFO_MAIN_B)) #define ICOM_GET_VFO_NUMBER(vfo) (ICOM_IS_SECONDARY_VFO(vfo) ? 0x01 : 0x00) commit ca9a45c93e36566a5a44b31664281cbfd2ad4966 Author: Mike Black W9MDB <mdb...@ya...> Date: Mon Oct 4 17:34:09 2021 -0500 Reduce icom auto_power_on timeout from 15 seconds to just over 5 seconds https://github.com/Hamlib/Hamlib/issues/815 diff --git a/rigs/icom/icom.c b/rigs/icom/icom.c index bfc65a8d..93b04403 100644 --- a/rigs/icom/icom.c +++ b/rigs/icom/icom.c @@ -7604,13 +7604,18 @@ int icom_set_powerstat(RIG *rig, powerstat_t status) int fe_max = 175; unsigned char fe_buf[fe_max]; // for FE's to power up int i; - int retry; + int retry, retry_save; struct rig_state *rs = &rig->state; struct icom_priv_data *priv = (struct icom_priv_data *) rs->priv; rig_debug(RIG_DEBUG_VERBOSE, "%s called status=%d\n", __func__, (int) status); + // elimininate retries to speed this up + // especially important when rig is not turned on + retry_save = rs->rigport.retry; + rs->rigport.retry = 0; + switch (status) { case RIG_POWER_ON: @@ -7628,40 +7633,31 @@ int icom_set_powerstat(RIG *rig, powerstat_t status) // we'll try 0x18 0x01 now -- should work on STBY rigs too pwr_sc = S_PWR_ON; fe_buf[0] = 0; - retry = rs->rigport.retry; - rs->rigport.retry = 0; priv->serial_USB_echo_off = 1; retval = icom_transaction(rig, C_SET_PWR, pwr_sc, NULL, 0, ackbuf, &ack_len); - rs->rigport.retry = retry; - // why was this sleep here? We'll try without it - //hl_usleep(3000 * 1000); // give it 3 seconds to wake up break; default: pwr_sc = S_PWR_OFF; fe_buf[0] = 0; - retry = rs->rigport.retry; - rs->rigport.retry = 0; retval = icom_transaction(rig, C_SET_PWR, pwr_sc, NULL, 0, ackbuf, &ack_len); - rs->rigport.retry = retry; } i = 0; - retry = 3; + retry = 2; if (status == RIG_POWER_ON) // wait for wakeup only { - for (i = 0; i < retry; ++i) // up to 10 attempts { freq_t freq; - sleep(1); // need to see if echo is on or not first // until such time as rig is awake we don't know - icom_get_usb_echo_off(rig); + retval = icom_get_usb_echo_off(rig); + if (retval == -RIG_ETIMEOUT) continue; // Use get_freq as all rigs should repond to this retval = rig_get_freq(rig, RIG_VFO_CURR, &freq); @@ -7680,6 +7676,7 @@ int icom_set_powerstat(RIG *rig, powerstat_t status) __func__, i + 1, retry); } } + rs->rigport.retry = retry_save; if (i == retry) { diff --git a/rigs/icom/icom.h b/rigs/icom/icom.h index 36200b0d..ad352eef 100644 --- a/rigs/icom/icom.h +++ b/rigs/icom/icom.h @@ -30,7 +30,7 @@ #include <sys/time.h> #endif -#define BACKEND_VER "20211002" +#define BACKEND_VER "20211004" #define ICOM_IS_SECONDARY_VFO(vfo) ((vfo) & (RIG_VFO_B | RIG_VFO_SUB | RIG_VFO_SUB_B | RIG_VFO_MAIN_B)) #define ICOM_GET_VFO_NUMBER(vfo) (ICOM_IS_SECONDARY_VFO(vfo) ? 0x01 : 0x00) commit 486b9ac252c59ceb4b6fbd1264d875c9e80fbe6c Merge: 0b966412 c85a4b92 Author: Michael Black <mdb...@ya...> Date: Mon Oct 4 08:43:31 2021 -0500 Merge pull request #816 from sq6emm/master Add method to build inside docker commit c85a4b9224c1f815a018a6b8496d209ef4902854 Author: Dawid SQ6EMM <sq...@ha...> Date: Mon Oct 4 15:31:04 2021 +0200 Add method to build inside docker diff --git a/docker-build/Dockerfile b/docker-build/Dockerfile new file mode 100644 index 00000000..0700fbca --- /dev/null +++ b/docker-build/Dockerfile @@ -0,0 +1,21 @@ +# Idea from https://github.com/ok2cqr/cqrlog + +FROM ubuntu:latest + +RUN apt-get update && apt-get -y upgrade + +ENV DEBIAN_FRONTEND="noninteractive" TZ="Europe/London" + +RUN apt-get install -y git build-essential automake libtool + +RUN mkdir -p /usr/local/hamlib-alpha /home/hamlib/build + +# Mount point for the git repository: +VOLUME ["/home/hamlib/build"] + +# Mount point for the result of the build: +VOLUME ["/usr/local/hamlib-alpha"] + +WORKDIR /home/hamlib/build + +ENTRYPOINT rm -rf build && mkdir -p build && cd build && ../bootstrap && ../configure --prefix=/usr/local/hamlib-alpha && make clean && make && make install diff --git a/docker-build/README.docker b/docker-build/README.docker new file mode 100644 index 00000000..ea9ad0f5 --- /dev/null +++ b/docker-build/README.docker @@ -0,0 +1,13 @@ +This is all about building hamlib inside docker contariner - so that you do not need to install dependencied on your local machine. + +1. Build docker container + +(cd docker-build && docker build --no-cache -t this.registry.is.invalid/hamlib-build .) + +2. Build hamlib + +docker run -ti -u root -v $(pwd):/home/hamlib/build -v /usr/local/hamlib-alpha:/usr/local/hamlib-alpha this.registry.is.invalid/hamlib-build + +3. Execute hamlib + +/usr/local/hamlib-alpha/bin/rigctl <your options here> commit 0b966412f4a9f319241c9625771dcfaa838b4158 Author: Mike Black W9MDB <mdb...@ya...> Date: Sun Oct 3 08:10:03 2021 -0500 For FT100 add swap to VFOB when in split and PTT on to allow power reading of VFOB Also add 100ms delay after PTT off as Fake It was not resetting rx freq after tx https://github.com/Hamlib/Hamlib/issues/808 diff --git a/rigs/yaesu/ft100.c b/rigs/yaesu/ft100.c index 6e72b2ac..0c698255 100644 --- a/rigs/yaesu/ft100.c +++ b/rigs/yaesu/ft100.c @@ -316,7 +316,7 @@ const struct rig_caps ft100_caps = RIG_MODEL(RIG_MODEL_FT100), .model_name = "FT-100", .mfg_name = "Yaesu", - .version = "20210928.0", + .version = "20210929.0", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, @@ -912,6 +912,7 @@ int ft100_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) { unsigned char cmd_index; + int split = rig->state.cache.split; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); @@ -919,16 +920,18 @@ int ft100_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) { case RIG_PTT_ON: cmd_index = FT100_NATIVE_CAT_PTT_ON; + if (split) rig_set_vfo(rig,RIG_VFO_B); break; case RIG_PTT_OFF: cmd_index = FT100_NATIVE_CAT_PTT_OFF; + if (split) rig_set_vfo(rig,RIG_VFO_A); + hl_usleep(100*1000); // give ptt some time to do it's thing -- fake it was not reseting freq after tx break; default: return -RIG_EINVAL; } - return ft100_send_priv_cmd(rig, cmd_index); } commit 068544eccbf3aaa6dfc3855bb6b243f5326f60ed Author: Mike Black W9MDB <mdb...@ya...> Date: Sat Oct 2 23:17:36 2021 -0500 Fix icom_set_mode_with_data to also set filter width https://github.com/Hamlib/Hamlib/issues/811 diff --git a/rigs/icom/icom.c b/rigs/icom/icom.c index bbf8be2a..bfc65a8d 100644 --- a/rigs/icom/icom.c +++ b/rigs/icom/icom.c @@ -2008,7 +2008,7 @@ int icom_set_mode_with_data(RIG *rig, vfo_t vfo, rmode_t mode, RETURNFUNC(retval); } - if (tmode == mode && ((width == RIG_PASSBAND_NOCHANGE) || (width == twidth)) + if (tmode == mode && ((width == RIG_PASSBAND_NOCHANGE) || (width == twidth))) { rig_debug(RIG_DEBUG_TRACE, "%s: mode/width not changing\n", __func__); RETURNFUNC(RIG_OK); @@ -2122,6 +2122,7 @@ int icom_set_mode_with_data(RIG *rig, vfo_t vfo, rmode_t mode, } } } + icom_set_dsp_flt(rig, mode, width); RETURNFUNC(retval); } commit 0018422d4649e655b6d1c463483ef837214101bc Author: Mike Black W9MDB <mdb...@ya...> Date: Sat Oct 2 22:59:19 2021 -0500 Add another check for icom_set_mode to skip if both mode and width are not changing diff --git a/rigs/icom/icom.c b/rigs/icom/icom.c index 906adc58..bbf8be2a 100644 --- a/rigs/icom/icom.c +++ b/rigs/icom/icom.c @@ -2008,7 +2008,7 @@ int icom_set_mode_with_data(RIG *rig, vfo_t vfo, rmode_t mode, RETURNFUNC(retval); } - if (tmode == mode && width == RIG_PASSBAND_NOCHANGE) + if (tmode == mode && ((width == RIG_PASSBAND_NOCHANGE) || (width == twidth)) { rig_debug(RIG_DEBUG_TRACE, "%s: mode/width not changing\n", __func__); RETURNFUNC(RIG_OK); commit eadd1da0097faa40258ac9fb8920e7c56cca1491 Author: Mike Black W9MDB <mdb...@ya...> Date: Sat Oct 2 17:33:21 2021 -0500 Fix IC7300 (and other Icoms) set/get_dsp_filter All Icoms will now try the 1A 03 command once and if it is rejected won't try again. https://github.com/Hamlib/Hamlib/issues/811 diff --git a/rigs/icom/icom.c b/rigs/icom/icom.c index f4bb41ef..906adc58 100644 --- a/rigs/icom/icom.c +++ b/rigs/icom/icom.c @@ -1738,6 +1738,7 @@ int icom_set_xit_new(RIG *rig, vfo_t vfo, shortfreq_t ts) this subcommand */ +int filtericom[] = { 50,100,150,200,250,300,350,400,450,500,600,700,800,900,1000,1100,1200,1300,1400,1500,1600,1700,1800,1900,2000,2100,2200,2300,2400,2500,2600,2700,2800,2900,3000,3100,3200,3300,3400,3500,3600 }; pbwidth_t icom_get_dsp_flt(RIG *rig, rmode_t mode) { @@ -1752,9 +1753,6 @@ pbwidth_t icom_get_dsp_flt(RIG *rig, rmode_t mode) rig_debug(RIG_DEBUG_VERBOSE, "%s called, mode=%s\n", __func__, rig_strrmode(mode)); - // only these models that we know of -- keep set_dsp_flt in sync - if ((rig->caps->rig_model & (RIG_MODEL_IC7000 | RIG_MODEL_IC7800 | RIG_MODEL_IC7300 || RIG_MODEL_IC9700 || RIG_MODEL_IC7610)) == 0) RETURNFUNC(RIG_OK); - if (rig_has_get_func(rig, RIG_FUNC_RF) && (mode & (RIG_MODE_RTTY | RIG_MODE_RTTYR))) { @@ -1790,14 +1788,14 @@ pbwidth_t icom_get_dsp_flt(RIG *rig, rmode_t mode) if (-RIG_ERJCTED == retval) { priv->no_1a_03_cmd = -1; /* do not keep asking */ - return (0); + return (RIG_OK); } if (retval != RIG_OK) { rig_debug(RIG_DEBUG_ERR, "%s: protocol error (%#.2x), " "len=%d\n", __func__, resbuf[0], res_len); - return (0); /* use default */ + return (RIG_OK); /* use default */ } if (res_len == 3 && resbuf[0] == C_CTL_MEM) @@ -1809,18 +1807,22 @@ pbwidth_t icom_get_dsp_flt(RIG *rig, rmode_t mode) if (mode & RIG_MODE_AM) { - return ((i + 1) * 200); /* Ic_7800 */ + if (i > 49) { + rig_debug(RIG_DEBUG_ERR, "%s: Expected max 49, got %d for filter\n", __func__, i); + RETURNFUNC(-RIG_EPROTO); + } + return ((i + 1) * 200); /* All Icoms that we know of */ } else if (mode & (RIG_MODE_CW | RIG_MODE_USB | RIG_MODE_LSB | RIG_MODE_RTTY | RIG_MODE_RTTYR | RIG_MODE_PKTUSB | RIG_MODE_PKTLSB)) { - rig_debug(RIG_DEBUG_TRACE, "%s: using width=%d\n", __func__, i); - RETURNFUNC(i < 10 ? (i + 1) * 50 : (i - 4) * 100); + rig_debug(RIG_DEBUG_TRACE, "%s: using filtericom width=%d\n", __func__, i); + RETURNFUNC(filtericom[i]); } } - RETURNFUNC(0); + RETURNFUNC(RIG_OK); } int icom_set_dsp_flt(RIG *rig, rmode_t mode, pbwidth_t width) @@ -1830,14 +1832,13 @@ int icom_set_dsp_flt(RIG *rig, rmode_t mode, pbwidth_t width) unsigned char flt_ext; value_t rfwidth; int ack_len = sizeof(ackbuf), flt_idx; + struct icom_priv_data *priv = (struct icom_priv_data *) rig->state.priv; unsigned char fw_sub_cmd = RIG_MODEL_IC7200 == rig->caps->rig_model ? 0x02 : S_MEM_FILT_WDTH; ENTERFUNC; - // only these models that we know of -- keep get_dsp in sync here - if ((rig->caps->rig_model & (RIG_MODEL_IC7000 | RIG_MODEL_IC7800 | RIG_MODEL_IC7300 || RIG_MODEL_IC9700 || RIG_MODEL_IC7610)) == 0) RETURNFUNC(RIG_OK); - + if (RIG_PASSBAND_NOCHANGE == width) { RETURNFUNC(RIG_OK); @@ -1869,47 +1870,26 @@ int icom_set_dsp_flt(RIG *rig, rmode_t mode, pbwidth_t width) RETURNFUNC(-RIG_EINVAL); } } + if (priv->no_1a_03_cmd) RETURNFUNC(RIG_OK); // don't bother to try since it doesn't work - switch (rig->caps->rig_model) + if (mode & RIG_MODE_AM) { - case RIG_MODEL_IC7000: - case RIG_MODEL_IC7800: - if (mode & RIG_MODE_AM) - { - flt_idx = (width / 200) - 1; /* TBC: IC_7800? */ - } - else if (mode & (RIG_MODE_CW | RIG_MODE_USB | RIG_MODE_LSB | RIG_MODE_RTTY | - RIG_MODE_RTTYR)) - { - if (width == 0) - { - width = 1; - } - - flt_idx = - width <= 500 ? ((width + 49) / 50) - 1 : ((width + 99) / 100) + 4; - } - else - { - RETURNFUNC(RIG_OK); - } - - break; - - case RIG_MODEL_IC7300: - if (mode & RIG_MODE_AM) - { - flt_idx = (width / 200) - 1; /* TBC: IC_7800? */ - } - else + flt_idx = (width / 200) - 1; /* TBC: IC_7800? */ + } + else if (mode & (RIG_MODE_CW | RIG_MODE_USB | RIG_MODE_LSB | RIG_MODE_RTTY | + RIG_MODE_RTTYR)) + { + if (width == 0) { - flt_idx = - width <= 500 ? ((width + 49) / 50) - 1 : ((width + 99) / 100) + 4; + width = 1; } - break; - - default: + flt_idx = + width <= 500 ? ((width + 49) / 50) - 1 : ((width + 99) / 100) + 4; + } + else + { + rig_debug(RIG_DEBUG_VERBOSE, "%s: unknown mode=%s\n", __func__, rig_strrmode(mode)); RETURNFUNC(RIG_OK); } @@ -1918,6 +1898,12 @@ int icom_set_dsp_flt(RIG *rig, rmode_t mode, pbwidth_t width) retval = icom_transaction(rig, C_CTL_MEM, fw_sub_cmd, &flt_ext, 1, ackbuf, &ack_len); + if (-RIG_ERJCTED == retval) + { + priv->no_1a_03_cmd = -1; /* do not keep asking */ + return (RIG_OK); + } + if (retval != RIG_OK) { rig_debug(RIG_DEBUG_ERR, "%s: protocol error (%#.2x), " @@ -7663,7 +7649,7 @@ int icom_set_powerstat(RIG *rig, powerstat_t status) } i = 0; - retry = 1; + retry = 3; if (status == RIG_POWER_ON) // wait for wakeup only { diff --git a/rigs/icom/icom.h b/rigs/icom/icom.h index f76d01a8..36200b0d 100644 --- a/rigs/icom/icom.h +++ b/rigs/icom/icom.h @@ -30,7 +30,7 @@ #include <sys/time.h> #endif -#define BACKEND_VER "20210929" +#define BACKEND_VER "20211002" #define ICOM_IS_SECONDARY_VFO(vfo) ((vfo) & (RIG_VFO_B | RIG_VFO_SUB | RIG_VFO_SUB_B | RIG_VFO_MAIN_B)) #define ICOM_GET_VFO_NUMBER(vfo) (ICOM_IS_SECONDARY_VFO(vfo) ? 0x01 : 0x00) commit a5ad107c636cc56e57b52926ce10c5b9b1dfdfa9 Author: Mike Black W9MDB <mdb...@ya...> Date: Thu Sep 30 09:09:51 2021 -0500 Adding NOTES.txt to rig model directories to keep track of rig behaviors This could be turned into a help facility eventually diff --git a/rigs/kenwood/NOTES.txt b/rigs/kenwood/NOTES.txt new file mode 100644 index 00000000..fd796c23 --- /dev/null +++ b/rigs/kenwood/NOTES.txt @@ -0,0 +1 @@ +FT-100 PTT source is determined by mode, rear connector used in data mode commit a2b3a8d67e82dc3b8475fbeecdc46434cc91a357 Author: Mike Black W9MDB <mdb...@ya...> Date: Wed Sep 29 05:46:53 2021 -0500 Disable icom_get_vfo as user twiddling VFO knob does not work while polling current_vfo is still determined at startup https://github.com/Hamlib/Hamlib/issues/806 diff --git a/rigs/icom/icom.c b/rigs/icom/icom.c index ebe2b4ed..f4bb41ef 100644 --- a/rigs/icom/icom.c +++ b/rigs/icom/icom.c @@ -967,10 +967,6 @@ icom_rig_open(RIG *rig) rig_debug(RIG_DEBUG_ERR, "%s: Unable to determine USB echo status\n", __func__); RETURNFUNC(retval); } - - // Determine active vfo again since it would have failed the 1st time - rig->state.current_vfo = icom_current_vfo(rig); - icom_current_vfo(rig); } rig->state.current_vfo = icom_current_vfo(rig); @@ -1736,7 +1732,12 @@ int icom_set_xit_new(RIG *rig, vfo_t vfo, shortfreq_t ts) Has been tested for IC-746pro, Should work on the all dsp rigs ie pro models. The 746 documentation says it has the get_if_filter, but doesn't give any decoding information ? Please test. + + DSP filter setting ($1A$03), but not supported by every rig, + and some models like IC910/Omni VI Plus have a different meaning for + this subcommand */ + pbwidth_t icom_get_dsp_flt(RIG *rig, rmode_t mode) { @@ -1751,6 +1752,9 @@ pbwidth_t icom_get_dsp_flt(RIG *rig, rmode_t mode) rig_debug(RIG_DEBUG_VERBOSE, "%s called, mode=%s\n", __func__, rig_strrmode(mode)); + // only these models that we know of -- keep set_dsp_flt in sync + if ((rig->caps->rig_model & (RIG_MODEL_IC7000 | RIG_MODEL_IC7800 | RIG_MODEL_IC7300 || RIG_MODEL_IC9700 || RIG_MODEL_IC7610)) == 0) RETURNFUNC(RIG_OK); + if (rig_has_get_func(rig, RIG_FUNC_RF) && (mode & (RIG_MODE_RTTY | RIG_MODE_RTTYR))) { @@ -1831,6 +1835,9 @@ int icom_set_dsp_flt(RIG *rig, rmode_t mode, pbwidth_t width) ENTERFUNC; + // only these models that we know of -- keep get_dsp in sync here + if ((rig->caps->rig_model & (RIG_MODEL_IC7000 | RIG_MODEL_IC7800 | RIG_MODEL_IC7300 || RIG_MODEL_IC9700 || RIG_MODEL_IC7610)) == 0) RETURNFUNC(RIG_OK); + if (RIG_PASSBAND_NOCHANGE == width) { RETURNFUNC(RIG_OK); @@ -2238,14 +2245,7 @@ int icom_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) RETURNFUNC(-RIG_ERJCTED); } - /* DSP filter setting ($1A$03), but not supported by every rig, - * and some models like IC910/Omni VI Plus have a different meaning for - * this subcommand - */ - if (rig->caps->rig_model == RIG_MODEL_IC7000) - { - icom_set_dsp_flt(rig, mode, width); - } + icom_set_dsp_flt(rig, mode, width); RETURNFUNC(RIG_OK); } @@ -2552,6 +2552,9 @@ int icom_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) RETURNFUNC(RIG_OK); } +#if 0 +// this seems to work but not for cqrlog and user twiddling VFO knob. +// may be able to use twiddle but will disable for now /* * icom_get_vfo * Assumes rig!=NULL, rig->state.priv!=NULL @@ -2564,6 +2567,7 @@ int icom_get_vfo(RIG *rig, vfo_t *vfo) RETURNFUNC(RIG_OK); } +#endif /* * icom_set_vfo diff --git a/rigs/icom/icom.h b/rigs/icom/icom.h index 3650b601..f76d01a8 100644 --- a/rigs/icom/icom.h +++ b/rigs/icom/icom.h @@ -30,7 +30,7 @@ #include <sys/time.h> #endif -#define BACKEND_VER "20210928" +#define BACKEND_VER "20210929" #define ICOM_IS_SECONDARY_VFO(vfo) ((vfo) & (RIG_VFO_B | RIG_VFO_SUB | RIG_VFO_SUB_B | RIG_VFO_MAIN_B)) #define ICOM_GET_VFO_NUMBER(vfo) (ICOM_IS_SECONDARY_VFO(vfo) ? 0x01 : 0x00) @@ -308,7 +308,11 @@ int icom_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); int icom_get_mode_with_data(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); int icom_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); +#if 0 // see icom_get_vfo in icom.c int icom_get_vfo(RIG *rig, vfo_t *vfo); +#else +#define icom_get_vfo NULL +#endif int icom_set_vfo(RIG *rig, vfo_t vfo); int icom_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t rptr_shift); int icom_get_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t *rptr_shift); commit dd1376becf82a05a30ac389051d0a00cbea621cc Author: Mike Black W9MDB <mdb...@ya...> Date: Tue Sep 28 23:13:37 2021 -0500 Fix debug statement https://github.com/Hamlib/Hamlib/issues/812 diff --git a/src/rig.c b/src/rig.c index faada6ef..c59c5265 100644 --- a/src/rig.c +++ b/src/rig.c @@ -1866,8 +1866,7 @@ int HAMLIB_API rig_set_freq(RIG *rig, vfo_t vfo, freq_t freq) RIG_OK); // would be better as error but other software won't handle errors } - rig_debug(RIG_DEBUG_TRACE, "%s: TARGETABLE_FREQ vfo=%s\n", __func__, - rig_strvfo(vfo)); + rig_debug(RIG_DEBUG_TRACE, "%s: TARGETABLE_FREQ vfo=%s\n", __func__, rig_strvfo(vfo)); int retry = 3; freq_t tfreq = 0; @@ -1916,8 +1915,7 @@ int HAMLIB_API rig_set_freq(RIG *rig, vfo_t vfo, freq_t freq) } else { - rig_debug(RIG_DEBUG_TRACE, "%s: not a TARGETABLE_FREQ vfo=%s\n", __func__, - rig_strvfo(vfo)); + rig_debug(RIG_DEBUG_TRACE, "%s: not a TARGETABLE_FREQ vfo=%s\n", __func__, rig_strvfo(vfo)); if (!caps->set_vfo) { @@ -1929,7 +1927,7 @@ int HAMLIB_API rig_set_freq(RIG *rig, vfo_t vfo, freq_t freq) if (retcode != RIG_OK) { rig_debug(RIG_DEBUG_ERR, "%s: set_vfo failed: %s\n", __func__, - rig_strerror(retcode)); + rigerror(retcode)); } commit da87903e3c16c0baea0b98faf2ce5a470504bf27 Author: Mike Black W9MDB <mdb...@ya...> Date: Tue Sep 28 23:03:56 2021 -0500 Fix set_vfo for non TARGETABLE_FREQ rigs like the FT100 Was not setting VFOB when requested https://github.com/Hamlib/Hamlib/issues/812 diff --git a/src/rig.c b/src/rig.c index 150da075..faada6ef 100644 --- a/src/rig.c +++ b/src/rig.c @@ -1924,6 +1924,15 @@ int HAMLIB_API rig_set_freq(RIG *rig, vfo_t vfo, freq_t freq) RETURNFUNC(-RIG_ENAVAIL); } + retcode = rig_set_vfo(rig, vfo); + + if (retcode != RIG_OK) + { + rig_debug(RIG_DEBUG_ERR, "%s: set_vfo failed: %s\n", __func__, + rig_strerror(retcode)); + } + + if (twiddling(rig)) { rig_debug(RIG_DEBUG_TRACE, "%s: Ignoring set_freq due to VFO twiddling\n", commit 7c42d6ddb049c1ab44756b51064c683f55ee3aab Author: Mike Black W9MDB <mdb...@ya...> Date: Tue Sep 28 23:03:06 2021 -0500 Fix LOCK macros diff --git a/src/rig.c b/src/rig.c index be2cd872..150da075 100644 --- a/src/rig.c +++ b/src/rig.c @@ -6800,13 +6800,13 @@ const char *HAMLIB_API rig_copyright() #ifdef PTHREAD #define MUTEX_LOCK(var) pthread_mutex_lock(var) #else -#define MUTEX_LOCK1(var) +#define MUTEX_LOCK(var) #endif #ifdef PTHREAD #define MUTEX_UNLOCK(var) pthread_mutex_unlock(var) #else -#define MUTEX_UNLOCK2(var) +#define MUTEX_UNLOCK(var) #endif /** commit 43251254c50f25f399fd25c924c58c354ca0e9ea Author: Mike Black W9MDB <mdb...@ya...> Date: Tue Sep 28 22:57:35 2021 -0500 New mutex macros to be resued across all rig functions to support async multicast actions diff --git a/src/rig.c b/src/rig.c index 8fb69daa..be2cd872 100644 --- a/src/rig.c +++ b/src/rig.c @@ -160,6 +160,8 @@ const char hamlib_copyright[231] = /* hamlib 1.2 ABI specifies 231 bytes */ #define ELAPSED1 clock_t __begin = clock() #define ELAPSED2 rig_debug(RIG_DEBUG_TRACE, "%s: elapsed=%.0lfms\n", __func__, ((double)clock() - __begin) / CLOCKS_PER_SEC * 1000) +#define LOCK \ + /* * Data structure to track the opened rig (by rig_open) */ @@ -2266,6 +2268,7 @@ int HAMLIB_API rig_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { RETURNFUNC(-RIG_EINVAL); } + ELAPSED1; // do not mess with mode while PTT is on @@ -6788,6 +6791,24 @@ const char *HAMLIB_API rig_copyright() return hamlib_copyright2; } +#ifdef PTHREAD +#define MUTEX(var) static pthread_mutex_t var = PTHREAD_MUTEX_INITIALIZER +#else +#define MUTEX(var) +#endif + +#ifdef PTHREAD +#define MUTEX_LOCK(var) pthread_mutex_lock(var) +#else +#define MUTEX_LOCK1(var) +#endif + +#ifdef PTHREAD +#define MUTEX_UNLOCK(var) pthread_mutex_unlock(var) +#else +#define MUTEX_UNLOCK2(var) +#endif + /** * \brief get a cookie to grab rig control * \param rig Not used @@ -6823,9 +6844,7 @@ int HAMLIB_API rig_cookie(RIG *rig, enum cookie_e cookie_cmd, char *cookie, static double time_last_used; struct timespec tp; int ret; -#ifdef HAVE_PTHREAD - static pthread_mutex_t cookie_lock = PTHREAD_MUTEX_INITIALIZER; -#endif + MUTEX(mutex_rig_cookie); /* This is not needed for RIG_COOKIE_RELEASE but keep it simple. */ if (cookie_len < HAMLIB_COOKIE_SIZE) @@ -6844,9 +6863,7 @@ int HAMLIB_API rig_cookie(RIG *rig, enum cookie_e cookie_cmd, char *cookie, /* Accesing cookie_save and time_last_used must be done with lock held. * So keep code simple and lock it during the whole operation. */ -#ifdef HAVE_PTHREAD - pthread_mutex_lock(&cookie_lock); -#endif + MUTEX_LOCK(mutex_rig_cookie); switch (cookie_cmd) { @@ -6937,11 +6954,8 @@ int HAMLIB_API rig_cookie(RIG *rig, enum cookie_e cookie_cmd, char *cookie, break; } -#ifdef HAVE_PTHREAD - pthread_mutex_unlock(&cookie_lock); -#endif + MUTEX_UNLOCK(mutex_rig_cookie); return ret; - } HAMLIB_EXPORT(void) sync_callback(int lock) commit 8399b4b4dc10541fb68d1cd265bfc718df202f5e Author: Mike Black W9MDB <mdb...@ya...> Date: Tue Sep 28 14:06:50 2021 -0500 For Icom get_vfo make the same change as last commit for other Icom rigs https://github.com/Hamlib/Hamlib/issues/806 diff --git a/rigs/icom/icom.c b/rigs/icom/icom.c index ad257452..ebe2b4ed 100644 --- a/rigs/icom/icom.c +++ b/rigs/icom/icom.c @@ -876,6 +876,15 @@ static vfo_t icom_current_vfo(RIG *rig) if (fCurr == f2) { + if (priv->vfo_flag != 0) + { + // we can't change freqs unless rig is idle and we don't know that + // so we only check vfo once when freqs are equal + rig_debug(RIG_DEBUG_TRACE,"%s: vfo already determined...returning current_vfo", __func__); + return rig->state.current_vfo; + } + priv->vfo_flag = 1; + fOffset = 100; rig_set_freq(rig, RIG_VFO_CURR, fCurr + fOffset); } commit 3a76cb1b40d465e641a7f0d8032c0f7e8638b72b Author: Mike Black W9MDB <mdb...@ya...> Date: Tue Sep 28 12:01:50 2021 -0500 For Icom get_vfo when freqs are equal will only check vfo 1 time This means get_vfo will not follow rig button pushes when freqs are equal https://github.com/Hamlib/Hamlib/issues/806 diff --git a/rigs/icom/icom.c b/rigs/icom/icom.c index f1c88fb7..ad257452 100644 --- a/rigs/icom/icom.c +++ b/rigs/icom/icom.c @@ -775,12 +775,23 @@ static vfo_t icom_current_vfo_x25(RIG *rig) freq_t fCurr, f2, f3; vfo_t currVFO = RIG_VFO_NONE; vfo_t chkVFO = RIG_VFO_A; + struct rig_state *rs = &rig->state; + struct icom_priv_data *priv = (struct icom_priv_data *) rs->priv; rig_get_freq(rig, RIG_VFO_CURR, &fCurr); rig_get_freq(rig, RIG_VFO_OTHER, &f2); if (fCurr == f2) { + if (priv->vfo_flag != 0) + { + // we can't change freqs unless rig is idle and we don't know that + // so we only check vfo once when freqs are equal + rig_debug(RIG_DEBUG_TRACE,"%s: vfo already determined...returning current_vfo", __func__); + return rig->state.current_vfo; + } + priv->vfo_flag = 1; + fOffset = 100; rig_set_freq(rig, RIG_VFO_CURR, fCurr + fOffset); } @@ -822,10 +833,7 @@ static vfo_t icom_current_vfo(RIG *rig) if (priv->x25cmdfails == 0) // these newer rigs get special treatment { - if (access("w9mdb.txt", F_OK) != -1) - { - return icom_current_vfo_x25(rig); - } + return icom_current_vfo_x25(rig); } else if (rig->state.cache.ptt) // don't do this if transmitting -- XCHG would mess it up { @@ -1846,23 +1854,46 @@ int icom_set_dsp_flt(RIG *rig, rmode_t mode, pbwidth_t width) } } - if (mode & RIG_MODE_AM) - { - flt_idx = (width / 200) - 1; /* TBC: Ic_7800? */ - } - else if (mode & (RIG_MODE_CW | RIG_MODE_USB | RIG_MODE_LSB | RIG_MODE_RTTY | - RIG_MODE_RTTYR)) + switch (rig->caps->rig_model) { - if (width == 0) + case RIG_MODEL_IC7000: + case RIG_MODEL_IC7800: + if (mode & RIG_MODE_AM) { - width = 1; + flt_idx = (width / 200) - 1; /* TBC: IC_7800? */ } + else if (mode & (RIG_MODE_CW | RIG_MODE_USB | RIG_MODE_LSB | RIG_MODE_RTTY | + RIG_MODE_RTTYR)) + { + if (width == 0) + { + width = 1; + } - flt_idx = - width <= 500 ? ((width + 49) / 50) - 1 : ((width + 99) / 100) + 4; - } - else - { + flt_idx = + width <= 500 ? ((width + 49) / 50) - 1 : ((width + 99) / 100) + 4; + } + else + { + RETURNFUNC(RIG_OK); + } + + break; + + case RIG_MODEL_IC7300: + if (mode & RIG_MODE_AM) + { + flt_idx = (width / 200) - 1; /* TBC: IC_7800? */ + } + else + { + flt_idx = + width <= 500 ? ((width + 49) / 50) - 1 : ((width + 99) / 100) + 4; + } + + break; + + default: RETURNFUNC(RIG_OK); } diff --git a/rigs/icom/icom.h b/rigs/icom/icom.h index 743b4148..3650b601 100644 --- a/rigs/icom/icom.h +++ b/rigs/icom/icom.h @@ -30,7 +30,7 @@ #include <sys/time.h> #endif -#define BACKEND_VER "20210926" +#define BACKEND_VER "20210928" #define ICOM_IS_SECONDARY_VFO(vfo) ((vfo) & (RIG_VFO_B | RIG_VFO_SUB | RIG_VFO_SUB_B | RIG_VFO_MAIN_B)) #define ICOM_GET_VFO_NUMBER(vfo) (ICOM_IS_SECONDARY_VFO(vfo) ? 0x01 : 0x00) @@ -266,6 +266,7 @@ struct icom_priv_data int spectrum_scope_count; /*!< Number of spectrum scopes, calculated from caps */ struct icom_spectrum_scope_cache spectrum_scope_cache[HAMLIB_MAX_SPECTRUM_SCOPES]; /*!< Cached Icom spectrum scope data used during reception of the data. The array index must match the scope ID. */ freq_t other_freq; /*!< Our other freq depending on which vfo is selected */ + int vfo_flag; // used to skip vfo check when frequencies are equal }; extern const struct ts_sc_list r8500_ts_sc_list[]; commit f076d135bc4c30aeb709e339e27b6f1dd7d7dafc Author: Mike Black W9MDB <mdb...@ya...> Date: Tue Sep 28 07:07:54 2021 -0500 Fix FT100 reading of power when in split mode https://github.com/Hamlib/Hamlib/issues/808 diff --git a/rigs/yaesu/ft100.c b/rigs/yaesu/ft100.c index bc49462b..6e72b2ac 100644 --- a/rigs/yaesu/ft100.c +++ b/rigs/yaesu/ft100.c @@ -316,7 +316,7 @@ const struct rig_caps ft100_caps = RIG_MODEL(RIG_MODEL_FT100), .model_name = "FT-100", .mfg_name = "Yaesu", - .version = "20210110.0", + .version = "20210928.0", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, @@ -955,15 +955,13 @@ int ft100_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) /* * Rem: The FT-100(D) has no set_level ability */ - -/* - * blind implementation of get_level. - * Please test on real hardware and send report on hamlib mailing list - */ int ft100_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { int ret; + int split = rig->state.cache.split; + int ptt = rig->state.cache.ptt; + FT100_METER_INFO ft100_meter; if (!rig) { return -RIG_EINVAL; } @@ -972,7 +970,10 @@ int ft100_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) rig_debug(RIG_DEBUG_VERBOSE, "%s: %s\n", __func__, rig_strlevel(level)); + // if in split have to switch to VFOB to read power and back to VFOA + if (split && ptt) rig_set_vfo(rig, RIG_VFO_B); ret = ft100_send_priv_cmd(rig, FT100_NATIVE_CAT_READ_METERS); + if (split && ptt) rig_set_vfo(rig, RIG_VFO_A); if (ret != RIG_OK) { commit de5cb713f08eeb1a37bab0331fca8dd0373946a0 Author: Mike Black W9MDB <mdb...@ya...> Date: Sun Sep 26 23:45:26 2021 -0500 Align some more code diff --git a/rigs/icom/icom_defs.h b/rigs/icom/icom_defs.h index 8314478d..c066b810 100644 --- a/rigs/icom/icom_defs.h +++ b/rigs/icom/icom_defs.h @@ -373,23 +373,23 @@ /* * RIT/XIT control (C_CTL_RIT) subcommands */ -#define S_RIT_FREQ 0x00 -#define S_RIT 0x01 /* RIT 0 = OFF, 1 = ON */ -#define S_XIT 0x02 /* XIT (delta TX) 0 = OFF, 1 = ON */ +#define S_RIT_FREQ 0x00 +#define S_RIT 0x01 /* RIT 0 = OFF, 1 = ON */ +#define S_XIT 0x02 /* XIT (delta TX) 0 = OFF, 1 = ON */ /* * Misc contents (C_CTL_MEM) subcommands applies to newer rigs. * * Beware the IC-7200 which is non-standard. */ -#define S_MEM_CNTNT 0x00 /* Memory content 2 bigendian */ -#define S_MEM_BAND_REG 0x01 /* band stacking register */ -#define S_MEM_FILT_WDTH 0x03 /* current passband filter width */ -#define S_MEM_PARM 0x05 /* rig parameters; extended parm # + param value: should be coded */ - /* in the rig files because they are different for each rig */ -#define S_MEM_DATA_MODE 0x06 /* data mode */ -#define S_MEM_TX_PB 0x07 /* SSB tx passband */ -#define S_MEM_FLTR_SHAPE 0x08 /* DSP filter shape 0=sharp 1=soft */ +#define S_MEM_CNTNT 0x00 /* Memory content 2 bigendian */ +#define S_MEM_BAND_REG 0x01 /* band stacking register */ +#define S_MEM_FILT_WDTH 0x03 /* current passband filter width */ +#define S_MEM_PARM 0x05 /* rig parameters; extended parm # + param value: should be coded */ + /* in the rig files because they are different for each rig */ +#define S_MEM_DATA_MODE 0x06 /* data mode */ +#define S_MEM_TX_PB 0x07 /* SSB tx passband */ +#define S_MEM_FLTR_SHAPE 0x08 /* DSP filter shape 0=sharp 1=soft */ /* Icr75c */ #define S_MEM_CNTNT_SLCT 0x01 @@ -431,18 +431,18 @@ /* * Tone control (C_SET_TONE) subcommands */ -#define S_TONE_RPTR 0x00 /* Tone frequency setting for repeater receive */ -#define S_TONE_SQL 0x01 /* Tone frequency setting for squelch */ -#define S_TONE_DTCS 0x02 /* DTCS code and polarity for squelch */ -#define S_TONE_P25NAC 0x03 /* P25 NAC */ -#define S_TONE_DSCSQL 0x07 /* D-STAR CSQL */ -#define S_TONE_DPCOM 0x08 /* dPMR COM ID */ -#define S_TONE_DPCC 0x09 /* dPMR CC */ -#define S_TONE_NXRAN 0x0A /* NXDN RAN */ -#define S_TONE_DCUC 0x0B /* DCR UC */ -#define S_TONE_DPSCK 0x0C /* dPMR scrambler key */ -#define S_TONE_NXENK 0x0D /* NXDN encryption key */ -#define S_TONE_DCENK 0x0E /* DCR encryption key */ +#define S_TONE_RPTR 0x00 /* Tone frequency setting for repeater receive */ +#define S_TONE_SQL 0x01 /* Tone frequency setting for squelch */ +#define S_TONE_DTCS 0x02 /* DTCS code and polarity for squelch */ +#define S_TONE_P25NAC 0x03 /* P25 NAC */ +#define S_TONE_DSCSQL 0x07 /* D-STAR CSQL */ +#define S_TONE_DPCOM 0x08 /* dPMR COM ID */ +#define S_TONE_DPCC 0x09 /* dPMR CC */ +#define S_TONE_NXRAN 0x0A /* NXDN RAN */ +#define S_TONE_DCUC 0x0B /* DCR UC */ +#define S_TONE_DPSCK 0x0C /* dPMR scrambler key */ +#define S_TONE_NXENK 0x0D /* NXDN encryption key */ +#define S_TONE_DCENK 0x0E /* DCR encryption key */ /* * Transceiver ID (C_RD_TRXID) subcommands commit 9c272dd5f773268158a9f4bcaf83929d4761910f Author: Mike Black W9MDB <mdb...@ya...> Date: Sun Sep 26 23:39:37 2021 -0500 Align some code diff --git a/rigs/icom/icom_defs.h b/rigs/icom/icom_defs.h index c6abfdd8..8314478d 100644 --- a/rigs/icom/icom_defs.h +++ b/rigs/icom/icom_defs.h @@ -305,49 +305,49 @@ /* * Function settings (C_CTL_FUNC) subcommands Set and Read */ -#define S_FUNC_PAMP 0x02 /* Preamp setting */ -#define S_FUNC_AGCOFF 0x10 /* IC-R8500 only */ -#define S_FUNC_AGCON 0x11 /* IC-R8500 only */ -#define S_FUNC_AGC 0x12 /* AGC setting presets: the dsp models allow these to be modified */ -#define S_FUNC_NBOFF 0x20 /* IC-R8500 only */ -#define S_FUNC_NBON 0x21 /* IC-R8500 only */ -#define S_FUNC_NB 0x22 /* NB setting */ -#define S_FUNC_APFOFF 0x30 /* IC-R8500 only */ -#define S_FUNC_APFON 0x31 /* IC-R8500 only */ -#define S_FUNC_APF 0x32 /* APF setting */ -#define S_FUNC_NR 0x40 /* NR setting */ -#define S_FUNC_ANF 0x41 /* ANF setting */ -#define S_FUNC_TONE 0x42 /* TONE setting */ -#define S_FUNC_TSQL 0x43 /* TSQL setting */ -#define S_FUNC_COMP 0x44 /* COMP setting */ -#define S_FUNC_MON 0x45 /* Monitor setting */ -#define S_FUNC_VOX 0x46 /* VOX setting */ -#define S_FUNC_BKIN 0x47 /* BK-IN setting */ -#define S_FUNC_MN 0x48 /* Manual notch setting */ -#define S_FUNC_RF 0x49 /* RTTY Filter setting */ -#define S_FUNC_AFC 0x4A /* Auto Frequency Control (AFC) setting */ -#define S_FUNC_CSQL 0x4B /* DTCS tone code squelch setting*/ -#define S_FUNC_VSC 0x4C /* voice squelch control useful for scanning*/ -#define S_FUNC_MANAGC 0x4D /* manual AGC */ -#define S_FUNC_DIGISEL 0x4E /* DIGI-SEL */ -#define S_FUNC_TW_PK 0x4F /* RTTY Twin Peak filter 0= off 1 = on */ -#define S_FUNC_DIAL_LK 0x50 /* Dial lock */ -#define S_FUNC_P25SQL 0x52 /* P25 DSQL */ -#define S_FUNC_ANTRX 0x53 /* ANT-RX */ -#define S_FUNC_IF1F 0x55 /* 1st IF filter */ -#define S_FUNC_DSPF 0x56 /* DSP filter */ -#define S_FUNC_MANN 0x57 /* Manual notch width */ -#define S_FUNC_SSBT 0x58 /* SSB Tx bandwidth */ -#define S_FUNC_SUBB 0x59 /* Sub band */ -#define S_FUNC_SATM 0x5A /* Satellite mode */ -#define S_FUNC_DSSQL 0x5B /* D-STAR DSQL */ -#define S_FUNC_DPSQL 0x5F /* dPMR DSQL */ -#define S_FUNC_NXSQL 0x60 /* NXDN DSQL */ -#define S_FUNC_DCSQL 0x61 /* DCR DSQL */ -#define S_FUNC_DPSCM 0x62 /* dPMR scrambler */ -#define S_FUNC_NXENC 0x63 /* NXDN encryption */ -#define S_FUNC_DCENC 0x64 /* DCR encryption */ -#define S_FUNC_IPP 0x65 /* IP+ setting */ +#define S_FUNC_PAMP 0x02 /* Preamp setting */ +#define S_FUNC_AGCOFF 0x10 /* IC-R8500 only */ +#define S_FUNC_AGCON 0x11 /* IC-R8500 only */ +#define S_FUNC_AGC 0x12 /* AGC setting presets: the dsp models allow these to be modified */ +#define S_FUNC_NBOFF 0x20 /* IC-R8500 only */ +#define S_FUNC_NBON 0x21 /* IC-R8500 only */ +#define S_FUNC_NB 0x22 /* NB setting */ +#define S_FUNC_APFOFF 0x30 /* IC-R8500 only */ +#define S_FUNC_APFON 0x31 /* IC-R8500 only */ +#define S_FUNC_APF 0x32 /* APF setting */ +#define S_FUNC_NR 0x40 /* NR setting */ +#define S_FUNC_ANF 0x41 /* ANF setting */ +#define S_FUNC_TONE 0x42 /* TONE setting */ +#define S_FUNC_TSQL 0x43 /* TSQL setting */ +#define S_FUNC_COMP 0x44 /* COMP setting */ +#define S_FUNC_MON 0x45 /* Monitor setting */ +#define S_FUNC_VOX 0x46 /* VOX setting */ +#define S_FUNC_BKIN 0x47 /* BK-IN setting */ +#define S_FUNC_MN 0x48 /* Manual notch setting */ +#define S_FUNC_RF 0x49 /* RTTY Filter setting */ +#define S_FUNC_AFC 0x4A /* Auto Frequency Control (AFC) setting */ +#define S_FUNC_CSQL 0x4B /* DTCS tone code squelch setting*/ +#define S_FUNC_VSC 0x4C /* voice squelch control useful for scanning*/ +#define S_FUNC_MANAGC 0x4D /* manual AGC */ +#define S_FUNC_DIGISEL 0x4E /* DIGI-SEL */ +#define S_FUNC_TW_PK 0x4F /* RTTY Twin Peak filter 0= off 1 = on */ +#define S_FUNC_DIAL_LK 0x50 /* Dial lock */ +#define S_FUNC_P25SQL 0x52 /* P25 DSQL */ +#define S_FUNC_ANTRX 0x53 /* ANT-RX */ +#define S_FUNC_IF1F 0x55 /* 1st IF filter */ +#define S_FUNC_DSPF 0x56 /* DSP filter */ +#define S_FUNC_MANN 0x57 /* Manual notch width */ +#define S_FUNC_SSBT 0x58 /* SSB Tx bandwidth */ +#define S_FUNC_SUBB 0x59 /* Sub band */ +#define S_FUNC_SATM 0x5A /* Satellite mode */ +#define S_FUNC_DSSQL 0x5B /* D-STAR DSQL */ +#define S_FUNC_DPSQL 0x5F /* dPMR DSQL */ +#define S_FUNC_NXSQL 0x60 /* NXDN DSQL */ +#define S_FUNC_DCSQL 0x61 /* DCR DSQL */ +#define S_FUNC_DPSCM 0x62 /* dPMR scrambler */ +#define S_FUNC_NXENC 0x63 /* NXDN encryption */ +#define S_FUNC_DCENC 0x64 /* DCR encryption */ +#define S_FUNC_IPP 0x65 /* IP+ setting */ /* * Set Power On/Off (C_SET_PWR) subcommands commit aae3ec49960d0a3805057971d731ed18051165da Author: Mike Black W9MDB <mdb...@ya...> Date: Sun Sep 26 17:03:47 2021 -0500 Allow IC-7300 and many other Icom rigs to find current vfo on startup Icom rigs that do not have 0x25 or XCHG cannot do this yet which are older Icom rigs XCHG rigs cannot get_vfo while transmitting but 0x25 rigs can https://github.com/Hamlib/Hamlib/issues/806 diff --git a/NEWS b/NEWS index 8d172c9d..05fb10f7 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,8 @@ Version 4.4 * 2021-??-?? * Icom rigs now default filter 2 when setting PKTUSB but user can override * Fix FTDX9000 meter readings + * Add Android sensor as a rotator + * Added rig_get_vfo to some Icom rigs that have XCHG or 0x25 command capability Version 4.3.1 * 2021-09-14 diff --git a/rigs/icom/ic7000.c b/rigs/icom/ic7000.c index 25b8cbfa..edf9255b 100644 --- a/rigs/icom/ic7000.c +++ b/rigs/icom/ic7000.c @@ -197,7 +197,7 @@ const struct rig_caps ic7000_caps = RIG_MODEL(RIG_MODEL_IC7000), .model_name = "IC-7000", .mfg_name = "Icom", - .version = BACKEND_VER ".1", + .version = BACKEND_VER ".2", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, @@ -336,6 +336,7 @@ const struct rig_caps ic7000_caps = .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, + .get_vfo = icom_get_vfo, .set_vfo = icom_set_vfo, .set_ant = NULL, /*automatically set by rig depending band */ .get_ant = NULL, diff --git a/rigs/icom/ic703.c b/rigs/icom/ic703.c index 419bc17b..d48ba807 100644 --- a/rigs/icom/ic703.c +++ b/rigs/icom/ic703.c @@ -89,7 +89,7 @@ const struct rig_caps ic703_caps = RIG_MODEL(RIG_MODEL_IC703), .model_name = "IC-703", .mfg_name = "Icom", - .version = BACKEND_VER ".0", + .version = BACKEND_VER ".1", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_MOBILE, @@ -202,6 +202,7 @@ const struct rig_caps ic703_caps = .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, + .get_vfo = icom_get_vfo, .decode_event = icom_decode_event, .set_level = icom_set_level, diff --git a/rigs/icom/ic706.c b/rigs/icom/ic706.c index f420f617..7d84d5b9 100644 --- a/rigs/icom/ic706.c +++ b/rigs/icom/ic706.c @@ -153,7 +153,7 @@ const struct rig_caps ic706_caps = RIG_MODEL(RIG_MODEL_IC706), .model_name = "IC-706", .mfg_name = "Icom", - .version = BACKEND_VER ".0", + .version = BACKEND_VER ".1", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_MOBILE, @@ -257,6 +257,7 @@ const struct rig_caps ic706_caps = .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, + .get_vfo = icom_get_vfo, .set_vfo = icom_set_vfo, .decode_event = icom_decode_event, @@ -291,7 +292,7 @@ const struct rig_caps ic706mkii_caps = RIG_MODEL(RIG_MODEL_IC706MKII), .model_name = "IC-706MkII", .mfg_name = "Icom", - .version = BACKEND_VER ".0", + .version = BACKEND_VER ".1", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_MOBILE, @@ -399,6 +400,7 @@ const struct rig_caps ic706mkii_caps = .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, + .get_vfo = icom_get_vfo, .set_vfo = icom_set_vfo, .decode_event = icom_decode_event, @@ -453,7 +455,7 @@ const struct rig_caps ic706mkiig_caps = RIG_MODEL(RIG_MODEL_IC706MKIIG), .model_name = "IC-706MkIIG", .mfg_name = "Icom", - .version = BACKEND_VER ".0", + .version = BACKEND_VER ".1", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_MOBILE, @@ -590,6 +592,7 @@ c... [truncated message content] |