Improve cache behavior for yaesu and kenwood

https://github.com/Hamlib/Hamlib/issues/226
pull/234/head
mdblack98 2020-04-27 10:00:07 -05:00
rodzic 600a674891
commit 909ece7627
2 zmienionych plików z 6 dodań i 7 usunięć

Wyświetl plik

@ -532,8 +532,8 @@ int kenwood_safe_transaction(RIG *rig, const char *cmd, char *buf,
return -RIG_EINVAL;
}
// if this is an IF; cmd and not the first time through check cache
if (strncmp(cmd, "IF;", 3) == 0 && priv->cache_start.tv_sec != 0)
// if this is an IF cmd and not the first time through check cache
if (strcmp(cmd, "IF") == 0 && priv->cache_start.tv_sec != 0)
{
int cache_age_ms;
@ -548,15 +548,14 @@ int kenwood_safe_transaction(RIG *rig, const char *cmd, char *buf,
// else we drop through and do the real IF command
}
else if (cmd[2] != ';')
if (strlen(cmd) > 2)
{
// then we must be setting something so we'll invalidate the cache
rig_debug(RIG_DEBUG_TRACE, "%s: cache invalidated\n", __func__);
priv->cache_start.tv_sec = 0;
}
memset(buf, 0, buf_size);
if (expected == 0)

Wyświetl plik

@ -5943,7 +5943,7 @@ int newcat_get_cmd(RIG *rig)
// this is for WSJT-X/JTDX sequence of v/f/m/t
// should allow rapid repeat of any call using the IF; cmd
// Any call that changes something in the IF response should invalidate the cache
if (strncmp(priv->cmd_str, "IF;", 2) == 0 && priv->cache_start.tv_sec != 0)
if (strcmp(priv->cmd_str, "IF;") == 0 && priv->cache_start.tv_sec != 0)
{
int cache_age_ms;
@ -5957,7 +5957,7 @@ int newcat_get_cmd(RIG *rig)
}
// we drop through and do the real IF command
}
else if (priv->cmd_str[2] != ';') // then we must be setting something so we'll invalidate the cache
if (priv->cmd_str[2] != ';') // then we must be setting something so we'll invalidate the cache
{
rig_debug(RIG_DEBUG_TRACE, "%s: cache invalidated\n", __func__);
priv->cache_start.tv_sec = 0;