From e7786cee4c4e15aeba8a551622342f4b090a3059 Mon Sep 17 00:00:00 2001 From: Mike Black W9MDB Date: Sun, 12 Nov 2023 13:22:02 -0600 Subject: [PATCH] Fix TS990S SWR read -- strange behavior of RM command reading first RM turned on for read New SWR table too for TS990S https://github.com/Hamlib/Hamlib/issues/1423 --- rigs/kenwood/kenwood.c | 9 +++++++++ rigs/kenwood/kenwood.h | 2 +- rigs/kenwood/ts990s.c | 10 ++++++---- src/rig.c | 8 ++++++++ 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/rigs/kenwood/kenwood.c b/rigs/kenwood/kenwood.c index 4e87543ba..7974d4423 100644 --- a/rigs/kenwood/kenwood.c +++ b/rigs/kenwood/kenwood.c @@ -1100,6 +1100,15 @@ int kenwood_open(RIG *rig) // mismatched IDs can still be tested rig->state.rigport.retry = retry_save; + + // TS-990S needs to ensure all RM meters are turned off as first one with read on gets read + // Any RM commands need to be ON/READ/OFF to allow other apps or threads to read meters + + if (RIG_IS_TS990S) + { + kenwood_transaction(rig, "RM10;RM20;RM30;RM40;RM50;RM60;", NULL, 0); + } + RETURNFUNC(RIG_OK); } diff --git a/rigs/kenwood/kenwood.h b/rigs/kenwood/kenwood.h index cfb5df20b..0e2a3858f 100644 --- a/rigs/kenwood/kenwood.h +++ b/rigs/kenwood/kenwood.h @@ -28,7 +28,7 @@ #include "token.h" #include "idx_builtin.h" -#define BACKEND_VER "20231031" +#define BACKEND_VER "20231112" #define EOM_KEN ';' #define EOM_TH '\r' diff --git a/rigs/kenwood/ts990s.c b/rigs/kenwood/ts990s.c index 63374cb16..39a5c9a07 100644 --- a/rigs/kenwood/ts990s.c +++ b/rigs/kenwood/ts990s.c @@ -59,9 +59,9 @@ #define TS990S_SWR_CAL { 5, \ { \ { 0, 1.0f }, \ - { 14, 1.5f }, \ - { 28, 2.0f }, \ - { 42, 3.0f }, \ + { 7, 1.5f }, \ + { 36, 3.0f }, \ + { 43, 6.0f }, \ { 70, 10.0f } \ } } @@ -647,7 +647,9 @@ int ts990s_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) break; case RIG_LEVEL_SWR: - retval = kenwood_safe_transaction(rig, "RM21", lvlbuf, sizeof(lvlbuf), 7); + // we need to turn on read, read it, and turn it off again + // first RM meter with read on is the that gets read with RM; + retval = kenwood_safe_transaction(rig, "RM21;RM;RM20", lvlbuf, sizeof(lvlbuf), 8); if (retval != RIG_OK) { diff --git a/src/rig.c b/src/rig.c index a080cd7d8..d95ae97fb 100644 --- a/src/rig.c +++ b/src/rig.c @@ -2740,6 +2740,14 @@ int HAMLIB_API rig_get_mode(RIG *rig, *width = rig->state.cache.widthMainA; RETURNFUNC(RIG_OK); } + else if (vfo == RIG_VFO_B) + { + if (rig->state.cache.modeMainB == RIG_MODE_NONE) + { + retcode = caps->get_mode(rig, vfo, mode, width); + return retcode; + } + } if ((*mode != RIG_MODE_NONE && cache_ms_mode < rig->state.cache.timeout_ms) && cache_ms_width < rig->state.cache.timeout_ms)