kopia lustrzana https://github.com/Hamlib/Hamlib
Make kenwood set_split more robust to possible reverse split
rodzic
238e17b736
commit
e283e2b039
|
@ -268,7 +268,7 @@ int kenwood_transaction(RIG *rig, const char *cmdstr, char *data,
|
||||||
|
|
||||||
if (cache_age_ms < 500) // 500ms cache time
|
if (cache_age_ms < 500) // 500ms cache time
|
||||||
{
|
{
|
||||||
rig_debug(RIG_DEBUG_TRACE, "%s: cache hit, age=%dms\n", __func__, cache_age_ms);
|
rig_debug(RIG_DEBUG_TRACE, "%s(%d): cache hit, age=%dms\n", __func__, __LINE__, cache_age_ms);
|
||||||
|
|
||||||
if (data) { strncpy(data, priv->last_if_response, datasize); }
|
if (data) { strncpy(data, priv->last_if_response, datasize); }
|
||||||
|
|
||||||
|
@ -1065,7 +1065,10 @@ int kenwood_set_vfo(RIG *rig, vfo_t vfo)
|
||||||
* This prevents a 1.8 second delay in PowerSDR when switching VFOs
|
* This prevents a 1.8 second delay in PowerSDR when switching VFOs
|
||||||
* We'll do this once if curr_mode has not been set yet
|
* We'll do this once if curr_mode has not been set yet
|
||||||
*/
|
*/
|
||||||
if (priv->is_emulation && priv->curr_mode > 0) { RETURNFUNC(RIG_OK); }
|
if (priv->is_emulation && priv->curr_mode > 0) {
|
||||||
|
TRACE;
|
||||||
|
RETURNFUNC(RIG_OK);
|
||||||
|
}
|
||||||
|
|
||||||
if (rig->state.current_vfo == vfo)
|
if (rig->state.current_vfo == vfo)
|
||||||
{
|
{
|
||||||
|
@ -1088,6 +1091,7 @@ int kenwood_set_vfo(RIG *rig, vfo_t vfo)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RIG_VFO_CURR:
|
case RIG_VFO_CURR:
|
||||||
|
TRACE;
|
||||||
rig->state.current_vfo = RIG_VFO_CURR;
|
rig->state.current_vfo = RIG_VFO_CURR;
|
||||||
RETURNFUNC(RIG_OK);
|
RETURNFUNC(RIG_OK);
|
||||||
|
|
||||||
|
@ -1151,6 +1155,7 @@ int kenwood_set_vfo(RIG *rig, vfo_t vfo)
|
||||||
{
|
{
|
||||||
RETURNFUNC(retval);
|
RETURNFUNC(retval);
|
||||||
}
|
}
|
||||||
|
TRACE;
|
||||||
rig->state.current_vfo = vfo;
|
rig->state.current_vfo = vfo;
|
||||||
|
|
||||||
/* if FN command then there's no FT or FR */
|
/* if FN command then there's no FT or FR */
|
||||||
|
@ -1160,15 +1165,46 @@ int kenwood_set_vfo(RIG *rig, vfo_t vfo)
|
||||||
RETURNFUNC(RIG_OK);
|
RETURNFUNC(RIG_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TRACE;
|
||||||
// some rigs need split turned on after VFOA is set
|
// some rigs need split turned on after VFOA is set
|
||||||
if (vfo == RIG_VFO_A && priv->split == RIG_SPLIT_ON)
|
if (priv->split == RIG_SPLIT_ON)
|
||||||
|
{ // so let's figure out who the rx_vfo is based on the tx_vfo
|
||||||
|
TRACE;
|
||||||
|
vfo_t rx_vfo = RIG_VFO_A;
|
||||||
|
switch(priv->tx_vfo)
|
||||||
{
|
{
|
||||||
rig_set_split_vfo(rig, RIG_VFO_CURR, 1, priv->tx_vfo);
|
case RIG_VFO_A:
|
||||||
|
rx_vfo = RIG_VFO_B;
|
||||||
|
break;
|
||||||
|
case RIG_VFO_MAIN:
|
||||||
|
rx_vfo = RIG_VFO_SUB;
|
||||||
|
break;
|
||||||
|
case RIG_VFO_MAIN_A:
|
||||||
|
rx_vfo = RIG_VFO_MAIN_B;
|
||||||
|
break;
|
||||||
|
case RIG_VFO_B:
|
||||||
|
rx_vfo = RIG_VFO_A;
|
||||||
|
break;
|
||||||
|
case RIG_VFO_SUB:
|
||||||
|
rx_vfo = RIG_VFO_MAIN;
|
||||||
|
break;
|
||||||
|
case RIG_VFO_SUB_B:
|
||||||
|
rx_vfo = RIG_VFO_MAIN_A;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
rig_debug(RIG_DEBUG_ERR, "%s: unhandled VFO=%s, deafaulting to VFOA\n", __func__, rig_strvfo(priv->tx_vfo));
|
||||||
|
|
||||||
|
}
|
||||||
|
retval = rig_set_split_vfo(rig, rx_vfo , 1, priv->tx_vfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
/* set TX VFO */
|
/* set TX VFO */
|
||||||
cmdbuf[1] = 'T';
|
cmdbuf[1] = 'T';
|
||||||
RETURNFUNC(kenwood_transaction(rig, cmdbuf, NULL, 0));
|
RETURNFUNC(kenwood_transaction(rig, cmdbuf, NULL, 0));
|
||||||
|
#else
|
||||||
|
RETURNFUNC(retval);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2062,9 +2098,21 @@ int kenwood_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
||||||
struct kenwood_priv_data *priv = rig->state.priv;
|
struct kenwood_priv_data *priv = rig->state.priv;
|
||||||
struct kenwood_priv_caps *caps = kenwood_caps(rig);
|
struct kenwood_priv_caps *caps = kenwood_caps(rig);
|
||||||
|
|
||||||
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called, vfo=%s, mode=%s, width=%d, curr_vfo=%s\n", __func__,
|
||||||
|
rig_strvfo(vfo), rig_strrmode(mode), (int)width, rig_strvfo(rig->state.current_vfo));
|
||||||
|
|
||||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called, vfo=%s, mode=%s, width=%d\n", __func__,
|
// we wont' set opposite VFO if the mode is the same as requested
|
||||||
rig_strvfo(vfo), rig_strrmode(mode), (int)width);
|
// setting VFOB mode requires split modifications which cause VFO flashing
|
||||||
|
// this should generally work unless the user changes mode on VFOB
|
||||||
|
// in which case VFOB won't get mode changed until restart
|
||||||
|
if (priv->split && (priv->tx_vfo & (RIG_VFO_B|RIG_VFO_SUB|RIG_VFO_SUB_A)))
|
||||||
|
{
|
||||||
|
if (priv->modeB == mode)
|
||||||
|
{
|
||||||
|
rig_debug(RIG_DEBUG_TRACE, "%s: VFOB mode already %s so ignoring request\n", __func__, rig_strrmode(mode));
|
||||||
|
return(RIG_OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (RIG_IS_TS590S || RIG_IS_TS590SG || RIG_IS_TS950S || RIG_IS_TS950SDX)
|
if (RIG_IS_TS590S || RIG_IS_TS590SG || RIG_IS_TS950S || RIG_IS_TS950SDX)
|
||||||
{
|
{
|
||||||
|
@ -2339,7 +2387,7 @@ int kenwood_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
|
||||||
struct kenwood_priv_data *priv = rig->state.priv;
|
struct kenwood_priv_data *priv = rig->state.priv;
|
||||||
struct kenwood_priv_caps *caps = kenwood_caps(rig);
|
struct kenwood_priv_caps *caps = kenwood_caps(rig);
|
||||||
|
|
||||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called, curr_vfo=%s\n", __func__, rig_strvfo(rig->state.current_vfo));
|
||||||
|
|
||||||
if (!mode || !width)
|
if (!mode || !width)
|
||||||
{
|
{
|
||||||
|
@ -2351,7 +2399,8 @@ int kenwood_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
|
||||||
/* only need to get it if it has to be initialized */
|
/* only need to get it if it has to be initialized */
|
||||||
if (priv->curr_mode > 0 && priv->is_emulation && vfo == RIG_VFO_B)
|
if (priv->curr_mode > 0 && priv->is_emulation && vfo == RIG_VFO_B)
|
||||||
{
|
{
|
||||||
RETURNFUNC(priv->curr_mode);
|
rig->state.current_vfo = RIG_VFO_A;
|
||||||
|
RETURNFUNC(RIG_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RIG_IS_TS990S)
|
if (RIG_IS_TS990S)
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#include "token.h"
|
#include "token.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
|
||||||
#define BACKEND_VER "20211118"
|
#define BACKEND_VER "20211122"
|
||||||
|
|
||||||
#define EOM_KEN ';'
|
#define EOM_KEN ';'
|
||||||
#define EOM_TH '\r'
|
#define EOM_TH '\r'
|
||||||
|
|
Ładowanie…
Reference in New Issue