Add cache invalidation for kenwood and yaesu

Reset all kenwood/yaesu backend versions to 0 since main backend is new
https://github.com/Hamlib/Hamlib/issues/226
pull/234/head
mdblack98 2020-04-27 09:36:40 -05:00
rodzic d6825cffbd
commit 600a674891
7 zmienionych plików z 51 dodań i 18 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", 2) == 0 && priv->cache_start.tv_sec != 0)
// 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)
{
int cache_age_ms;
@ -548,6 +548,13 @@ 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] != ';')
{
// 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);
@ -581,12 +588,12 @@ int kenwood_safe_transaction(RIG *rig, const char *cmd, char *buf,
}
}
while (err != RIG_OK && ++retry < rig->state.rigport.retry);
// update the cache
if (strncmp(cmd, "IF", 2) == 0)
if (strncmp(cmd, "IF;", 3) == 0)
{
elapsed_ms(&priv->cache_start, 1);
strcpy(priv->last_if_response, buf);
elapsed_ms(&priv->cache_start, 1);
strcpy(priv->last_if_response, buf);
}
return err;
@ -3880,8 +3887,10 @@ int kenwood_get_channel(RIG *rig, channel_t *chan, int read_only)
}
#warning Need to add setting rig to channel values
if (!read_only) {
// Set rig to channel values
if (!read_only)
{
// Set rig to channel values
}
return RIG_OK;

Wyświetl plik

@ -27,7 +27,7 @@
#include <string.h>
#include "token.h"
#define BACKEND_VER "20200426"
#define BACKEND_VER "20200427"
#define EOM_KEN ';'
#define EOM_TH '\r'

Wyświetl plik

@ -102,7 +102,7 @@ const struct rig_caps pihpsdr_caps =
RIG_MODEL(RIG_MODEL_HPSDR),
.model_name = "PiHPSDR",
.mfg_name = "OpenHPSDR",
.version = BACKEND_VER ".1",
.version = BACKEND_VER ".0",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER,

Wyświetl plik

@ -634,7 +634,7 @@ const struct rig_caps pt8000a_caps =
RIG_MODEL(RIG_MODEL_PT8000A),
.model_name = "PT-8000A",
.mfg_name = "Hilberling",
.version = BACKEND_VER ".1",
.version = BACKEND_VER ".0",
.copyright = "LGPL",
.status = RIG_STATUS_BETA,
.rig_type = RIG_TYPE_TRANSCEIVER,

Wyświetl plik

@ -60,7 +60,7 @@ const struct rig_caps ts950s_caps =
RIG_MODEL(RIG_MODEL_TS950S),
.model_name = "TS-950S",
.mfg_name = "Kenwood",
.version = BACKEND_VER ".1",
.version = BACKEND_VER ".0",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER,

Wyświetl plik

@ -864,6 +864,8 @@ int newcat_set_vfo(RIG *rig, vfo_t vfo)
priv = (struct newcat_priv_data *)rig->state.priv;
state = &rig->state;
priv->cache_start.tv_sec = 0; // invalidate the cache
rig_debug(RIG_DEBUG_TRACE, "%s: called, passed vfo = %s\n", __func__,
rig_strvfo(vfo));
@ -1055,6 +1057,8 @@ int newcat_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
char txon[] = "TX1;";
char txoff[] = "TX0;";
priv->cache_start.tv_sec = 0; // invalidate the cache
if (!newcat_valid_command(rig, "TX"))
{
return -RIG_ENAVAIL;
@ -5937,8 +5941,9 @@ int newcat_get_cmd(RIG *rig)
// try to cache rapid repeats of the IF command
// this is for WSJT-X/JTDX sequence of v/f/m/t
// should reduce 3 IF requests to 1 request and 2 cache hits
if (strncmp(priv->cmd_str, "IF", 2) == 0 && priv->cache_start.tv_sec != 0)
// 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)
{
int cache_age_ms;
@ -5950,9 +5955,14 @@ int newcat_get_cmd(RIG *rig)
strcpy(priv->ret_data, priv->last_if_response);
return RIG_OK;
}
// else we drop through and do the real IF command
// 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
{
rig_debug(RIG_DEBUG_TRACE, "%s: cache invalidated\n", __func__);
priv->cache_start.tv_sec = 0;
}
while (rc != RIG_OK && retry_count++ <= state->rigport.retry)
{
@ -6048,7 +6058,7 @@ int newcat_get_cmd(RIG *rig)
}
// update the cache
if (strncmp(priv->cmd_str, "IF", 2) == 0)
if (strncmp(priv->cmd_str, "IF;", 3) == 0)
{
elapsed_ms(&priv->cache_start, 1);
strcpy(priv->last_if_response, priv->ret_data);

Wyświetl plik

@ -17,7 +17,8 @@
# Please email any bugs, comments, and/or additions to this file to:
# hamlib-developer@lists.sourceforge.net
set RIGCTL "$srcdir/rigctl"
set RIGCTL "../rigctl"
set verbose 0
if ![info exists prompt] then {
set prompt "Rig command: "
@ -70,3 +71,16 @@ proc rigctl_start {} {
}
rigctl_start
send "v\n"
expect { -re ""}
expect { -re "v*"}
expect { -re "VFO:*"}
expect { -re "Rig Command:"}
#send "f\n"
#expect { -re "Frequency:*"}
#interact
#send "m\n"
#expect { -re "Mode:*"}
#send "t\n"
#expect { -re "PTT:*"}
rigctl_exit