From f1a9823bddf2dd93e781bbc6fe9ef0a46335a639 Mon Sep 17 00:00:00 2001 From: Mike Black W9MDB Date: Wed, 8 Nov 2023 08:05:56 -0600 Subject: [PATCH] Move swr from rig_cache to priv value until we get rig_cache fixed to be expandable https://github.com/Hamlib/Hamlib/issues/1419 --- include/hamlib/rig.h | 2 +- rigs/kenwood/flex6xxx.c | 12 +++++++----- rigs/kenwood/kenwood.h | 1 + 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/include/hamlib/rig.h b/include/hamlib/rig.h index bc16a1f0c..590e91e67 100644 --- a/include/hamlib/rig.h +++ b/include/hamlib/rig.h @@ -2478,6 +2478,7 @@ typedef enum { * \brief Rig cache data * * This struct contains all the items we cache at the highest level + * DO NOT MODIFY THIS STRUCTURE AT ALL -- we need a new cache that is a pointer rather than a structure */ struct rig_cache { int timeout_ms; // the cache timeout for invalidating itself @@ -2551,7 +2552,6 @@ struct rig_cache { struct timespec time_ptt; struct timespec time_split; int satmode; // if rig is in satellite mode - double swr; // keep swr }; /** diff --git a/rigs/kenwood/flex6xxx.c b/rigs/kenwood/flex6xxx.c index 3a6b1d113..0510ceac8 100644 --- a/rigs/kenwood/flex6xxx.c +++ b/rigs/kenwood/flex6xxx.c @@ -94,7 +94,8 @@ static struct kenwood_priv_caps powersdr_priv_caps = { .cmdtrm = EOM_KEN, .mode_table = powersdr_mode_table, - .if_len = 37 + .if_len = 37, + .swr = 0 }; #define DSP_BW_NUM 8 @@ -839,16 +840,17 @@ int powersdr_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) case RIG_LEVEL_SWR: { + struct kenwood_priv_caps *priv = kenwood_caps(rig); ptt_t ptt = 0; rig_get_ptt(rig, RIG_VFO_CURR, &ptt); - if (ptt == RIG_PTT_OFF) { val->f = rig->state.cache.swr; return RIG_OK;} + if (ptt == RIG_PTT_OFF) { val->f = priv->swr; return RIG_OK;} cmd = "ZZRM8"; // get SWR len = 5; ans = 8; retval = kenwood_transaction(rig, cmd, lvlbuf, sizeof(lvlbuf)); - if (retval != RIG_OK) { val->f = rig->state.cache.swr; return RIG_OK;}; - sscanf(lvlbuf,"ZZRM8%lg", &rig->state.cache.swr); - val->f = rig->state.cache.swr; + if (retval != RIG_OK) { val->f = priv->swr; return RIG_OK;}; + sscanf(lvlbuf,"ZZRM8%lg", &priv->swr); + val->f = priv->swr; rig_debug(RIG_DEBUG_ERR, "%s(%d) swr=%.1f\n", __func__, __LINE__, val->f); return RIG_OK; } diff --git a/rigs/kenwood/kenwood.h b/rigs/kenwood/kenwood.h index c455685ff..cfb5df20b 100644 --- a/rigs/kenwood/kenwood.h +++ b/rigs/kenwood/kenwood.h @@ -135,6 +135,7 @@ struct kenwood_priv_caps struct kenwood_filter_width *filter_width; /* Last entry should have value == -1 and width_hz == -1 */ struct kenwood_slope_filter *slope_filter_high; /* Last entry should have value == -1 and frequency_hz == -1 */ struct kenwood_slope_filter *slope_filter_low; /* Last entry should have value == -1 and frequency_hz == -1 */ + double swr; }; struct kenwood_priv_data