Add RIG_TARGETABLE_PTT and RIG_TARGETABLE_RITXIT

For most rigs these are non-vfo specific commands so we can avoid doing VFO switching
Add flags to all Yaesu, Icom, and Kenwood in rig_open
Some rigs do have VFO specific but it's already in the backend
More rigs can use these flags..TBD...
https://github.com/Hamlib/Hamlib/issues/430
pull/435/head
Michael Black W9MDB 2020-10-31 17:19:08 -05:00
rodzic fe672e8115
commit 74356b3a99
6 zmienionych plików z 29 dodań i 8 usunięć

Wyświetl plik

@ -457,6 +457,9 @@ typedef unsigned int vfo_t;
/* /*
* targetable bitfields, for internal use. * targetable bitfields, for internal use.
* RIG_TARGETABLE_PURE means a pure targetable radio on every command * 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 //! @cond Doxygen_Suppress
#define RIG_TARGETABLE_NONE 0 #define RIG_TARGETABLE_NONE 0
@ -466,6 +469,8 @@ typedef unsigned int vfo_t;
#define RIG_TARGETABLE_TONE (1<<3) #define RIG_TARGETABLE_TONE (1<<3)
#define RIG_TARGETABLE_FUNC (1<<4) #define RIG_TARGETABLE_FUNC (1<<4)
#define RIG_TARGETABLE_LEVEL (1<<5) #define RIG_TARGETABLE_LEVEL (1<<5)
#define RIG_TARGETABLE_RITXIT (1<<6)
#define RIG_TARGETABLE_PTT (1<<7)
#define RIG_TARGETABLE_ALL 0x7fffffff #define RIG_TARGETABLE_ALL 0x7fffffff
//! @endcond //! @endcond
// //

Wyświetl plik

@ -2078,7 +2078,7 @@ struct rig_caps dummy_caps =
.copyright = "LGPL", .copyright = "LGPL",
.status = RIG_STATUS_STABLE, .status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_OTHER, .rig_type = RIG_TYPE_OTHER,
.targetable_vfo = 0, .targetable_vfo = RIG_TARGETABLE_PTT|RIG_TARGETABLE_RITXIT,
.ptt_type = RIG_PTT_RIG, .ptt_type = RIG_PTT_RIG,
.dcd_type = RIG_DCD_RIG, .dcd_type = RIG_DCD_RIG,
.port_type = RIG_PORT_NONE, .port_type = RIG_PORT_NONE,
@ -2243,7 +2243,7 @@ struct rig_caps dummy_no_vfo_caps =
.copyright = "LGPL", .copyright = "LGPL",
.status = RIG_STATUS_STABLE, .status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_OTHER, .rig_type = RIG_TYPE_OTHER,
.targetable_vfo = 0, .targetable_vfo = RIG_TARGETABLE_PTT|RIG_TARGETABLE_RITXIT,
.ptt_type = RIG_PTT_RIG, .ptt_type = RIG_PTT_RIG,
.dcd_type = RIG_DCD_RIG, .dcd_type = RIG_DCD_RIG,
.port_type = RIG_PORT_NONE, .port_type = RIG_PORT_NONE,

Wyświetl plik

@ -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 #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 icom_get_freq_range(rig); // try get to get rig range capability dyamically
#endif #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; return RIG_OK;
} }

Wyświetl plik

@ -937,6 +937,12 @@ int kenwood_open(RIG *rig)
// we're making this non fatal // we're making this non fatal
// mismatched IDs can still be tested // mismatched IDs can still be tested
rig->state.rigport.retry = retry_save; 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; return RIG_OK;
} }

Wyświetl plik

@ -529,6 +529,12 @@ int newcat_open(RIG *rig)
/* Initialize rig_id in case any subsequent commands need it */ /* Initialize rig_id in case any subsequent commands need it */
(void)newcat_get_rigid(rig); (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; return RIG_OK;
} }

Wyświetl plik

@ -2271,7 +2271,7 @@ int HAMLIB_API rig_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
return -RIG_ENIMPL; return -RIG_ENIMPL;
} }
if ((caps->targetable_vfo & RIG_TARGETABLE_PURE) if ((caps->targetable_vfo & RIG_TARGETABLE_PTT)
|| vfo == RIG_VFO_CURR || vfo == RIG_VFO_CURR
|| vfo == rig->state.current_vfo) || 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; return RIG_OK;
} }
if ((caps->targetable_vfo & RIG_TARGETABLE_PURE) if ((caps->targetable_vfo & RIG_TARGETABLE_PTT)
|| vfo == RIG_VFO_CURR || vfo == RIG_VFO_CURR
|| vfo == rig->state.current_vfo) || 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; return -RIG_ENAVAIL;
} }
if ((caps->targetable_vfo & RIG_TARGETABLE_PURE) if ((caps->targetable_vfo & RIG_TARGETABLE_RITXIT)
|| vfo == RIG_VFO_CURR || vfo == RIG_VFO_CURR
|| vfo == rig->state.current_vfo) || 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; return -RIG_ENAVAIL;
} }
if ((caps->targetable_vfo & RIG_TARGETABLE_PURE) if ((caps->targetable_vfo & RIG_TARGETABLE_RITXIT)
|| vfo == RIG_VFO_CURR || vfo == RIG_VFO_CURR
|| vfo == rig->state.current_vfo) || 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; return -RIG_ENAVAIL;
} }
if ((caps->targetable_vfo & RIG_TARGETABLE_PURE) if ((caps->targetable_vfo & RIG_TARGETABLE_RITXIT)
|| vfo == RIG_VFO_CURR || vfo == RIG_VFO_CURR
|| vfo == rig->state.current_vfo) || 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; return -RIG_ENAVAIL;
} }
if ((caps->targetable_vfo & RIG_TARGETABLE_PURE) if ((caps->targetable_vfo & RIG_TARGETABLE_RITXIT)
|| vfo == RIG_VFO_CURR || vfo == RIG_VFO_CURR
|| vfo == rig->state.current_vfo) || vfo == rig->state.current_vfo)
{ {