Update cache for yaesu rigs when bypassing rig_* functions

Update cache for FT991
Add polling for freq and mode in rig_open to prime those values
https://github.com/Hamlib/Hamlib/issues/1056
https://github.com/Hamlib/Hamlib/issues/1050
pull/1068/head
Mike Black W9MDB 2022-06-07 11:50:25 -05:00
rodzic ce99f4c75d
commit 479c43afa1
3 zmienionych plików z 31 dodań i 2 usunięć

Wyświetl plik

@ -1314,6 +1314,10 @@ int newcat_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
{
RETURNFUNC(err);
}
if (vfo == RIG_VFO_A || vfo == RIG_VFO_MAIN)
rig->state.cache.modeMainA = mode;
else
rig->state.cache.modeMainB = mode;
if (RIG_PASSBAND_NOCHANGE == width) { RETURNFUNC(err); }
@ -2337,6 +2341,7 @@ int newcat_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode,
pbwidth_t tmp_width;
int err;
rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s, tx_mode=%s, tx_width=%d\n", __func__, rig_strvfo(vfo), rig_strrmode(tx_mode), (int)tx_width);
err = newcat_get_mode(rig, RIG_VFO_B, &tmp_mode, &tmp_width);
if (err < 0)
@ -2356,6 +2361,10 @@ int newcat_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode,
{
RETURNFUNC(err);
}
if (vfo == RIG_VFO_A || vfo == RIG_VFO_MAIN)
rig->state.cache.modeMainA = tx_mode;
else
rig->state.cache.modeMainB = tx_mode;
RETURNFUNC(-RIG_ENAVAIL);

Wyświetl plik

@ -50,7 +50,7 @@
typedef char ncboolean;
/* shared function version */
#define NEWCAT_VER "20220601"
#define NEWCAT_VER "20220607"
/* Hopefully large enough for future use, 128 chars plus '\0' */
#define NEWCAT_DATA_LEN 129

Wyświetl plik

@ -1309,6 +1309,16 @@ int HAMLIB_API rig_open(RIG *rig)
// freq_t freq;
// if (caps->get_freq) rig_get_freq(rig, RIG_VFO_A, &freq);
// if (caps->get_freq) rig_get_freq(rig, RIG_VFO_B, &freq);
// prime the freq and mode settings
// don't care about the return here -- if it doesn't work so be it
freq_t freq;
rig_get_freq(rig, RIG_VFO_A, &freq);
rig_get_freq(rig, RIG_VFO_B, &freq);
rmode_t mode;
pbwidth_t width;
rig_get_mode(rig, RIG_VFO_A, &mode, &width);
rig_get_mode(rig, RIG_VFO_B, &mode, &width);
memcpy(&rs->rigport_deprecated, &rs->rigport, sizeof(hamlib_port_t_deprecated));
memcpy(&rs->pttport_deprecated, &rs->pttport, sizeof(hamlib_port_t_deprecated));
@ -4149,13 +4159,17 @@ int HAMLIB_API rig_set_split_mode(RIG *rig,
RETURNFUNC(-RIG_EINVAL);
}
// we check both VFOs are in the same tx mode -- the we can ignore
// we check both VFOs are in the same tx mode -- then we can ignore
// this could be make more intelligent but this should cover all cases where we can skip this
if (tx_mode == rig->state.cache.modeMainA && tx_mode == rig->state.cache.modeMainB)
{
rig_debug(RIG_DEBUG_TRACE, "%s: mode already %s so no change required\n", __func__, rig_strrmode(tx_mode));
return RIG_OK;
}
else
{
rig_debug(RIG_DEBUG_TRACE, "%s: mode %s is different from A=%s and B=%s\n", __func__, rig_strrmode(tx_mode), rig_strrmode(rig->state.cache.modeMainA), rig_strrmode(rig->state.cache.modeMainB));
}
// do not mess with mode while PTT is on
if (rig->state.cache.ptt)
@ -4309,6 +4323,12 @@ int HAMLIB_API rig_set_split_mode(RIG *rig,
rig_set_split_vfo(rig, rx_vfo, RIG_SPLIT_ON, tx_vfo);
if (vfo == RIG_VFO_A || vfo == RIG_VFO_MAIN)
rig->state.cache.modeMainA = tx_mode;
else
rig->state.cache.modeMainB = tx_mode;
ELAPSED2;
RETURNFUNC(retcode);
}