diff --git a/include/hamlib/rig.h b/include/hamlib/rig.h index 03474a848..013ad6506 100644 --- a/include/hamlib/rig.h +++ b/include/hamlib/rig.h @@ -457,6 +457,9 @@ typedef unsigned int vfo_t; /* * targetable bitfields, for internal use. * RIG_TARGETABLE_PURE means a pure targetable radio on every command + * In rig.c lack of a flag will case a VFO change if needed + * So setting this flag will mean the backend handles any VFO needs + * For many rigs RITXIT and PTT are non-VFO commands so need these flags */ //! @cond Doxygen_Suppress #define RIG_TARGETABLE_NONE 0 @@ -466,6 +469,8 @@ typedef unsigned int vfo_t; #define RIG_TARGETABLE_TONE (1<<3) #define RIG_TARGETABLE_FUNC (1<<4) #define RIG_TARGETABLE_LEVEL (1<<5) +#define RIG_TARGETABLE_RITXIT (1<<6) +#define RIG_TARGETABLE_PTT (1<<7) #define RIG_TARGETABLE_ALL 0x7fffffff //! @endcond // diff --git a/rigs/dummy/dummy.c b/rigs/dummy/dummy.c index 1eb02497b..c214ce3c9 100644 --- a/rigs/dummy/dummy.c +++ b/rigs/dummy/dummy.c @@ -2078,7 +2078,7 @@ struct rig_caps dummy_caps = .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_OTHER, - .targetable_vfo = 0, + .targetable_vfo = RIG_TARGETABLE_PTT|RIG_TARGETABLE_RITXIT, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_NONE, @@ -2243,7 +2243,7 @@ struct rig_caps dummy_no_vfo_caps = .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_OTHER, - .targetable_vfo = 0, + .targetable_vfo = RIG_TARGETABLE_PTT|RIG_TARGETABLE_RITXIT, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_NONE, diff --git a/rigs/icom/icom.c b/rigs/icom/icom.c index fadfd433a..d7bc08d8b 100644 --- a/rigs/icom/icom.c +++ b/rigs/icom/icom.c @@ -814,6 +814,10 @@ icom_rig_open(RIG *rig) #if 0 // do not do this here -- needs to be done when ranges are requested instead as this is very slow icom_get_freq_range(rig); // try get to get rig range capability dyamically #endif + // All Icom rigs as of 20201031 do not need VFO switch for PTT and RITXIT + // They are non-VFO specific commands + // If they ever become VFO specific implement in the backend + rig->caps->targetable_vfo |= RIG_TARGETABLE_PTT | RIG_TARGETABLE_RITXIT; return RIG_OK; } diff --git a/rigs/kenwood/kenwood.c b/rigs/kenwood/kenwood.c index a8e7d79ba..6dea34774 100644 --- a/rigs/kenwood/kenwood.c +++ b/rigs/kenwood/kenwood.c @@ -937,6 +937,12 @@ int kenwood_open(RIG *rig) // we're making this non fatal // mismatched IDs can still be tested rig->state.rigport.retry = retry_save; + + // All Kenwood rigs as of 20201031 do not need VFO switch for PTT and RITXIT + // They are non-VFO specific commands + // If they ever become VFO specific implement in the backend + + rig->caps->targetable_vfo |= RIG_TARGETABLE_PTT | RIG_TARGETABLE_RITXIT; return RIG_OK; } diff --git a/rigs/yaesu/newcat.c b/rigs/yaesu/newcat.c index 285bdef0f..ad8bac005 100644 --- a/rigs/yaesu/newcat.c +++ b/rigs/yaesu/newcat.c @@ -529,6 +529,12 @@ int newcat_open(RIG *rig) /* Initialize rig_id in case any subsequent commands need it */ (void)newcat_get_rigid(rig); + // All Yaeus rigs as of 20201031 do not need VFO switch for PTT and RITXIT + // They are non-VFO specific commands + // A couple of rigs do have vfo-specific in the backends + // If they ever become VFO specific implement in the backend + rig->caps->targetable_vfo |= RIG_TARGETABLE_PTT | RIG_TARGETABLE_RITXIT; + return RIG_OK; } diff --git a/src/rig.c b/src/rig.c index ffeb0b4b0..69a990ddf 100644 --- a/src/rig.c +++ b/src/rig.c @@ -2271,7 +2271,7 @@ int HAMLIB_API rig_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) return -RIG_ENIMPL; } - if ((caps->targetable_vfo & RIG_TARGETABLE_PURE) + if ((caps->targetable_vfo & RIG_TARGETABLE_PTT) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) { @@ -2486,7 +2486,7 @@ int HAMLIB_API rig_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) return RIG_OK; } - if ((caps->targetable_vfo & RIG_TARGETABLE_PURE) + if ((caps->targetable_vfo & RIG_TARGETABLE_PTT) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) { @@ -3860,7 +3860,7 @@ int HAMLIB_API rig_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit) return -RIG_ENAVAIL; } - if ((caps->targetable_vfo & RIG_TARGETABLE_PURE) + if ((caps->targetable_vfo & RIG_TARGETABLE_RITXIT) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) { @@ -3928,7 +3928,7 @@ int HAMLIB_API rig_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit) return -RIG_ENAVAIL; } - if ((caps->targetable_vfo & RIG_TARGETABLE_PURE) + if ((caps->targetable_vfo & RIG_TARGETABLE_RITXIT) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) { @@ -3996,7 +3996,7 @@ int HAMLIB_API rig_set_xit(RIG *rig, vfo_t vfo, shortfreq_t xit) return -RIG_ENAVAIL; } - if ((caps->targetable_vfo & RIG_TARGETABLE_PURE) + if ((caps->targetable_vfo & RIG_TARGETABLE_RITXIT) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) { @@ -4064,7 +4064,7 @@ int HAMLIB_API rig_get_xit(RIG *rig, vfo_t vfo, shortfreq_t *xit) return -RIG_ENAVAIL; } - if ((caps->targetable_vfo & RIG_TARGETABLE_PURE) + if ((caps->targetable_vfo & RIG_TARGETABLE_RITXIT) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) {