More pointers to state

pull/1532/head
George Baltz N3GB 2024-03-16 11:25:46 -04:00
rodzic 406b947134
commit 4b436479d1
16 zmienionych plików z 103 dodań i 99 usunięć

Wyświetl plik

@ -96,10 +96,10 @@ int elecraft_open(RIG *rig)
{ {
int err; int err;
char buf[KENWOOD_MAX_BUF_LEN]; char buf[KENWOOD_MAX_BUF_LEN];
struct kenwood_priv_data *priv = rig->state.priv;
char *model = "Unknown"; char *model = "Unknown";
struct rig_state *rs = &rig->state; struct rig_state *rs = STATE(rig);
struct hamlib_port *rp = RIGPORT(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_debug(RIG_DEBUG_VERBOSE, "%s called, rig version=%s\n", __func__,
rig->caps->version); rig->caps->version);
@ -395,7 +395,7 @@ int elecraft_open(RIG *rig)
int elecraft_close(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) 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); 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; } if (tq && ft == 1) { *vfo = STATE(rig)->tx_vfo = RIG_VFO_B; }
else if (tq && ft == 0) { *vfo = rig->state.tx_vfo = RIG_VFO_A; } 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); RETURNFUNC2(RIG_OK);
} }

Wyświetl plik

@ -113,13 +113,13 @@ int verify_flexradio_id(RIG *rig, char *id)
int flexradio_open(RIG *rig) int flexradio_open(RIG *rig)
{ {
struct kenwood_priv_data *priv = rig->state.priv; struct kenwood_priv_data *priv = STATE(rig)->priv;
int err; int err;
char id[FLEXRADIO_MAX_BUF_LEN]; char id[FLEXRADIO_MAX_BUF_LEN];
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); 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 */ /* Use check for "ID017;" to verify rig is reachable */
err = verify_flexradio_id(rig, id); err = verify_flexradio_id(rig, id);

Wyświetl plik

@ -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)) 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__); 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)) 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__); 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)) 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__); 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)) 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__); rig_debug(RIG_DEBUG_VERBOSE, "%s: setting VFO to current\n", __func__);
} }

Wyświetl plik

@ -259,7 +259,7 @@ struct rig_caps k2_caps =
int k2_open(RIG *rig) int k2_open(RIG *rig)
{ {
int err; 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__); 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; int err;
char f = '*'; char f = '*';
struct k2_filt_lst_s *flt; 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__); rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);

Wyświetl plik

@ -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_data = "DT";
char *cmd_bw = "BW"; char *cmd_bw = "BW";
int cmd_bw_len = 6; 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)); 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) 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); 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 buf[KENWOOD_MAX_BUF_LEN];
char *dtcmd; char *dtcmd;
struct kenwood_priv_caps *caps = kenwood_caps(rig); 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_debug(RIG_DEBUG_VERBOSE, "%s called vfo=%s mode=%s width=%d\n", __func__,
rig_strvfo(vfo), rig_strrmode(mode), (int)width); rig_strvfo(vfo), rig_strrmode(mode), (int)width);
if (vfo == RIG_VFO_CURR) if (vfo == RIG_VFO_CURR)
{ {
vfo = rig->state.current_vfo; vfo = STATE(rig)->current_vfo;
} }
rmode_t tmodeA, tmodeB; rmode_t tmodeA, tmodeB;
@ -1361,7 +1361,7 @@ int k3_set_vfo(RIG *rig, vfo_t vfo)
ENTERFUNC; ENTERFUNC;
// we emulate vfo selection for Elecraft // we emulate vfo selection for Elecraft
rig->state.current_vfo = vfo; STATE(rig)->current_vfo = vfo;
RETURNFUNC(RIG_OK); RETURNFUNC(RIG_OK);
} }
@ -1370,7 +1370,7 @@ int k3_get_vfo(RIG *rig, vfo_t *vfo)
{ {
ENTERFUNC; ENTERFUNC;
*vfo = rig->state.current_vfo; *vfo = STATE(rig)->current_vfo;
RETURNFUNC(RIG_OK); 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; char kmode;
int err; int err;
char cmd_m[16]; 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__); rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
@ -1828,7 +1828,7 @@ static int k3_get_maxpower(RIG *rig)
//int retval; //int retval;
int maxpower = 15; // K3 default power level int maxpower = 15; // K3 default power level
//char levelbuf[KENWOOD_MAX_BUF_LEN]; //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 // default range is 0-15 if there is no KPA3 installed
if (priv->has_kpa3 || priv->has_kpa100) 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 i;
int foundit = 0; 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); SNPRINTF(levelbuf, sizeof(levelbuf), "RA%02d", i + 1);
foundit = 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 retval;
int lvl; int lvl;
size_t len; 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__); 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++) 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); rig_debug(RIG_DEBUG_ERR, "%s: unexpected att level %d\n", __func__, lvl);
return -RIG_EPROTO; 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; return -RIG_EINTERNAL;
} }
val->i = rig->state.attenuator[i - 1]; val->i = STATE(rig)->attenuator[i - 1];
} }
break; 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: 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]; char levelbuf[KENWOOD_MAX_BUF_LEN];
int pwr; int pwr;

Wyświetl plik

@ -793,6 +793,7 @@ int pihpsdr_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
{ {
char levelbuf[16]; char levelbuf[16];
int i, kenwood_val; int i, kenwood_val;
struct rig_state *rs = STATE(rig);
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); 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; 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); SNPRINTF(levelbuf, sizeof(levelbuf), "RA%02d", i + 1);
foundit = 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; 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); SNPRINTF(levelbuf, sizeof(levelbuf), "PA%01d", i + 1);
foundit = 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) if (lvl > 9)
{ {
val->i = rig->state.preamp[0]; val->i = STATE(rig)->preamp[0];
} }
break; break;
@ -1018,7 +1019,7 @@ int pihpsdr_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
if (lvl > 99) 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; break;

Wyświetl plik

@ -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)); 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); 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__); 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); 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__); 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); 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__); 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); 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) 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]; char cmd[16];
int vfonum, txvfonum, vfomode = 0; int vfonum, txvfonum, vfomode = 0;
int retval; int retval;
@ -638,14 +639,14 @@ int tm_set_vfo_bc2(RIG *rig, vfo_t vfo)
vfonum = 0; vfonum = 0;
/* put back split mode when toggling */ /* put back split mode when toggling */
txvfonum = (priv->split == RIG_SPLIT_ON && txvfonum = (priv->split == RIG_SPLIT_ON &&
rig->state.tx_vfo == RIG_VFO_B) ? 1 : vfonum; rs->tx_vfo == RIG_VFO_B) ? 1 : vfonum;
break; break;
case RIG_VFO_B: case RIG_VFO_B:
vfonum = 1; vfonum = 1;
/* put back split mode when toggling */ /* put back split mode when toggling */
txvfonum = (priv->split == RIG_SPLIT_ON && txvfonum = (priv->split == RIG_SPLIT_ON &&
rig->state.tx_vfo == RIG_VFO_A) ? 0 : vfonum; rs->tx_vfo == RIG_VFO_A) ? 0 : vfonum;
break; break;
case RIG_VFO_MEM: 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) 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]; char vfobuf[16];
int vfonum, txvfonum; int vfonum, txvfonum;
int retval; 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) 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]; char buf[10];
int retval; 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]; char vch, buf[10], ackbuf[20];
int retval, v; int retval, v;
unsigned int l; unsigned int l;
struct rig_state *rs = STATE(rig);
vfo_t tvfo; vfo_t tvfo;
rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); 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) switch (tvfo)
{ {
@ -1277,7 +1279,7 @@ th_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
} }
else else
{ {
val->i = rig->state.attenuator[ackbuf[4] - '1']; val->i = rs->attenuator[ackbuf[4] - '1'];
} }
break; 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__); 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) 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__); 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) 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__); rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__);
/* store current VFO */ /* store current VFO */
cvfo = rig->state.current_vfo; cvfo = STATE(rig)->current_vfo;
/* check if we should switch VFO */ /* check if we should switch VFO */
if (cvfo != RIG_VFO_MEM) 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__); 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); 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->flags = lockout ? RIG_CHFLAG_SKIP : 0;
chan->freq = freq; chan->freq = freq;
chan->vfo = RIG_VFO_MEM; 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) 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; channel_num = chan->channel_num;
for (step = 0; rig->state.tuning_steps[step].ts != 0; step++) for (step = 0; STATE(rig)->tuning_steps[step].ts != 0; step++)
if (chan->tuning_step <= rig->state.tuning_steps[step].ts) if (chan->tuning_step <= STATE(rig)->tuning_steps[step].ts)
{ {
break; break;
} }

Wyświetl plik

@ -148,7 +148,7 @@ static struct kenwood_priv_caps thd72_priv_caps =
int thd72_open(RIG *rig) int thd72_open(RIG *rig)
{ {
int ret; int ret;
struct kenwood_priv_data *priv = rig->state.priv; struct kenwood_priv_data *priv = STATE(rig)->priv;
strcpy(priv->verify_cmd, "ID\r"); strcpy(priv->verify_cmd, "ID\r");
//ret = kenwood_transaction(rig, "", NULL, 0); //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_VFO:
case RIG_VFO_MAIN: case RIG_VFO_MAIN:
cmd = "BC 0"; cmd = "BC 0";
rig->state.current_vfo = RIG_VFO_A; STATE(rig)->current_vfo = RIG_VFO_A;
break; break;
case RIG_VFO_B: case RIG_VFO_B:
case RIG_VFO_SUB: case RIG_VFO_SUB:
rig->state.current_vfo = RIG_VFO_B; STATE(rig)->current_vfo = RIG_VFO_B;
cmd = "BC 1"; cmd = "BC 1";
break; break;
@ -192,7 +192,7 @@ static int thd72_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
{ {
int retval; int retval;
char vfobuf[16]; char vfobuf[16];
const struct kenwood_priv_data *priv = rig->state.priv; const struct kenwood_priv_data *priv = STATE(rig)->priv;
char vfonum = '0'; char vfonum = '0';
rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); 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) 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]; char vfobuf[16];
int retval; 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, static int thd72_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
vfo_t *txvfo) vfo_t *txvfo)
{ {
struct kenwood_priv_data *priv = rig->state.priv; struct kenwood_priv_data *priv = STATE(rig)->priv;
char buf[10]; char buf[10];
int retval; 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) 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)); 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) 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; int i, j, ret;
hamlib_port_t *rp = RIGPORT(rig); hamlib_port_t *rp = RIGPORT(rig);
channel_t *chan; 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; int chan_next = chan_list[0].start;
char block[BLOCK_SZ]; char block[BLOCK_SZ];
char resp[CMD_SZ]; char resp[CMD_SZ];

Wyświetl plik

@ -156,7 +156,7 @@ static struct kenwood_priv_caps thd74_priv_caps =
int thd74_open(RIG *rig) int thd74_open(RIG *rig)
{ {
//int ret; //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 // this is already done in kenwood_init
//strcpy(priv->verify_cmd, "ID\r"); //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) 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) 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) 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; int retval;
char buf[128], fbuf[12]; 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) 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; int retval;
char buf[128]; 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) 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__); 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) 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__); 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) 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; int retval;
char buf[128]; 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) 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__); 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; int i, j, ret;
hamlib_port_t *rp = RIGPORT(rig); hamlib_port_t *rp = RIGPORT(rig);
channel_t *chan; 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; int chan_next = chan_list[0].start;
char block[BLOCK_SZ]; char block[BLOCK_SZ];
char resp[CMD_SZ]; char resp[CMD_SZ];

Wyświetl plik

@ -497,6 +497,7 @@ int thg71_open(RIG *rig)
char ackbuf[ACKBUF_LEN]; char ackbuf[ACKBUF_LEN];
int retval, i; int retval, i;
const freq_range_t frend = RIG_FRNG_END; const freq_range_t frend = RIG_FRNG_END;
struct rig_state *rs = STATE(rig);
/* this will check the model id */ /* this will check the model id */
retval = kenwood_open(rig); retval = kenwood_open(rig);
@ -546,7 +547,7 @@ int thg71_open(RIG *rig)
frng.high_power = -1; frng.high_power = -1;
frng.low_power = -1; frng.low_power = -1;
frng.label = ""; frng.label = "";
rig->state.rx_range_list[i] = frng; rs->rx_range_list[i] = frng;
if (frng.startf > MHz(200)) if (frng.startf > MHz(200))
{ {
@ -558,12 +559,12 @@ int thg71_open(RIG *rig)
} }
frng.low_power = mW(50); 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; rs->rx_range_list[i] = frend;
rig->state.tx_range_list[i] = frend; rs->tx_range_list[i] = frend;
rig->state.vfo_list = RIG_VFO_A | RIG_VFO_MEM ; rs->vfo_list = RIG_VFO_A | RIG_VFO_MEM ;
return RIG_OK; return RIG_OK;
} }

Wyświetl plik

@ -659,14 +659,14 @@ static int tmd710_open(RIG *rig)
rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); 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 // Get current RX and TX VFO state, do not care if we succeed or not
tmd710_get_vfo(rig, &vfo); tmd710_get_vfo(rig, &vfo);
tmd710_get_split_vfo(rig, RIG_VFO_CURR, &split, &vfo); tmd710_get_split_vfo(rig, RIG_VFO_CURR, &split, &vfo);
rig_debug(RIG_DEBUG_TRACE, "rig->state.tx_vfo: %s\n", rig_debug(RIG_DEBUG_TRACE, "STATE(rig)->tx_vfo: %s\n",
rig_strvfo(rig->state.tx_vfo)); rig_strvfo(STATE(rig)->tx_vfo));
return 0; 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__); rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__);
// Use the TX VFO for split // 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__); rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__);
// Use the TX VFO for split // 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) 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; 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) 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; return retval;
} }
rig->state.tx_vfo = txvfo; STATE(rig)->tx_vfo = txvfo;
return RIG_OK; 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; 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 // 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; RIG_SPLIT_ON;
return RIG_OK; return RIG_OK;
@ -2097,7 +2097,7 @@ int tmd710_get_mem(RIG *rig, vfo_t vfo, int *ch)
} }
else 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); snprintf(cmd, sizeof(cmd), "MR %d", vfonum);
@ -2143,7 +2143,7 @@ int tmd710_set_mem(RIG *rig, vfo_t vfo, int ch)
} }
else 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); 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 * 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) 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 * 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) int tmd710_set_ext_level(RIG *rig, vfo_t vfo, hamlib_token_t token, value_t val)

Wyświetl plik

@ -567,7 +567,7 @@ int tmv7_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only)
chan->freq = freq; chan->freq = freq;
chan->vfo = RIG_VFO_MEM; 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)) 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; freq = (long)chan->freq;
for (step = 0; rig->state.tuning_steps[step].ts != 0; step++) for (step = 0; STATE(rig)->tuning_steps[step].ts != 0; step++)
if (chan->tuning_step == rig->state.tuning_steps[step].ts) { break; } if (chan->tuning_step == STATE(rig)->tuning_steps[step].ts) { break; }
switch (chan->rptr_shift) switch (chan->rptr_shift)
{ {

Wyświetl plik

@ -170,7 +170,7 @@ int transfox_open(RIG *rig)
{ {
rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__); 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 */ /* do not call kenwood_open(rig), rig has no "ID" command */

Wyświetl plik

@ -275,7 +275,7 @@ int ts2000_init(RIG *rig)
return retval; return retval;
} }
priv = (struct kenwood_priv_data *) rig->state.priv; priv = (struct kenwood_priv_data *) STATE(rig)->priv;
priv->ag_format = 3; priv->ag_format = 3;
priv->micgain_min = 0; priv->micgain_min = 0;
@ -1004,7 +1004,7 @@ static int ts2000_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit)
{ {
int retval; int retval;
char buf[7]; char buf[7];
struct kenwood_priv_data *priv = rig->state.priv; struct kenwood_priv_data *priv = STATE(rig)->priv;
ENTERFUNC; ENTERFUNC;

Wyświetl plik

@ -439,7 +439,7 @@ static int ts870s_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
else else
{ {
for (i = 0; i < lvl && i < HAMLIB_MAXDBLSTSIZ; i++) 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: " rig_debug(RIG_DEBUG_ERR, "ts870s_get_level: "
"unexpected att level %d\n", lvl); "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; return -RIG_EINTERNAL;
} }
val->i = rig->state.attenuator[i - 1]; val->i = STATE(rig)->attenuator[i - 1];
} }
break; break;

Wyświetl plik

@ -412,11 +412,11 @@ int ts990s_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
switch (vfo) switch (vfo)
{ {
case RIG_VFO_MAIN: 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; break;
case RIG_VFO_SUB: 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; break;
default: default:
@ -456,7 +456,7 @@ int ts990s_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
} }
else else
{ {
val->i = rig->state.attenuator[lvlbuf[3] - '1']; val->i = STATE(rig)->attenuator[lvlbuf[3] - '1'];
} }
} }
break; break;