kopia lustrzana https://github.com/Hamlib/Hamlib
Merge branch 'master' into ts480-fixes
commit
6fd5371b12
|
@ -903,7 +903,7 @@ typedef uint64_t rig_level_e;
|
|||
|
||||
/*!< These are not settable */
|
||||
#define RIG_LEVEL_RAWSTR CONSTANT_64BIT_FLAG(26) /*!< \c RAWSTR -- Raw (A/D) value for signal strength, specific to each rig, arg int */
|
||||
#define RIG_LEVEL_SQLSTAT CONSTANT_64BIT_FLAG(27) /*!< \c SQLSTAT -- SQL status, arg int (open=1/closed=0). Deprecated, use get_dcd instead */
|
||||
//#define RIG_LEVEL_SQLSTAT CONSTANT_64BIT_FLAG(27) /*!< \c SQLSTAT -- SQL status, arg int (open=1/closed=0). Deprecated, use get_dcd instead */
|
||||
#define RIG_LEVEL_SWR CONSTANT_64BIT_FLAG(28) /*!< \c SWR -- SWR, arg float [0.0 ... infinite] */
|
||||
#define RIG_LEVEL_ALC CONSTANT_64BIT_FLAG(29) /*!< \c ALC -- ALC, arg float */
|
||||
#define RIG_LEVEL_STRENGTH CONSTANT_64BIT_FLAG(30) /*!< \c STRENGTH -- Effective (calibrated) signal strength relative to S9, arg int (dB) */
|
||||
|
@ -945,7 +945,7 @@ typedef uint64_t rig_level_e;
|
|||
//! @cond Doxygen_Suppress
|
||||
#define RIG_LEVEL_FLOAT_LIST (RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_SQL|RIG_LEVEL_APF|RIG_LEVEL_NR|RIG_LEVEL_PBT_IN|RIG_LEVEL_PBT_OUT|RIG_LEVEL_RFPOWER|RIG_LEVEL_MICGAIN|RIG_LEVEL_COMP|RIG_LEVEL_BALANCE|RIG_LEVEL_SWR|RIG_LEVEL_ALC|RIG_LEVEL_VOXGAIN|RIG_LEVEL_ANTIVOX|RIG_LEVEL_RFPOWER_METER|RIG_LEVEL_RFPOWER_METER_WATTS|RIG_LEVEL_COMP_METER|RIG_LEVEL_VD_METER|RIG_LEVEL_ID_METER|RIG_LEVEL_NOTCHF_RAW|RIG_LEVEL_MONITOR_GAIN|RIG_LEVEL_NB)
|
||||
|
||||
#define RIG_LEVEL_READONLY_LIST (RIG_LEVEL_SQLSTAT|RIG_LEVEL_SWR|RIG_LEVEL_ALC|RIG_LEVEL_STRENGTH|RIG_LEVEL_RAWSTR|RIG_LEVEL_RFPOWER_METER|RIG_LEVEL_COMP_METER|RIG_LEVEL_VD_METER|RIG_LEVEL_ID_METER)
|
||||
#define RIG_LEVEL_READONLY_LIST (RIG_LEVEL_SWR|RIG_LEVEL_ALC|RIG_LEVEL_STRENGTH|RIG_LEVEL_RAWSTR|RIG_LEVEL_RFPOWER_METER|RIG_LEVEL_COMP_METER|RIG_LEVEL_VD_METER|RIG_LEVEL_ID_METER)
|
||||
|
||||
#define RIG_LEVEL_IS_FLOAT(l) ((l)&RIG_LEVEL_FLOAT_LIST)
|
||||
#define RIG_LEVEL_SET(l) ((l)&~RIG_LEVEL_READONLY_LIST)
|
||||
|
|
|
@ -844,7 +844,8 @@ static int dummy_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
|
|||
|
||||
ENTERFUNC;
|
||||
priv->curr->tx_freq = tx_freq;
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: priv->curr->tx_freq = %.0f\n", __func__, priv->curr->tx_freq);
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: priv->curr->tx_freq = %.0f\n", __func__,
|
||||
priv->curr->tx_freq);
|
||||
|
||||
RETURNFUNC(RIG_OK);
|
||||
}
|
||||
|
@ -857,7 +858,8 @@ static int dummy_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq)
|
|||
ENTERFUNC;
|
||||
|
||||
*tx_freq = priv->curr->tx_freq;
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: priv->curr->tx_freq = %.0f\n", __func__, priv->curr->tx_freq);
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: priv->curr->tx_freq = %.0f\n", __func__,
|
||||
priv->curr->tx_freq);
|
||||
|
||||
RETURNFUNC(RIG_OK);
|
||||
}
|
||||
|
|
|
@ -328,9 +328,11 @@ static int netrigctl_open(RIG *rig)
|
|||
{
|
||||
break;
|
||||
}
|
||||
switch(i)
|
||||
|
||||
switch (i)
|
||||
{
|
||||
}
|
||||
|
||||
rig->caps->tx_range_list1->startf = rs->tx_range_list[i].startf;
|
||||
rig->caps->tx_range_list1->endf = rs->tx_range_list[i].endf;
|
||||
rig->caps->tx_range_list1->modes = rs->tx_range_list[i].modes;
|
||||
|
@ -400,7 +402,7 @@ static int netrigctl_open(RIG *rig)
|
|||
return (ret < 0) ? ret : -RIG_EPROTO;
|
||||
}
|
||||
|
||||
rs->max_rit = atol(buf);
|
||||
rig->caps->max_rit = rs->max_rit = atol(buf);
|
||||
|
||||
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1);
|
||||
|
||||
|
@ -409,7 +411,7 @@ static int netrigctl_open(RIG *rig)
|
|||
return (ret < 0) ? ret : -RIG_EPROTO;
|
||||
}
|
||||
|
||||
rs->max_xit = atol(buf);
|
||||
rig->caps->max_xit = rs->max_xit = atol(buf);
|
||||
|
||||
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1);
|
||||
|
||||
|
@ -418,7 +420,7 @@ static int netrigctl_open(RIG *rig)
|
|||
return (ret < 0) ? ret : -RIG_EPROTO;
|
||||
}
|
||||
|
||||
rs->max_ifshift = atol(buf);
|
||||
rig->caps->max_ifshift = rs->max_ifshift = atol(buf);
|
||||
|
||||
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1);
|
||||
|
||||
|
@ -441,13 +443,20 @@ static int netrigctl_open(RIG *rig)
|
|||
&rs->preamp[2], &rs->preamp[3],
|
||||
&rs->preamp[4], &rs->preamp[5],
|
||||
&rs->preamp[6]);
|
||||
rig->caps->preamp[0] = rs->preamp[0];
|
||||
rig->caps->preamp[1] = rs->preamp[1];
|
||||
rig->caps->preamp[2] = rs->preamp[2];
|
||||
rig->caps->preamp[3] = rs->preamp[3];
|
||||
rig->caps->preamp[4] = rs->preamp[4];
|
||||
rig->caps->preamp[5] = rs->preamp[5];
|
||||
rig->caps->preamp[6] = rs->preamp[6];
|
||||
|
||||
if (ret < 0 || ret >= HAMLIB_MAXDBLSTSIZ)
|
||||
{
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
rs->preamp[ret] = RIG_DBLST_END;
|
||||
rig->caps->preamp[ret] = rs->preamp[ret] = RIG_DBLST_END;
|
||||
|
||||
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1);
|
||||
|
||||
|
@ -461,13 +470,20 @@ static int netrigctl_open(RIG *rig)
|
|||
&rs->attenuator[2], &rs->attenuator[3],
|
||||
&rs->attenuator[4], &rs->attenuator[5],
|
||||
&rs->attenuator[6]);
|
||||
rig->caps->attenuator[0] = rs->attenuator[0];
|
||||
rig->caps->attenuator[1] = rs->attenuator[1];
|
||||
rig->caps->attenuator[2] = rs->attenuator[2];
|
||||
rig->caps->attenuator[3] = rs->attenuator[3];
|
||||
rig->caps->attenuator[4] = rs->attenuator[4];
|
||||
rig->caps->attenuator[5] = rs->attenuator[5];
|
||||
rig->caps->attenuator[6] = rs->attenuator[6];
|
||||
|
||||
if (ret < 0 || ret >= HAMLIB_MAXDBLSTSIZ)
|
||||
{
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
rs->attenuator[ret] = RIG_DBLST_END;
|
||||
rig->caps->attenuator[ret] = rs->attenuator[ret] = RIG_DBLST_END;
|
||||
|
||||
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1);
|
||||
|
||||
|
@ -476,7 +492,7 @@ static int netrigctl_open(RIG *rig)
|
|||
return (ret < 0) ? ret : -RIG_EPROTO;
|
||||
}
|
||||
|
||||
rs->has_get_func = strtoll(buf, NULL, 0);
|
||||
rig->caps->has_get_func = rs->has_get_func = strtoll(buf, NULL, 0);
|
||||
|
||||
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1);
|
||||
|
||||
|
@ -485,7 +501,7 @@ static int netrigctl_open(RIG *rig)
|
|||
return (ret < 0) ? ret : -RIG_EPROTO;
|
||||
}
|
||||
|
||||
rs->has_set_func = strtoll(buf, NULL, 0);
|
||||
rig->caps->has_set_func = rs->has_set_func = strtoll(buf, NULL, 0);
|
||||
|
||||
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1);
|
||||
|
||||
|
@ -494,7 +510,7 @@ static int netrigctl_open(RIG *rig)
|
|||
return (ret < 0) ? ret : -RIG_EPROTO;
|
||||
}
|
||||
|
||||
rs->has_get_level = strtoll(buf, NULL, 0);
|
||||
rig->caps->has_get_level = rs->has_get_level = strtoll(buf, NULL, 0);
|
||||
|
||||
if (rs->has_get_level & RIG_LEVEL_RAWSTR)
|
||||
{
|
||||
|
@ -502,6 +518,7 @@ static int netrigctl_open(RIG *rig)
|
|||
provide a front end emulation, if it can't then an
|
||||
-RIG_EINVAL will be returned */
|
||||
rs->has_get_level |= RIG_LEVEL_STRENGTH;
|
||||
rig->caps->has_get_level |= RIG_LEVEL_STRENGTH;
|
||||
}
|
||||
|
||||
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1);
|
||||
|
@ -511,7 +528,7 @@ static int netrigctl_open(RIG *rig)
|
|||
return (ret < 0) ? ret : -RIG_EPROTO;
|
||||
}
|
||||
|
||||
rs->has_set_level = strtoll(buf, NULL, 0);
|
||||
rig->caps->has_set_level = rs->has_set_level = strtoll(buf, NULL, 0);
|
||||
|
||||
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1);
|
||||
|
||||
|
@ -529,7 +546,7 @@ static int netrigctl_open(RIG *rig)
|
|||
return (ret < 0) ? ret : -RIG_EPROTO;
|
||||
}
|
||||
|
||||
rs->has_set_parm = strtoll(buf, NULL, 0);
|
||||
rig->caps->has_set_parm = rs->has_set_parm = strtoll(buf, NULL, 0);
|
||||
|
||||
#if 0
|
||||
gran_t level_gran[RIG_SETTING_MAX]; /*!< level granularity */
|
||||
|
@ -587,10 +604,16 @@ static int netrigctl_open(RIG *rig)
|
|||
* if there is any PTT capability and we have not
|
||||
* locally overridden it
|
||||
*/
|
||||
rig->state.pttport.type.ptt = temp;
|
||||
rig->state.pttport.type.ptt = RIG_PTT_RIG_MICDATA;
|
||||
rig->caps->ptt_type = RIG_PTT_RIG_MICDATA;
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: %s set to %d\n", __func__, setting,
|
||||
rig->state.pttport.type.ptt);
|
||||
}
|
||||
else
|
||||
{
|
||||
rig->state.pttport.type.ptt = temp;
|
||||
rig->caps->ptt_type = temp;
|
||||
}
|
||||
}
|
||||
else if (strcmp(setting, "targetable_vfo") == 0)
|
||||
{
|
||||
|
@ -626,7 +649,8 @@ static int netrigctl_open(RIG *rig)
|
|||
{
|
||||
// use the rig's timeout value pluse 200ms for potential network delays
|
||||
rig->caps->timeout = strtol(value, NULL, 0) + 200;
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: timeout value = '%s', final timeout=%d\n", __func__, value, rig->caps->timeout);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: timeout value = '%s', final timeout=%d\n",
|
||||
__func__, value, rig->caps->timeout);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -2105,10 +2105,11 @@ int icom_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
|
|||
// reason is we can't get width without swapping vfos -- yuck!!
|
||||
if (width != NULL)
|
||||
{
|
||||
if (vfo & (RIG_VFO_A | RIG_VFO_MAIN | RIG_VFO_SUB_A | RIG_VFO_MAIN_A))
|
||||
if (vfo & (RIG_VFO_A | RIG_VFO_MAIN | RIG_VFO_SUB_A | RIG_VFO_MAIN_A |
|
||||
RIG_VFO_CURR))
|
||||
{
|
||||
// then we get our current vfo..i.e. VFOA
|
||||
if (rig->state.current_vfo != RIG_VFO_A)
|
||||
// then we get what was asked for
|
||||
if (vfo == RIG_VFO_NONE)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s(%d): forcing default VFO_A\n", __func__,
|
||||
__LINE__);
|
||||
|
@ -2137,7 +2138,9 @@ int icom_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
|
|||
rig_set_vfo(rig, RIG_VFO_B);
|
||||
retval = icom_get_dsp_flt(rig, *mode);
|
||||
*width = retval;
|
||||
if (*width == 0) *width = rig->state.cache.widthMainA; // we'll use VFOA's width
|
||||
|
||||
if (*width == 0) { *width = rig->state.cache.widthMainA; } // we'll use VFOA's width
|
||||
|
||||
// dont' really care about cache time here
|
||||
// this is just to prevent vfo swapping while getting width
|
||||
rig->state.cache.widthMainB = retval;
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#define BACKEND_VER "20210418"
|
||||
#define BACKEND_VER "20210419"
|
||||
|
||||
/*
|
||||
* defines used by comp_cal_str in rig.c
|
||||
|
|
|
@ -1219,7 +1219,7 @@ const struct rig_caps powersdr_caps =
|
|||
.serial_parity = RIG_PARITY_NONE,
|
||||
.serial_handshake = RIG_HANDSHAKE_NONE,
|
||||
.write_delay = 0,
|
||||
.post_write_delay = 20,
|
||||
.post_write_delay = 0,
|
||||
// The combination of timeout and retry is important
|
||||
// We need at least 3 seconds to do profile switches
|
||||
// Hitting the timeout is OK as long as we retry
|
||||
|
|
|
@ -781,18 +781,6 @@ int kenwood_open(RIG *rig)
|
|||
"%s: no response to get_id from rig...continuing anyways.\n", __func__);
|
||||
}
|
||||
|
||||
if (RIG_IS_TS2000
|
||||
|| RIG_IS_TS480
|
||||
|| RIG_IS_TS590S
|
||||
|| RIG_IS_TS590SG
|
||||
|| RIG_IS_TS890S
|
||||
|| RIG_IS_TS990S)
|
||||
{
|
||||
// rig has Set 2 RIT/XIT function
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: rig has_rit2\n", __func__);
|
||||
priv->has_rit2 = 1;
|
||||
}
|
||||
|
||||
if (RIG_IS_TS590S)
|
||||
{
|
||||
/* we need the firmware version for these rigs to deal with f/w defects */
|
||||
|
@ -910,7 +898,8 @@ int kenwood_open(RIG *rig)
|
|||
int retval;
|
||||
split_t split;
|
||||
vfo_t tx_vfo;
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: found the right driver for %s(%d)\n", __func__, rig->caps->model_name, rig->caps->rig_model);
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: found the right driver for %s(%d)\n",
|
||||
__func__, rig->caps->model_name, rig->caps->rig_model);
|
||||
/* get current AI state so it can be restored */
|
||||
kenwood_get_trn(rig, &priv->trn_state); /* ignore errors */
|
||||
|
||||
|
@ -1732,11 +1721,10 @@ int kenwood_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit)
|
|||
int retval, i;
|
||||
shortfreq_t curr_rit;
|
||||
int diff;
|
||||
struct kenwood_priv_data *priv = rig->state.priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called: vfo=%s, rit=%ld, has_rit2=%d\n",
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called: vfo=%s, rit=%ld\n",
|
||||
__func__,
|
||||
rig_strvfo(vfo), rit, priv->has_rit2);
|
||||
rig_strvfo(vfo), rit);
|
||||
|
||||
retval = kenwood_get_rit(rig, vfo, &curr_rit);
|
||||
|
||||
|
@ -1745,32 +1733,24 @@ int kenwood_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit)
|
|||
RETURNFUNC(retval);
|
||||
}
|
||||
|
||||
if (priv->has_rit2) // if backend shows it has the Set 2 command
|
||||
// we'll set the rigs that have a rit step setting to 10Hz steps
|
||||
retval = kenwood_transaction(rig, "RC;RU00010", NULL, 0);
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
char cmd[15]; // length required to make Apple-gcc happy (unicode-proof).
|
||||
snprintf(cmd, sizeof(cmd) - 1, "R%c%05d", rit > 0 ? 'U' : 'D', abs((int)rit));
|
||||
retval = kenwood_transaction(rig, cmd, NULL, 0);
|
||||
RETURNFUNC(retval);
|
||||
}
|
||||
else
|
||||
|
||||
if (rit == 0) { RETURNFUNC(RIG_OK); } // we're done here
|
||||
|
||||
snprintf(buf, sizeof(buf), "R%c", (rit > 0) ? 'U' : 'D');
|
||||
|
||||
diff = labs((rit + rit >= 0 ? 5 : -5) / 10); // round to nearest
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: rit change loop=%d\n", __func__, diff);
|
||||
|
||||
for (i = 0; i < diff; i++)
|
||||
{
|
||||
retval = kenwood_transaction(rig, "RC", NULL, 0);
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
RETURNFUNC(retval);
|
||||
}
|
||||
|
||||
if (rit == 0) { RETURNFUNC(RIG_OK); } // we're done here
|
||||
|
||||
snprintf(buf, sizeof(buf), "R%c", (rit > 0) ? 'U' : 'D');
|
||||
|
||||
diff = labs((rit + rit >= 0 ? 5 : -5) / 10); // round to nearest
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: rit change loop=%d\n", __func__, diff);
|
||||
|
||||
for (i = 0; i < diff; i++)
|
||||
{
|
||||
retval = kenwood_transaction(rig, buf, NULL, 0);
|
||||
}
|
||||
retval = kenwood_transaction(rig, buf, NULL, 0);
|
||||
}
|
||||
|
||||
RETURNFUNC(retval);
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "token.h"
|
||||
#include "misc.h"
|
||||
|
||||
#define BACKEND_VER "20210406"
|
||||
#define BACKEND_VER "20210423"
|
||||
|
||||
#define EOM_KEN ';'
|
||||
#define EOM_TH '\r'
|
||||
|
@ -153,7 +153,6 @@ struct kenwood_priv_data
|
|||
struct timespec cache_start;
|
||||
char last_if_response[KENWOOD_MAX_BUF_LEN];
|
||||
int poweron; /* to avoid powering on more than once */
|
||||
int has_rit2; /* rig has set 2 rit command */
|
||||
int ag_format; /* which AG command is being used...see LEVEL_AF in kenwood.c*/
|
||||
int micgain_min, micgain_max; /* varies by rig so we figure it out automagically */
|
||||
int is_k2;
|
||||
|
|
|
@ -796,7 +796,8 @@ int prm80_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only)
|
|||
chan->funcs |= (lock_byte & 0x05) ? RIG_FUNC_LOCK : 0;
|
||||
chan->funcs |= (lock_byte & 0x08) ? RIG_FUNC_MUTE : 0;
|
||||
|
||||
chan->freq = pll_value_to_rx_freq((hhtoi(statebuf + 12) << 8) + hhtoi(statebuf + 14));
|
||||
chan->freq = pll_value_to_rx_freq((hhtoi(statebuf + 12) << 8) + hhtoi(
|
||||
statebuf + 14));
|
||||
chan->tx_freq = ((hhtoi(statebuf + 16) << 8) + hhtoi(statebuf + 18)) * FREQ_DIV;
|
||||
|
||||
if (chan->rptr_shift != RIG_RPT_SHIFT_NONE)
|
||||
|
|
|
@ -847,7 +847,6 @@ static struct
|
|||
{ RIG_LEVEL_SLOPE_HIGH, "SLOPE_HIGH" },
|
||||
{ RIG_LEVEL_BKIN_DLYMS, "BKIN_DLYMS" },
|
||||
{ RIG_LEVEL_RAWSTR, "RAWSTR" },
|
||||
{ RIG_LEVEL_SQLSTAT, "SQLSTAT" },
|
||||
{ RIG_LEVEL_SWR, "SWR" },
|
||||
{ RIG_LEVEL_ALC, "ALC" },
|
||||
{ RIG_LEVEL_STRENGTH, "STRENGTH" },
|
||||
|
|
|
@ -143,11 +143,23 @@ int network_open(hamlib_port_t *rp, int default_port)
|
|||
|
||||
#ifdef __MINGW32__
|
||||
WSADATA wsadata;
|
||||
int ret;
|
||||
|
||||
if (!(wsstarted++) && WSAStartup(MAKEWORD(1, 1), &wsadata) == SOCKET_ERROR)
|
||||
if (wsstarted == 0)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: error creating socket\n", __func__);
|
||||
RETURNFUNC(-RIG_EIO);
|
||||
ret = WSAStartup(MAKEWORD(1, 1), &wsadata);
|
||||
|
||||
if (ret == 0)
|
||||
{
|
||||
wsstarted = 1;
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: WSAStartup OK\n", __func__);
|
||||
}
|
||||
else
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: error creating socket, WSAStartup ret=%d\n",
|
||||
__func__, ret);
|
||||
RETURNFUNC(-RIG_EIO);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -347,20 +359,30 @@ void network_flush(hamlib_port_t *rp)
|
|||
//! @cond Doxygen_Suppress
|
||||
int network_close(hamlib_port_t *rp)
|
||||
{
|
||||
int ret;
|
||||
int ret = 0;
|
||||
|
||||
ENTERFUNC;
|
||||
|
||||
#ifdef __MINGW32__
|
||||
ret = closesocket(rp->fd);
|
||||
|
||||
if (--wsstarted)
|
||||
if (rp->fd > 0)
|
||||
{
|
||||
WSACleanup();
|
||||
#ifdef __MINGW32__
|
||||
ret = closesocket(rp->fd);
|
||||
#else
|
||||
ret = close(rp->fd);
|
||||
#endif
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: close socket ret=%d\n", __func__, ret);
|
||||
rp->fd = 0;
|
||||
}
|
||||
|
||||
#ifdef __MINGW32__
|
||||
|
||||
if (wsstarted)
|
||||
{
|
||||
ret = WSACleanup();
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: WSACleanup ret=%d\n", __func__, ret);
|
||||
wsstarted = 0;
|
||||
}
|
||||
|
||||
#else
|
||||
ret = close(rp->fd);
|
||||
#endif
|
||||
RETURNFUNC(ret);
|
||||
}
|
||||
|
|
54
src/rig.c
54
src/rig.c
|
@ -1691,6 +1691,7 @@ int HAMLIB_API rig_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
const struct rig_caps *caps;
|
||||
int retcode;
|
||||
freq_t freq_new = freq;
|
||||
vfo_t vfo_save;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called vfo=%s, freq=%.0f\n", __func__,
|
||||
rig_strvfo(vfo), freq);
|
||||
|
@ -1703,14 +1704,13 @@ int HAMLIB_API rig_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
if (rig->state.twiddle_state == TWIDDLE_ON)
|
||||
{
|
||||
// we keep skipping set_freq while the vfo knob is in motion
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: Twiddle on so skipping this set_freq request one time\n", __func__);
|
||||
rig_debug(RIG_DEBUG_VERBOSE,
|
||||
"%s: Twiddle on so skipping this set_freq request one time\n", __func__);
|
||||
rig->state.twiddle_state = TWIDDLE_OFF;
|
||||
}
|
||||
|
||||
caps = rig->caps;
|
||||
|
||||
vfo = vfo_fixup(rig, vfo);
|
||||
|
||||
if (rig->state.lo_freq != 0.0)
|
||||
{
|
||||
freq -= rig->state.lo_freq;
|
||||
|
@ -1727,6 +1727,9 @@ int HAMLIB_API rig_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
RETURNFUNC(-RIG_ENAVAIL);
|
||||
}
|
||||
|
||||
vfo_save = rig->state.current_vfo;
|
||||
vfo = vfo_fixup(rig, vfo);
|
||||
|
||||
if ((caps->targetable_vfo & RIG_TARGETABLE_FREQ)
|
||||
|| vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo)
|
||||
{
|
||||
|
@ -1734,6 +1737,7 @@ int HAMLIB_API rig_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
{
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: Ignoring set_freq due to VFO twiddling\n",
|
||||
__func__);
|
||||
if (vfo != vfo_save && vfo != RIG_VFO_CURR) rig_set_vfo(rig, vfo_save);
|
||||
RETURNFUNC(
|
||||
RIG_OK); // would be better as error but other software won't handle errors
|
||||
}
|
||||
|
@ -1751,7 +1755,7 @@ int HAMLIB_API rig_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
|
||||
set_cache_freq(rig, vfo, (freq_t)0);
|
||||
|
||||
#if 0 // this verification seems to be causing bad behavior on some reigs
|
||||
#if 0 // this verification seems to be causing bad behavior on some rigs
|
||||
|
||||
if (caps->get_freq)
|
||||
{
|
||||
|
@ -1789,8 +1793,6 @@ int HAMLIB_API rig_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
{
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: not a TARGETABLE_FREQ vfo=%s\n", __func__,
|
||||
rig_strvfo(vfo));
|
||||
int rc2;
|
||||
vfo_t curr_vfo;
|
||||
|
||||
if (!caps->set_vfo)
|
||||
{
|
||||
|
@ -1801,33 +1803,12 @@ int HAMLIB_API rig_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
{
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: Ignoring set_freq due to VFO twiddling\n",
|
||||
__func__);
|
||||
if (vfo != vfo_save && vfo != RIG_VFO_CURR) rig_set_vfo(rig, vfo_save);
|
||||
RETURNFUNC(
|
||||
RIG_OK); // would be better as error but other software won't handle errors
|
||||
}
|
||||
|
||||
curr_vfo = rig->state.current_vfo;
|
||||
retcode = caps->set_vfo(rig, vfo);
|
||||
// why is the line below here?
|
||||
// it's causing set_freq on the wrong vfo
|
||||
//vfo = rig->state.current_vfo; // can't call get_vfo since Icoms don't have it
|
||||
|
||||
if (retcode != RIG_OK)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: set_vfo(%s) err %.10000s\n", __func__,
|
||||
rig_strvfo(vfo), rigerror(retcode));
|
||||
RETURNFUNC(retcode);
|
||||
}
|
||||
|
||||
|
||||
retcode = caps->set_freq(rig, vfo, freq);
|
||||
/* try and revert even if we had an error above */
|
||||
rc2 = caps->set_vfo(rig, curr_vfo);
|
||||
|
||||
if (RIG_OK == retcode)
|
||||
{
|
||||
/* return the first error code */
|
||||
retcode = rc2;
|
||||
}
|
||||
}
|
||||
|
||||
if (retcode == RIG_OK && caps->get_freq != NULL)
|
||||
|
@ -1865,6 +1846,8 @@ int HAMLIB_API rig_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
|
||||
set_cache_freq(rig, vfo, freq_new);
|
||||
|
||||
if (vfo != vfo_save && vfo != RIG_VFO_CURR) rig_set_vfo(rig, vfo_save);
|
||||
|
||||
RETURNFUNC(retcode);
|
||||
}
|
||||
|
||||
|
@ -1912,6 +1895,8 @@ int HAMLIB_API rig_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
|
||||
vfo = vfo_fixup(rig, vfo);
|
||||
|
||||
if (vfo == RIG_VFO_CURR) vfo = curr_vfo;
|
||||
|
||||
// we ignore get_freq for the uplink VFO for gpredict to behave better
|
||||
if ((rig->state.uplink == 1 && vfo == RIG_VFO_SUB)
|
||||
|| (rig->state.uplink == 2 && vfo == RIG_VFO_MAIN))
|
||||
|
@ -2490,9 +2475,11 @@ int HAMLIB_API rig_set_vfo(RIG *rig, vfo_t vfo)
|
|||
|
||||
ENTERFUNC;
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called vfo=%s\n", __func__, rig_strvfo(vfo));
|
||||
|
||||
if (vfo == RIG_VFO_B || vfo == RIG_VFO_SUB)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s ********************** called vfo=%s\n", __func__, rig_strvfo(vfo));
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s ********************** called vfo=%s\n",
|
||||
__func__, rig_strvfo(vfo));
|
||||
}
|
||||
|
||||
if (CHECK_RIG_ARG(rig))
|
||||
|
@ -4094,7 +4081,7 @@ int HAMLIB_API rig_set_split_freq_mode(RIG *rig,
|
|||
|
||||
// in split mode we alwasy use VFOB
|
||||
// in the future we may start using RIG_VFO_TX and let the backend figure out what VFO to use
|
||||
vfo = vfo_fixup(rig,RIG_VFO_B); // in split mode we always use VFOB/Sub for TX
|
||||
vfo = vfo_fixup(rig, RIG_VFO_B); // in split mode we always use VFOB/Sub for TX
|
||||
rig_debug(RIG_DEBUG_VERBOSE,
|
||||
"%s: vfo=%s, tx_freq=%.0f, tx_mode=%s, tx_width=%d\n", __func__,
|
||||
rig_strvfo(vfo), tx_freq, rig_strrmode(tx_mode), (int)tx_width);
|
||||
|
@ -4347,7 +4334,8 @@ int HAMLIB_API rig_get_split_vfo(RIG *rig,
|
|||
|
||||
if (!split || !tx_vfo)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: split or tx_vfo is null, split=%p, tx_vfo=%p\n", __func__, split, tx_vfo);
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: split or tx_vfo is null, split=%p, tx_vfo=%p\n",
|
||||
__func__, split, tx_vfo);
|
||||
RETURNFUNC(-RIG_EINVAL);
|
||||
}
|
||||
|
||||
|
@ -4358,7 +4346,9 @@ int HAMLIB_API rig_get_split_vfo(RIG *rig,
|
|||
// if we can't get the vfo we will return whatever we have cached
|
||||
*split = rig->state.cache.split;
|
||||
*tx_vfo = rig->state.cache.split_vfo;
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: no get_split_vfo so returning split=%d, tx_vfo=%s\n", __func__, *split, rig_strvfo(*tx_vfo));
|
||||
rig_debug(RIG_DEBUG_VERBOSE,
|
||||
"%s: no get_split_vfo so returning split=%d, tx_vfo=%s\n", __func__, *split,
|
||||
rig_strvfo(*tx_vfo));
|
||||
RETURNFUNC(RIG_OK);
|
||||
}
|
||||
|
||||
|
|
|
@ -344,12 +344,6 @@ int dumpcaps(RIG *rig, FILE *fout)
|
|||
caps->level_gran);
|
||||
fprintf(fout, "Get level: %s\n", prntbuf);
|
||||
|
||||
if ((caps->has_get_level & RIG_LEVEL_SQLSTAT))
|
||||
{
|
||||
fprintf(fout, "Warning--backend uses deprecated SQLSTAT level!\n");
|
||||
backend_warnings++;
|
||||
}
|
||||
|
||||
if ((caps->has_get_level & RIG_LEVEL_RAWSTR)
|
||||
&& caps->str_cal.size == 0
|
||||
&& !(caps->has_get_level & RIG_LEVEL_STRENGTH))
|
||||
|
|
|
@ -170,12 +170,6 @@ int dumpcaps_rot(ROT *rot, FILE *fout)
|
|||
caps->level_gran);
|
||||
fprintf(fout, "Get level: %s\n", prntbuf);
|
||||
|
||||
if ((caps->has_get_level & RIG_LEVEL_SQLSTAT))
|
||||
{
|
||||
fprintf(fout, "Warning--backend uses deprecated SQLSTAT level!\n");
|
||||
backend_warnings++;
|
||||
}
|
||||
|
||||
rot_sprintf_level_gran(prntbuf, sizeof(prntbuf), caps->has_set_level,
|
||||
caps->level_gran);
|
||||
fprintf(fout, "Set level: %s\n", prntbuf);
|
||||
|
|
|
@ -522,6 +522,19 @@ int main(int argc, char *argv[])
|
|||
*/
|
||||
if (dump_caps_opt)
|
||||
{
|
||||
|
||||
// if rigctld then we need to open to get the rig caps
|
||||
if (my_model == RIG_MODEL_NETRIGCTL) {
|
||||
int ret;
|
||||
rig_set_debug(verbose);
|
||||
my_rig = rig_init(my_model);
|
||||
if((ret=rig_open(my_rig)) != RIG_OK)
|
||||
{
|
||||
fprintf(stderr,"Unable to open rigctld: %s\n", rigerror(ret));
|
||||
exit(1);
|
||||
}
|
||||
rig_close(my_rig);
|
||||
}
|
||||
dumpcaps(my_rig, stdout);
|
||||
rig_cleanup(my_rig); /* if you care about memory */
|
||||
exit(0);
|
||||
|
|
|
@ -1651,11 +1651,13 @@ int rigctl_parse(RIG *my_rig, FILE *fin, FILE *fout, char *argv[], int argc,
|
|||
}
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: vfo_opt=%d\n", __func__, *vfo_opt);
|
||||
|
||||
if (my_rig->state.comm_state == 0)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_WARN, "%s: rig not open...trying to reopen\n", __func__);
|
||||
rig_open(my_rig);
|
||||
}
|
||||
|
||||
retcode = (*cmd_entry->rig_routine)(my_rig,
|
||||
fout,
|
||||
fin,
|
||||
|
|
|
@ -16,15 +16,16 @@
|
|||
#define BUFSIZE 256
|
||||
|
||||
int civ_731_mode = 0;
|
||||
vfo_t vfo_curr = RIG_VFO_A;
|
||||
vfo_t current_vfo = RIG_VFO_A;
|
||||
int split = 0;
|
||||
|
||||
// we make B different from A to ensure we see a difference at startup
|
||||
float freqA = 14074000;
|
||||
float freqB = 14074500;
|
||||
mode_t modeA = RIG_MODE_CW;
|
||||
mode_t modeB = RIG_MODE_CW;
|
||||
pbwidth_t widthA = 200;
|
||||
pbwidth_t widthB = 300;
|
||||
mode_t modeB = RIG_MODE_USB;
|
||||
pbwidth_t widthA = 0;
|
||||
pbwidth_t widthB = 1;
|
||||
|
||||
void dumphex(unsigned char *buf, int n)
|
||||
{
|
||||
|
@ -75,7 +76,7 @@ void frameParse(int fd, unsigned char *frame, int len)
|
|||
case 0x03:
|
||||
|
||||
//from_bcd(frameackbuf[2], (civ_731_mode ? 4 : 5) * 2);
|
||||
if (vfo_curr == RIG_VFO_A || vfo_curr == RIG_VFO_MAIN)
|
||||
if (current_vfo == RIG_VFO_A || current_vfo == RIG_VFO_MAIN)
|
||||
{
|
||||
printf("get_freqA\n");
|
||||
to_bcd(&frame[5], (long long)freqA, (civ_731_mode ? 4 : 5) * 2);
|
||||
|
@ -90,21 +91,48 @@ void frameParse(int fd, unsigned char *frame, int len)
|
|||
write(fd, frame, 11);
|
||||
break;
|
||||
|
||||
case 0x04:
|
||||
if (current_vfo == RIG_VFO_A || current_vfo == RIG_VFO_MAIN)
|
||||
{
|
||||
printf("get_modeA\n");
|
||||
frame[5] = modeA;
|
||||
frame[6] = widthA;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("get_modeB\n");
|
||||
frame[5] = modeB;
|
||||
frame[6] = widthB;
|
||||
}
|
||||
|
||||
frame[7] = 0xfd;
|
||||
write(fd, frame, 8);
|
||||
break;
|
||||
|
||||
case 0x05:
|
||||
freq = from_bcd(&frame[5], (civ_731_mode ? 4 : 5) * 2);
|
||||
printf("set_freq to %.0f\n", freq);
|
||||
|
||||
if (vfo_curr == RIG_VFO_A || vfo_curr == RIG_VFO_MAIN) { freqA = freq; }
|
||||
if (current_vfo == RIG_VFO_A || current_vfo == RIG_VFO_MAIN) { freqA = freq; }
|
||||
else { freqB = freq; }
|
||||
|
||||
// case 0x06:
|
||||
|
||||
|
||||
|
||||
case 0x07:
|
||||
|
||||
if (frame[5] == 0xd0) { vfo_curr = RIG_VFO_MAIN; }
|
||||
else if (frame[5] == 0xd1) { vfo_curr = RIG_VFO_SUB; }
|
||||
switch (frame[5])
|
||||
{
|
||||
case 0x00: current_vfo = RIG_VFO_A; break;
|
||||
|
||||
printf("set_vfo to %s\n", rig_strvfo(vfo_curr));
|
||||
case 0x01: current_vfo = RIG_VFO_B; break;
|
||||
|
||||
case 0xd0: current_vfo = RIG_VFO_MAIN; break;
|
||||
|
||||
case 0xd1: current_vfo = RIG_VFO_SUB; break;
|
||||
}
|
||||
|
||||
printf("set_vfo to %s\n", rig_strvfo(current_vfo));
|
||||
|
||||
frame[4] = 0xfb;
|
||||
frame[5] = 0xfd;
|
||||
|
@ -121,6 +149,21 @@ void frameParse(int fd, unsigned char *frame, int len)
|
|||
write(fd, frame, 6);
|
||||
break;
|
||||
|
||||
case 0x1a: // miscellaneous things
|
||||
switch (frame[5])
|
||||
{
|
||||
case 0x03: // width
|
||||
if (current_vfo == RIG_VFO_A || current_vfo == RIG_VFO_MAIN) { frame[6] = widthA; }
|
||||
else { frame[6] = widthB; }
|
||||
|
||||
frame[7] = 0xfd;
|
||||
write(fd, frame, 8);
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
#if 0
|
||||
case 0x25:
|
||||
if (frame[6] == 0xfd)
|
||||
{
|
||||
|
@ -151,6 +194,7 @@ void frameParse(int fd, unsigned char *frame, int len)
|
|||
}
|
||||
|
||||
break;
|
||||
#endif
|
||||
|
||||
default: printf("cmd 0x%02x unknown\n", frame[4]);
|
||||
}
|
||||
|
@ -164,10 +208,12 @@ int openPort(char *comport) // doesn't matter for using pts devices
|
|||
{
|
||||
int fd;
|
||||
fd = open(comport, O_RDWR);
|
||||
|
||||
if (fd < 0)
|
||||
{
|
||||
perror(comport);
|
||||
}
|
||||
|
||||
return fd;
|
||||
}
|
||||
|
||||
|
@ -197,8 +243,14 @@ int openPort(char *comport) // doesn't matter for using pts devices
|
|||
|
||||
void rigStatus()
|
||||
{
|
||||
printf("VFOA: mode=%s width=%ld freq=%.0f\n", rig_strrmode(modeA), widthA, freqA);
|
||||
printf("VFOB: mode=%s width=%ld freq=%.0f\n", rig_strrmode(modeB), widthB, freqB);
|
||||
char vfoa = current_vfo == RIG_VFO_A ? '*' : ' ';
|
||||
char vfob = current_vfo == RIG_VFO_B ? '*' : ' ';
|
||||
printf("%cVFOA: mode=%s width=%ld freq=%.0f\n", vfoa, rig_strrmode(modeA),
|
||||
widthA,
|
||||
freqA);
|
||||
printf("%cVFOB: mode=%s width=%ld freq=%.0f\n", vfob, rig_strrmode(modeB),
|
||||
widthB,
|
||||
freqB);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
|
@ -208,13 +260,16 @@ int main(int argc, char **argv)
|
|||
|
||||
printf("%s: %s\n", argv[0], rig_version());
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
|
||||
if (argc != 2)
|
||||
{
|
||||
printf("Missing comport argument\n");
|
||||
printf("%s [comport]\n", argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
while (1)
|
||||
{
|
||||
int len = frameGet(fd, buf);
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#define SERIAL_PORT "/dev/ttyUSB0"
|
||||
#define SERIAL_PORT "/dev/pts/2"
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
|
|
Ładowanie…
Reference in New Issue