Move swr from rig_cache to priv value until we get rig_cache fixed to be expandable

https://github.com/Hamlib/Hamlib/issues/1419
pull/1421/head^2
Mike Black W9MDB 2023-11-08 08:05:56 -06:00
rodzic 62341a657e
commit f1a9823bdd
3 zmienionych plików z 9 dodań i 6 usunięć

Wyświetl plik

@ -2478,6 +2478,7 @@ typedef enum {
* \brief Rig cache data * \brief Rig cache data
* *
* This struct contains all the items we cache at the highest level * 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 { struct rig_cache {
int timeout_ms; // the cache timeout for invalidating itself int timeout_ms; // the cache timeout for invalidating itself
@ -2551,7 +2552,6 @@ struct rig_cache {
struct timespec time_ptt; struct timespec time_ptt;
struct timespec time_split; struct timespec time_split;
int satmode; // if rig is in satellite mode int satmode; // if rig is in satellite mode
double swr; // keep swr
}; };
/** /**

Wyświetl plik

@ -94,7 +94,8 @@ static struct kenwood_priv_caps powersdr_priv_caps =
{ {
.cmdtrm = EOM_KEN, .cmdtrm = EOM_KEN,
.mode_table = powersdr_mode_table, .mode_table = powersdr_mode_table,
.if_len = 37 .if_len = 37,
.swr = 0
}; };
#define DSP_BW_NUM 8 #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: case RIG_LEVEL_SWR:
{ {
struct kenwood_priv_caps *priv = kenwood_caps(rig);
ptt_t ptt = 0; ptt_t ptt = 0;
rig_get_ptt(rig, RIG_VFO_CURR, &ptt); 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 cmd = "ZZRM8"; // get SWR
len = 5; len = 5;
ans = 8; ans = 8;
retval = kenwood_transaction(rig, cmd, lvlbuf, sizeof(lvlbuf)); retval = kenwood_transaction(rig, cmd, lvlbuf, sizeof(lvlbuf));
if (retval != RIG_OK) { val->f = rig->state.cache.swr; return RIG_OK;}; if (retval != RIG_OK) { val->f = priv->swr; return RIG_OK;};
sscanf(lvlbuf,"ZZRM8%lg", &rig->state.cache.swr); sscanf(lvlbuf,"ZZRM8%lg", &priv->swr);
val->f = rig->state.cache.swr; val->f = priv->swr;
rig_debug(RIG_DEBUG_ERR, "%s(%d) swr=%.1f\n", __func__, __LINE__, val->f); rig_debug(RIG_DEBUG_ERR, "%s(%d) swr=%.1f\n", __func__, __LINE__, val->f);
return RIG_OK; return RIG_OK;
} }

Wyświetl plik

@ -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_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_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 */ struct kenwood_slope_filter *slope_filter_low; /* Last entry should have value == -1 and frequency_hz == -1 */
double swr;
}; };
struct kenwood_priv_data struct kenwood_priv_data