kopia lustrzana https://github.com/Hamlib/Hamlib
More pointers to state
rodzic
406b947134
commit
4b436479d1
|
@ -96,10 +96,10 @@ int elecraft_open(RIG *rig)
|
|||
{
|
||||
int err;
|
||||
char buf[KENWOOD_MAX_BUF_LEN];
|
||||
struct kenwood_priv_data *priv = rig->state.priv;
|
||||
char *model = "Unknown";
|
||||
struct rig_state *rs = &rig->state;
|
||||
struct rig_state *rs = STATE(rig);
|
||||
struct hamlib_port *rp = RIGPORT(rig);
|
||||
struct kenwood_priv_data *priv = rs->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called, rig version=%s\n", __func__,
|
||||
rig->caps->version);
|
||||
|
@ -395,7 +395,7 @@ int elecraft_open(RIG *rig)
|
|||
|
||||
int elecraft_close(RIG *rig)
|
||||
{
|
||||
const struct kenwood_priv_data *priv = rig->state.priv;
|
||||
const struct kenwood_priv_data *priv = STATE(rig)->priv;
|
||||
|
||||
if (priv->save_k2_ext_lvl >= 0)
|
||||
{
|
||||
|
@ -622,12 +622,12 @@ int elecraft_get_vfo_tq(RIG *rig, vfo_t *vfo)
|
|||
rig_debug(RIG_DEBUG_ERR, "%s: unable to parse TQ '%s'\n", __func__, splitbuf);
|
||||
}
|
||||
|
||||
*vfo = rig->state.tx_vfo = RIG_VFO_A;
|
||||
*vfo = STATE(rig)->tx_vfo = RIG_VFO_A;
|
||||
|
||||
if (tq && ft == 1) { *vfo = rig->state.tx_vfo = RIG_VFO_B; }
|
||||
else if (tq && ft == 0) { *vfo = rig->state.tx_vfo = RIG_VFO_A; }
|
||||
if (tq && ft == 1) { *vfo = STATE(rig)->tx_vfo = RIG_VFO_B; }
|
||||
else if (tq && ft == 0) { *vfo = STATE(rig)->tx_vfo = RIG_VFO_A; }
|
||||
|
||||
if (!tq && fr == 1) { *vfo = rig->state.rx_vfo = rig->state.tx_vfo = RIG_VFO_B; }
|
||||
if (!tq && fr == 1) { *vfo = STATE(rig)->rx_vfo = STATE(rig)->tx_vfo = RIG_VFO_B; }
|
||||
|
||||
RETURNFUNC2(RIG_OK);
|
||||
}
|
||||
|
|
|
@ -113,13 +113,13 @@ int verify_flexradio_id(RIG *rig, char *id)
|
|||
|
||||
int flexradio_open(RIG *rig)
|
||||
{
|
||||
struct kenwood_priv_data *priv = rig->state.priv;
|
||||
struct kenwood_priv_data *priv = STATE(rig)->priv;
|
||||
int err;
|
||||
char id[FLEXRADIO_MAX_BUF_LEN];
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
//struct flexradio_priv_data *priv = rig->state.priv;
|
||||
//struct flexradio_priv_data *priv = STATE(rig)->priv;
|
||||
|
||||
/* Use check for "ID017;" to verify rig is reachable */
|
||||
err = verify_flexradio_id(rig, id);
|
||||
|
|
|
@ -178,7 +178,7 @@ static int flex6k_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
|
|||
|
||||
if ((vfo == RIG_VFO_VFO) || (vfo == RIG_VFO_CURR))
|
||||
{
|
||||
vfo = rig->state.current_vfo;
|
||||
vfo = STATE(rig)->current_vfo;
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: setting VFO to current\n", __func__);
|
||||
}
|
||||
|
||||
|
@ -275,7 +275,7 @@ static int powersdr_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode,
|
|||
|
||||
if ((vfo == RIG_VFO_VFO) || (vfo == RIG_VFO_CURR))
|
||||
{
|
||||
vfo = rig->state.current_vfo;
|
||||
vfo = STATE(rig)->current_vfo;
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: setting VFO to current\n", __func__);
|
||||
}
|
||||
|
||||
|
@ -451,7 +451,7 @@ static int flex6k_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
|||
|
||||
if ((vfo == RIG_VFO_VFO) || (vfo == RIG_VFO_CURR))
|
||||
{
|
||||
vfo = rig->state.current_vfo;
|
||||
vfo = STATE(rig)->current_vfo;
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: setting VFO to current\n", __func__);
|
||||
}
|
||||
|
||||
|
@ -523,7 +523,7 @@ static int powersdr_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
|||
|
||||
if ((vfo == RIG_VFO_VFO) || (vfo == RIG_VFO_CURR))
|
||||
{
|
||||
vfo = rig->state.current_vfo;
|
||||
vfo = STATE(rig)->current_vfo;
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: setting VFO to current\n", __func__);
|
||||
}
|
||||
|
||||
|
|
|
@ -259,7 +259,7 @@ struct rig_caps k2_caps =
|
|||
int k2_open(RIG *rig)
|
||||
{
|
||||
int err;
|
||||
struct kenwood_priv_data *priv = rig->state.priv;
|
||||
struct kenwood_priv_data *priv = STATE(rig)->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
|
@ -293,7 +293,7 @@ int k2_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
|||
int err;
|
||||
char f = '*';
|
||||
struct k2_filt_lst_s *flt;
|
||||
const struct kenwood_priv_data *priv = rig->state.priv;
|
||||
const struct kenwood_priv_data *priv = STATE(rig)->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
|
|
|
@ -1007,7 +1007,7 @@ int k3_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
|
|||
char *cmd_data = "DT";
|
||||
char *cmd_bw = "BW";
|
||||
int cmd_bw_len = 6;
|
||||
const struct kenwood_priv_data *priv = rig->state.priv;
|
||||
const struct kenwood_priv_data *priv = STATE(rig)->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called vfo=%s\n", __func__, rig_strvfo(vfo));
|
||||
|
||||
|
@ -1031,7 +1031,7 @@ int k3_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
|
|||
|
||||
if (vfo == RIG_VFO_CURR)
|
||||
{
|
||||
vfo = rig->state.current_vfo;
|
||||
vfo = STATE(rig)->current_vfo;
|
||||
}
|
||||
|
||||
err = kenwood_get_mode(rig, vfo, &temp_m, &temp_w);
|
||||
|
@ -1159,14 +1159,14 @@ int k3_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
|||
char buf[KENWOOD_MAX_BUF_LEN];
|
||||
char *dtcmd;
|
||||
struct kenwood_priv_caps *caps = kenwood_caps(rig);
|
||||
struct kenwood_priv_data *priv = rig->state.priv;
|
||||
struct kenwood_priv_data *priv = STATE(rig)->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called vfo=%s mode=%s width=%d\n", __func__,
|
||||
rig_strvfo(vfo), rig_strrmode(mode), (int)width);
|
||||
|
||||
if (vfo == RIG_VFO_CURR)
|
||||
{
|
||||
vfo = rig->state.current_vfo;
|
||||
vfo = STATE(rig)->current_vfo;
|
||||
}
|
||||
|
||||
rmode_t tmodeA, tmodeB;
|
||||
|
@ -1361,7 +1361,7 @@ int k3_set_vfo(RIG *rig, vfo_t vfo)
|
|||
ENTERFUNC;
|
||||
|
||||
// we emulate vfo selection for Elecraft
|
||||
rig->state.current_vfo = vfo;
|
||||
STATE(rig)->current_vfo = vfo;
|
||||
|
||||
RETURNFUNC(RIG_OK);
|
||||
}
|
||||
|
@ -1370,7 +1370,7 @@ int k3_get_vfo(RIG *rig, vfo_t *vfo)
|
|||
{
|
||||
ENTERFUNC;
|
||||
|
||||
*vfo = rig->state.current_vfo;
|
||||
*vfo = STATE(rig)->current_vfo;
|
||||
|
||||
RETURNFUNC(RIG_OK);
|
||||
}
|
||||
|
@ -1552,7 +1552,7 @@ int k3_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width)
|
|||
char kmode;
|
||||
int err;
|
||||
char cmd_m[16];
|
||||
const struct kenwood_priv_data *priv = rig->state.priv;
|
||||
const struct kenwood_priv_data *priv = STATE(rig)->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
|
@ -1828,7 +1828,7 @@ static int k3_get_maxpower(RIG *rig)
|
|||
//int retval;
|
||||
int maxpower = 15; // K3 default power level
|
||||
//char levelbuf[KENWOOD_MAX_BUF_LEN];
|
||||
const struct kenwood_priv_data *priv = rig->state.priv;
|
||||
const struct kenwood_priv_data *priv = STATE(rig)->priv;
|
||||
|
||||
// default range is 0-15 if there is no KPA3 installed
|
||||
if (priv->has_kpa3 || priv->has_kpa100)
|
||||
|
@ -1952,9 +1952,9 @@ int k3_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
|
|||
int i;
|
||||
int foundit = 0;
|
||||
|
||||
for (i = 0; i < HAMLIB_MAXDBLSTSIZ && rig->state.attenuator[i]; i++)
|
||||
for (i = 0; i < HAMLIB_MAXDBLSTSIZ && STATE(rig)->attenuator[i]; i++)
|
||||
{
|
||||
if (val.i == rig->state.attenuator[i])
|
||||
if (val.i == STATE(rig)->attenuator[i])
|
||||
{
|
||||
SNPRINTF(levelbuf, sizeof(levelbuf), "RA%02d", i + 1);
|
||||
foundit = 1;
|
||||
|
@ -2019,7 +2019,7 @@ int k3_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
int retval;
|
||||
int lvl;
|
||||
size_t len;
|
||||
const struct kenwood_priv_data *priv = rig->state.priv;
|
||||
const struct kenwood_priv_data *priv = STATE(rig)->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
|
@ -2191,7 +2191,7 @@ int k3_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
|
||||
for (i = 0; i < lvl && i < HAMLIB_MAXDBLSTSIZ; i++)
|
||||
{
|
||||
if (rig->state.attenuator[i] == 0)
|
||||
if (STATE(rig)->attenuator[i] == 0)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: unexpected att level %d\n", __func__, lvl);
|
||||
return -RIG_EPROTO;
|
||||
|
@ -2203,7 +2203,7 @@ int k3_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
return -RIG_EINTERNAL;
|
||||
}
|
||||
|
||||
val->i = rig->state.attenuator[i - 1];
|
||||
val->i = STATE(rig)->attenuator[i - 1];
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -2432,7 +2432,7 @@ int kx3_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
|
||||
case RIG_LEVEL_RFPOWER_METER_WATTS:
|
||||
{
|
||||
struct kenwood_priv_data *priv = rig->state.priv;
|
||||
struct kenwood_priv_data *priv = STATE(rig)->priv;
|
||||
char levelbuf[KENWOOD_MAX_BUF_LEN];
|
||||
int pwr;
|
||||
|
||||
|
|
|
@ -793,6 +793,7 @@ int pihpsdr_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
|
|||
{
|
||||
char levelbuf[16];
|
||||
int i, kenwood_val;
|
||||
struct rig_state *rs = STATE(rig);
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
|
@ -853,9 +854,9 @@ int pihpsdr_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
|
|||
{
|
||||
int foundit = 0;
|
||||
|
||||
for (i = 0; i < HAMLIB_MAXDBLSTSIZ && rig->state.attenuator[i]; i++)
|
||||
for (i = 0; i < HAMLIB_MAXDBLSTSIZ && rs->attenuator[i]; i++)
|
||||
{
|
||||
if (val.i == rig->state.attenuator[i])
|
||||
if (val.i == rs->attenuator[i])
|
||||
{
|
||||
SNPRINTF(levelbuf, sizeof(levelbuf), "RA%02d", i + 1);
|
||||
foundit = 1;
|
||||
|
@ -882,9 +883,9 @@ int pihpsdr_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
|
|||
{
|
||||
int foundit = 0;
|
||||
|
||||
for (i = 0; i < HAMLIB_MAXDBLSTSIZ && rig->state.preamp[i]; i++)
|
||||
for (i = 0; i < HAMLIB_MAXDBLSTSIZ && rs->preamp[i]; i++)
|
||||
{
|
||||
if (val.i == rig->state.preamp[i])
|
||||
if (val.i == rs->preamp[i])
|
||||
{
|
||||
SNPRINTF(levelbuf, sizeof(levelbuf), "PA%01d", i + 1);
|
||||
foundit = 1;
|
||||
|
@ -987,7 +988,7 @@ int pihpsdr_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
|
||||
if (lvl > 9)
|
||||
{
|
||||
val->i = rig->state.preamp[0];
|
||||
val->i = STATE(rig)->preamp[0];
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -1018,7 +1019,7 @@ int pihpsdr_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
|
||||
if (lvl > 99)
|
||||
{
|
||||
val->i = rig->state.attenuator[0]; /* Since the TS-2000 only has one step on the attenuator */
|
||||
val->i = STATE(rig)->attenuator[0]; /* Since the TS-2000 only has one step on the attenuator */
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
@ -214,7 +214,7 @@ th_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: called %s\n", __func__, rig_strvfo(vfo));
|
||||
|
||||
if (vfo != RIG_VFO_CURR && vfo != rig->state.current_vfo)
|
||||
if (vfo != RIG_VFO_CURR && vfo != STATE(rig)->current_vfo)
|
||||
{
|
||||
return kenwood_wrong_vfo(__func__, vfo);
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ th_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__);
|
||||
|
||||
if (vfo != RIG_VFO_CURR && vfo != rig->state.current_vfo)
|
||||
if (vfo != RIG_VFO_CURR && vfo != STATE(rig)->current_vfo)
|
||||
{
|
||||
return kenwood_wrong_vfo(__func__, vfo);
|
||||
}
|
||||
|
@ -292,7 +292,7 @@ th_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
|||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__);
|
||||
|
||||
if (vfo != RIG_VFO_CURR && vfo != rig->state.current_vfo)
|
||||
if (vfo != RIG_VFO_CURR && vfo != STATE(rig)->current_vfo)
|
||||
{
|
||||
return kenwood_wrong_vfo(__func__, vfo);
|
||||
}
|
||||
|
@ -348,7 +348,7 @@ th_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
|
|||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__);
|
||||
|
||||
if (vfo != RIG_VFO_CURR && vfo != rig->state.current_vfo)
|
||||
if (vfo != RIG_VFO_CURR && vfo != STATE(rig)->current_vfo)
|
||||
{
|
||||
return kenwood_wrong_vfo(__func__, vfo);
|
||||
}
|
||||
|
@ -624,7 +624,8 @@ th_get_vfo(RIG *rig, vfo_t *vfo)
|
|||
*/
|
||||
int tm_set_vfo_bc2(RIG *rig, vfo_t vfo)
|
||||
{
|
||||
const struct kenwood_priv_data *priv = rig->state.priv;
|
||||
struct rig_state *rs = STATE(rig);
|
||||
const struct kenwood_priv_data *priv = rs->priv;
|
||||
char cmd[16];
|
||||
int vfonum, txvfonum, vfomode = 0;
|
||||
int retval;
|
||||
|
@ -638,14 +639,14 @@ int tm_set_vfo_bc2(RIG *rig, vfo_t vfo)
|
|||
vfonum = 0;
|
||||
/* put back split mode when toggling */
|
||||
txvfonum = (priv->split == RIG_SPLIT_ON &&
|
||||
rig->state.tx_vfo == RIG_VFO_B) ? 1 : vfonum;
|
||||
rs->tx_vfo == RIG_VFO_B) ? 1 : vfonum;
|
||||
break;
|
||||
|
||||
case RIG_VFO_B:
|
||||
vfonum = 1;
|
||||
/* put back split mode when toggling */
|
||||
txvfonum = (priv->split == RIG_SPLIT_ON &&
|
||||
rig->state.tx_vfo == RIG_VFO_A) ? 0 : vfonum;
|
||||
rs->tx_vfo == RIG_VFO_A) ? 0 : vfonum;
|
||||
break;
|
||||
|
||||
case RIG_VFO_MEM:
|
||||
|
@ -687,7 +688,7 @@ int tm_set_vfo_bc2(RIG *rig, vfo_t vfo)
|
|||
|
||||
int th_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t txvfo)
|
||||
{
|
||||
struct kenwood_priv_data *priv = rig->state.priv;
|
||||
struct kenwood_priv_data *priv = STATE(rig)->priv;
|
||||
char vfobuf[16];
|
||||
int vfonum, txvfonum;
|
||||
int retval;
|
||||
|
@ -758,7 +759,7 @@ int th_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t txvfo)
|
|||
|
||||
int th_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *txvfo)
|
||||
{
|
||||
struct kenwood_priv_data *priv = rig->state.priv;
|
||||
struct kenwood_priv_data *priv = STATE(rig)->priv;
|
||||
char buf[10];
|
||||
int retval;
|
||||
|
||||
|
@ -1125,12 +1126,13 @@ th_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
char vch, buf[10], ackbuf[20];
|
||||
int retval, v;
|
||||
unsigned int l;
|
||||
struct rig_state *rs = STATE(rig);
|
||||
|
||||
vfo_t tvfo;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__);
|
||||
|
||||
tvfo = (vfo == RIG_VFO_CURR) ? rig->state.current_vfo : vfo;
|
||||
tvfo = (vfo == RIG_VFO_CURR) ? rs->current_vfo : vfo;
|
||||
|
||||
switch (tvfo)
|
||||
{
|
||||
|
@ -1277,7 +1279,7 @@ th_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
}
|
||||
else
|
||||
{
|
||||
val->i = rig->state.attenuator[ackbuf[4] - '1'];
|
||||
val->i = rs->attenuator[ackbuf[4] - '1'];
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -1318,7 +1320,7 @@ int th_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
|
|||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__);
|
||||
|
||||
tvfo = (vfo == RIG_VFO_CURR) ? rig->state.current_vfo : vfo;
|
||||
tvfo = (vfo == RIG_VFO_CURR) ? STATE(rig)->current_vfo : vfo;
|
||||
|
||||
switch (tvfo)
|
||||
{
|
||||
|
@ -1700,7 +1702,7 @@ th_set_mem(RIG *rig, vfo_t vfo, int ch)
|
|||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__);
|
||||
|
||||
tvfo = (vfo == RIG_VFO_CURR) ? rig->state.current_vfo : vfo;
|
||||
tvfo = (vfo == RIG_VFO_CURR) ? STATE(rig)->current_vfo : vfo;
|
||||
|
||||
switch (tvfo)
|
||||
{
|
||||
|
@ -1741,7 +1743,7 @@ th_get_mem(RIG *rig, vfo_t vfo, int *ch)
|
|||
rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__);
|
||||
|
||||
/* store current VFO */
|
||||
cvfo = rig->state.current_vfo;
|
||||
cvfo = STATE(rig)->current_vfo;
|
||||
|
||||
/* check if we should switch VFO */
|
||||
if (cvfo != RIG_VFO_MEM)
|
||||
|
@ -1866,7 +1868,7 @@ int th_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
|
|||
{
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__);
|
||||
|
||||
if (vfo != RIG_VFO_CURR && vfo != rig->state.current_vfo)
|
||||
if (vfo != RIG_VFO_CURR && vfo != STATE(rig)->current_vfo)
|
||||
{
|
||||
return kenwood_wrong_vfo(__func__, vfo);
|
||||
}
|
||||
|
@ -2053,7 +2055,7 @@ int th_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only)
|
|||
chan->flags = lockout ? RIG_CHFLAG_SKIP : 0;
|
||||
chan->freq = freq;
|
||||
chan->vfo = RIG_VFO_MEM;
|
||||
chan->tuning_step = rig->state.tuning_steps[step].ts;
|
||||
chan->tuning_step = STATE(rig)->tuning_steps[step].ts;
|
||||
|
||||
if (priv->mode_table)
|
||||
{
|
||||
|
@ -2228,8 +2230,8 @@ int th_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
|
|||
|
||||
channel_num = chan->channel_num;
|
||||
|
||||
for (step = 0; rig->state.tuning_steps[step].ts != 0; step++)
|
||||
if (chan->tuning_step <= rig->state.tuning_steps[step].ts)
|
||||
for (step = 0; STATE(rig)->tuning_steps[step].ts != 0; step++)
|
||||
if (chan->tuning_step <= STATE(rig)->tuning_steps[step].ts)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -148,7 +148,7 @@ static struct kenwood_priv_caps thd72_priv_caps =
|
|||
int thd72_open(RIG *rig)
|
||||
{
|
||||
int ret;
|
||||
struct kenwood_priv_data *priv = rig->state.priv;
|
||||
struct kenwood_priv_data *priv = STATE(rig)->priv;
|
||||
strcpy(priv->verify_cmd, "ID\r");
|
||||
|
||||
//ret = kenwood_transaction(rig, "", NULL, 0);
|
||||
|
@ -170,12 +170,12 @@ static int thd72_set_vfo(RIG *rig, vfo_t vfo)
|
|||
case RIG_VFO_VFO:
|
||||
case RIG_VFO_MAIN:
|
||||
cmd = "BC 0";
|
||||
rig->state.current_vfo = RIG_VFO_A;
|
||||
STATE(rig)->current_vfo = RIG_VFO_A;
|
||||
break;
|
||||
|
||||
case RIG_VFO_B:
|
||||
case RIG_VFO_SUB:
|
||||
rig->state.current_vfo = RIG_VFO_B;
|
||||
STATE(rig)->current_vfo = RIG_VFO_B;
|
||||
cmd = "BC 1";
|
||||
break;
|
||||
|
||||
|
@ -192,7 +192,7 @@ static int thd72_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
|
|||
{
|
||||
int retval;
|
||||
char vfobuf[16];
|
||||
const struct kenwood_priv_data *priv = rig->state.priv;
|
||||
const struct kenwood_priv_data *priv = STATE(rig)->priv;
|
||||
char vfonum = '0';
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__);
|
||||
|
@ -257,7 +257,7 @@ static int thd72_get_vfo(RIG *rig, vfo_t *vfo)
|
|||
|
||||
static int thd72_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t txvfo)
|
||||
{
|
||||
struct kenwood_priv_data *priv = rig->state.priv;
|
||||
struct kenwood_priv_data *priv = STATE(rig)->priv;
|
||||
char vfobuf[16];
|
||||
int retval;
|
||||
|
||||
|
@ -302,7 +302,7 @@ static int thd72_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t txvfo)
|
|||
static int thd72_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
|
||||
vfo_t *txvfo)
|
||||
{
|
||||
struct kenwood_priv_data *priv = rig->state.priv;
|
||||
struct kenwood_priv_data *priv = STATE(rig)->priv;
|
||||
char buf[10];
|
||||
int retval;
|
||||
|
||||
|
@ -340,7 +340,7 @@ static int thd72_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
|
|||
static int thd72_vfoc(RIG *rig, vfo_t vfo, char *vfoc)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: called VFO=%s\n", __func__, rig_strvfo(vfo));
|
||||
vfo = (vfo == RIG_VFO_CURR) ? rig->state.current_vfo : vfo;
|
||||
vfo = (vfo == RIG_VFO_CURR) ? STATE(rig)->current_vfo : vfo;
|
||||
|
||||
switch (vfo)
|
||||
{
|
||||
|
@ -1520,7 +1520,7 @@ int thd72_get_chan_all_cb(RIG *rig, chan_cb_t chan_cb, rig_ptr_t arg)
|
|||
int i, j, ret;
|
||||
hamlib_port_t *rp = RIGPORT(rig);
|
||||
channel_t *chan;
|
||||
chan_t *chan_list = rig->state.chan_list;
|
||||
chan_t *chan_list = STATE(rig)->chan_list;
|
||||
int chan_next = chan_list[0].start;
|
||||
char block[BLOCK_SZ];
|
||||
char resp[CMD_SZ];
|
||||
|
|
|
@ -156,7 +156,7 @@ static struct kenwood_priv_caps thd74_priv_caps =
|
|||
int thd74_open(RIG *rig)
|
||||
{
|
||||
//int ret;
|
||||
//struct kenwood_priv_data *priv = rig->state.priv;
|
||||
//struct kenwood_priv_data *priv = STATE(rig)->priv;
|
||||
// this is already done in kenwood_init
|
||||
//strcpy(priv->verify_cmd, "ID\r");
|
||||
|
||||
|
@ -239,7 +239,7 @@ static int thd74_get_vfo(RIG *rig, vfo_t *vfo)
|
|||
|
||||
static int thd74_vfoc(RIG *rig, vfo_t vfo, char *vfoc)
|
||||
{
|
||||
vfo = (vfo == RIG_VFO_CURR) ? rig->state.current_vfo : vfo;
|
||||
vfo = (vfo == RIG_VFO_CURR) ? STATE(rig)->current_vfo : vfo;
|
||||
|
||||
switch (vfo)
|
||||
{
|
||||
|
@ -395,7 +395,7 @@ static int thd74_round_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
|
||||
static int thd74_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
||||
{
|
||||
struct kenwood_priv_data *priv = rig->state.priv;
|
||||
struct kenwood_priv_data *priv = STATE(rig)->priv;
|
||||
int retval;
|
||||
char buf[128], fbuf[12];
|
||||
|
||||
|
@ -422,7 +422,7 @@ static int thd74_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
|
||||
static int thd74_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
||||
{
|
||||
struct kenwood_priv_data *priv = rig->state.priv;
|
||||
struct kenwood_priv_data *priv = STATE(rig)->priv;
|
||||
int retval;
|
||||
char buf[128];
|
||||
|
||||
|
@ -1347,7 +1347,7 @@ static int thd74_get_channel(RIG *rig, vfo_t vfo, channel_t *chan,
|
|||
|
||||
int thd74_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t txvfo)
|
||||
{
|
||||
struct kenwood_priv_data *priv = rig->state.priv;
|
||||
struct kenwood_priv_data *priv = STATE(rig)->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__);
|
||||
|
||||
|
@ -1363,7 +1363,7 @@ int thd74_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t txvfo)
|
|||
|
||||
int thd74_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *txvfo)
|
||||
{
|
||||
struct kenwood_priv_data *priv = rig->state.priv;
|
||||
struct kenwood_priv_data *priv = STATE(rig)->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__);
|
||||
|
||||
|
@ -1385,7 +1385,7 @@ otherwise return -RIG_EPROTO
|
|||
*/
|
||||
int thd74_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq)
|
||||
{
|
||||
struct kenwood_priv_data *priv = rig->state.priv;
|
||||
struct kenwood_priv_data *priv = STATE(rig)->priv;
|
||||
int retval;
|
||||
char buf[128];
|
||||
|
||||
|
@ -1417,7 +1417,7 @@ otherwise return -RIG_EPROTO
|
|||
*/
|
||||
int thd74_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
|
||||
{
|
||||
struct kenwood_priv_data *priv = rig->state.priv;
|
||||
struct kenwood_priv_data *priv = STATE(rig)->priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__);
|
||||
|
||||
|
@ -1512,7 +1512,7 @@ int thd74_get_chan_all_cb(RIG *rig, chan_cb_t chan_cb, rig_ptr_t arg)
|
|||
int i, j, ret;
|
||||
hamlib_port_t *rp = RIGPORT(rig);
|
||||
channel_t *chan;
|
||||
chan_t *chan_list = rig->state.chan_list;
|
||||
chan_t *chan_list = STATE(rig)->chan_list;
|
||||
int chan_next = chan_list[0].start;
|
||||
char block[BLOCK_SZ];
|
||||
char resp[CMD_SZ];
|
||||
|
|
|
@ -497,6 +497,7 @@ int thg71_open(RIG *rig)
|
|||
char ackbuf[ACKBUF_LEN];
|
||||
int retval, i;
|
||||
const freq_range_t frend = RIG_FRNG_END;
|
||||
struct rig_state *rs = STATE(rig);
|
||||
|
||||
/* this will check the model id */
|
||||
retval = kenwood_open(rig);
|
||||
|
@ -546,7 +547,7 @@ int thg71_open(RIG *rig)
|
|||
frng.high_power = -1;
|
||||
frng.low_power = -1;
|
||||
frng.label = "";
|
||||
rig->state.rx_range_list[i] = frng;
|
||||
rs->rx_range_list[i] = frng;
|
||||
|
||||
if (frng.startf > MHz(200))
|
||||
{
|
||||
|
@ -558,12 +559,12 @@ int thg71_open(RIG *rig)
|
|||
}
|
||||
|
||||
frng.low_power = mW(50);
|
||||
rig->state.tx_range_list[i] = frng;
|
||||
rs->tx_range_list[i] = frng;
|
||||
}
|
||||
|
||||
rig->state.rx_range_list[i] = frend;
|
||||
rig->state.tx_range_list[i] = frend;
|
||||
rig->state.vfo_list = RIG_VFO_A | RIG_VFO_MEM ;
|
||||
rs->rx_range_list[i] = frend;
|
||||
rs->tx_range_list[i] = frend;
|
||||
rs->vfo_list = RIG_VFO_A | RIG_VFO_MEM ;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
|
|
@ -659,14 +659,14 @@ static int tmd710_open(RIG *rig)
|
|||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__);
|
||||
|
||||
rig->state.tx_vfo = RIG_VFO_A;
|
||||
STATE(rig)->tx_vfo = RIG_VFO_A;
|
||||
|
||||
// Get current RX and TX VFO state, do not care if we succeed or not
|
||||
tmd710_get_vfo(rig, &vfo);
|
||||
tmd710_get_split_vfo(rig, RIG_VFO_CURR, &split, &vfo);
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "rig->state.tx_vfo: %s\n",
|
||||
rig_strvfo(rig->state.tx_vfo));
|
||||
rig_debug(RIG_DEBUG_TRACE, "STATE(rig)->tx_vfo: %s\n",
|
||||
rig_strvfo(STATE(rig)->tx_vfo));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1288,7 +1288,7 @@ int tmd710_set_split_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__);
|
||||
|
||||
// Use the TX VFO for split
|
||||
return tmd710_do_set_freq(rig, rig->state.tx_vfo, freq);
|
||||
return tmd710_do_set_freq(rig, STATE(rig)->tx_vfo, freq);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1301,7 +1301,7 @@ int tmd710_get_split_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__);
|
||||
|
||||
// Use the TX VFO for split
|
||||
return tmd710_do_get_freq(rig, rig->state.tx_vfo, freq);
|
||||
return tmd710_do_get_freq(rig, STATE(rig)->tx_vfo, freq);
|
||||
}
|
||||
|
||||
static int tmd710_find_ctcss_index(RIG *rig, tone_t tone, int *ctcss_index)
|
||||
|
@ -1645,7 +1645,7 @@ static int tmd710_find_tuning_step_index(RIG *rig, shortfreq_t ts,
|
|||
{
|
||||
int k, stepind = -1;
|
||||
|
||||
for (k = 0; rig->state.tuning_steps[k].ts != 0; ++k)
|
||||
for (k = 0; STATE(rig)->tuning_steps[k].ts != 0; ++k)
|
||||
{
|
||||
|
||||
if ((rig->caps->tuning_steps[k].modes == RIG_MODE_NONE)
|
||||
|
@ -2030,7 +2030,7 @@ int tmd710_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t txvfo)
|
|||
return retval;
|
||||
}
|
||||
|
||||
rig->state.tx_vfo = txvfo;
|
||||
STATE(rig)->tx_vfo = txvfo;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
@ -2062,10 +2062,10 @@ int tmd710_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *txvfo)
|
|||
return -RIG_EPROTO;
|
||||
}
|
||||
|
||||
rig->state.tx_vfo = *txvfo;
|
||||
STATE(rig)->tx_vfo = *txvfo;
|
||||
|
||||
// Rig is always in "split mode" and VFOs are targetable, so simply check current and TX VFOs
|
||||
*split = rig->state.current_vfo == rig->state.tx_vfo ? RIG_SPLIT_OFF :
|
||||
*split = STATE(rig)->current_vfo == STATE(rig)->tx_vfo ? RIG_SPLIT_OFF :
|
||||
RIG_SPLIT_ON;
|
||||
|
||||
return RIG_OK;
|
||||
|
@ -2097,7 +2097,7 @@ int tmd710_get_mem(RIG *rig, vfo_t vfo, int *ch)
|
|||
}
|
||||
else
|
||||
{
|
||||
vfonum = rig->state.current_vfo == RIG_VFO_A ? 0 : 1;
|
||||
vfonum = STATE(rig)->current_vfo == RIG_VFO_A ? 0 : 1;
|
||||
}
|
||||
|
||||
snprintf(cmd, sizeof(cmd), "MR %d", vfonum);
|
||||
|
@ -2143,7 +2143,7 @@ int tmd710_set_mem(RIG *rig, vfo_t vfo, int ch)
|
|||
}
|
||||
else
|
||||
{
|
||||
vfonum = rig->state.current_vfo == RIG_VFO_A ? 0 : 1;
|
||||
vfonum = STATE(rig)->current_vfo == RIG_VFO_A ? 0 : 1;
|
||||
}
|
||||
|
||||
snprintf(cmd, sizeof(cmd), "MR %d,%03d", vfonum, ch);
|
||||
|
@ -2904,7 +2904,7 @@ int tmd710_set_parm(RIG *rig, setting_t parm, value_t val)
|
|||
|
||||
/*
|
||||
* tmd710_get_ext_level
|
||||
* Assumes rig!=NULL, rig->state.priv!=NULL, val!=NULL
|
||||
* Assumes rig!=NULL, STATE(rig)->priv!=NULL, val!=NULL
|
||||
*
|
||||
*/
|
||||
int tmd710_get_ext_level(RIG *rig, vfo_t vfo, hamlib_token_t token, value_t *val)
|
||||
|
@ -2938,7 +2938,7 @@ int tmd710_get_ext_level(RIG *rig, vfo_t vfo, hamlib_token_t token, value_t *val
|
|||
|
||||
/*
|
||||
* tmd710_set_ext_level
|
||||
* Assumes rig!=NULL, rig->state.priv!=NULL
|
||||
* Assumes rig!=NULL, STATE(rig)->priv!=NULL
|
||||
*
|
||||
*/
|
||||
int tmd710_set_ext_level(RIG *rig, vfo_t vfo, hamlib_token_t token, value_t val)
|
||||
|
|
|
@ -567,7 +567,7 @@ int tmv7_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only)
|
|||
|
||||
chan->freq = freq;
|
||||
chan->vfo = RIG_VFO_MEM;
|
||||
chan->tuning_step = rig->state.tuning_steps[step].ts;
|
||||
chan->tuning_step = STATE(rig)->tuning_steps[step].ts;
|
||||
|
||||
if (freq < MHz(138))
|
||||
{
|
||||
|
@ -672,8 +672,8 @@ int tmv7_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
|
|||
|
||||
freq = (long)chan->freq;
|
||||
|
||||
for (step = 0; rig->state.tuning_steps[step].ts != 0; step++)
|
||||
if (chan->tuning_step == rig->state.tuning_steps[step].ts) { break; }
|
||||
for (step = 0; STATE(rig)->tuning_steps[step].ts != 0; step++)
|
||||
if (chan->tuning_step == STATE(rig)->tuning_steps[step].ts) { break; }
|
||||
|
||||
switch (chan->rptr_shift)
|
||||
{
|
||||
|
|
|
@ -170,7 +170,7 @@ int transfox_open(RIG *rig)
|
|||
{
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__);
|
||||
|
||||
rig->state.current_vfo = RIG_VFO_A;
|
||||
STATE(rig)->current_vfo = RIG_VFO_A;
|
||||
|
||||
/* do not call kenwood_open(rig), rig has no "ID" command */
|
||||
|
||||
|
|
|
@ -275,7 +275,7 @@ int ts2000_init(RIG *rig)
|
|||
return retval;
|
||||
}
|
||||
|
||||
priv = (struct kenwood_priv_data *) rig->state.priv;
|
||||
priv = (struct kenwood_priv_data *) STATE(rig)->priv;
|
||||
|
||||
priv->ag_format = 3;
|
||||
priv->micgain_min = 0;
|
||||
|
@ -1004,7 +1004,7 @@ static int ts2000_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit)
|
|||
{
|
||||
int retval;
|
||||
char buf[7];
|
||||
struct kenwood_priv_data *priv = rig->state.priv;
|
||||
struct kenwood_priv_data *priv = STATE(rig)->priv;
|
||||
|
||||
ENTERFUNC;
|
||||
|
||||
|
|
|
@ -439,7 +439,7 @@ static int ts870s_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
else
|
||||
{
|
||||
for (i = 0; i < lvl && i < HAMLIB_MAXDBLSTSIZ; i++)
|
||||
if (rig->state.attenuator[i] == 0)
|
||||
if (STATE(rig)->attenuator[i] == 0)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "ts870s_get_level: "
|
||||
"unexpected att level %d\n", lvl);
|
||||
|
@ -451,7 +451,7 @@ static int ts870s_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
return -RIG_EINTERNAL;
|
||||
}
|
||||
|
||||
val->i = rig->state.attenuator[i - 1];
|
||||
val->i = STATE(rig)->attenuator[i - 1];
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
@ -412,11 +412,11 @@ int ts990s_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
switch (vfo)
|
||||
{
|
||||
case RIG_VFO_MAIN:
|
||||
val->i = '1' == lvlbuf[2] ? rig->state.preamp[0] : 0;
|
||||
val->i = '1' == lvlbuf[2] ? STATE(rig)->preamp[0] : 0;
|
||||
break;
|
||||
|
||||
case RIG_VFO_SUB:
|
||||
val->i = '1' == lvlbuf[3] ? rig->state.preamp[0] : 0;
|
||||
val->i = '1' == lvlbuf[3] ? STATE(rig)->preamp[0] : 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -456,7 +456,7 @@ int ts990s_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
}
|
||||
else
|
||||
{
|
||||
val->i = rig->state.attenuator[lvlbuf[3] - '1'];
|
||||
val->i = STATE(rig)->attenuator[lvlbuf[3] - '1'];
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
Ładowanie…
Reference in New Issue