kopia lustrzana https://github.com/Hamlib/Hamlib
Merge branch 'master' of https://github.com/mdblack98/Hamlib
commit
e12ac07739
|
@ -471,7 +471,20 @@ typedef unsigned int vfo_t;
|
||||||
#define RIG_TARGETABLE_FUNC (1<<4)
|
#define RIG_TARGETABLE_FUNC (1<<4)
|
||||||
#define RIG_TARGETABLE_ALL 0x7fffffff
|
#define RIG_TARGETABLE_ALL 0x7fffffff
|
||||||
//! @endcond
|
//! @endcond
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Newer Icoms like the 9700 and 910 have VFOA/B on both Main & Sub
|
||||||
|
// Compared to older rigs which have one or the other
|
||||||
|
// So we need to distinguish between them
|
||||||
|
//! @cond Doxygen_Suppress
|
||||||
|
#define VFO_HAS_A_B ((rig->state.vfo_list & (RIG_VFO_A|RIG_VFO_B)) == (RIG_VFO_A|RIG_VFO_B))
|
||||||
|
#define VFO_HAS_MAIN_SUB ((rig->state.vfo_list & (RIG_VFO_MAIN|RIG_VFO_SUB)) == (RIG_VFO_MAIN|RIG_VFO_SUB))
|
||||||
|
#define VFO_HAS_MAIN_SUB_ONLY ((!VFO_HAS_A_B) & VFO_HAS_MAIN_SUB)
|
||||||
|
#define VFO_HAS_MAIN_SUB_A_B_ONLY (VFO_HAS_A_B & VFO_HAS_MAIN_SUB)
|
||||||
|
#define VFO_HAS_A_B_ONLY (VFO_HAS_A_B & (!VFO_HAS_MAIN_SUB))
|
||||||
|
#define VFO_DUAL (RIG_VFO_MAIN_A|RIG_VFO_MAIN_B|RIG_VFO_SUB_A|RIG_VFO_SUB_B)
|
||||||
|
#define VFO_HAS_DUAL ((rig->state.vfo_list & VFO_DUAL == VFO_DUAL)
|
||||||
|
//! @endcond
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Macro for bandpass to be set to normal
|
* \brief Macro for bandpass to be set to normal
|
||||||
|
@ -2630,7 +2643,7 @@ rig_need_debug HAMLIB_PARAMS((enum rig_debug_level_e debug_level));
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
// doing the debug macro with a dummy sprintf allows gcc to check the format string
|
// doing the debug macro with a dummy sprintf allows gcc to check the format string
|
||||||
#define rig_debug(debug_level,fmt,...) { char xxxbuf[16384]="";snprintf(xxxbuf,sizeof(xxxbuf),fmt,__VA_ARGS__);rig_debug(debug_level,fmt,##__VA_ARGS__); }
|
#define rig_debug(debug_level,fmt,...) { char xxxbuf[756]="";snprintf(xxxbuf,sizeof(xxxbuf),fmt,__VA_ARGS__);rig_debug(debug_level,fmt,##__VA_ARGS__); }
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
extern HAMLIB_EXPORT(void)
|
extern HAMLIB_EXPORT(void)
|
||||||
|
|
|
@ -44,17 +44,6 @@
|
||||||
#include "icom_defs.h"
|
#include "icom_defs.h"
|
||||||
#include "frame.h"
|
#include "frame.h"
|
||||||
|
|
||||||
// Newer Icoms like the 9700 and 910 have VFOA/B on both Main & Sub
|
|
||||||
// Compared to older rigs which have one or the other
|
|
||||||
// So we need to distinguish between them
|
|
||||||
#define VFO_HAS_A_B ((rig->state.vfo_list & (RIG_VFO_A|RIG_VFO_B)) == (RIG_VFO_A|RIG_VFO_B))
|
|
||||||
#define VFO_HAS_MAIN_SUB ((rig->state.vfo_list & (RIG_VFO_MAIN|RIG_VFO_SUB)) == (RIG_VFO_MAIN|RIG_VFO_SUB))
|
|
||||||
#define VFO_HAS_MAIN_SUB_ONLY ((!VFO_HAS_A_B) & VFO_HAS_MAIN_SUB)
|
|
||||||
#define VFO_HAS_MAIN_SUB_A_B_ONLY (VFO_HAS_A_B & VFO_HAS_MAIN_SUB)
|
|
||||||
#define VFO_HAS_A_B_ONLY (VFO_HAS_A_B & (!VFO_HAS_MAIN_SUB))
|
|
||||||
#define VFO_DUAL (RIG_VFO_MAIN_A|RIG_VFO_MAIN_B|RIG_VFO_SUB_A|RIG_VFO_SUB_B)
|
|
||||||
#define VFO_HAS_DUAL ((rig->state.vfo_list & VFO_DUAL == VFO_DUAL)
|
|
||||||
|
|
||||||
static int set_vfo_curr(RIG *rig, vfo_t vfo, vfo_t curr_vfo);
|
static int set_vfo_curr(RIG *rig, vfo_t vfo, vfo_t curr_vfo);
|
||||||
|
|
||||||
const cal_table_float_t icom_default_swr_cal =
|
const cal_table_float_t icom_default_swr_cal =
|
||||||
|
@ -1999,7 +1988,7 @@ int icom_set_vfo(RIG *rig, vfo_t vfo)
|
||||||
__func__);
|
__func__);
|
||||||
return -RIG_EINVAL;
|
return -RIG_EINVAL;
|
||||||
}
|
}
|
||||||
|
rig_debug(RIG_DEBUG_TRACE,"%s: debug#1\n", __func__);
|
||||||
if (vfo != priv->curr_vfo)
|
if (vfo != priv->curr_vfo)
|
||||||
{
|
{
|
||||||
rig_debug(RIG_DEBUG_TRACE, "%s: VFO changing from %s to %s\n", __func__,
|
rig_debug(RIG_DEBUG_TRACE, "%s: VFO changing from %s to %s\n", __func__,
|
||||||
|
@ -2007,6 +1996,7 @@ int icom_set_vfo(RIG *rig, vfo_t vfo)
|
||||||
priv->curr_freq = 0; // reset curr_freq so set_freq works 1st time
|
priv->curr_freq = 0; // reset curr_freq so set_freq works 1st time
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rig_debug(RIG_DEBUG_TRACE,"%s: debug#2\n", __func__);
|
||||||
switch (vfo)
|
switch (vfo)
|
||||||
{
|
{
|
||||||
case RIG_VFO_A:
|
case RIG_VFO_A:
|
||||||
|
@ -2130,8 +2120,10 @@ int icom_set_vfo(RIG *rig, vfo_t vfo)
|
||||||
return -RIG_EINVAL;
|
return -RIG_EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rig_debug(RIG_DEBUG_TRACE,"%s: debug#3\n", __func__);
|
||||||
retval = icom_transaction(rig, C_SET_VFO, icvfo, NULL, 0,
|
retval = icom_transaction(rig, C_SET_VFO, icvfo, NULL, 0,
|
||||||
ackbuf, &ack_len);
|
ackbuf, &ack_len);
|
||||||
|
rig_debug(RIG_DEBUG_TRACE,"%s: debug#4\n", __func__);
|
||||||
|
|
||||||
if (retval != RIG_OK)
|
if (retval != RIG_OK)
|
||||||
{
|
{
|
||||||
|
@ -2147,6 +2139,7 @@ int icom_set_vfo(RIG *rig, vfo_t vfo)
|
||||||
|
|
||||||
priv->curr_vfo = vfo;
|
priv->curr_vfo = vfo;
|
||||||
rig->state.current_vfo = vfo;
|
rig->state.current_vfo = vfo;
|
||||||
|
rig_debug(RIG_DEBUG_TRACE,"%s: debug#5\n", __func__);
|
||||||
return RIG_OK;
|
return RIG_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
11
src/rig.c
11
src/rig.c
|
@ -1801,6 +1801,17 @@ int HAMLIB_API rig_set_vfo(RIG *rig, vfo_t vfo)
|
||||||
return -RIG_EINVAL;
|
return -RIG_EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// make sure we are asking for a VFO that the rig actually has
|
||||||
|
if ((vfo == RIG_VFO_A || vfo == RIG_VFO_B) && !VFO_HAS_A_B) {
|
||||||
|
rig_debug(RIG_DEBUG_ERR, "%s: rig does not have %s\n", __func__, rig_strvfo(vfo));
|
||||||
|
return -RIG_EINVAL;
|
||||||
|
}
|
||||||
|
if ((vfo == RIG_VFO_MAIN || vfo == RIG_VFO_SUB) && !VFO_HAS_MAIN_SUB)
|
||||||
|
{
|
||||||
|
rig_debug(RIG_DEBUG_ERR, "%s: rig does not have %s\n", __func__, rig_strvfo(vfo));
|
||||||
|
return -RIG_EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
caps = rig->caps;
|
caps = rig->caps;
|
||||||
|
|
||||||
if (caps->set_vfo == NULL)
|
if (caps->set_vfo == NULL)
|
||||||
|
|
Ładowanie…
Reference in New Issue