Merge pull request #1481 from mikaelnousiainen/streamline-vfo-targeting-and-split-functionality

Streamline VFO targeting and split functionality
pull/1482/head
Michael Black 2024-01-21 14:24:48 -06:00 zatwierdzone przez GitHub
commit 1dfd17cc18
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
33 zmienionych plików z 2666 dodań i 2625 usunięć

Wyświetl plik

@ -433,7 +433,6 @@ typedef enum {
typedef enum {
RIG_SPLIT_OFF = 0, /*!< Split mode disabled */
RIG_SPLIT_ON, /*!< Split mode enabled */
RIG_SPLIT_SIMPLEX = 0x10, /*< Split mode simples for ID-5100 */
} split_t;

Wyświetl plik

@ -69,13 +69,11 @@ struct dummy_priv_data
channel_t *curr; /* points to vfo_a, vfo_b or mem[] */
// we're trying to emulate all sorts of vfo possibilities so this looks redundant
channel_t vfo_a;
channel_t vfo_b;
channel_t vfo_c;
channel_t vfo_maina;
channel_t vfo_mainb;
channel_t vfo_suba;
channel_t vfo_subb;
channel_t vfo_c;
channel_t mem[NB_CHAN];
struct ext_list *ext_funcs;
@ -257,41 +255,53 @@ static int dummy_init(RIG *rig)
}
}
priv->vfo_a.ext_levels = alloc_init_ext(dummy_ext_levels);
if (!priv->vfo_a.ext_levels)
priv->vfo_maina.ext_levels = alloc_init_ext(dummy_ext_levels);
if (!priv->vfo_maina.ext_levels)
{
RETURNFUNC(-RIG_ENOMEM);
}
priv->vfo_mainb.ext_levels = alloc_init_ext(dummy_ext_levels);
if (!priv->vfo_mainb.ext_levels)
{
RETURNFUNC(-RIG_ENOMEM);
}
priv->vfo_b.ext_levels = alloc_init_ext(dummy_ext_levels);
priv->vfo_suba.ext_levels = alloc_init_ext(dummy_ext_levels);
if (!priv->vfo_suba.ext_levels)
{
RETURNFUNC(-RIG_ENOMEM);
}
priv->vfo_subb.ext_levels = alloc_init_ext(dummy_ext_levels);
if (!priv->vfo_subb.ext_levels)
{
RETURNFUNC(-RIG_ENOMEM);
}
if (!priv->vfo_b.ext_levels)
priv->vfo_c.ext_levels = alloc_init_ext(dummy_ext_levels);
if (!priv->vfo_c.ext_levels)
{
RETURNFUNC(-RIG_ENOMEM);
}
priv->ext_funcs = alloc_init_ext(dummy_ext_funcs);
if (!priv->ext_funcs)
{
RETURNFUNC(-RIG_ENOMEM);
}
priv->ext_parms = alloc_init_ext(dummy_ext_parms);
if (!priv->ext_parms)
{
RETURNFUNC(-RIG_ENOMEM);
}
init_chan(rig, RIG_VFO_A, &priv->vfo_a);
init_chan(rig, RIG_VFO_B, &priv->vfo_b);
init_chan(rig, RIG_VFO_MAIN_A, &priv->vfo_maina);
init_chan(rig, RIG_VFO_MAIN_B, &priv->vfo_mainb);
init_chan(rig, RIG_VFO_SUB_A, &priv->vfo_suba);
init_chan(rig, RIG_VFO_SUB_B, &priv->vfo_subb);
priv->curr = &priv->vfo_a;
init_chan(rig, RIG_VFO_C, &priv->vfo_c);
priv->curr = &priv->vfo_maina;
if (rig->caps->rig_model == RIG_MODEL_DUMMY_NOVFO)
{
@ -319,8 +329,11 @@ static int dummy_cleanup(RIG *rig)
free(priv->mem[i].ext_levels);
}
free(priv->vfo_a.ext_levels);
free(priv->vfo_b.ext_levels);
free(priv->vfo_maina.ext_levels);
free(priv->vfo_mainb.ext_levels);
free(priv->vfo_suba.ext_levels);
free(priv->vfo_subb.ext_levels);
free(priv->vfo_c.ext_levels);
free(priv->ext_funcs);
free(priv->ext_parms);
free(priv->magic_conf);
@ -448,14 +461,12 @@ static int dummy_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
switch (vfo)
{
case RIG_VFO_MAIN:
case RIG_VFO_A: priv->vfo_a.freq = freq; break;
case RIG_VFO_A:
case RIG_VFO_MAIN_A: priv->vfo_maina.freq = freq; break;
case RIG_VFO_MAIN_B: priv->vfo_mainb.freq = freq; break;
case RIG_VFO_SUB:
case RIG_VFO_B: priv->vfo_b.freq = freq; break;
case RIG_VFO_B:
case RIG_VFO_MAIN_B: priv->vfo_mainb.freq = freq; break;
case RIG_VFO_SUB_A: priv->vfo_suba.freq = freq; break;
@ -498,14 +509,12 @@ static int dummy_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
switch (vfo)
{
case RIG_VFO_MAIN:
case RIG_VFO_A: *freq = priv->vfo_a.freq; break;
case RIG_VFO_A:
case RIG_VFO_MAIN_A: *freq = priv->vfo_maina.freq; break;
case RIG_VFO_MAIN_B: *freq = priv->vfo_mainb.freq; break;
case RIG_VFO_SUB:
case RIG_VFO_B: *freq = priv->vfo_b.freq; break;
case RIG_VFO_B:
case RIG_VFO_MAIN_B: *freq = priv->vfo_mainb.freq; break;
case RIG_VFO_SUB_A: *freq = priv->vfo_suba.freq; break;
@ -535,15 +544,23 @@ static int dummy_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
vfo = vfo_fixup(rig, vfo, rig->state.cache.split);
if (vfo == RIG_VFO_CURR) { vfo = priv->curr_vfo; }
if (width == RIG_PASSBAND_NOCHANGE)
{
switch (vfo)
{
case RIG_VFO_MAIN:
case RIG_VFO_A: width = priv->vfo_a.width; break;
case RIG_VFO_A:
case RIG_VFO_MAIN_A: width = priv->vfo_maina.width; break;
case RIG_VFO_SUB:
case RIG_VFO_B: width = priv->vfo_b.width; break;
case RIG_VFO_B:
case RIG_VFO_MAIN_B: width = priv->vfo_mainb.width; break;
case RIG_VFO_SUB_A: width = priv->vfo_suba.width; break;
case RIG_VFO_SUB_B: width = priv->vfo_subb.width; break;
case RIG_VFO_C: width = priv->vfo_c.width; break;
}
@ -552,10 +569,16 @@ static int dummy_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
switch (vfo)
{
case RIG_VFO_MAIN:
case RIG_VFO_A: priv->vfo_a.mode = mode; priv->vfo_a.width = width; break;
case RIG_VFO_A:
case RIG_VFO_MAIN_A: priv->vfo_maina.mode = mode; priv->vfo_maina.width = width; break;
case RIG_VFO_SUB:
case RIG_VFO_B: priv->vfo_b.mode = mode; priv->vfo_b.width = width; break;
case RIG_VFO_B:
case RIG_VFO_MAIN_B: priv->vfo_mainb.mode = mode; priv->vfo_mainb.width = width; break;
case RIG_VFO_SUB_A: priv->vfo_suba.mode = mode; priv->vfo_suba.width = width; break;
case RIG_VFO_SUB_B: priv->vfo_subb.mode = mode; priv->vfo_subb.width = width; break;
case RIG_VFO_C: priv->vfo_c.mode = mode; priv->vfo_c.width = width; break;
@ -575,9 +598,17 @@ static int dummy_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
switch (vfo)
{
case RIG_VFO_A: priv->vfo_a.width = width; break;
case RIG_VFO_MAIN:
case RIG_VFO_A:
case RIG_VFO_MAIN_A: priv->vfo_maina.width = width; break;
case RIG_VFO_B: priv->vfo_b.width = width; break;
case RIG_VFO_SUB:
case RIG_VFO_B:
case RIG_VFO_MAIN_B: priv->vfo_mainb.width = width; break;
case RIG_VFO_SUB_A: priv->vfo_suba.width = width; break;
case RIG_VFO_SUB_B: priv->vfo_subb.width = width; break;
case RIG_VFO_C: priv->vfo_c.width = width; break;
}
@ -594,17 +625,33 @@ static int dummy_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
usleep(CMDSLEEP);
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__, rig_strvfo(vfo));
if (vfo == RIG_VFO_CURR) { vfo = rig->state.current_vfo; }
if (vfo == RIG_VFO_CURR) { vfo = priv->curr_vfo; }
switch (vfo)
{
case RIG_VFO_MAIN:
case RIG_VFO_A: *mode = priv->vfo_a.mode; *width = priv->vfo_a.width; break;
case RIG_VFO_A:
case RIG_VFO_MAIN_A:
*mode = priv->vfo_maina.mode; *width = priv->vfo_maina.width;
break;
case RIG_VFO_SUB:
case RIG_VFO_B: *mode = priv->vfo_b.mode; *width = priv->vfo_b.width; break;
case RIG_VFO_B:
case RIG_VFO_MAIN_B:
*mode = priv->vfo_mainb.mode; *width = priv->vfo_mainb.width;
break;
case RIG_VFO_C: *mode = priv->vfo_c.mode; *width = priv->vfo_c.width; break;
case RIG_VFO_SUB_A:
*mode = priv->vfo_suba.mode; *width = priv->vfo_suba.width;
break;
case RIG_VFO_SUB_B:
*mode = priv->vfo_subb.mode; *width = priv->vfo_subb.width;
break;
case RIG_VFO_C:
*mode = priv->vfo_c.mode; *width = priv->vfo_c.width;
break;
}
RETURNFUNC(RIG_OK);
@ -620,32 +667,25 @@ static int dummy_set_vfo(RIG *rig, vfo_t vfo)
usleep(CMDSLEEP);
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__, rig_strvfo(vfo));
if (vfo == RIG_VFO_CURR) { vfo = rig->state.current_vfo; }
priv->last_vfo = priv->curr_vfo;
priv->curr_vfo = vfo;
if (vfo == RIG_VFO_CURR) { vfo = priv->curr_vfo; }
switch (vfo)
{
case RIG_VFO_VFO: /* FIXME */
case RIG_VFO_RX:
case RIG_VFO_MAIN: priv->curr = &priv->vfo_a; break;
case RIG_VFO_MAIN:
case RIG_VFO_A:
case RIG_VFO_MAIN_A: priv->curr = &priv->vfo_maina; break;
case RIG_VFO_SUB:
case RIG_VFO_B:
case RIG_VFO_MAIN_B: priv->curr = &priv->vfo_mainb; break;
case RIG_VFO_A: priv->curr = &priv->vfo_a; break;
case RIG_VFO_SUB: priv->curr = &priv->vfo_b; break;
case RIG_VFO_SUB_A: priv->curr = &priv->vfo_suba; break;
case RIG_VFO_SUB_B: priv->curr = &priv->vfo_subb; break;
case RIG_VFO_B: priv->curr = &priv->vfo_b; break;
case RIG_VFO_C: priv->curr = &priv->vfo_c; break;
case RIG_VFO_MEM:
@ -656,10 +696,10 @@ static int dummy_set_vfo(RIG *rig, vfo_t vfo)
}
case RIG_VFO_TX:
if (priv->tx_vfo == RIG_VFO_A) { priv->curr = &priv->vfo_a; }
else if (priv->tx_vfo == RIG_VFO_B) { priv->curr = &priv->vfo_b; }
if (priv->tx_vfo == RIG_VFO_A) { priv->curr = &priv->vfo_maina; }
else if (priv->tx_vfo == RIG_VFO_B) { priv->curr = &priv->vfo_mainb; }
else if (priv->tx_vfo == RIG_VFO_MEM) { priv->curr = &priv->mem[curr->channel_num]; }
else { priv->curr = &priv->vfo_a; }
else { priv->curr = &priv->vfo_maina; }
break;
@ -669,6 +709,8 @@ static int dummy_set_vfo(RIG *rig, vfo_t vfo)
RETURNFUNC(-RIG_EINVAL);
}
priv->last_vfo = priv->curr_vfo;
priv->curr_vfo = vfo;
rig->state.current_vfo = vfo;
RETURNFUNC(RIG_OK);
@ -943,11 +985,17 @@ static int dummy_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
int retval;
ENTERFUNC;
rig_debug(RIG_DEBUG_VERBOSE, "%s: vfo=%s freq=%.0f\n", __func__, rig_strvfo(vfo), tx_freq);
retval = dummy_set_freq(rig, vfo, tx_freq);
if (priv->split == RIG_SPLIT_OFF || priv->tx_vfo == RIG_VFO_NONE || priv->tx_vfo == RIG_VFO_CURR)
{
rig_debug(RIG_DEBUG_WARN, "%s: split not enabled, but set_split_freq() called? ignorning\n", __func__);
RETURNFUNC(RIG_OK);
}
retval = dummy_set_freq(rig, priv->tx_vfo, tx_freq);
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: freq=%.0f\n", __func__, tx_freq);
RETURNFUNC(retval);
}
@ -956,14 +1004,21 @@ static int dummy_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
static int dummy_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq)
{
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
int retval;
ENTERFUNC;
rig_debug(RIG_DEBUG_VERBOSE, "%s: vfo=%s\n", __func__, rig_strvfo(vfo));
*tx_freq = priv->curr->tx_freq;
rig_debug(RIG_DEBUG_VERBOSE, "%s: priv->curr->tx_freq = %.0f\n", __func__,
priv->curr->tx_freq);
if (priv->split == RIG_SPLIT_OFF || priv->tx_vfo == RIG_VFO_NONE || priv->tx_vfo == RIG_VFO_CURR)
{
rig_debug(RIG_DEBUG_WARN, "%s: split not enabled, but get_split_freq() called? ignorning\n", __func__);
RETURNFUNC(RIG_OK);
}
RETURNFUNC(RIG_OK);
retval = dummy_get_freq(rig, priv->tx_vfo, tx_freq);
rig_debug(RIG_DEBUG_VERBOSE, "%s: freq=%.0f\n", __func__, *tx_freq);
RETURNFUNC(retval);
}
static int dummy_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode,
@ -971,41 +1026,67 @@ static int dummy_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode,
{
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
channel_t *curr = priv->curr;
int retval;
ENTERFUNC;
rig_debug(RIG_DEBUG_VERBOSE, "%s: vfo=%s tx_mode=%s tx_width=%ld\n",
__func__, rig_strvfo(vfo), rig_strrmode(tx_mode), tx_width);
if (priv->split == RIG_SPLIT_OFF || priv->tx_vfo == RIG_VFO_NONE || priv->tx_vfo == RIG_VFO_CURR)
{
rig_debug(RIG_DEBUG_WARN, "%s: split not enabled, but set_split_mode() called? ignorning\n", __func__);
RETURNFUNC(RIG_OK);
}
retval = dummy_set_mode(rig, priv->tx_vfo, tx_mode, tx_width);
curr->tx_mode = tx_mode;
if (RIG_PASSBAND_NOCHANGE == tx_width) { RETURNFUNC(RIG_OK); }
if (RIG_PASSBAND_NOCHANGE == tx_width)
{
RETURNFUNC(retval);
}
curr->tx_width = tx_width;
RETURNFUNC(RIG_OK);
RETURNFUNC(retval);
}
static int dummy_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode,
pbwidth_t *tx_width)
{
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
const channel_t *curr = priv->curr;
int retval;
ENTERFUNC;
rig_debug(RIG_DEBUG_VERBOSE, "%s: vfo=%s\n", __func__, rig_strvfo(vfo));
*tx_mode = curr->tx_mode;
*tx_width = curr->tx_width;
if (priv->split == RIG_SPLIT_OFF || priv->tx_vfo == RIG_VFO_NONE || priv->tx_vfo == RIG_VFO_CURR)
{
rig_debug(RIG_DEBUG_WARN, "%s: split not enabled, but get_split_mode() called? ignorning\n", __func__);
RETURNFUNC(RIG_OK);
}
RETURNFUNC(RIG_OK);
retval = dummy_get_mode(rig, priv->tx_vfo, tx_mode, tx_width);
rig_debug(RIG_DEBUG_VERBOSE, "%s: vfo=%s tx_mode=%s tx_width=%ld\n",
__func__, rig_strvfo(vfo), rig_strrmode(*tx_mode), *tx_width);
RETURNFUNC(retval);
}
static int dummy_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
{
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
channel_t *curr = priv->curr;
ENTERFUNC;
rig_debug(RIG_DEBUG_VERBOSE, "%s: split=%d, vfo=%s, tx_vfo=%s\n",
__func__, split, rig_strvfo(vfo), rig_strvfo(tx_vfo));
curr->split = split;
if (tx_vfo == RIG_VFO_NONE || tx_vfo == RIG_VFO_CURR) { tx_vfo = priv->curr_vfo; }
if (tx_vfo == RIG_VFO_CURR || tx_vfo == RIG_VFO_TX) { tx_vfo = vfo_fixup(rig, vfo, rig->state.cache.split); }
priv->split = split;
priv->tx_vfo = tx_vfo;
RETURNFUNC(RIG_OK);
@ -1016,10 +1097,14 @@ static int dummy_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
vfo_t *tx_vfo)
{
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
const channel_t *curr = priv->curr;
ENTERFUNC;
*split = curr->split;
*split = priv->split;
*tx_vfo = priv->tx_vfo;
rig_debug(RIG_DEBUG_VERBOSE, "%s: split=%d, vfo=%s, tx_vfo=%s\n",
__func__, *split, rig_strvfo(vfo), rig_strvfo(*tx_vfo));
RETURNFUNC(RIG_OK);
}
@ -1832,7 +1917,7 @@ static int dummy_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
{
int ch = curr->channel_num;
copy_chan(curr, priv->last_vfo == RIG_VFO_A ?
&priv->vfo_a : &priv->vfo_b);
&priv->vfo_maina : &priv->vfo_mainb);
curr->channel_num = ch;
curr->channel_desc[0] = '\0';
curr->vfo = RIG_VFO_MEM;
@ -1852,7 +1937,7 @@ static int dummy_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
if (priv->curr_vfo == RIG_VFO_MEM)
{
channel_t *vfo_chan = (priv->last_vfo == RIG_VFO_A) ?
&priv->vfo_a : &priv->vfo_b;
&priv->vfo_maina : &priv->vfo_mainb;
copy_chan(vfo_chan, curr);
chan_vfo(vfo_chan, priv->last_vfo);
}
@ -1867,14 +1952,14 @@ static int dummy_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
case RIG_OP_CPY: /* VFO A = VFO B or VFO B = VFO A */
if (priv->curr_vfo == RIG_VFO_A)
{
copy_chan(&priv->vfo_b, &priv->vfo_a);
chan_vfo(&priv->vfo_b, RIG_VFO_B);
copy_chan(&priv->vfo_mainb, &priv->vfo_maina);
chan_vfo(&priv->vfo_mainb, RIG_VFO_B);
break;
}
else if (priv->curr_vfo == RIG_VFO_B)
{
copy_chan(&priv->vfo_a, &priv->vfo_b);
chan_vfo(&priv->vfo_a, RIG_VFO_A);
copy_chan(&priv->vfo_maina, &priv->vfo_mainb);
chan_vfo(&priv->vfo_maina, RIG_VFO_A);
break;
}
@ -1891,11 +1976,11 @@ static int dummy_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
RETURNFUNC(-RIG_ENOMEM);
}
copy_chan(&chan, &priv->vfo_b);
copy_chan(&priv->vfo_b, &priv->vfo_a);
copy_chan(&priv->vfo_a, &chan);
chan_vfo(&priv->vfo_a, RIG_VFO_A);
chan_vfo(&priv->vfo_b, RIG_VFO_B);
copy_chan(&chan, &priv->vfo_mainb);
copy_chan(&priv->vfo_mainb, &priv->vfo_maina);
copy_chan(&priv->vfo_maina, &chan);
chan_vfo(&priv->vfo_maina, RIG_VFO_A);
chan_vfo(&priv->vfo_mainb, RIG_VFO_B);
free(chan.ext_levels);
break;
}
@ -2017,11 +2102,11 @@ static int dummy_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
break;
case RIG_VFO_A:
copy_chan(&priv->vfo_a, chan);
copy_chan(&priv->vfo_maina, chan);
break;
case RIG_VFO_B:
copy_chan(&priv->vfo_b, chan);
copy_chan(&priv->vfo_mainb, chan);
break;
case RIG_VFO_CURR:
@ -2068,11 +2153,11 @@ static int dummy_get_channel(RIG *rig, vfo_t vfo, channel_t *chan,
break;
case RIG_VFO_A:
copy_chan(chan, &priv->vfo_a);
copy_chan(chan, &priv->vfo_maina);
break;
case RIG_VFO_B:
copy_chan(chan, &priv->vfo_b);
copy_chan(chan, &priv->vfo_mainb);
break;
case RIG_VFO_CURR:
@ -2314,6 +2399,13 @@ struct rig_caps dummy_caps =
[LVL_SPECTRUM_REF] = {.min = {.f = -30.0f}, .max = {.f = 10.0f}, .step = {.f = 0.5f}},
[LVL_SPECTRUM_AVG] = {.min = {.i = 0}, .max = {.i = 3}, .step = {.i = 1}},
},
.parm_gran = {
[PARM_BACKLIGHT] = {.min = {.f = 0.0f}, .max = {.f = 1.0f}, .step = {.f = 1.0f / 255.0f}},
[PARM_BANDSELECT] = {.step = {.s = "BANDUNUSED,BAND70CM,BAND33CM,BAND23CM"}},
[PARM_BEEP] = {.min = {.i = 0}, .max = {.i = 1}},
[PARM_SCREENSAVER] = {.min = {.i = 0}, .max = {.i = 3}, .step = {.i = 1}},
[PARM_KEYERTYPE] = {.step = {.s = "STRAIGHT,BUG,PADDLE"}},
},
.ctcss_list = common_ctcss_list,
.dcs_list = full_dcs_list,
.chan_list = {

Wyświetl plik

@ -30,6 +30,11 @@ struct ext_list *alloc_init_ext(const struct confparams *cfp)
struct ext_list *elp;
int i, nb_ext;
if (cfp == NULL)
{
return NULL;
}
for (nb_ext = 0; !RIG_IS_EXT_END(cfp[nb_ext]); nb_ext++)
;
@ -55,6 +60,11 @@ struct ext_list *find_ext(struct ext_list *elp, token_t token)
{
int i;
if (elp == NULL)
{
return NULL;
}
for (i = 0; elp[i].token != 0; i++)
{
if (elp[i].token == token)

Wyświetl plik

@ -200,7 +200,14 @@ static const struct icom_priv_caps ic7100_priv_caps =
},
.extcmds = ic7100_extcmds,
.antack_len = 2,
.ant_count = 2
.ant_count = 2,
.x25x26_always = 0,
.x25x26_possibly = 1,
.x1cx03_always = 0,
.x1cx03_possibly = 1,
.x1ax03_supported = 1,
.mode_with_filter = 1,
.data_mode_supported = 1
};
// if hour < 0 then only date will be set
@ -373,7 +380,7 @@ struct rig_caps ic7100_caps =
.max_ifshift = Hz(0),
.agc_level_count = 3,
.agc_levels = { RIG_AGC_FAST, RIG_AGC_MEDIUM, RIG_AGC_SLOW },
.targetable_vfo = 0,
.targetable_vfo = RIG_TARGETABLE_FREQ | RIG_TARGETABLE_MODE,
.vfo_ops = IC7100_VFO_OPS,
.scan_ops = IC7100_SCAN_OPS,
.transceive = RIG_TRN_RIG,
@ -480,8 +487,8 @@ struct rig_caps ic7100_caps =
.get_freq = icom_get_freq,
.set_freq = icom_set_freq,
.get_mode = icom_get_mode_with_data,
.set_mode = icom_set_mode_with_data,
.get_mode = icom_get_mode,
.set_mode = icom_set_mode,
// .get_vfo = icom_get_vfo,
.set_vfo = icom_set_vfo,

Wyświetl plik

@ -116,6 +116,13 @@ static const struct icom_priv_caps IC7200_priv_caps =
{ .level = RIG_AGC_SLOW, .icom_level = 2 },
{ .level = RIG_AGC_LAST, .icom_level = -1 },
},
.x25x26_always = 0,
.x25x26_possibly = 0,
.x1cx03_always = 0,
.x1cx03_possibly = 0,
.x1ax03_supported = 1,
.mode_with_filter = 1,
.data_mode_supported = 1
};
struct rig_caps ic7200_caps =
@ -244,8 +251,8 @@ struct rig_caps ic7200_caps =
.set_freq = icom_set_freq,
.get_freq = icom_get_freq,
.set_mode = icom_set_mode_with_data,
.get_mode = icom_get_mode_with_data,
.set_mode = icom_set_mode,
.get_mode = icom_get_mode,
.set_vfo = icom_set_vfo,
// .get_vfo = icom_get_vfo,
.set_ant = NULL, /*automatically set by rig depending band */

Wyświetl plik

@ -409,7 +409,13 @@ static const struct icom_priv_caps IC7300_priv_caps =
},
},
.extcmds = ic7300_extcmds, /* Custom op parameters */
.x25_always = 1
.x25x26_always = 1,
.x25x26_possibly = 1,
.x1cx03_always = 1,
.x1cx03_possibly = 1,
.x1ax03_supported = 1,
.mode_with_filter = 1,
.data_mode_supported = 1
};
static const struct icom_priv_caps IC9700_priv_caps =
@ -458,7 +464,13 @@ static const struct icom_priv_caps IC9700_priv_caps =
},
},
.extcmds = ic9700_extcmds, /* Custom op parameters */
// .x25_always = 1 // except when in satellite mode so can't do this
.x25x26_always = 1,
.x25x26_possibly = 1,
.x1cx03_always = 1,
.x1cx03_possibly = 1,
.x1ax03_supported = 1,
.mode_with_filter = 1,
.data_mode_supported = 1
};
static const struct icom_priv_caps IC705_priv_caps =
@ -582,6 +594,13 @@ static const struct icom_priv_caps IC705_priv_caps =
},
},
.extcmds = ic705_extcmds, /* Custom parameters */
.x25x26_always = 1,
.x25x26_possibly = 1,
.x1cx03_always = 1,
.x1cx03_possibly = 1,
.x1ax03_supported = 1,
.mode_with_filter = 1,
.data_mode_supported = 1
};
static const struct icom_priv_caps IC905_priv_caps =
@ -704,6 +723,13 @@ static const struct icom_priv_caps IC905_priv_caps =
},
},
.extcmds = ic705_extcmds, /* Custom parameters */
.x25x26_always = 1,
.x25x26_possibly = 1,
.x1cx03_always = 1,
.x1cx03_possibly = 1,
.x1ax03_supported = 1,
.mode_with_filter = 1,
.data_mode_supported = 1
};
struct rig_caps ic7300_caps =
@ -750,7 +776,7 @@ struct rig_caps ic7300_caps =
[PARM_BEEP] = {.min = {.i = 0}, .max = {.i = 1}, .step = {.i = 1}},
[PARM_SCREENSAVER] = {.min = {.i = 0}, .max = {.i = 3}, .step = {.i = 1}},
[PARM_TIME] = {.min = {.i = 0}, .max = {.i = 86399}, .step = {.i = 1}},
[PARM_KEYERTYPE] = {.step = {.s = "STRAIGHT, BUG, PADDLE"}},
[PARM_KEYERTYPE] = {.step = {.s = "STRAIGHT,BUG,PADDLE"}},
},
.ext_tokens = ic7300_ext_tokens,
@ -894,8 +920,8 @@ struct rig_caps ic7300_caps =
.set_freq = icom_set_freq,
.get_freq = icom_get_freq,
.set_mode = icom_set_mode_with_data,
.get_mode = icom_get_mode_with_data,
.set_mode = icom_set_mode,
.get_mode = icom_get_mode,
// .get_vfo = icom_get_vfo,
.set_vfo = icom_set_vfo,
.set_ant = NULL,
@ -993,7 +1019,7 @@ struct rig_caps ic9700_caps =
[PARM_BANDSELECT] = {.step = {.s = "BANDUNUSED,BAND70CM,BAND33CM,BAND23CM"}},
[PARM_BEEP] = {.min = {.i = 0}, .max = {.i = 1}},
[PARM_SCREENSAVER] = {.min = {.i = 0}, .max = {.i = 3}, .step = {.i = 1}},
[PARM_KEYERTYPE] = {.step = {.s = "STRAIGHT, BUG, PADDLE"}},
[PARM_KEYERTYPE] = {.step = {.s = "STRAIGHT,BUG,PADDLE"}},
},
.ext_tokens = ic9700_ext_tokens,
.extlevels = icom_ext_levels,
@ -1219,8 +1245,9 @@ struct rig_caps ic9700_caps =
.set_freq = icom_set_freq,
.get_freq = icom_get_freq,
.set_mode = icom_set_mode_with_data,
.get_mode = icom_get_mode_with_data,
.set_mode = icom_set_mode,
.get_mode = icom_get_mode,
// IC-9700 can indicate Main/Sub band selection, but not VFO A/B, so leave get_vfo not implemented
// .get_vfo = icom_get_vfo,
.set_vfo = ic9700_set_vfo,
.set_ant = NULL,
@ -1491,8 +1518,8 @@ struct rig_caps ic705_caps =
.set_freq = icom_set_freq,
.get_freq = icom_get_freq,
.set_mode = icom_set_mode_with_data,
.get_mode = icom_get_mode_with_data,
.set_mode = icom_set_mode,
.get_mode = icom_get_mode,
// .get_vfo = icom_get_vfo,
.set_vfo = icom_set_vfo,
.set_ant = NULL,
@ -1588,7 +1615,7 @@ struct rig_caps ic905_caps =
[PARM_BANDSELECT] = {.step = {.s = "BANDUNUSED,BAND70CM,BAND33CM,BAND23CM,BAND23CM,BAND13CM,BAND3CM"}},
[PARM_BEEP] = {.min = {.i = 0}, .max = {.i = 1}},
[PARM_SCREENSAVER] = {.min = {.i = 0}, .max = {.i = 3}, .step = {.i = 1}},
[PARM_KEYERTYPE] = {.step = {.s = "STRAIGHT, BUG, PADDLE"}},
[PARM_KEYERTYPE] = {.step = {.s = "STRAIGHT,BUG,PADDLE"}},
},
.ext_tokens = ic705_ext_tokens,
.extlevels = icom_ext_levels,
@ -1761,8 +1788,8 @@ struct rig_caps ic905_caps =
.set_freq = icom_set_freq,
.get_freq = icom_get_freq,
.set_mode = icom_set_mode_with_data,
.get_mode = icom_get_mode_with_data,
.set_mode = icom_set_mode,
.get_mode = icom_get_mode,
// .get_vfo = icom_get_vfo,
.set_vfo = icom_set_vfo,
.set_ant = NULL,
@ -2187,48 +2214,38 @@ int ic9700_get_clock(RIG *rig, int *year, int *month, int *day, int *hour,
int ic9700_set_vfo(RIG *rig, vfo_t vfo)
{
ENTERFUNC;
unsigned char ackbuf[MAXFRAMELEN];
int ack_len = sizeof(ackbuf), retval = -RIG_EINTERNAL;
int ack_len = sizeof(ackbuf);
int retval;
int vfo_is_main_or_sub = (vfo == RIG_VFO_MAIN) || (vfo == RIG_VFO_SUB);
ENTERFUNC;
rig_debug(RIG_DEBUG_VERBOSE, "%s: vfo=%s\n", __func__, rig_strvfo(vfo));
if (rig->state.cache.satmode)
if (rig->state.cache.satmode && !vfo_is_main_or_sub)
{
if (vfo == RIG_VFO_A) { vfo = RIG_VFO_MAIN; }
else if (vfo == RIG_VFO_B) { vfo = RIG_VFO_SUB; }
// Translate VFO A/B to Main/Sub in satellite mode
if (vfo == RIG_VFO_A)
{
vfo = RIG_VFO_MAIN;
}
else if (vfo == RIG_VFO_B)
{
vfo = RIG_VFO_SUB;
}
else
{
rig_debug(RIG_DEBUG_ERR, "%s: unknown vfo %s\n", __func__, rig_strvfo(vfo));
rig_debug(RIG_DEBUG_ERR, "%s: Invalid VFO %s in satellite mode\n", __func__, rig_strvfo(vfo));
return -RIG_EINVAL;
}
}
if (vfo == RIG_VFO_A)
{
retval = icom_transaction(rig, 0x07, 0x00, NULL, 0, ackbuf, &ack_len);
retval = icom_transaction(rig, C_SET_VFO, S_VFOA, NULL, 0, ackbuf, &ack_len);
}
else if (vfo == RIG_VFO_B)
{
retval = icom_transaction(rig, 0x07, 0x01, NULL, 0, ackbuf, &ack_len);
}
else if (vfo == RIG_VFO_MAIN || vfo == RIG_VFO_MAIN_A || vfo == RIG_VFO_MAIN_B)
{
retval = icom_transaction(rig, 0x07, 0xd0, NULL, 0, ackbuf, &ack_len);
if (retval != RIG_OK)
{
rig_debug(RIG_DEBUG_ERR, "%s: %s\n", __func__, rigerror(retval));
return -retval;
}
if (vfo == RIG_VFO_MAIN_A || vfo == RIG_VFO_MAIN_B)
{
int subcmd = vfo == RIG_VFO_MAIN_A ? 0x00 : 0x01;
retval = icom_transaction(rig, 0x07, subcmd, NULL, 0, ackbuf, &ack_len);
}
}
else if (vfo == RIG_VFO_SUB || vfo == RIG_VFO_SUB_A || vfo == RIG_VFO_SUB_B)
{
if (rig->state.cache.satmode)
{
@ -2238,31 +2255,69 @@ int ic9700_set_vfo(RIG *rig, vfo_t vfo)
return RIG_OK;
}
// first switch to sub
retval = icom_transaction(rig, 0x07, 0xd1, NULL, 0, ackbuf, &ack_len);
retval = icom_transaction(rig, C_SET_VFO, S_VFOB, NULL, 0, ackbuf, &ack_len);
}
else if (vfo == RIG_VFO_MAIN || vfo == RIG_VFO_MAIN_A || vfo == RIG_VFO_MAIN_B)
{
// First switch to Main receiver
retval = icom_transaction(rig, C_SET_VFO, S_MAIN, NULL, 0, ackbuf, &ack_len);
if (retval != RIG_OK)
{
rig_debug(RIG_DEBUG_ERR, "%s: %s\n", __func__, rigerror(retval));
return -retval;
return retval;
}
if (rig->state.cache.satmode && vfo == RIG_VFO_MAIN_B)
{
rig_debug(RIG_DEBUG_WARN, "%s: cannot switch to VFOB when in satmode\n", __func__);
// we return RIG_OK anyways as this should just be a bad request
return RIG_OK;
}
if (vfo == RIG_VFO_MAIN_A || vfo == RIG_VFO_MAIN_B)
{
int subcmd = vfo == RIG_VFO_MAIN_A ? S_VFOA : S_VFOB;
retval = icom_transaction(rig, C_SET_VFO, subcmd, NULL, 0, ackbuf, &ack_len);
}
}
else if (vfo == RIG_VFO_SUB || vfo == RIG_VFO_SUB_A || vfo == RIG_VFO_SUB_B)
{
// First switch to Sub receiver
retval = icom_transaction(rig, C_SET_VFO, S_SUB, NULL, 0, ackbuf, &ack_len);
if (retval != RIG_OK)
{
rig_debug(RIG_DEBUG_ERR, "%s: %s\n", __func__, rigerror(retval));
return retval;
}
if (rig->state.cache.satmode && vfo == RIG_VFO_SUB_B)
{
rig_debug(RIG_DEBUG_WARN, "%s: cannot switch to VFOB when in satmode\n", __func__);
// we return RIG_OK anyways as this should just be a bad request
return RIG_OK;
}
if (vfo == RIG_VFO_SUB_A || vfo == RIG_VFO_SUB_B)
{
HAMLIB_TRACE;
int subcmd = vfo == RIG_VFO_SUB_A ? 0x00 : 0x01;
retval = icom_transaction(rig, 0x07, subcmd, NULL, 0, ackbuf, &ack_len);
int subcmd = vfo == RIG_VFO_SUB_A ? S_VFOA : S_VFOB;
retval = icom_transaction(rig, C_SET_VFO, subcmd, NULL, 0, ackbuf, &ack_len);
}
}
else if (vfo == RIG_VFO_MEM)
{
return icom_set_vfo(rig, vfo);
}
else
{
// Unsupported VFO
RETURNFUNC(-RIG_EINVAL);
}
if (retval != RIG_OK)
{
rig_debug(RIG_DEBUG_ERR, "%s: %s\n", __func__, rigerror(retval));
return -retval;
return retval;
}
RETURNFUNC(retval);

Wyświetl plik

@ -115,6 +115,7 @@ static const struct icom_priv_caps ic7410_priv_caps =
{ .level = RIG_AGC_FAST, .icom_level = 3 },
{ .level = RIG_AGC_LAST, .icom_level = -1 },
},
.data_mode_supported = 1,
};
@ -155,7 +156,7 @@ struct rig_caps ic7410_caps =
.parm_gran = {
[PARM_BACKLIGHT] = {.min = {.f = 0.0f}, .max = {.f = 1.0f}, .step = {.f = 1.0f / 255.0f}},
[PARM_ANN] = {.min = {.i = 0}, .max = {.i = 2}, .step = {.i = 1}},
[PARM_KEYERTYPE] = {.step = {.s = "STRAIGHT, BUG, PADDLE"}},
[PARM_KEYERTYPE] = {.step = {.s = "STRAIGHT,BUG,PADDLE"}},
},
.ctcss_list = common_ctcss_list,
@ -249,8 +250,8 @@ struct rig_caps ic7410_caps =
.set_freq = icom_set_freq,
.get_freq = icom_get_freq,
.set_mode = icom_set_mode_with_data,
.get_mode = icom_get_mode_with_data,
.set_mode = icom_set_mode,
.get_mode = icom_get_mode,
.set_vfo = icom_set_vfo,
// .get_vfo = icom_get_vfo,
.set_ant = icom_set_ant,

Wyświetl plik

@ -556,8 +556,8 @@ struct rig_caps ic746pro_caps =
.set_freq = icom_set_freq,
.get_freq = icom_get_freq,
.set_mode = icom_set_mode_with_data,
.get_mode = icom_get_mode_with_data,
.set_mode = icom_set_mode,
.get_mode = icom_get_mode,
.set_vfo = icom_set_vfo,
// .get_vfo = icom_get_vfo,
.set_ant = icom_set_ant,

Wyświetl plik

@ -471,6 +471,7 @@ static const struct icom_priv_caps ic756pro2_priv_caps =
{ .level = RIG_AGC_LAST, .icom_level = -1 },
},
.extcmds = ic756pro_cmdparms, /* Custom op parameters */
.data_mode_supported = 1
};
/*
@ -651,8 +652,8 @@ struct rig_caps ic756pro2_caps =
.set_freq = icom_set_freq,
.get_freq = icom_get_freq,
.set_mode = icom_set_mode_with_data,
.get_mode = icom_get_mode_with_data,
.set_mode = icom_set_mode,
.get_mode = icom_get_mode,
.set_vfo = icom_set_vfo,
// .get_vfo = icom_get_vfo,
.set_ant = icom_set_ant,
@ -902,6 +903,7 @@ static const struct icom_priv_caps ic756pro3_priv_caps =
{ .level = RIG_AGC_LAST, .icom_level = -1 },
},
.extcmds = ic756pro_cmdparms, /* Custom op parameters */
.data_mode_supported = 1
};
@ -1102,8 +1104,8 @@ struct rig_caps ic756pro3_caps =
.set_freq = icom_set_freq,
.get_freq = icom_get_freq,
.set_mode = icom_set_mode_with_data,
.get_mode = icom_get_mode_with_data,
.set_mode = icom_set_mode,
.get_mode = icom_get_mode,
.set_vfo = icom_set_vfo,
// .get_vfo = icom_get_vfo,
.set_ant = icom_set_ant,

Wyświetl plik

@ -161,6 +161,13 @@ static const struct icom_priv_caps ic7600_priv_caps =
{ .level = RIG_AGC_LAST, .icom_level = -1 },
},
.extcmds = ic7600_extcmds, /* Custom op parameters */
.x25x26_always = 0,
.x25x26_possibly = 1,
.x1cx03_always = 0,
.x1cx03_possibly = 1,
.x1ax03_supported = 1,
.mode_with_filter = 1,
.data_mode_supported = 1
};
@ -317,7 +324,7 @@ struct rig_caps ic7600_caps =
[PARM_TIME] = {.min = {.i = 0}, .max = {.i = 86399}, .step = {.i = 1}},
[PARM_ANN] = {.min = {.i = 0}, .max = {.i = 2}, .step = {.i = 1}},
[PARM_APO] = { .min = { .i = 1 }, .max = { .i = 1439} },
[PARM_KEYERTYPE] = {.step = {.s = "STRAIGHT, BUG, PADDLE"}},
[PARM_KEYERTYPE] = {.step = {.s = "STRAIGHT,BUG,PADDLE"}},
},
.ext_tokens = ic7600_ext_tokens,
@ -333,7 +340,7 @@ struct rig_caps ic7600_caps =
.max_ifshift = Hz(0),
.agc_level_count = 3,
.agc_levels = { RIG_AGC_FAST, RIG_AGC_MEDIUM, RIG_AGC_SLOW },
.targetable_vfo = 0,
.targetable_vfo = RIG_TARGETABLE_FREQ | RIG_TARGETABLE_MODE,
.vfo_ops = IC7600_VFO_OPS,
.scan_ops = IC7600_SCAN_OPS,
.transceive = RIG_TRN_RIG,
@ -424,10 +431,10 @@ struct rig_caps ic7600_caps =
.set_freq = icom_set_freq,
.get_freq = icom_get_freq,
.set_mode = icom_set_mode_with_data,
.get_mode = icom_get_mode_with_data,
.set_mode = icom_set_mode,
.get_mode = icom_get_mode,
.set_vfo = icom_set_vfo,
// .get_vfo = icom_get_vfo,
.get_vfo = icom_get_vfo,
.set_ant = icom_set_ant,
.get_ant = icom_get_ant,

Wyświetl plik

@ -242,7 +242,13 @@ static const struct icom_priv_caps ic7610_priv_caps =
},
},
.extcmds = ic7610_extcmds,
.x25_always = 1,
.x25x26_always = 1,
.x25x26_possibly = 1,
.x1cx03_always = 1,
.x1cx03_possibly = 1,
.x1ax03_supported = 1,
.mode_with_filter = 1,
.data_mode_supported = 1
};
@ -402,7 +408,7 @@ struct rig_caps ic7610_caps =
[PARM_BEEP] = {.min = {.i = 0}, .max = {.i = 1}, .step = {.i = 1}},
[PARM_TIME] = {.min = {.i = 0}, .max = {.i = 86399}, .step = {.i = 1}},
[PARM_ANN] = {.min = {.i = 0}, .max = {.i = 2}, .step = {.i = 1}},
[PARM_KEYERTYPE] = {.step = {.s = "STRAIGHT, BUG, PADDLE"}},
[PARM_KEYERTYPE] = {.step = {.s = "STRAIGHT,BUG,PADDLE"}},
},
.ext_tokens = ic7610_ext_tokens,
@ -565,10 +571,10 @@ struct rig_caps ic7610_caps =
.set_freq = icom_set_freq,
.get_freq = icom_get_freq,
.set_mode = icom_set_mode_with_data,
.get_mode = icom_get_mode_with_data,
.set_mode = icom_set_mode,
.get_mode = icom_get_mode,
.set_vfo = icom_set_vfo,
// .get_vfo = icom_get_vfo,
.get_vfo = icom_get_vfo,
.set_ant = icom_set_ant,
.get_ant = icom_get_ant,

Wyświetl plik

@ -143,6 +143,13 @@ static const struct icom_priv_caps ic7700_priv_caps =
{ .level = RIG_AGC_LAST, .icom_level = -1 },
},
.extcmds = ic7700_extcmds,
.x25x26_always = 0,
.x25x26_possibly = 1,
.x1cx03_always = 0,
.x1cx03_possibly = 1,
.x1ax03_supported = 1,
.mode_with_filter = 1,
.data_mode_supported = 1
};
// if hour < 0 then only date will be set
@ -316,7 +323,7 @@ struct rig_caps ic7700_caps =
.agc_level_count = 4,
.agc_levels = { RIG_AGC_OFF, RIG_AGC_FAST, RIG_AGC_MEDIUM, RIG_AGC_SLOW },
// 7700 can have a different mode on VFOB but requires VFO swap
.targetable_vfo = RIG_TARGETABLE_MODE,
.targetable_vfo = RIG_TARGETABLE_FREQ | RIG_TARGETABLE_MODE,
.vfo_ops = IC7700_VFO_OPS,
.scan_ops = IC7700_SCAN_OPS,
.transceive = RIG_TRN_RIG,
@ -407,8 +414,8 @@ struct rig_caps ic7700_caps =
.set_freq = icom_set_freq,
.get_freq = icom_get_freq,
.set_mode = icom_set_mode_with_data,
.get_mode = icom_get_mode_with_data,
.set_mode = icom_set_mode,
.get_mode = icom_get_mode,
.set_vfo = icom_set_vfo,
// .get_vfo = icom_get_vfo,
.set_ant = icom_set_ant,

Wyświetl plik

@ -153,6 +153,13 @@ static const struct icom_priv_caps ic7800_priv_caps =
{ .level = RIG_AGC_LAST, .icom_level = -1 },
},
.extcmds = ic7800_extcmds,
.x25x26_always = 0,
.x25x26_possibly = 1,
.x1cx03_always = 0,
.x1cx03_possibly = 1,
.x1ax03_supported = 1,
.mode_with_filter = 1,
.data_mode_supported = 1
};
struct rig_caps ic7800_caps =
@ -296,10 +303,10 @@ struct rig_caps ic7800_caps =
.set_freq = icom_set_freq,
.get_freq = icom_get_freq,
.set_mode = icom_set_mode_with_data,
.get_mode = icom_get_mode_with_data,
.set_mode = icom_set_mode,
.get_mode = icom_get_mode,
.set_vfo = icom_set_vfo,
// .get_vfo = icom_get_vfo,
.get_vfo = icom_get_vfo,
.set_ant = icom_set_ant,
.get_ant = icom_get_ant,

Wyświetl plik

@ -235,7 +235,13 @@ static struct icom_priv_caps ic785x_priv_caps =
},
},
.extcmds = ic785x_extcmds,
.x25_always = 1,
.x25x26_always = 1,
.x25x26_possibly = 1,
.x1cx03_always = 1,
.x1cx03_possibly = 1,
.x1ax03_supported = 1,
.mode_with_filter = 1,
.data_mode_supported = 1
};
struct rig_caps ic785x_caps =
@ -282,7 +288,7 @@ struct rig_caps ic785x_caps =
[PARM_BEEP] = {.min = {.i = 0}, .max = {.i = 1}, .step = {.i = 1}},
[PARM_TIME] = {.min = {.i = 0}, .max = {.i = 86399}, .step = {.i = 1}},
[PARM_ANN] = {.min = {.i = 0}, .max = {.i = 2}, .step = {.i = 1}},
[PARM_KEYERTYPE] = {.step = {.s = "STRAIGHT, BUG, PADDLE"}},
[PARM_KEYERTYPE] = {.step = {.s = "STRAIGHT,BUG,PADDLE"}},
},
.ext_tokens = ic785x_ext_tokens,
@ -443,10 +449,10 @@ struct rig_caps ic785x_caps =
.set_freq = icom_set_freq,
.get_freq = icom_get_freq,
.set_mode = icom_set_mode_with_data,
.get_mode = icom_get_mode_with_data,
.set_mode = icom_set_mode,
.get_mode = icom_get_mode,
.set_vfo = icom_set_vfo,
// .get_vfo = icom_get_vfo,
.get_vfo = icom_get_vfo,
.set_ant = icom_set_ant,
.get_ant = icom_get_ant,

Wyświetl plik

@ -56,7 +56,6 @@ static const struct icom_priv_caps ic821h_priv_caps =
// If Main/Sub we assume we're doing satmode
int ic821h_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
{
struct icom_priv_data *priv = (struct icom_priv_data *) rig->state.priv;
int retval = -RIG_EINTERNAL;
ENTERFUNC;
@ -69,14 +68,14 @@ int ic821h_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
split; // we emulate satmode of other rigs since we apparently can't query
rig_debug(RIG_DEBUG_TRACE, "%s: tx_vfo==MAIN so assuming sat mode=%d\n",
__func__, rig->state.cache.satmode);
priv->tx_vfo = split == RIG_SPLIT_ON ? RIG_VFO_SUB : RIG_VFO_MAIN;
rig->state.tx_vfo = split == RIG_SPLIT_ON ? RIG_VFO_SUB : RIG_VFO_MAIN;
// the IC821 seems to be backwards in satmode -- setting Main select Sub and vice versa
retval = rig_set_vfo(rig, RIG_VFO_SUB);
}
else if (tx_vfo == RIG_VFO_A)
{
retval = rig_set_vfo(rig, RIG_VFO_A);
priv->tx_vfo = split == RIG_SPLIT_ON ? RIG_VFO_B : RIG_VFO_A;
rig->state.tx_vfo = split == RIG_SPLIT_ON ? RIG_VFO_B : RIG_VFO_A;
}
else
{

Wyświetl plik

@ -102,6 +102,13 @@ static const struct icom_priv_caps ic9100_priv_caps =
.antack_len = 2,
.ant_count = 2,
.extcmds = ic9100_extcmds,
.x25x26_always = 0,
.x25x26_possibly = 0,
.x1cx03_always = 0,
.x1cx03_possibly = 0,
.x1ax03_supported = 1,
.mode_with_filter = 1,
.data_mode_supported = 1
};
struct rig_caps ic9100_caps =
@ -140,7 +147,7 @@ struct rig_caps ic9100_caps =
[PARM_BACKLIGHT] = {.min = {.f = 0.0f}, .max = {.f = 1.0f}, .step = {.f = 1.0f / 255.0f}},
[PARM_BANDSELECT] = {.step = {.s = "BANDUNUSED,BAND160M,BAND80M,BAND40M,BAND30M,BAND20M,BAND17M,BAND15M,BAND12M,BAND10M,BAND6M,BANDGEN"}},
[PARM_ANN] = {.min = {.i = 0}, .max = {.i = 2}, .step = {.i = 1}},
[PARM_KEYERTYPE] = {.step = {.s = "STRAIGHT, BUG, PADDLE"}},
[PARM_KEYERTYPE] = {.step = {.s = "STRAIGHT,BUG,PADDLE"}},
},
.ctcss_list = common_ctcss_list,
@ -241,8 +248,8 @@ struct rig_caps ic9100_caps =
.get_freq = icom_get_freq,
.set_freq = icom_set_freq,
.get_mode = icom_get_mode_with_data,
.set_mode = icom_set_mode_with_data,
.get_mode = icom_get_mode,
.set_mode = icom_set_mode,
.set_vfo = icom_set_vfo,
// .get_vfo = icom_get_vfo,

Plik diff jest za duży Load Diff

Wyświetl plik

@ -55,7 +55,7 @@
* parameters and levels.
*/
#define STR_CAL_LENGTH 16
#define STR_CAL_S0 -54
#define STR_CAL_S0 (-54)
#define MULTIB_SUBCMD
/*
@ -244,7 +244,13 @@ struct icom_priv_caps
struct icom_spectrum_edge_frequency_range spectrum_edge_frequency_ranges[ICOM_MAX_SPECTRUM_FREQ_RANGES]; /*!< Icom spectrum scope edge frequencies, if supported by the rig. Last entry should have zeros in all fields. */
struct cmdparams *extcmds; /*!< Pointer to extended operations array */
int dualwatch_split; /*!< Rig supports dual watch for split ops -- e.g. ID-5100 */
int x25_always; /*!< Means the rig should use 0x25 and 0x26 commands always */
int x25x26_always; /*!< Rig should use 0x25 and 0x26 commands always */
int x25x26_possibly; /*!< Rig might support 0x25 and 0x26 commands if the firmware is upgraded */
int x1cx03_always; /*!< Rig should use 0x1C 0x03 command for getting TX frequency */
int x1cx03_possibly; /*!< Rig might support 0x1C 0x03 command if the firmware is upgraded TODO: is this added by FW upgrade ever? */
int x1ax03_supported; /*!< Rig supports setting/getting filter width */
int mode_with_filter; /*!< Rig mode commands include filter selection */
int data_mode_supported; /*!< Rig supports data mode flag */
};
struct icom_priv_data
@ -252,23 +258,29 @@ struct icom_priv_data
unsigned char re_civ_addr; /*!< The remote equipment's CI-V address */
int civ_731_mode; /*!< Off: freqs on 10 digits, On: freqs on 8 digits */
int no_xchg; /*!< Off: use VFO XCHG to set other VFO, On: use set VFO to set other VFO */
int no_1a_03_cmd; /*!< Rig doesn't tell IF widths */
int split_on; /*!< Record split state */
int no_1a_03_cmd; /*!< Rig does not support setting/getting filter width */
int split_on_deprecated; /*!< @deprecated Use rig_cache.split - Record split state */
pltstate_t *pltstate; /*!< Only on optoscan */
int serial_USB_echo_off; /*!< USB is not set to echo */
/* we track vfos internally for use with different functions like split */
/* this allows queries using CURR_VFO and Main/Sub to behave */
vfo_t rx_vfo;
vfo_t tx_vfo;
freq_t curr_freq; /*!< Our current freq depending on which vfo is selected */
freq_t main_freq; /*!< Track last setting of main -- not being used yet */
freq_t sub_freq; /*!< Track last setting of sub -- not being used yet */
freq_t maina_freq;
freq_t mainb_freq;
freq_t suba_freq;
freq_t subb_freq;
freq_t vfoa_freq; /*!< Track last setting of vfoa -- used to return last freq when ptt is asserted */
freq_t vfob_freq; /*!< Track last setting of vfob -- used to return last freq when ptt is asserted */
/**
* Icom backends track VFOs internally for use with different functions like split.
* This allows queries using CURR_VFO and Main/Sub to work correctly.
*
* The fields in this struct are no longer used, because rig_state and rig_cache structs provide
* the same functionality for all rigs globally.
*/
vfo_t rx_vfo_deprecated; /*!< @deprecated Use rig_state.rx_vfo */
vfo_t tx_vfo_deprecated; /*!< @deprecated Use rig_state.tx_vfo */
freq_t curr_freq_deprecated; /*!< @deprecated Use rig_cache.freqCurr - Our current freq depending on which vfo is selected */
freq_t main_freq_deprecated; /*!< @deprecated Use rig_cache.freqMainA - Track last setting of main -- not being used yet */
freq_t sub_freq_deprecated; /*!< @deprecated Use rig_cache.freqSubA - Track last setting of sub -- not being used yet */
freq_t maina_freq_deprecated; /*!< @deprecated Use rig_cache.freqMainA */
freq_t mainb_freq_deprecated; /*!< @deprecated Use rig_cache.freqMainB */
freq_t suba_freq_deprecated; /*!< @deprecated Use rig_cache.freqSubA */
freq_t subb_freq_deprecated; /*!< @deprecated Use rig_cache.freqSubB */
freq_t vfoa_freq_deprecated; /*!< @deprecated Use rig_cache.freqMainA - Track last setting of vfoa -- used to return last freq when ptt is asserted */
freq_t vfob_freq_deprecated; /*!< @deprecated Use rig_cache.freqMainB - Track last setting of vfob -- used to return last freq when ptt is asserted */
int x25cmdfails; /*!< This will get set if the 0x25 command fails so we try just once */
int x26cmdfails; /*!< This will get set if the 0x26 command fails so we try just once */
int x1cx03cmdfails; /*!< This will get set if the 0x1c 0x03 command fails so we try just once */
@ -277,7 +289,7 @@ struct icom_priv_data
unsigned char datamode; /*!< Current datamode */
int spectrum_scope_count; /*!< Number of spectrum scopes, calculated from caps */
struct icom_spectrum_scope_cache spectrum_scope_cache[HAMLIB_MAX_SPECTRUM_SCOPES]; /*!< Cached Icom spectrum scope data used during reception of the data. The array index must match the scope ID. */
freq_t other_freq; /*!< Our other freq depending on which vfo is selected */
freq_t other_freq_deprecated; /*!< @deprecated Use rig_cache.freqOther - Our other freq depending on which vfo is selected */
int vfo_flag; // used to skip vfo check when frequencies are equal
int dual_watch_main_sub; // 0=main, 1=sub
};
@ -316,16 +328,9 @@ int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq);
int icom_get_rit_new(RIG *rig, vfo_t vfo, shortfreq_t *ts);
int icom_set_rit_new(RIG *rig, vfo_t vfo, shortfreq_t ts);
int icom_set_xit_new(RIG *rig, vfo_t vfo, shortfreq_t ts);
int icom_set_mode_with_data(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width);
int icom_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width);
int icom_get_mode_with_data(RIG *rig, vfo_t vfo, rmode_t *mode,
pbwidth_t *width);
int icom_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width);
#if 1 // see icom_get_vfo in icom.c
int icom_get_vfo(RIG *rig, vfo_t *vfo);
#else
#define icom_get_vfo NULL
#endif
int icom_set_vfo(RIG *rig, vfo_t vfo);
int icom_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t rptr_shift);
int icom_get_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t *rptr_shift);
@ -341,8 +346,8 @@ int icom_set_split_freq_mode(RIG *rig, vfo_t vfo, freq_t tx_freq,
rmode_t tx_mode, pbwidth_t tx_width);
int icom_get_split_freq_mode(RIG *rig, vfo_t vfo, freq_t *tx_freq,
rmode_t *tx_mode, pbwidth_t *tx_width);
int icom_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo);
int icom_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo);
int icom_set_split_vfo(RIG *rig, vfo_t rx_vfo, split_t split, vfo_t tx_vfo);
int icom_get_split_vfo(RIG *rig, vfo_t rx_vfo, split_t *split, vfo_t *tx_vfo);
int icom_mem_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo);
int icom_set_ts(RIG *rig, vfo_t vfo, shortfreq_t ts);
int icom_get_ts(RIG *rig, vfo_t vfo, shortfreq_t *ts);
@ -594,5 +599,4 @@ extern struct rig_caps icr30_caps;
#define RIG_IS_X5105 (rig->state.rig_model == RIG_MODEL_X5105)
#define RIG_IS_X6100 (rig->state.rig_model == RIG_MODEL_X6100)
#endif /* _ICOM_H */

Wyświetl plik

@ -98,6 +98,7 @@
#define C_CTL_RIT 0x21 /* RIT/XIT control */
#define C_CTL_DSD 0x22 /* D-STAR Data */
#define C_SEND_SEL_FREQ 0x25 /* Send/Recv sel/unsel VFO frequency */
#define C_SEND_SEL_MODE 0x26 /* Send/Recv sel/unsel VFO mode & filter */
#define C_CTL_SCP 0x27 /* Scope control & data */
#define C_SND_VOICE 0x28 /* Transmit Voice Memory Contents */
#define C_CTL_MTEXT 0x70 /* Microtelecom Extension */
@ -160,7 +161,7 @@
#define S_DUAL 0xc2 /* Dual watch (0 = off, 1 = on) */
#define S_MAIN 0xd0 /* Select MAIN band */
#define S_SUB 0xd1 /* Select SUB band */
#define S_SUB_SEL 0xd2 /* Read/Set Main/Sub selection */
#define S_BAND_SEL 0xd2 /* Read/Set Main/Sub band selection */
#define S_FRONTWIN 0xe0 /* Select front window */
/*
@ -361,8 +362,9 @@
/*
* Transmit control (C_CTL_PTT) subcommands
*/
#define S_PTT 0x00
#define S_ANT_TUN 0x01 /* Auto tuner 0=OFF, 1 = ON, 2=Start Tuning */
#define S_PTT 0x00
#define S_ANT_TUN 0x01 /* Auto tuner 0=OFF, 1 = ON, 2=Start Tuning */
#define S_RD_TX_FREQ 0x03 /* Read transmit frequency */
/*
* Band Edge control (C_CTL_EDGE) subcommands

Wyświetl plik

@ -141,7 +141,7 @@ static struct icom_priv_caps x108g_priv_caps =
0x70, /* default address */
0, /* 731 mode */
0, /* no XCHG */
ic7200_ts_sc_list
ic7200_ts_sc_list,
};
@ -321,6 +321,21 @@ struct rig_caps x108g_caps =
.hamlib_check_rig_caps = HAMLIB_CHECK_RIG_CAPS
};
static struct icom_priv_caps x6100_priv_caps =
{
0x70, /* default address */
0, /* 731 mode */
0, /* no XCHG */
ic7200_ts_sc_list,
.x25x26_always = 0,
.x25x26_possibly = 0,
.x1cx03_always = 0,
.x1cx03_possibly = 0,
.x1ax03_supported = 0,
.mode_with_filter = 1,
.data_mode_supported = 1
};
struct rig_caps x6100_caps =
{
RIG_MODEL(RIG_MODEL_X6100),
@ -445,7 +460,7 @@ struct rig_caps x6100_caps =
.set_conf = icom_set_conf,
.get_conf = icom_get_conf,
.priv = (void *)& x108g_priv_caps,
.priv = (void *) &x6100_priv_caps,
.rig_init = icom_init,
.rig_cleanup = icom_cleanup,
.rig_open = icom_rig_open,
@ -453,8 +468,8 @@ struct rig_caps x6100_caps =
.set_freq = icom_set_freq,
.get_freq = icom_get_freq,
.set_mode = icom_set_mode_with_data,
.get_mode = icom_get_mode_with_data,
.set_mode = icom_set_mode,
.get_mode = icom_get_mode,
.set_vfo = icom_set_vfo,
.set_ant = NULL, /*automatically set by rig depending band */
.get_ant = NULL,
@ -909,7 +924,6 @@ int x108g_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
*/
static int x108g_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
{
struct icom_priv_data *priv = (struct icom_priv_data *)rig->state.priv;
unsigned char ackbuf[MAXFRAMELEN];
int ack_len = sizeof(ackbuf), rc;
int split_sc;
@ -925,7 +939,7 @@ static int x108g_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
case RIG_SPLIT_ON:
split_sc = S_SPLT_ON;
if (!priv->split_on)
if (rig->state.cache.split == RIG_SPLIT_OFF)
{
/* ensure VFO A is Rx and VFO B is Tx as we assume that elsewhere */
if ((rig->state.vfo_list & (RIG_VFO_A | RIG_VFO_B)) == (RIG_VFO_A | RIG_VFO_B))
@ -952,7 +966,7 @@ static int x108g_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
return -RIG_ERJCTED;
}
priv->split_on = RIG_SPLIT_ON == split;
rig->state.cache.split = split;
return RIG_OK;
}
@ -991,13 +1005,17 @@ static int x108g_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
current VFO is VFO A and the split Tx VFO is always VFO B. These
assumptions allow us to deal with the lack of VFO and split
queries */
/* broken if user changes split on rig :( */
if ((rig->state.vfo_list & (RIG_VFO_A | RIG_VFO_B)) == (RIG_VFO_A | RIG_VFO_B)
&& priv->split_on) /* broken if user changes split on rig :( */
&& rig->state.cache.split != RIG_SPLIT_OFF)
{
/* VFO A/B style rigs swap VFO on split Tx so we need to disable
split for certainty */
if (RIG_OK != (rc = icom_transaction(rig, C_CTL_SPLT, S_SPLT_OFF, NULL, 0,
ackbuf, &ack_len))) { return rc; }
rc = icom_transaction(rig, C_CTL_SPLT, S_SPLT_OFF, NULL, 0, ackbuf, &ack_len);
if (rc != RIG_OK)
{
return rc;
}
if (ack_len != 2 || ackbuf[0] != 0x0f)
{
@ -1016,11 +1034,14 @@ static int x108g_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
if (RIG_OK != (rc = icom_set_vfo(rig, rx_vfo))) { return rc; }
if ((rig->state.vfo_list & (RIG_VFO_A | RIG_VFO_B)) == (RIG_VFO_A | RIG_VFO_B)
&& priv->split_on)
&& rig->state.cache.split != RIG_SPLIT_OFF)
{
/* Re-enable split */
if (RIG_OK != (rc = icom_transaction(rig, C_CTL_SPLT, S_SPLT_ON, NULL, 0,
ackbuf, &ack_len))) { return rc; }
rc = icom_transaction(rig, C_CTL_SPLT, S_SPLT_ON, NULL, 0, ackbuf, &ack_len);
if (rc != RIG_OK)
{
return rc;
}
}
return rc;
@ -1061,13 +1082,17 @@ static int x108g_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode,
current VFO is VFO A and the split Tx VFO is always VFO B. These
assumptions allow us to deal with the lack of VFO and split
queries */
/* broken if user changes split on rig :( */
if ((rig->state.vfo_list & (RIG_VFO_A | RIG_VFO_B)) == (RIG_VFO_A | RIG_VFO_B)
&& priv->split_on) /* broken if user changes split on rig :( */
&& rig->state.cache.split != RIG_SPLIT_OFF)
{
/* VFO A/B style rigs swap VFO on split Tx so we need to disable
split for certainty */
if (RIG_OK != (rc = icom_transaction(rig, C_CTL_SPLT, S_SPLT_OFF, NULL, 0,
ackbuf, &ack_len))) { return rc; }
rc = icom_transaction(rig, C_CTL_SPLT, S_SPLT_OFF, NULL, 0, ackbuf, &ack_len);
if (rc != RIG_OK)
{
return rc;
}
if (ack_len != 2 || ackbuf[0] != 0x0f)
{
@ -1087,13 +1112,15 @@ static int x108g_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode,
if (RIG_OK != (rc = icom_set_vfo(rig, rx_vfo))) { return rc; }
if ((rig->state.vfo_list & (RIG_VFO_A | RIG_VFO_B)) == (RIG_VFO_A | RIG_VFO_B)
&& priv->split_on)
&& rig->state.cache.split != RIG_SPLIT_OFF)
{
/* Re-enable split */
if (RIG_OK != (rc = icom_transaction(rig, C_CTL_SPLT, S_SPLT_ON, NULL, 0,
ackbuf, &ack_len))) { return rc; }
rc = icom_transaction(rig, C_CTL_SPLT, S_SPLT_ON, NULL, 0, ackbuf, &ack_len);
if (rc != RIG_OK)
{
return rc;
}
}
return rc;
}

Wyświetl plik

@ -345,7 +345,7 @@ static const yaesu_newcat_commands_t valid_commands[] =
{"SS", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE },
// ST command has two meanings Step or Split Status
// If new rig is added that has ST ensure it means Split
// Otherwise modify newcat_get_tx_vfo
// Otherwise modify newcat_(set|get)_split
{"ST", TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE },
{"SV", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE },
{"SY", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE},
@ -387,6 +387,8 @@ const struct confparams newcat_cfg_params[] =
/* NewCAT Internal Functions */
static ncboolean newcat_is_rig(RIG *rig, rig_model_t model);
static int newcat_set_split(RIG *rig, split_t split, vfo_t *rx_vfo, vfo_t *tx_vfo);
static int newcat_get_split(RIG *rig, split_t *split, vfo_t *tx_vfo);
static int newcat_set_vfo_from_alias(RIG *rig, vfo_t *vfo);
static int newcat_get_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode,
pbwidth_t *width);
@ -397,7 +399,7 @@ static int newcat_get_narrow(RIG *rig, vfo_t vfo, ncboolean *narrow);
static int newcat_set_faststep(RIG *rig, ncboolean fast_step);
static int newcat_get_faststep(RIG *rig, ncboolean *fast_step);
static int newcat_get_rigid(RIG *rig);
static int newcat_get_vfo_mode(RIG *rig, vfo_t vfo, rmode_t *vfo_mode);
static int newcat_get_vfo_mode(RIG *rig, vfo_t vfo, vfo_t *vfo_mode);
static int newcat_vfomem_toggle(RIG *rig);
static int set_roofing_filter(RIG *rig, vfo_t vfo, int index);
static int set_roofing_filter_for_width(RIG *rig, vfo_t vfo, int width);
@ -835,8 +837,7 @@ int newcat_60m_exception(RIG *rig, freq_t freq, mode_t mode)
int err;
int channel = -1;
int i;
rmode_t tmode;
pbwidth_t twidth;
vfo_t vfo_mode;
if (!(freq > 5.2 && freq < 5.5)) // we're not on 60M
{
@ -876,9 +877,9 @@ int newcat_60m_exception(RIG *rig, freq_t freq, mode_t mode)
rig_debug(RIG_DEBUG_VERBOSE, "%s: 60M exception ignoring freq/mode commands\n",
__func__);
rig_get_mode(rig, RIG_VFO_A, &tmode, &twidth);
newcat_get_vfo_mode(rig, RIG_VFO_A, &vfo_mode);
if (tmode != RIG_VFO_MEM)
if (vfo_mode != RIG_VFO_MEM)
{
err = newcat_vfomem_toggle(rig);
@ -934,8 +935,7 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
struct rig_caps *caps;
struct newcat_priv_data *priv;
int special_60m = 0;
rmode_t tmode;
pbwidth_t twidth;
vfo_t vfo_mode;
ENTERFUNC;
@ -964,9 +964,9 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
priv = (struct newcat_priv_data *)rig->state.priv;
caps = rig->caps;
rig_get_mode(rig, RIG_VFO_A, &tmode, &twidth);
newcat_get_vfo_mode(rig, RIG_VFO_A, &vfo_mode);
if (tmode == RIG_VFO_MEM)
if (vfo_mode == RIG_VFO_MEM)
{
// then we need to toggle back to VFO mode
newcat_vfomem_toggle(rig);
@ -1106,7 +1106,7 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
// Call this after open to set width_frequency for later use
if (priv->width_frequency == 0)
{
rmode_t vfo_mode;
vfo_t vfo_mode;
newcat_get_vfo_mode(rig, vfo, &vfo_mode);
}
@ -1664,7 +1664,7 @@ int newcat_set_vfo(RIG *rig, vfo_t vfo)
struct rig_state *state;
char c;
int err, mem;
rmode_t vfo_mode;
vfo_t vfo_mode;
char command[] = "VS";
priv = (struct newcat_priv_data *)rig->state.priv;
@ -1820,7 +1820,7 @@ int newcat_get_vfo(RIG *rig, vfo_t *vfo)
struct rig_state *state = &rig->state;
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
int err;
rmode_t vfo_mode;
vfo_t vfo_mode;
char const *command = "VS";
ENTERFUNC;
@ -2720,7 +2720,6 @@ int newcat_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
int err;
vfo_t rx_vfo = RIG_VFO_NONE;
//ENTERFUNC;
rig_debug(RIG_DEBUG_TRACE, "%s: entered, rxvfo=%s, txvfo=%s, split=%d\n",
__func__, rig_strvfo(vfo), rig_strvfo(tx_vfo), split);
@ -2739,14 +2738,22 @@ int newcat_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
if (is_ft991)
{
// FT-991(A) doesn't have a concept of an active VFO, so VFO B needs to be the split VFO
vfo = RIG_VFO_A;
tx_vfo = RIG_SPLIT_ON == split ? RIG_VFO_B : RIG_VFO_A;
}
else if (is_ftdx101d || is_ftdx101mp)
{
// FTDX101(D/MP) always use Sub VFO for transmit when in split mode
vfo = RIG_VFO_MAIN;
tx_vfo = RIG_SPLIT_ON == split ? RIG_VFO_SUB : RIG_VFO_MAIN;
}
else if (is_ftdx10)
{
// FTDX10 always uses VFO B for transmit when in split mode
vfo = RIG_VFO_A;
tx_vfo = RIG_SPLIT_ON == split ? RIG_VFO_B : RIG_VFO_A;
}
else
{
err = newcat_get_vfo(rig, &rx_vfo); /* sync to rig current vfo */
@ -2760,11 +2767,21 @@ int newcat_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
switch (split)
{
case RIG_SPLIT_OFF:
err = newcat_set_tx_vfo(rig, vfo);
err = -RIG_ENAVAIL;
if (err != RIG_OK)
if (newcat_valid_command(rig, "ST"))
{
RETURNFUNC(err);
err = newcat_set_split(rig, split, &rx_vfo, &tx_vfo);
}
if (err == -RIG_ENAVAIL)
{
err = newcat_set_tx_vfo(rig, vfo);
if (err != RIG_OK)
{
RETURNFUNC(err);
}
}
if (rx_vfo != vfo && newcat_valid_command(rig, "VS"))
@ -2780,11 +2797,21 @@ int newcat_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
break;
case RIG_SPLIT_ON:
err = newcat_set_tx_vfo(rig, tx_vfo);
err = -RIG_ENAVAIL;
if (err != RIG_OK)
if (newcat_valid_command(rig, "ST"))
{
RETURNFUNC(err);
err = newcat_set_split(rig, split, &rx_vfo, &tx_vfo);
}
if (err == -RIG_ENAVAIL)
{
err = newcat_set_tx_vfo(rig, tx_vfo);
if (err != RIG_OK)
{
RETURNFUNC(err);
}
}
if (rx_vfo != vfo)
@ -2820,25 +2847,32 @@ int newcat_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo)
RETURNFUNC(err);
}
err = newcat_get_tx_vfo(rig, tx_vfo);
if (err != RIG_OK)
err = -RIG_ENAVAIL;
if (newcat_valid_command(rig, "ST"))
{
RETURNFUNC(err);
err = newcat_get_split(rig, split, tx_vfo);
}
// we assume split is always on VFO_B
//if (*tx_vfo == RIG_VFO_B || *tx_vfo == RIG_VFO_SUB)
rig_debug(RIG_DEBUG_TRACE, "%s: tx_vfo=%s, curr_vfo=%s\n", __func__,
rig_strvfo(*tx_vfo), rig_strvfo(rig->state.current_vfo));
if (err == -RIG_ENAVAIL)
{
err = newcat_get_tx_vfo(rig, tx_vfo);
if (*tx_vfo != rig->state.current_vfo)
{
*split = RIG_SPLIT_ON;
}
else
{
*split = RIG_SPLIT_OFF;
if (err != RIG_OK)
{
RETURNFUNC(err);
}
rig_debug(RIG_DEBUG_TRACE, "%s: tx_vfo=%s, curr_vfo=%s\n", __func__,
rig_strvfo(*tx_vfo), rig_strvfo(rig->state.current_vfo));
if (*tx_vfo != rig->state.current_vfo)
{
*split = RIG_SPLIT_ON;
}
else
{
*split = RIG_SPLIT_OFF;
}
}
rig_debug(RIG_DEBUG_TRACE, "SPLIT = %d, vfo = %s, TX_vfo = %s\n", *split,
@ -8156,16 +8190,12 @@ ncboolean newcat_is_rig(RIG *rig, rig_model_t model)
}
/*
* newcat_set_tx_vfo does not set priv->curr_vfo
* does set rig->state.tx_vfo
*/
int newcat_set_tx_vfo(RIG *rig, vfo_t tx_vfo)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
int err;
char p1;
struct newcat_priv_data *priv = (struct newcat_priv_data *) rig->state.priv;
char *command = "FT";
int result;
char p1;
ENTERFUNC;
@ -8174,11 +8204,11 @@ int newcat_set_tx_vfo(RIG *rig, vfo_t tx_vfo)
RETURNFUNC(-RIG_ENAVAIL);
}
err = newcat_set_vfo_from_alias(rig, &tx_vfo);
result = newcat_set_vfo_from_alias(rig, &tx_vfo);
if (err < 0)
if (result < 0)
{
RETURNFUNC(err);
RETURNFUNC(result);
}
switch (tx_vfo)
@ -8211,36 +8241,12 @@ int newcat_set_tx_vfo(RIG *rig, vfo_t tx_vfo)
RETURNFUNC(-RIG_EINVAL);
}
/* TODO: G4WJS - FT-450 only has toggle command so not sure how to
definitively set the TX VFO (VS; doesn't seem to help
either) */
if (newcat_is_rig(rig, RIG_MODEL_FT950) ||
newcat_is_rig(rig, RIG_MODEL_FT2000) ||
newcat_is_rig(rig, RIG_MODEL_FTDX5000) ||
newcat_is_rig(rig, RIG_MODEL_FTDX1200) ||
newcat_is_rig(rig, RIG_MODEL_FTDX10) ||
newcat_is_rig(rig, RIG_MODEL_FT991) ||
newcat_is_rig(rig, RIG_MODEL_FTDX3000))
// NOTE: FT-450 only has toggle command so not sure how to definitively set the TX VFO (VS; doesn't seem to help either)
if (is_ft950 || is_ft2000 || is_ftdx3000 || is_ftdx3000dm || is_ftdx5000 || is_ftdx1200 || is_ft991 ||
is_ftdx10 || is_ftdx101d || is_ftdx101mp)
{
p1 = p1 + 2; /* use non-Toggle commands */
// If VFOB is active then we change VFOB with FT3 instead of VFOA
if (rig->state.current_vfo == RIG_VFO_B
|| rig->state.current_vfo == RIG_VFO_SUB) { p1++; }
}
// this doesn't seem to work on FTDX101MP latest firmware as of 20230911 so we test once and disable if needed
if ((is_ftdx101d || is_ftdx101mp) && p1 == '1' && !priv->ftdx101_st_missing)
{
// what other Yaesu rigs should be using this?
// The DX101D returns FT0 when in split and not transmitting
command = "ST";
SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "%s%c%c", command, p1, cat_term);
int retval = newcat_set_cmd(rig);
if (retval != RIG_OK) {priv->ftdx101_st_missing = 1; retval = RIG_OK;}
RETURNFUNC(retval);
// These rigs use numbers 2 and 3 to denote A/B or Main/Sub VFOs - 0 and 1 are for toggling TX function
p1 = p1 + 2;
}
SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "%s%c%c", command, p1, cat_term);
@ -8248,32 +8254,29 @@ int newcat_set_tx_vfo(RIG *rig, vfo_t tx_vfo)
rig_debug(RIG_DEBUG_TRACE, "cmd_str = %s, vfo=%s\n", priv->cmd_str,
rig_strvfo(tx_vfo));
result = newcat_set_cmd(rig);
if (result != RIG_OK)
{
RETURNFUNC(result);
}
rig->state.tx_vfo = tx_vfo;
RETURNFUNC(newcat_set_cmd(rig));
RETURNFUNC(result);
}
/*
* newcat_get_tx_vfo does not set priv->curr_vfo
*/
int newcat_get_tx_vfo(RIG *rig, vfo_t *tx_vfo)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
int err;
char c;
rmode_t vfo_mode;
struct newcat_priv_data *priv = (struct newcat_priv_data *) rig->state.priv;
char const *command = "FT";
vfo_t vfo_mode;
int result;
char c;
ENTERFUNC;
if (is_ftdx101d || is_ftdx101mp)
{
// what other Yaesu rigs should be using this?
// The DX101D returns FT0 when in split and not transmitting
command = "ST";
}
if (!newcat_valid_command(rig, command))
{
RETURNFUNC(-RIG_ENAVAIL);
@ -8281,10 +8284,9 @@ int newcat_get_tx_vfo(RIG *rig, vfo_t *tx_vfo)
SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "%s%c", command, cat_term);
/* Get TX VFO */
if (RIG_OK != (err = newcat_get_cmd(rig)))
if (RIG_OK != (result = newcat_get_cmd(rig)))
{
RETURNFUNC(err);
RETURNFUNC(result);
}
c = priv->ret_data[2];
@ -8292,17 +8294,25 @@ int newcat_get_tx_vfo(RIG *rig, vfo_t *tx_vfo)
switch (c)
{
case '0':
if (rig->state.vfo_list & RIG_VFO_MAIN) { *tx_vfo = RIG_VFO_MAIN; }
else { *tx_vfo = RIG_VFO_A; }
rig->state.cache.split = 0;
if (rig->state.vfo_list & RIG_VFO_MAIN)
{
*tx_vfo = RIG_VFO_MAIN;
}
else
{
*tx_vfo = RIG_VFO_A;
}
break;
case '1' :
if (rig->state.vfo_list & RIG_VFO_SUB) { *tx_vfo = RIG_VFO_SUB; }
else { *tx_vfo = RIG_VFO_B; }
rig->state.cache.split = 1;
if (rig->state.vfo_list & RIG_VFO_SUB)
{
*tx_vfo = RIG_VFO_SUB;
}
else
{
*tx_vfo = RIG_VFO_B;
}
break;
default:
@ -8312,11 +8322,11 @@ int newcat_get_tx_vfo(RIG *rig, vfo_t *tx_vfo)
}
/* Check to see if RIG is in MEM mode */
err = newcat_get_vfo_mode(rig, RIG_VFO_A, &vfo_mode);
result = newcat_get_vfo_mode(rig, RIG_VFO_A, &vfo_mode);
if (err != RIG_OK)
if (result != RIG_OK)
{
RETURNFUNC(err);
RETURNFUNC(result);
}
if (vfo_mode == RIG_VFO_MEM && *tx_vfo == RIG_VFO_A)
@ -8330,6 +8340,160 @@ int newcat_get_tx_vfo(RIG *rig, vfo_t *tx_vfo)
}
static int newcat_set_split(RIG *rig, split_t split, vfo_t *rx_vfo, vfo_t *tx_vfo)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *) rig->state.priv;
char *command = "ST";
char p1;
int result;
ENTERFUNC;
if (!newcat_valid_command(rig, "ST") || is_ft450 || priv->split_st_command_missing)
{
RETURNFUNC(-RIG_ENAVAIL);
}
result = newcat_set_vfo_from_alias(rig, tx_vfo);
if (result < 0)
{
RETURNFUNC(result);
}
switch (split)
{
case RIG_SPLIT_OFF:
p1 = '0';
break;
case RIG_SPLIT_ON:
p1 = '1';
break;
default:
RETURNFUNC(-RIG_EINVAL);
}
SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "%s%c%c", command, p1, cat_term);
rig_debug(RIG_DEBUG_TRACE, "cmd_str = %s, vfo=%s\n", priv->cmd_str,
rig_strvfo(*tx_vfo));
result = newcat_set_cmd(rig);
if (result != RIG_OK)
{
priv->split_st_command_missing = 1;
RETURNFUNC(result);
}
switch (split)
{
case RIG_SPLIT_OFF:
*rx_vfo = rig->state.current_vfo;
*tx_vfo = rig->state.current_vfo;
break;
case RIG_SPLIT_ON:
// These rigs have fixed RX and TX VFOs when using the ST split command
if (is_ftdx101d || is_ftdx101mp)
{
*rx_vfo = RIG_VFO_MAIN;
*tx_vfo = RIG_VFO_SUB;
}
else if (is_ftdx10)
{
*rx_vfo = RIG_VFO_A;
*tx_vfo = RIG_VFO_B;
}
else
{
*rx_vfo = rig->state.current_vfo;
result = newcat_get_tx_vfo(rig, tx_vfo);
if (result != RIG_OK)
{
RETURNFUNC(result);
}
}
break;
default:
RETURNFUNC(-RIG_EINVAL);
}
RETURNFUNC(result);
}
static int newcat_get_split(RIG *rig, split_t *split, vfo_t *tx_vfo)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *) rig->state.priv;
char const *command = "ST";
int result;
char c;
ENTERFUNC;
if (!newcat_valid_command(rig, "ST") || is_ft450 || priv->split_st_command_missing)
{
RETURNFUNC(-RIG_ENAVAIL);
}
SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "%s%c", command, cat_term);
result = newcat_get_cmd(rig);
if (result != RIG_OK)
{
priv->split_st_command_missing = 1;
RETURNFUNC(result);
}
c = priv->ret_data[2];
switch (c)
{
case '0':
*split = RIG_SPLIT_OFF;
result = newcat_get_tx_vfo(rig, tx_vfo);
if (result != RIG_OK)
{
RETURNFUNC(result);
}
break;
case '1' :
*split = RIG_SPLIT_ON;
// These rigs have fixed RX and TX VFOs when using the ST split command
if (is_ftdx101d || is_ftdx101mp)
{
*tx_vfo = RIG_VFO_SUB;
}
else if (is_ftdx10)
{
*tx_vfo = RIG_VFO_B;
}
else
{
result = newcat_get_tx_vfo(rig, tx_vfo);
if (result != RIG_OK)
{
RETURNFUNC(result);
}
}
break;
default:
rig_debug(RIG_DEBUG_ERR, "%s: Unknown split=%c from index 2 of %s\n", __func__,
c, priv->ret_data);
RETURNFUNC(-RIG_EPROTO);
}
rig_debug(RIG_DEBUG_TRACE, "%s: tx_vfo = %s\n", __func__, rig_strvfo(*tx_vfo));
RETURNFUNC(RIG_OK);
}
int newcat_set_vfo_from_alias(RIG *rig, vfo_t *vfo)
{
@ -10788,7 +10952,7 @@ int newcat_get_rigid(RIG *rig)
* RIG_VFO_MEM for VFO MEM
* return: RIG_OK or error
*/
int newcat_get_vfo_mode(RIG *rig, vfo_t vfo, rmode_t *vfo_mode)
int newcat_get_vfo_mode(RIG *rig, vfo_t vfo, vfo_t *vfo_mode)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
int err;
@ -11275,7 +11439,7 @@ int newcat_set_cmd_validate(RIG *rig)
}
else if (strncmp(priv->cmd_str, "ST", 2) == 0)
{
strcpy(valcmd, ";");
strcpy(valcmd, "ST;");
}
else if (strncmp(priv->cmd_str, "KM", 2) == 0)
{

Wyświetl plik

@ -129,7 +129,7 @@ struct newcat_priv_data
int poweron; /* to prevent powering on more than once */
int question_mark_response_means_rejected; /* the question mark response has multiple meanings */
char front_rear_status; /* e.g. FTDX5000 EX103 status */
int ftdx101_st_missing; /* is ST command gone? assume not until proven otherwise */
int split_st_command_missing; /* is ST command gone? assume not until proven otherwise */
};
/*

Wyświetl plik

@ -60,15 +60,31 @@ int rig_set_cache_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
if (vfo == RIG_VFO_OTHER) { vfo = vfo_fixup(rig, vfo, rig->state.cache.split); }
if (vfo == rig->state.current_vfo)
{
rig->state.cache.modeCurr = mode;
if (width > 0)
{
rig->state.cache.widthCurr = width;
}
elapsed_ms(&rig->state.cache.time_modeCurr, HAMLIB_ELAPSED_SET);
}
switch (vfo)
{
case RIG_VFO_ALL: // we'll use NONE to reset all VFO caches
elapsed_ms(&rig->state.cache.time_modeMainA, HAMLIB_ELAPSED_INVALIDATE);
elapsed_ms(&rig->state.cache.time_modeMainB, HAMLIB_ELAPSED_INVALIDATE);
elapsed_ms(&rig->state.cache.time_modeMainC, HAMLIB_ELAPSED_INVALIDATE);
elapsed_ms(&rig->state.cache.time_modeSubA, HAMLIB_ELAPSED_INVALIDATE);
elapsed_ms(&rig->state.cache.time_modeSubB, HAMLIB_ELAPSED_INVALIDATE);
elapsed_ms(&rig->state.cache.time_modeSubC, HAMLIB_ELAPSED_INVALIDATE);
elapsed_ms(&rig->state.cache.time_widthMainA, HAMLIB_ELAPSED_INVALIDATE);
elapsed_ms(&rig->state.cache.time_widthMainB, HAMLIB_ELAPSED_INVALIDATE);
elapsed_ms(&rig->state.cache.time_widthMainC, HAMLIB_ELAPSED_INVALIDATE);
elapsed_ms(&rig->state.cache.time_widthSubA, HAMLIB_ELAPSED_INVALIDATE);
elapsed_ms(&rig->state.cache.time_widthSubB, HAMLIB_ELAPSED_INVALIDATE);
elapsed_ms(&rig->state.cache.time_widthSubC, HAMLIB_ELAPSED_INVALIDATE);
break;
case RIG_VFO_A:
@ -104,6 +120,21 @@ int rig_set_cache_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
elapsed_ms(&rig->state.cache.time_widthMainC, HAMLIB_ELAPSED_SET);
break;
case RIG_VFO_SUB_A:
rig->state.cache.modeSubA = mode;
elapsed_ms(&rig->state.cache.time_modeSubA, HAMLIB_ELAPSED_SET);
break;
case RIG_VFO_SUB_B:
rig->state.cache.modeSubB = mode;
elapsed_ms(&rig->state.cache.time_modeSubB, HAMLIB_ELAPSED_SET);
break;
case RIG_VFO_SUB_C:
rig->state.cache.modeSubC = mode;
elapsed_ms(&rig->state.cache.time_modeSubC, HAMLIB_ELAPSED_SET);
break;
case RIG_VFO_MEM:
rig->state.cache.modeMem = mode;
elapsed_ms(&rig->state.cache.time_modeMem, HAMLIB_ELAPSED_SET);
@ -153,6 +184,12 @@ int rig_set_cache_freq(RIG *rig, vfo_t vfo, freq_t freq)
rig_strvfo(vfo), freq);
}
if (vfo == rig->state.current_vfo)
{
rig->state.cache.freqCurr = freq;
elapsed_ms(&rig->state.cache.time_freqCurr, flag);
}
switch (vfo)
{
case RIG_VFO_ALL: // we'll use NONE to reset all VFO caches
@ -167,9 +204,15 @@ int rig_set_cache_freq(RIG *rig, vfo_t vfo, freq_t freq)
elapsed_ms(&rig->state.cache.time_modeMainA, HAMLIB_ELAPSED_INVALIDATE);
elapsed_ms(&rig->state.cache.time_modeMainB, HAMLIB_ELAPSED_INVALIDATE);
elapsed_ms(&rig->state.cache.time_modeMainC, HAMLIB_ELAPSED_INVALIDATE);
elapsed_ms(&rig->state.cache.time_modeSubA, HAMLIB_ELAPSED_INVALIDATE);
elapsed_ms(&rig->state.cache.time_modeSubB, HAMLIB_ELAPSED_INVALIDATE);
elapsed_ms(&rig->state.cache.time_modeSubC, HAMLIB_ELAPSED_INVALIDATE);
elapsed_ms(&rig->state.cache.time_widthMainA, HAMLIB_ELAPSED_INVALIDATE);
elapsed_ms(&rig->state.cache.time_widthMainB, HAMLIB_ELAPSED_INVALIDATE);
elapsed_ms(&rig->state.cache.time_widthMainC, HAMLIB_ELAPSED_INVALIDATE);
elapsed_ms(&rig->state.cache.time_widthSubA, HAMLIB_ELAPSED_INVALIDATE);
elapsed_ms(&rig->state.cache.time_widthSubB, HAMLIB_ELAPSED_INVALIDATE);
elapsed_ms(&rig->state.cache.time_widthSubC, HAMLIB_ELAPSED_INVALIDATE);
elapsed_ms(&rig->state.cache.time_ptt, HAMLIB_ELAPSED_INVALIDATE);
elapsed_ms(&rig->state.cache.time_split, HAMLIB_ELAPSED_INVALIDATE);
break;
@ -328,7 +371,7 @@ int rig_get_cache(RIG *rig, vfo_t vfo, freq_t *freq, int *cache_ms_freq,
break;
case RIG_VFO_NONE:
rig_debug(RIG_DEBUG_VERBOSE, "%s(%d): ignoring VFO_OTHER\n", __func__,
rig_debug(RIG_DEBUG_VERBOSE, "%s(%d): ignoring VFO_NONE\n", __func__,
__LINE__);
break;

Wyświetl plik

@ -1341,16 +1341,11 @@ static int read_string_generic(hamlib_port_t *p,
short timeout_retries = p->timeout_retry;
//HAMLIB_TRACE2;
while (total_count < rxmax - 1) // allow 1 byte for end-of-string
{
ssize_t rd_count = 0;
int result;
int timeout_save = p->timeout;
// p->timeout = 2;
result = port_wait_for_data(p, direct);
//HAMLIB_TRACE2;
p->timeout = timeout_save;
if (result == -RIG_ETIMEOUT)
{
@ -1361,7 +1356,6 @@ static int read_string_generic(hamlib_port_t *p,
__func__, __LINE__,
p->timeout_retry - timeout_retries, p->timeout_retry, p->timeout);
hl_usleep(10 * 1000);
//HAMLIB_TRACE2;
continue;
}
@ -1420,11 +1414,9 @@ static int read_string_generic(hamlib_port_t *p,
//rig_debug(RIG_DEBUG_ERR, "xs: avail=%d expected_len=%d, minlen=%d, direct=%d\n", __func__, avail, expected_len, minlen, direct);
#endif
#endif
//HAMLIB_TRACE2;
shortcut:
rd_count = port_read_generic(p, &rxbuffer[total_count],
expected_len == 1 ? 1 : minlen, direct);
//HAMLIB_TRACE2;
// rig_debug(RIG_DEBUG_VERBOSE, "%s: read %d bytes tot=%d\n", __func__, (int)rd_count, total_count);
minlen -= rd_count;
@ -1454,8 +1446,6 @@ shortcut:
while (++i < 10 && errno == EBUSY); // 50ms should be enough
//HAMLIB_TRACE2;
/* if we get 0 bytes or an error something is wrong */
if (rd_count <= 0)
{

Wyświetl plik

@ -2089,37 +2089,14 @@ vfo_t HAMLIB_API vfo_fixup(RIG *rig, vfo_t vfo, split_t split)
vfo = RIG_VFO_A; // default to mapping VFO_MAIN to VFO_A
if (VFO_HAS_MAIN_SUB_ONLY) { vfo = RIG_VFO_MAIN; }
//in this case we don't change it as either VFOA/B or Main/Sub makes a difference
//ID5100 for example has to turn on dual watch mode for Main/Sub
//if (VFO_HAS_MAIN_SUB_A_B_ONLY) { vfo = RIG_VFO_MAIN; }
}
else if (vfo == RIG_VFO_TX)
{
#if 0
int retval;
split_t split = 0;
// get split if we can -- it will default to off otherwise
// maybe split/satmode/vfo/freq/mode can be cached for rigs
// that don't have read capability or get_vfo like Icom?
// Icom's lack of get_vfo is problematic in this respect
// If we cache vfo or others than twiddling the rig may cause problems
retval = rig_get_split(rig, vfo, &split);
if (retval != RIG_OK)
{
split = rig->state.cache.split;
}
#endif
int satmode = rig->state.cache.satmode;
rig_debug(RIG_DEBUG_VERBOSE, "%s(%d): split=%d, vfo==%s tx_vfo=%s\n", __func__,
__LINE__, split, rig_strvfo(vfo), rig_strvfo(rig->state.tx_vfo));
//if (vfo == RIG_VFO_TX) { vfo = rig->state.tx_vfo; RETURNFUNC(RIG_OK); }
if (VFO_HAS_MAIN_SUB_ONLY && !split && !satmode && vfo != RIG_VFO_B) { vfo = RIG_VFO_MAIN; }
else if (VFO_HAS_MAIN_SUB_ONLY && (split || satmode || vfo == RIG_VFO_B)) { vfo = RIG_VFO_SUB; }
@ -2139,12 +2116,10 @@ vfo_t HAMLIB_API vfo_fixup(RIG *rig, vfo_t vfo, split_t split)
vfo = RIG_VFO_B; // default to VFO_B
if (VFO_HAS_MAIN_SUB_ONLY) { vfo = RIG_VFO_SUB; }
//if (VFO_HAS_MAIN_SUB_A_B_ONLY) { vfo = RIG_VFO_SUB; }
rig_debug(RIG_DEBUG_TRACE, "%s: final vfo=%s\n", __func__, rig_strvfo(vfo));
}
rig_debug(RIG_DEBUG_TRACE, "%s: final vfo=%s\n", __func__, rig_strvfo(vfo));
return vfo;
}

Wyświetl plik

@ -122,6 +122,10 @@ typedef struct multicast_publisher_args_s
int data_write_fd;
int data_read_fd;
#endif
#ifdef HAVE_PTHREAD
pthread_mutex_t write_lock;
#endif
} multicast_publisher_args;
typedef struct multicast_publisher_priv_data_s
@ -655,6 +659,22 @@ static int multicast_publisher_write_data(const multicast_publisher_args
return (RIG_OK);
}
static void multicast_publisher_write_lock(RIG *rig)
{
struct rig_state *rs = &rig->state;
multicast_publisher_priv_data *priv_data = (multicast_publisher_priv_data *)
rs->multicast_publisher_priv_data;
pthread_mutex_lock(&priv_data->args.write_lock);
}
static void multicast_publisher_write_unlock(RIG *rig)
{
struct rig_state *rs = &rig->state;
multicast_publisher_priv_data *priv_data = (multicast_publisher_priv_data *)
rs->multicast_publisher_priv_data;
pthread_mutex_unlock(&priv_data->args.write_lock);
}
static int multicast_publisher_read_data(const multicast_publisher_args
*mcast_publisher_args, size_t length, unsigned char *data)
{
@ -663,7 +683,11 @@ static int multicast_publisher_read_data(const multicast_publisher_args
struct timeval timeout;
ssize_t result;
int retval;
int retries = 2;
size_t offset = 0;
size_t length_left = length;
retry:
timeout.tv_sec = 0;
timeout.tv_usec = MULTICAST_DATA_PIPE_TIMEOUT_USEC;
@ -698,7 +722,7 @@ static int multicast_publisher_read_data(const multicast_publisher_args
return -RIG_EIO;
}
result = read(fd, data, length);
result = read(fd, data + offset, length_left);
if (result < 0)
{
@ -712,11 +736,25 @@ static int multicast_publisher_read_data(const multicast_publisher_args
return (-RIG_EIO);
}
if (result != length)
offset += result;
length_left -= result;
if (length_left > 0)
{
if (retries > 0)
{
// Execution of this routine may time out between writes to pipe, retry to get more data
rig_debug(RIG_DEBUG_VERBOSE,
"%s: could not read from multicast publisher data pipe, expected %ld bytes, read %ld bytes, retrying...\n",
__func__, (long) length, (long) offset);
retries--;
goto retry;
}
rig_debug(RIG_DEBUG_ERR,
"%s: could not read from multicast publisher data pipe, expected %ld bytes, read %ld bytes\n",
__func__, (long) length, (long) result);
"%s: could not read from multicast publisher data pipe even after retries, expected %ld bytes, read %ld bytes\n",
__func__, (long) length, (long) offset);
return (-RIG_EIO);
}
@ -759,6 +797,7 @@ static int multicast_publisher_write_packet_header(RIG *rig,
int network_publish_rig_poll_data(RIG *rig)
{
const struct rig_state *rs = &rig->state;
int result;
multicast_publisher_data_packet packet =
{
.type = MULTICAST_PUBLISHER_DATA_PACKET_TYPE_POLL,
@ -772,13 +811,17 @@ int network_publish_rig_poll_data(RIG *rig)
return RIG_OK;
}
return multicast_publisher_write_packet_header(rig, &packet);
multicast_publisher_write_lock(rig);
result = multicast_publisher_write_packet_header(rig, &packet);
multicast_publisher_write_unlock(rig);
return result;
}
// cppcheck-suppress unusedFunction
int network_publish_rig_transceive_data(RIG *rig)
{
const struct rig_state *rs = &rig->state;
int result;
multicast_publisher_data_packet packet =
{
.type = MULTICAST_PUBLISHER_DATA_PACKET_TYPE_TRANSCEIVE,
@ -792,7 +835,10 @@ int network_publish_rig_transceive_data(RIG *rig)
return RIG_OK;
}
return multicast_publisher_write_packet_header(rig, &packet);
multicast_publisher_write_lock(rig);
result = multicast_publisher_write_packet_header(rig, &packet);
multicast_publisher_write_unlock(rig);
return result;
}
int network_publish_rig_spectrum_data(RIG *rig, struct rig_spectrum_line *line)
@ -814,10 +860,14 @@ int network_publish_rig_spectrum_data(RIG *rig, struct rig_spectrum_line *line)
return RIG_OK;
}
// Acquire write lock to write all data in one go to the pipe
multicast_publisher_write_lock(rig);
result = multicast_publisher_write_packet_header(rig, &packet);
if (result != RIG_OK)
{
multicast_publisher_write_unlock(rig);
RETURNFUNC2(result);
}
@ -830,12 +880,15 @@ int network_publish_rig_spectrum_data(RIG *rig, struct rig_spectrum_line *line)
if (result != RIG_OK)
{
multicast_publisher_write_unlock(rig);
RETURNFUNC2(result);
}
result = multicast_publisher_write_data(
mcast_publisher_args, line->spectrum_data_length, line->spectrum_data);
multicast_publisher_write_unlock(rig);
if (result != RIG_OK)
{
RETURNFUNC2(result);
@ -955,7 +1008,7 @@ void *multicast_publisher(void *arg)
rs->multicast_publisher_run = 1;
while (rs->multicast_publisher_run == 1)
while (rs->multicast_publisher_run)
{
int result;
@ -971,6 +1024,7 @@ void *multicast_publisher(void *arg)
// TODO: how to detect closing of pipe, indicate with error code
// TODO: error handling, flush pipe in case of error?
hl_usleep(100 * 1000);
continue;
}
@ -1011,6 +1065,7 @@ void *multicast_publisher(void *arg)
}
}
rs->multicast_publisher_run = 0;
mcast_publisher_priv->thread_id = 0;
rig_debug(RIG_DEBUG_VERBOSE, "%s(%d): Stopped multicast publisher\n", __FILE__,
@ -1262,6 +1317,9 @@ void *multicast_receiver(void *arg)
arg;
RIG *rig = args->rig;
struct rig_state *rs = &rig->state;
multicast_receiver_priv_data *mcast_receiver_priv =
(multicast_receiver_priv_data *)
rs->multicast_receiver_priv_data;
struct sockaddr_in dest_addr;
int socket_fd = args->socket_fd;
@ -1383,7 +1441,7 @@ void *multicast_receiver(void *arg)
rs->multicast_receiver_run = 1;
while (rs->multicast_receiver_run == 1)
while (rs->multicast_receiver_run)
{
struct sockaddr_in client_addr;
socklen_t client_len = sizeof(client_addr);
@ -1393,14 +1451,14 @@ void *multicast_receiver(void *arg)
ssize_t result;
timeout.tv_sec = 0;
timeout.tv_usec = 100000;
timeout.tv_usec = MULTICAST_DATA_PIPE_TIMEOUT_USEC;
FD_ZERO(&rfds);
FD_SET(socket_fd, &rfds);
efds = rfds;
select_result = select(socket_fd + 1, &rfds, NULL, &efds, &timeout);
if (rs->multicast_receiver_run == 0)
if (!rs->multicast_receiver_run)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s(%d): pselect signal\n", __func__, __LINE__);
break;
@ -1461,6 +1519,7 @@ void *multicast_receiver(void *arg)
}
rs->multicast_receiver_run = 0;
mcast_receiver_priv->thread_id = 0;
rig_debug(RIG_DEBUG_VERBOSE, "%s(%d): Stopped multicast receiver\n", __FILE__,
__LINE__);
@ -1485,12 +1544,20 @@ int network_multicast_publisher_start(RIG *rig, const char *multicast_addr,
multicast_publisher_priv_data *mcast_publisher_priv;
int socket_fd;
int status;
int mutex_status;
#ifdef __MINGW32__
char ip4[32];
#endif
ENTERFUNC;
if (rs->multicast_publisher_priv_data != NULL)
{
rig_debug(RIG_DEBUG_WARN, "%s(%d): multicast publisher already running\n",
__FILE__, __LINE__);
RETURNFUNC(-RIG_EINVAL);
}
rig_debug(RIG_DEBUG_VERBOSE,
"%s(%d): multicast publisher address=%s, port=%d\n", __FILE__,
__LINE__,
@ -1514,14 +1581,6 @@ int network_multicast_publisher_start(RIG *rig, const char *multicast_addr,
return RIG_OK;
}
if (rs->multicast_publisher_priv_data != NULL)
{
rig_debug(RIG_DEBUG_ERR, "%s(%d): multicast publisher already running\n",
__FILE__,
__LINE__);
RETURNFUNC(-RIG_EINVAL);
}
status = network_init();
#ifdef __MINGW32__ // always RIG_OK if not Windows
@ -1579,6 +1638,7 @@ int network_multicast_publisher_start(RIG *rig, const char *multicast_addr,
}
rs->snapshot_packet_sequence_number = 0;
rs->multicast_publisher_run = 0;
rs->multicast_publisher_priv_data = calloc(1,
sizeof(multicast_publisher_priv_data));
@ -1595,9 +1655,11 @@ int network_multicast_publisher_start(RIG *rig, const char *multicast_addr,
mcast_publisher_priv->args.multicast_port = multicast_port;
mcast_publisher_priv->args.rig = rig;
mutex_status = pthread_mutex_init(&mcast_publisher_priv->args.write_lock, NULL);
status = multicast_publisher_create_data_pipe(mcast_publisher_priv);
if (status < 0)
if (status < 0 || mutex_status != 0)
{
free(rs->multicast_publisher_priv_data);
rs->multicast_publisher_priv_data = NULL;
@ -1672,6 +1734,8 @@ int network_multicast_publisher_stop(RIG *rig)
mcast_publisher_priv->args.socket_fd = -1;
}
pthread_mutex_destroy(&mcast_publisher_priv->args.write_lock);
free(rs->multicast_publisher_priv_data);
rs->multicast_publisher_priv_data = NULL;
@ -1698,6 +1762,14 @@ int network_multicast_receiver_start(RIG *rig, const char *multicast_addr,
ENTERFUNC;
if (rs->multicast_receiver_priv_data != NULL)
{
rig_debug(RIG_DEBUG_ERR, "%s(%d): multicast receiver already running\n",
__FILE__,
__LINE__);
RETURNFUNC(-RIG_EINVAL);
}
rig_debug(RIG_DEBUG_VERBOSE, "%s(%d): multicast receiver address=%s, port=%d\n",
__FILE__,
__LINE__,
@ -1707,15 +1779,7 @@ int network_multicast_receiver_start(RIG *rig, const char *multicast_addr,
{
rig_debug(RIG_DEBUG_TRACE, "%s(%d): not starting multicast receiver\n",
__FILE__, __LINE__);
return RIG_OK;
}
if (rs->multicast_receiver_priv_data != NULL)
{
rig_debug(RIG_DEBUG_ERR, "%s(%d): multicast receiver already running\n",
__FILE__,
__LINE__);
RETURNFUNC(-RIG_EINVAL);
RETURNFUNC(RIG_OK);
}
status = network_init();
@ -1758,7 +1822,7 @@ int network_multicast_receiver_start(RIG *rig, const char *multicast_addr,
#endif
rs->multicast_receiver_run = 1;
rs->multicast_receiver_run = 0;
rs->multicast_receiver_priv_data = calloc(1,
sizeof(multicast_receiver_priv_data));

681
src/rig.c

Plik diff jest za duży Load Diff

Wyświetl plik

@ -72,7 +72,7 @@ int rig_sprintf_vfo(char *str, int nlen, vfo_t vfo)
if (sv && sv[0] && (strstr(sv, "None") == 0))
{
len += sprintf(str + len, "%s ", sv);
len += snprintf(str + len, nlen - len, "%s ", sv);
check_buffer_overflow(str, len, nlen);
}
}
@ -151,7 +151,7 @@ int rig_sprintf_ant(char *str, int str_len, ant_t ant)
break;
}
len += sprintf(str + len, "%s ", ant_name);
len += snprintf(str + len, str_len - len, "%s ", ant_name);
check_buffer_overflow(str, len, str_len);
}
}
@ -389,7 +389,7 @@ int rig_sprintf_level_gran(char *str, int nlen, setting_t level,
if (RIG_LEVEL_IS_FLOAT(rig_idx2setting(i)))
{
len += sprintf(str + len,
len += snprintf(str + len, nlen - len,
"%s(%f..%f/%f) ",
ms,
gran[i].min.f,
@ -398,7 +398,7 @@ int rig_sprintf_level_gran(char *str, int nlen, setting_t level,
}
else
{
len += sprintf(str + len,
len += snprintf(str + len, nlen - len,
"%s(%d..%d/%d) ",
ms,
gran[i].min.i,
@ -448,7 +448,7 @@ int rot_sprintf_level_gran(char *str, int nlen, setting_t level,
if (ROT_LEVEL_IS_FLOAT(rig_idx2setting(i)))
{
len += sprintf(str + len,
len += snprintf(str + len, nlen - len,
"%s(%f..%f/%f) ",
ms,
gran[i].min.f,
@ -457,7 +457,7 @@ int rot_sprintf_level_gran(char *str, int nlen, setting_t level,
}
else
{
len += sprintf(str + len,
len += snprintf(str + len, nlen - len,
"%s(%d..%d/%d) ",
ms,
gran[i].min.i,
@ -567,7 +567,7 @@ int rig_sprintf_parm_gran(char *str, int nlen, setting_t parm,
if (RIG_PARM_IS_FLOAT(rig_idx2setting(i)))
{
len += snprintf(str + len, nlen,
len += snprintf(str + len, nlen - len,
"%s(%.g..%.g/%.g) ",
ms,
gran[i].min.f,
@ -578,19 +578,15 @@ int rig_sprintf_parm_gran(char *str, int nlen, setting_t parm,
{
if (gran[i].step.s)
{
rig_debug(RIG_DEBUG_ERR, "%s: BAND_SELECT?\n", __func__);
if (strcmp(ms,"BANDSELECT")!=0)
{
len += sprintf(str + len,
len += snprintf(str + len, nlen - len,
"%s(%s) ",
ms,
gran[i].step.s);
}
}
}
else
{
len += sprintf(str + len,
len += snprintf(str + len, nlen - len,
"%s(%d..%d/%d) ",
ms,
gran[i].min.i,
@ -640,7 +636,7 @@ int rot_sprintf_parm_gran(char *str, int nlen, setting_t parm,
if (ROT_PARM_IS_FLOAT(rig_idx2setting(i)))
{
len += sprintf(str + len,
len += snprintf(str + len, nlen - len,
"%s(%f..%f/%f) ",
ms,
gran[i].min.f,
@ -649,7 +645,7 @@ int rot_sprintf_parm_gran(char *str, int nlen, setting_t parm,
}
else
{
len += sprintf(str + len,
len += snprintf(str + len, nlen - len,
"%s(%d..%d/%d) ",
ms,
gran[i].min.i,
@ -744,7 +740,7 @@ int rot_sprintf_status(char *str, int nlen, rot_status_t status)
if (sv && sv[0] && (strstr(sv, "None") == 0))
{
len += sprintf(str + len, "%s ", sv);
len += snprintf(str + len, nlen - len, "%s ", sv);
}
check_buffer_overflow(str, len, nlen);
@ -902,6 +898,11 @@ int print_ext_param(const struct confparams *cfp, rig_ptr_t ptr)
cfp->u.n.step);
break;
case RIG_CONF_INT:
fprintf((FILE *)ptr, "\t\tRange: %d..%d/%d\n", (int) cfp->u.n.min, (int) cfp->u.n.max,
(int) cfp->u.n.step);
break;
case RIG_CONF_COMBO:
fprintf((FILE *)ptr, "\t\tValues:");
@ -940,7 +941,7 @@ int rig_sprintf_agc_levels(RIG *rig, char *str, int lenstr)
{
if (strlen(str) > 0) { strcat(str, " "); }
sprintf(tmpbuf, "%d=%s", priv_caps->agc_levels[i].icom_level,
snprintf(tmpbuf, sizeof(tmpbuf), "%d=%s", priv_caps->agc_levels[i].icom_level,
rig_stragclevel(priv_caps->agc_levels[i].level));
if (strlen(str) + strlen(tmpbuf) < lenstr - 1)
@ -960,7 +961,7 @@ int rig_sprintf_agc_levels(RIG *rig, char *str, int lenstr)
{
if (strlen(str) > 0) { strcat(str, " "); }
sprintf(tmpbuf, "%d=%s", rig->caps->agc_levels[i],
snprintf(tmpbuf, sizeof(tmpbuf), "%d=%s", rig->caps->agc_levels[i],
rig_stragclevel(rig->caps->agc_levels[i]));
if (strlen(str) + strlen(tmpbuf) < lenstr - 1)

Wyświetl plik

@ -248,6 +248,23 @@ int dumpcaps(RIG *rig, FILE *fout)
"Has targetable VFO: %s\n",
caps->targetable_vfo ? "Y" : "N");
fprintf(fout, "Targetable features:");
if (caps->targetable_vfo & RIG_TARGETABLE_FREQ) { fprintf(fout, " FREQ"); }
if (caps->targetable_vfo & RIG_TARGETABLE_MODE) { fprintf(fout, " MODE"); }
if (caps->targetable_vfo & RIG_TARGETABLE_TONE) { fprintf(fout, " TONE"); }
if (caps->targetable_vfo & RIG_TARGETABLE_FUNC) { fprintf(fout, " FUNC"); }
if (caps->targetable_vfo & RIG_TARGETABLE_LEVEL) { fprintf(fout, " LEVEL"); }
if (caps->targetable_vfo & RIG_TARGETABLE_RITXIT) { fprintf(fout, " RITXIT"); }
if (caps->targetable_vfo & RIG_TARGETABLE_PTT) { fprintf(fout, " PTT"); }
if (caps->targetable_vfo & RIG_TARGETABLE_MEM) { fprintf(fout, " MEM"); }
if (caps->targetable_vfo & RIG_TARGETABLE_BANK) { fprintf(fout, " BANK"); }
if (caps->targetable_vfo & RIG_TARGETABLE_ANT) { fprintf(fout, " ANT"); }
if (caps->targetable_vfo & RIG_TARGETABLE_ROOFING) { fprintf(fout, " ROOFING"); }
if (caps->targetable_vfo & RIG_TARGETABLE_SPECTRUM) { fprintf(fout, " SPECTRUM"); }
if (caps->targetable_vfo & RIG_TARGETABLE_BAND) { fprintf(fout, " BAND"); }
if (caps->targetable_vfo == 0) { fprintf(fout, " None"); }
fprintf(fout, "\n");
fprintf(fout,
"Has async data support: %s\n",
caps->async_data_supported ? "Y" : "N");

Wyświetl plik

@ -228,6 +228,7 @@ int main(int argc, char *argv[])
char rigstartup[1024];
char vbuf[1024];
rig_powerstat = RIG_POWER_ON; // defaults to power on
struct timespec powerstat_check_time;
#if HAVE_SIGACTION
struct sigaction act;
#endif
@ -822,6 +823,8 @@ int main(int argc, char *argv[])
#endif
#endif
elapsed_ms(&powerstat_check_time, HAMLIB_ELAPSED_SET);
do
{
if (!rig_opened)
@ -837,10 +840,11 @@ int main(int argc, char *argv[])
// If we get a timeout, the rig might be powered off
// Update our power status in case power gets turned off
if (retcode == -RIG_ETIMEOUT && my_rig->caps->get_powerstat)
// Check power status if rig is powered off, but not more often than once per second
if (my_rig->caps->get_powerstat && (retcode == -RIG_ETIMEOUT ||
(retcode == -RIG_EPOWER && elapsed_ms(&powerstat_check_time, HAMLIB_ELAPSED_GET) >= 1000)))
{
powerstat_t powerstat;
rig_get_powerstat(my_rig, &powerstat);
rig_powerstat = powerstat;
@ -848,6 +852,8 @@ int main(int argc, char *argv[])
{
retcode = -RIG_EPOWER;
}
elapsed_ms(&powerstat_check_time, HAMLIB_ELAPSED_SET);
}
// if we get a hard error we try to reopen the rig again

Wyświetl plik

@ -1772,6 +1772,7 @@ readline_repeat:
&& cmd_entry->cmd != 0x87 // set_powerstat
&& cmd_entry->cmd != 0x88 // get_powerstat
&& cmd_entry->cmd != 0xa5 // client_version
&& cmd_entry->cmd != 0xf2 // set_vfo_opt
&& my_rig->caps->rig_model !=
RIG_MODEL_POWERSDR) // some rigs can do stuff when powered off
{

Wyświetl plik

@ -1234,6 +1234,7 @@ void *handle_socket(void *arg)
char send_cmd_term = '\r'; /* send_cmd termination char */
int ext_resp = 0;
rig_powerstat = RIG_POWER_ON; // defaults to power on
struct timespec powerstat_check_time;
fsockin = get_fsockin(handle_data_arg);
@ -1299,6 +1300,8 @@ void *handle_socket(void *arg)
my_rig->state.powerstat = rig_powerstat;
}
elapsed_ms(&powerstat_check_time, HAMLIB_ELAPSED_SET);
do
{
mutex_rigctld(1);
@ -1315,7 +1318,6 @@ void *handle_socket(void *arg)
if (rig_opened) // only do this if rig is open
{
powerstat_t powerstat;
rig_debug(RIG_DEBUG_TRACE, "%s: doing rigctl_parse vfo_mode=%d, secure=%d\n",
__func__,
handle_data_arg->vfo_mode, handle_data_arg->use_password);
@ -1328,8 +1330,11 @@ void *handle_socket(void *arg)
// If we get a timeout, the rig might be powered off
// Update our power status in case power gets turned off
if (retcode == -RIG_ETIMEOUT && my_rig->caps->get_powerstat)
// Check power status if rig is powered off, but not more often than once per second
if (my_rig->caps->get_powerstat && (retcode == -RIG_ETIMEOUT ||
(retcode == -RIG_EPOWER && elapsed_ms(&powerstat_check_time, HAMLIB_ELAPSED_GET) >= 1000)))
{
powerstat_t powerstat;
rig_get_powerstat(my_rig, &powerstat);
rig_powerstat = powerstat;
@ -1337,6 +1342,8 @@ void *handle_socket(void *arg)
{
retcode = -RIG_EPOWER;
}
elapsed_ms(&powerstat_check_time, HAMLIB_ELAPSED_SET);
}
}
else

Wyświetl plik

@ -417,7 +417,7 @@ static int scanfc(FILE *fin, const char *format, void *p)
}
if (ferror(fin)) { rig_debug(RIG_DEBUG_ERR, "%s: errno=%d, %s\n", __func__, errno, strerror(errno)); clearerr(fin); }
if (errno == 22) // invalid arg we will continue
if (errno == EINVAL) // invalid arg we will continue
{
continue;
}