Merge pull request #780 from wutje/yeasu_cmmd_indirection_removal

Yaesu cmnd indirection removal
pull/788/head
Michael Black 2021-09-01 06:06:12 -05:00 zatwierdzone przez GitHub
commit 9fad079730
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
14 zmienionych plików z 118 dodań i 347 usunięć

Wyświetl plik

@ -386,19 +386,12 @@ int ft100_close(RIG *rig)
static int ft100_send_priv_cmd(RIG *rig, unsigned char cmd_index)
{
struct rig_state *rig_s;
unsigned char *cmd; /* points to sequence to send */
rig_debug(RIG_DEBUG_VERBOSE, "%s called (%d)\n", __func__, cmd_index);
if (!rig) { return -RIG_EINVAL; }
rig_s = &rig->state;
cmd = (unsigned char *) &ncmd[cmd_index].nseq; /* get native sequence */
return write_block(&rig_s->rigport, (char *) cmd, YAESU_CMD_LENGTH);
return write_block(&rig->state.rigport, (char *) &ncmd[cmd_index].nseq,
YAESU_CMD_LENGTH);
}
static int ft100_read_status(RIG *rig)
@ -463,14 +456,11 @@ static int ft100_read_flags(RIG *rig)
int ft100_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
{
struct rig_state *rig_s;
unsigned char p_cmd[YAESU_CMD_LENGTH];
unsigned char cmd_index; /* index of sequence to send */
if (!rig) { return -RIG_EINVAL; }
rig_s = &rig->state;
rig_debug(RIG_DEBUG_VERBOSE, "ft100: requested freq = %"PRIfreq" Hz \n", freq);
cmd_index = FT100_NATIVE_CAT_SET_FREQ;
@ -481,7 +471,7 @@ int ft100_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
freq = (int)freq / 10;
to_bcd(p_cmd, freq, 8); /* store bcd format in in p_cmd */
return write_block(&rig_s->rigport, (char *) p_cmd, YAESU_CMD_LENGTH);
return write_block(&rig->state.rigport, (char *) p_cmd, YAESU_CMD_LENGTH);
}
int ft100_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
@ -1045,13 +1035,10 @@ int ft100_get_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t *shift)
*/
int ft100_set_dcs_code(RIG *rig, vfo_t vfo, tone_t code)
{
struct rig_state *rig_s;
unsigned char p_cmd[YAESU_CMD_LENGTH];
unsigned char cmd_index; /* index of sequence to send */
int pcode;
rig_s = &rig->state;
for (pcode = 0; pcode < 104 && ft100_dcs_list[pcode] != 0; pcode++)
{
if (ft100_dcs_list[pcode] == code)
@ -1075,7 +1062,7 @@ int ft100_set_dcs_code(RIG *rig, vfo_t vfo, tone_t code)
p_cmd[3] = (char)pcode;
return write_block(&rig_s->rigport, (char *) p_cmd, YAESU_CMD_LENGTH);
return write_block(&rig->state.rigport, (char *) p_cmd, YAESU_CMD_LENGTH);
}
int ft100_get_dcs_code(RIG *rig, vfo_t vfo, tone_t *code)
@ -1102,7 +1089,6 @@ int ft100_get_dcs_code(RIG *rig, vfo_t vfo, tone_t *code)
*/
int ft100_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone)
{
struct rig_state *rig_s;
unsigned char p_cmd[YAESU_CMD_LENGTH];
unsigned char cmd_index; /* index of sequence to send */
int ptone;
@ -1121,8 +1107,6 @@ int ft100_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone)
return -RIG_EINVAL;
}
rig_s = &rig->state;
rig_debug(RIG_DEBUG_VERBOSE, "%s = %.1f Hz, n=%d\n", __func__,
(float)tone / 10, ptone);
@ -1132,7 +1116,7 @@ int ft100_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone)
p_cmd[3] = (char)ptone;
return write_block(&rig_s->rigport, (char *) p_cmd, YAESU_CMD_LENGTH);
return write_block(&rig->state.rigport, (char *) p_cmd, YAESU_CMD_LENGTH);
}
int ft100_get_ctcss_tone(RIG *rig, vfo_t vfo, tone_t *tone)

Wyświetl plik

@ -135,7 +135,6 @@ struct ft1000d_priv_data
vfo_t split_vfo; /* TX VFO in split mode Added on 16 Dec 2016 to include FT1000D function */
split_t split; /* split active or not Added on 16 Dec 2016 to include FT1000D function */
unsigned char p_cmd[YAESU_CMD_LENGTH]; /* private copy of CAT cmd */
yaesu_cmd_set_t pcs[FT1000D_NATIVE_SIZE]; /* private cmd set */
ft1000d_update_data_t update_data; /* returned data */
};
@ -325,9 +324,6 @@ int ft1000d_init(RIG *rig)
priv = rig->state.priv;
// Copy native cmd set to private cmd storage area
memcpy(priv->pcs, ncmd, sizeof(ncmd));
// Set default pacing value
priv->pacing = FT1000D_PACING_DEFAULT_VALUE;
@ -2336,7 +2332,6 @@ int ft1000d_get_vfo(RIG *rig, vfo_t *vfo)
int ft1000d_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *value)
{
struct ft1000d_priv_data *priv;
struct rig_state *rig_s;
unsigned char mdata[YAESU_CMD_LENGTH];
int err;
@ -2379,8 +2374,7 @@ int ft1000d_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *value)
return err;
}
rig_s = &rig->state;
err = read_block(&rig_s->rigport, (char *) mdata, FT1000D_READ_METER_LENGTH);
err = read_block(&rig->state.rigport, (char *) mdata, FT1000D_READ_METER_LENGTH);
if (err < 0)
{
@ -3271,7 +3265,7 @@ int ft1000d_get_update_data(RIG *rig, unsigned char ci, unsigned short ch)
return -RIG_EINVAL;
}
n = read_block(&rig_s->rigport, p, rl);
n = read_block(&rig->state.rigport, p, rl);
}
while (n < 0 && retry-- >= 0);
@ -3297,15 +3291,13 @@ int ft1000d_get_update_data(RIG *rig, unsigned char ci, unsigned short ch)
* TODO: place variant of this in yaesu.c
*
* Arguments: *rig Valid RIG instance
* ci Command index of the pcs struct
* ci Command index of the ncmd table
*
* Returns: RIG_OK if all called functions are successful,
* otherwise returns error from called functiion
*/
int ft1000d_send_static_cmd(RIG *rig, unsigned char ci)
{
struct rig_state *rig_s;
struct ft1000d_priv_data *priv;
int err;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
@ -3316,17 +3308,14 @@ int ft1000d_send_static_cmd(RIG *rig, unsigned char ci)
return -RIG_EINVAL;
}
priv = (struct ft1000d_priv_data *)rig->state.priv;
rig_s = &rig->state;
if (!priv->pcs[ci].ncomp)
if (!ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_TRACE,
"%s: Attempt to send incomplete sequence\n", __func__);
return -RIG_EINVAL;
}
err = write_block(&rig_s->rigport, (char *) priv->pcs[ci].nseq,
err = write_block(&rig->state.rigport, (char *) ncmd[ci].nseq,
YAESU_CMD_LENGTH);
if (err != RIG_OK)
@ -3334,7 +3323,7 @@ int ft1000d_send_static_cmd(RIG *rig, unsigned char ci)
return err;
}
hl_usleep(rig_s->rigport.write_delay * 1000);
hl_usleep(rig->state.rigport.write_delay * 1000);
return RIG_OK;
}
@ -3345,7 +3334,7 @@ int ft1000d_send_static_cmd(RIG *rig, unsigned char ci)
* TODO: place variant of this in yaesu.c
*
* Arguments: *rig Valid RIG instance
* ci Command index of the pcs struct
* ci Command index of the ncmd table
* p1-p4 Command parameters
*
* Returns: RIG_OK if all called functions are successful,
@ -3355,7 +3344,6 @@ int ft1000d_send_dynamic_cmd(RIG *rig, unsigned char ci,
unsigned char p1, unsigned char p2,
unsigned char p3, unsigned char p4)
{
struct rig_state *rig_s;
struct ft1000d_priv_data *priv;
int err;
@ -3374,14 +3362,13 @@ int ft1000d_send_dynamic_cmd(RIG *rig, unsigned char ci,
priv = (struct ft1000d_priv_data *)rig->state.priv;
if (priv->pcs[ci].ncomp)
if (ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_TRACE,
"%s: Attempt to modify complete sequence\n", __func__);
return -RIG_EINVAL;
}
rig_s = &rig->state;
memcpy(&priv->p_cmd, &ncmd[ci].nseq, YAESU_CMD_LENGTH);
priv->p_cmd[3] = p1;
@ -3389,7 +3376,7 @@ int ft1000d_send_dynamic_cmd(RIG *rig, unsigned char ci,
priv->p_cmd[1] = p3;
priv->p_cmd[0] = p4;
err = write_block(&rig_s->rigport, (char *) &priv->p_cmd,
err = write_block(&rig->state.rigport, (char *) &priv->p_cmd,
YAESU_CMD_LENGTH);
if (err != RIG_OK)
@ -3397,7 +3384,7 @@ int ft1000d_send_dynamic_cmd(RIG *rig, unsigned char ci,
return err;
}
hl_usleep(rig_s->rigport.write_delay * 1000);
hl_usleep(rig->state.rigport.write_delay * 1000);
return RIG_OK;
}
@ -3408,7 +3395,6 @@ int ft1000d_send_dynamic_cmd(RIG *rig, unsigned char ci,
* TODO: place variant of this in yaesu.c
*
* Arguments: *rig Valid RIG instance
* ci Command index of the pcs struct
* freq freq_t frequency value
*
* Returns: RIG_OK if all called functions are successful,
@ -3416,7 +3402,6 @@ int ft1000d_send_dynamic_cmd(RIG *rig, unsigned char ci,
*/
int ft1000d_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
{
struct rig_state *rig_s;
struct ft1000d_priv_data *priv;
int err;
// cppcheck-suppress *
@ -3434,15 +3419,13 @@ int ft1000d_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
priv = (struct ft1000d_priv_data *)rig->state.priv;
if (priv->pcs[ci].ncomp)
if (ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_TRACE,
"%s: Attempt to modify complete sequence\n", __func__);
return -RIG_EINVAL;
}
rig_s = &rig->state;
/* Copy native cmd freq_set to private cmd storage area */
memcpy(&priv->p_cmd, &ncmd[ci].nseq, YAESU_CMD_LENGTH);
@ -3452,7 +3435,7 @@ int ft1000d_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
rig_debug(RIG_DEBUG_TRACE, fmt, __func__, (int64_t)from_bcd(priv->p_cmd,
FT1000D_BCD_DIAL) * 10);
err = write_block(&rig_s->rigport, (char *) &priv->p_cmd,
err = write_block(&rig->state.rigport, (char *) &priv->p_cmd,
YAESU_CMD_LENGTH);
if (err != RIG_OK)
@ -3460,7 +3443,7 @@ int ft1000d_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
return err;
}
hl_usleep(rig_s->rigport.write_delay * 1000);
hl_usleep(rig->state.rigport.write_delay * 1000);
return RIG_OK;
}
@ -3469,7 +3452,7 @@ int ft1000d_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
* change the rit frequency.
*
* Arguments: *rig Valid RIG instance
* ci Command index of the pcs struct
* ci Command index of the ncmd table
* rit shortfreq_t frequency value
*
* Returns: RIG_OK if all called functions are successful,
@ -3478,7 +3461,6 @@ int ft1000d_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
int ft1000d_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit)
{
struct ft1000d_priv_data *priv;
struct rig_state *rig_s;
int err;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
@ -3492,9 +3474,8 @@ int ft1000d_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit)
rig_debug(RIG_DEBUG_TRACE, "%s: passed rit = %li Hz\n", __func__, rit);
priv = (struct ft1000d_priv_data *) rig->state.priv;
rig_s = &rig->state;
if (priv->pcs[ci].ncomp)
if (ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_TRACE, "%s: Attempt to modify complete sequence\n",
__func__);
@ -3520,7 +3501,7 @@ int ft1000d_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit)
// Store bcd format into privat command storage area
to_bcd(priv->p_cmd, labs(rit) / 10, FT1000D_BCD_RIT);
err = write_block(&rig_s->rigport, (char *) &priv->p_cmd,
err = write_block(&rig->state.rigport, (char *) &priv->p_cmd,
YAESU_CMD_LENGTH);
if (err != RIG_OK)
@ -3528,7 +3509,7 @@ int ft1000d_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit)
return err;
}
hl_usleep(rig_s->rigport.write_delay * 1000);
hl_usleep(rig->state.rigport.write_delay * 1000);
return RIG_OK;
}

Wyświetl plik

@ -206,7 +206,6 @@ struct ft1000mp_priv_data
unsigned int read_update_delay; /* depends on pacing value */
unsigned char
p_cmd[YAESU_CMD_LENGTH]; /* private copy of 1 constructed CAT cmd */
yaesu_cmd_set_t pcs[FT1000MP_NATIVE_SIZE]; /* private cmd set */
unsigned char update_data[2 *
FT1000MP_STATUS_UPDATE_LENGTH]; /* returned data--max value, some are less */
};
@ -642,11 +641,6 @@ int ft1000mp_init(RIG *rig)
priv = rig->state.priv;
/*
* Copy native cmd set to private cmd storage area
*/
memcpy(priv->pcs, ncmd, sizeof(ncmd));
/* TODO: read pacing from preferences */
priv->pacing =
FT1000MP_PACING_DEFAULT_VALUE; /* set pacing to minimum for now */
@ -709,7 +703,7 @@ int ft1000mp_open(RIG *rig)
/* send PACING cmd to rig */
cmd = p->p_cmd;
write_block(&rig_s->rigport, (char *) cmd, YAESU_CMD_LENGTH);
write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH);
ft1000mp_get_vfo(rig, &rig->state.current_vfo);
/* TODO */
@ -721,7 +715,6 @@ int ft1000mp_open(RIG *rig)
int ft1000mp_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
{
struct rig_state *rig_s;
struct ft1000mp_priv_data *p;
unsigned char *cmd; /* points to sequence to send */
int cmd_index = 0;
@ -730,8 +723,6 @@ int ft1000mp_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
p = (struct ft1000mp_priv_data *)rig->state.priv;
rig_s = &rig->state;
rig_debug(RIG_DEBUG_TRACE, "%s: requested freq = %"PRIfreq" Hz \n", __func__,
freq);
@ -774,7 +765,7 @@ int ft1000mp_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
(freq_t)from_bcd(p->p_cmd, 8) * 10);
cmd = p->p_cmd; /* get native sequence */
write_block(&rig_s->rigport, (char *) cmd, YAESU_CMD_LENGTH);
write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH);
RETURNFUNC(RIG_OK);
}
@ -1566,21 +1557,19 @@ int ft1000mp_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
static int ft1000mp_get_update_data(RIG *rig, unsigned char ci,
unsigned char rl)
{
struct rig_state *rig_s;
struct ft1000mp_priv_data *p;
int n; /* for read_ */
ENTERFUNC;
p = (struct ft1000mp_priv_data *)rig->state.priv;
rig_s = &rig->state;
// timeout retries are done in read_block now
// based on rig backed retry value
/* send UPDATE command to fetch data*/
ft1000mp_send_priv_cmd(rig, ci);
n = read_block(&rig_s->rigport, (char *) p->update_data, rl);
n = read_block(&rig->state.rigport, (char *) p->update_data, rl);
if (n == -RIG_ETIMEOUT)
{
@ -1600,28 +1589,15 @@ static int ft1000mp_get_update_data(RIG *rig, unsigned char ci,
static int ft1000mp_send_priv_cmd(RIG *rig, unsigned char ci)
{
struct rig_state *rig_s;
struct ft1000mp_priv_data *p;
unsigned char *cmd; /* points to sequence to send */
unsigned char cmd_index; /* index of sequence to send */
ENTERFUNC;
p = (struct ft1000mp_priv_data *)rig->state.priv;
rig_s = &rig->state;
cmd_index = ci; /* get command */
if (! p->pcs[cmd_index].ncomp)
if (! ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_TRACE, "%s: attempt to send incomplete sequence\n",
__func__);
RETURNFUNC(-RIG_EINVAL);
}
cmd = (unsigned char *) p->pcs[cmd_index].nseq; /* get native sequence */
rig_flush(&rig_s->rigport);
write_block(&rig_s->rigport, (char *) cmd, YAESU_CMD_LENGTH);
write_block(&rig->state.rigport, (char *) ncmd[ci].nseq, YAESU_CMD_LENGTH);
RETURNFUNC(RIG_OK);

Wyświetl plik

@ -298,19 +298,11 @@ int ft600_close(RIG *rig)
static int ft600_send_priv_cmd(RIG *rig, unsigned char cmd_index)
{
struct rig_state *rig_s;
unsigned char *cmd; /* points to sequence to send */
rig_debug(RIG_DEBUG_VERBOSE, "%s called (%d)\n", __func__, cmd_index);
if (!rig) { return -RIG_EINVAL; }
rig_s = &rig->state;
cmd = (unsigned char *) &ncmd[cmd_index].nseq; /* get native sequence */
return write_block(&rig_s->rigport, (char *) cmd, YAESU_CMD_LENGTH);
return write_block(&rig->state.rigport, (char *) &ncmd[cmd_index].nseq, YAESU_CMD_LENGTH);
}
static int ft600_read_status(RIG *rig)
@ -386,14 +378,11 @@ int ft600_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
int ft600_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
{
struct rig_state *rig_s;
unsigned char p_cmd[YAESU_CMD_LENGTH];
unsigned char cmd_index; /* index of sequence to send */
if (!rig) { return -RIG_EINVAL; }
rig_s = &rig->state;
rig_debug(RIG_DEBUG_VERBOSE, "ft600: requested freq = %"PRIfreq" Hz \n", freq);
cmd_index = FT600_NATIVE_CAT_SET_FREQ;
@ -403,7 +392,7 @@ int ft600_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
freq = (int)freq / 10;
to_bcd(p_cmd, freq, 8); /* store bcd format in in p_cmd */
return write_block(&rig_s->rigport, (char *) p_cmd, YAESU_CMD_LENGTH);
return write_block(&rig->state.rigport, (char *) p_cmd, YAESU_CMD_LENGTH);
}
int ft600_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)

Wyświetl plik

@ -372,7 +372,7 @@ int ft747_open(RIG *rig)
/* send PACING cmd to rig, once for all */
ret = write_block(&rig_s->rigport, (char *)p->p_cmd, YAESU_CMD_LENGTH);
ret = write_block(&rig->state.rigport, (char *)p->p_cmd, YAESU_CMD_LENGTH);
if (ret < 0)
{
@ -407,7 +407,6 @@ int ft747_close(RIG *rig)
int ft747_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
{
struct rig_state *rig_s;
struct ft747_priv_data *p;
unsigned char *cmd; /* points to sequence to send */
// cppcheck-suppress *
@ -415,8 +414,6 @@ int ft747_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
p = (struct ft747_priv_data *)rig->state.priv;
rig_s = &rig->state;
rig_debug(RIG_DEBUG_VERBOSE, "ft747: requested freq = %"PRIfreq" Hz \n", freq);
/*
@ -435,7 +432,7 @@ int ft747_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
rig_force_cache_timeout(&p->status_tv);
cmd = p->p_cmd; /* get native sequence */
return write_block(&rig_s->rigport, (char *) cmd, YAESU_CMD_LENGTH);
return write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH);
}
@ -909,24 +906,14 @@ static int ft747_get_update_data(RIG *rig)
static int ft747_send_priv_cmd(RIG *rig, unsigned char ci)
{
struct rig_state *rig_s;
unsigned char *cmd; /* points to sequence to send */
unsigned char cmd_index; /* index of sequence to send */
rig_s = &rig->state;
cmd_index = ci; /* get command */
if (! ft747_ncmd[cmd_index].ncomp)
if (! ft747_ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: attempt to send incomplete sequence\n",
__func__);
return -RIG_EINVAL;
}
cmd = (unsigned char *) ft747_ncmd[cmd_index].nseq; /* get native sequence */
return write_block(&rig_s->rigport, (char *) cmd, YAESU_CMD_LENGTH);
return write_block(&rig->state.rigport, (char *) ft747_ncmd[ci].nseq, YAESU_CMD_LENGTH);
}

Wyświetl plik

@ -201,7 +201,6 @@ struct ft840_priv_data
vfo_t current_vfo; /* active VFO from last cmd */
unsigned char
p_cmd[YAESU_CMD_LENGTH]; /* private copy of 1 constructed CAT cmd */
yaesu_cmd_set_t pcs[FT840_NATIVE_SIZE]; /* private cmd set */
unsigned char
update_data[FT840_ALL_DATA_LENGTH]; /* returned data--max value, some are less */
unsigned char current_mem; /* private memory channel number */
@ -366,11 +365,6 @@ static int ft840_init(RIG *rig)
priv = rig->state.priv;
/*
* Copy native cmd set to private cmd storage area
*/
memcpy(priv->pcs, ncmd, sizeof(ncmd));
/* TODO: read pacing from preferences */
priv->pacing = FT840_PACING_DEFAULT_VALUE; /* set pacing to minimum for now */
priv->read_update_delay =
@ -1703,7 +1697,6 @@ static int ft840_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
static int ft840_get_update_data(RIG *rig, unsigned char ci, unsigned char rl)
{
struct rig_state *rig_s;
struct ft840_priv_data *priv;
int n, err; /* for read_ */
@ -1715,7 +1708,6 @@ static int ft840_get_update_data(RIG *rig, unsigned char ci, unsigned char rl)
}
priv = (struct ft840_priv_data *)rig->state.priv;
rig_s = &rig->state;
err = ft840_send_static_cmd(rig, ci);
@ -1724,7 +1716,7 @@ static int ft840_get_update_data(RIG *rig, unsigned char ci, unsigned char rl)
return err;
}
n = read_block(&rig_s->rigport, (char *) priv->update_data, rl);
n = read_block(&rig->state.rigport, (char *) priv->update_data, rl);
if (n < 0)
{
@ -1743,7 +1735,7 @@ static int ft840_get_update_data(RIG *rig, unsigned char ci, unsigned char rl)
* TODO: place variant of this in yaesu.c
*
* Arguments: *rig Valid RIG instance
* ci Command index of the pcs struct
* ci Command index of the ncmd table
*
* Returns: RIG_OK if all called functions are successful,
* otherwise returns error from called functiion
@ -1751,8 +1743,6 @@ static int ft840_get_update_data(RIG *rig, unsigned char ci, unsigned char rl)
static int ft840_send_static_cmd(RIG *rig, unsigned char ci)
{
struct rig_state *rig_s;
struct ft840_priv_data *priv;
int err;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
@ -1762,17 +1752,14 @@ static int ft840_send_static_cmd(RIG *rig, unsigned char ci)
return -RIG_EINVAL;
}
priv = (struct ft840_priv_data *)rig->state.priv;
rig_s = &rig->state;
if (!priv->pcs[ci].ncomp)
if (!ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_TRACE,
"%s: Attempt to send incomplete sequence\n", __func__);
return -RIG_EINVAL;
}
err = write_block(&rig_s->rigport, (char *) priv->pcs[ci].nseq,
err = write_block(&rig->state.rigport, (char *) ncmd[ci].nseq,
YAESU_CMD_LENGTH);
if (err != RIG_OK)
@ -1791,7 +1778,7 @@ static int ft840_send_static_cmd(RIG *rig, unsigned char ci)
* TODO: place variant of this in yaesu.c
*
* Arguments: *rig Valid RIG instance
* ci Command index of the pcs struct
* ci Command index of the ncmd table
* p1-p4 Command parameters
*
* Returns: RIG_OK if all called functions are successful,
@ -1802,7 +1789,6 @@ static int ft840_send_dynamic_cmd(RIG *rig, unsigned char ci,
unsigned char p1, unsigned char p2,
unsigned char p3, unsigned char p4)
{
struct rig_state *rig_s;
struct ft840_priv_data *priv;
int err;
@ -1820,14 +1806,13 @@ static int ft840_send_dynamic_cmd(RIG *rig, unsigned char ci,
priv = (struct ft840_priv_data *)rig->state.priv;
if (priv->pcs[ci].ncomp)
if (ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_TRACE,
"%s: Attempt to modify complete sequence\n", __func__);
return -RIG_EINVAL;
}
rig_s = &rig->state;
memcpy(&priv->p_cmd, &ncmd[ci].nseq, YAESU_CMD_LENGTH);
priv->p_cmd[P1] = p1; /* ick */
@ -1835,7 +1820,7 @@ static int ft840_send_dynamic_cmd(RIG *rig, unsigned char ci,
priv->p_cmd[P3] = p3;
priv->p_cmd[P4] = p4;
err = write_block(&rig_s->rigport, (char *) &priv->p_cmd,
err = write_block(&rig->state.rigport, (char *) &priv->p_cmd,
YAESU_CMD_LENGTH);
if (err != RIG_OK)
@ -1854,7 +1839,7 @@ static int ft840_send_dynamic_cmd(RIG *rig, unsigned char ci,
* TODO: place variant of this in yaesu.c
*
* Arguments: *rig Valid RIG instance
* ci Command index of the pcs struct
* ci Command index of the ncmd table
* freq freq_t frequency value
*
* Returns: RIG_OK if all called functions are successful,
@ -1863,7 +1848,6 @@ static int ft840_send_dynamic_cmd(RIG *rig, unsigned char ci,
static int ft840_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
{
struct rig_state *rig_s;
struct ft840_priv_data *priv;
int err;
// cppcheck-suppress *
@ -1881,15 +1865,13 @@ static int ft840_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
priv = (struct ft840_priv_data *)rig->state.priv;
if (priv->pcs[ci].ncomp)
if (ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_TRACE,
"%s: Attempt to modify complete sequence\n", __func__);
return -RIG_EINVAL;
}
rig_s = &rig->state;
/* Copy native cmd freq_set to private cmd storage area */
memcpy(&priv->p_cmd, &ncmd[ci].nseq, YAESU_CMD_LENGTH);
@ -1899,7 +1881,7 @@ static int ft840_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
rig_debug(RIG_DEBUG_TRACE, fmt, __func__, (int64_t)from_bcd(priv->p_cmd,
FT840_BCD_DIAL) * 10);
err = write_block(&rig_s->rigport, (char *) &priv->p_cmd,
err = write_block(&rig->state.rigport, (char *) &priv->p_cmd,
YAESU_CMD_LENGTH);
if (err != RIG_OK)
@ -1918,7 +1900,7 @@ static int ft840_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
* TODO: place variant of this in yaesu.c
*
* Arguments: *rig Valid RIG instance
* ci Command index of the pcs struct
* ci Command index of the ncmd table
* rit shortfreq_t frequency value
* p1 P1 value -- CLAR_SET_FREQ
* p2 P2 value -- CLAR_OFFSET_PLUS || CLAR_OFFSET_MINUS
@ -1932,7 +1914,6 @@ static int ft840_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
#ifdef USE_FT840_SET_RIT
static int ft840_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit)
{
struct rig_state *rig_s;
struct ft840_priv_data *priv;
unsigned char p1;
unsigned char p2;
@ -1950,15 +1931,13 @@ static int ft840_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit)
priv = (struct ft840_priv_data *)rig->state.priv;
if (priv->pcs[ci].ncomp)
if (ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_TRACE,
"%s: Attempt to modify complete sequence\n", __func__);
return -RIG_EINVAL;
}
rig_s = &rig->state;
p1 = CLAR_SET_FREQ;
if (rit < 0)
@ -1984,7 +1963,7 @@ static int ft840_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit)
priv->p_cmd[P1] = p1; /* ick */
priv->p_cmd[P2] = p2;
err = write_block(&rig_s->rigport, (char *) &priv->p_cmd,
err = write_block(&rig->state.rigport, (char *) &priv->p_cmd,
YAESU_CMD_LENGTH);
if (err != RIG_OK)

Wyświetl plik

@ -645,15 +645,6 @@ int ft847_close(RIG *rig)
static int ft847_send_priv_cmd(RIG *rig, int cmd_index)
{
struct rig_state *rig_s;
unsigned char *cmd; /* points to sequence to send */
if (!rig)
{
return -RIG_EINVAL;
}
if (! ncmd[cmd_index].ncomp)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: attempt to send incomplete sequence\n",
@ -661,11 +652,7 @@ static int ft847_send_priv_cmd(RIG *rig, int cmd_index)
return -RIG_EINVAL;
}
rig_s = &rig->state;
cmd = (unsigned char *) ncmd[cmd_index].nseq; /* get native sequence */
return write_block(&rig_s->rigport, (char *) cmd, YAESU_CMD_LENGTH);
return write_block(&rig->state.rigport, (char *) ncmd[cmd_index].nseq, YAESU_CMD_LENGTH);
}
@ -717,7 +704,6 @@ static int opcode_vfo(RIG *rig, unsigned char *cmd, int cmd_index, vfo_t vfo)
int ft847_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
{
struct rig_state *rig_s;
unsigned char p_cmd[YAESU_CMD_LENGTH]; /* sequence to send */
int ret;
// cppcheck-suppress *
@ -728,8 +714,6 @@ int ft847_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
return -RIG_EINVAL;
}
rig_s = &rig->state;
rig_debug(RIG_DEBUG_VERBOSE, "ft847: requested freq = %"PRIfreq" Hz, vfo=%s\n",
freq, rig_strvfo(vfo));
@ -761,7 +745,7 @@ int ft847_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
}
}
return write_block(&rig_s->rigport, (char *)p_cmd, YAESU_CMD_LENGTH);
return write_block(&rig->state.rigport, (char *)p_cmd, YAESU_CMD_LENGTH);
}
#define MD_LSB 0x00

Wyświetl plik

@ -76,8 +76,6 @@
struct ft857_priv_data
{
yaesu_cmd_set_t pcs[FT857_NATIVE_SIZE]; /* TODO: why? */
/* rx status */
struct timeval rx_status_tv;
unsigned char rx_status;
@ -316,8 +314,6 @@ const struct rig_caps ft857_caps =
int ft857_init(RIG *rig)
{
struct ft857_priv_data *priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
if ((rig->state.priv = calloc(1, sizeof(struct ft857_priv_data))) == NULL)
@ -325,11 +321,6 @@ int ft857_init(RIG *rig)
return -RIG_ENOMEM;
}
priv = rig->state.priv;
/* Copy complete native cmd set to private cmd storage area */
memcpy(priv->pcs, ncmd, sizeof(ncmd));
return RIG_OK;
}
@ -400,12 +391,11 @@ static int check_cache_timeout(struct timeval *tv)
static int ft857_read_eeprom(RIG *rig, unsigned short addr, unsigned char *out)
{
struct ft857_priv_data *p = (struct ft857_priv_data *) rig->state.priv;
unsigned char data[YAESU_CMD_LENGTH];
int n;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
memcpy(data, (char *)p->pcs[FT857_NATIVE_CAT_EEPROM_READ].nseq,
memcpy(data, (char *)ncmd[FT857_NATIVE_CAT_EEPROM_READ].nseq,
YAESU_CMD_LENGTH);
data[0] = addr >> 8;
@ -465,7 +455,7 @@ static int ft857_get_status(RIG *rig, int status)
rig_flush(&rig->state.rigport);
write_block(&rig->state.rigport, (char *) p->pcs[status].nseq,
write_block(&rig->state.rigport, (char *) ncmd[status].nseq,
YAESU_CMD_LENGTH);
if ((n = read_block(&rig->state.rigport, (char *) data, len)) < 0)
@ -499,17 +489,15 @@ static int ft857_get_status(RIG *rig, int status)
*/
static int ft857_send_cmd(RIG *rig, int index)
{
struct ft857_priv_data *p = (struct ft857_priv_data *) rig->state.priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
if (p->pcs[index].ncomp == 0)
if (ncmd[index].ncomp == 0)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: incomplete sequence\n", __func__);
return -RIG_EINTERNAL;
}
write_block(&rig->state.rigport, (char *) p->pcs[index].nseq, YAESU_CMD_LENGTH);
write_block(&rig->state.rigport, (char *) ncmd[index].nseq, YAESU_CMD_LENGTH);
return ft817_read_ack(rig);
}
@ -518,18 +506,17 @@ static int ft857_send_cmd(RIG *rig, int index)
*/
static int ft857_send_icmd(RIG *rig, int index, unsigned char *data)
{
struct ft857_priv_data *p = (struct ft857_priv_data *) rig->state.priv;
unsigned char cmd[YAESU_CMD_LENGTH];
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
if (p->pcs[index].ncomp == 1)
if (ncmd[index].ncomp == 1)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: complete sequence\n", __func__);
return -RIG_EINTERNAL;
}
cmd[YAESU_CMD_LENGTH - 1] = p->pcs[index].nseq[YAESU_CMD_LENGTH - 1];
cmd[YAESU_CMD_LENGTH - 1] = ncmd[index].nseq[YAESU_CMD_LENGTH - 1];
memcpy(cmd, data, YAESU_CMD_LENGTH - 1);
write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH);

Wyświetl plik

@ -139,7 +139,6 @@ struct ft890_priv_data
vfo_t current_vfo; /* active VFO from last cmd */
unsigned char
p_cmd[YAESU_CMD_LENGTH]; /* private copy of 1 constructed CAT cmd */
yaesu_cmd_set_t pcs[FT890_NATIVE_SIZE]; /* private cmd set */
unsigned char
update_data[FT890_ALL_DATA_LENGTH]; /* returned data--max value, some are less */
unsigned char current_mem; /* private memory channel number */
@ -302,11 +301,6 @@ static int ft890_init(RIG *rig)
priv = rig->state.priv;
/*
* Copy native cmd set to private cmd storage area
*/
memcpy(priv->pcs, ncmd, sizeof(ncmd));
/* TODO: read pacing from preferences */
priv->pacing = FT890_PACING_DEFAULT_VALUE; /* set pacing to minimum for now */
priv->read_update_delay =
@ -1642,7 +1636,6 @@ static int ft890_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
static int ft890_get_update_data(RIG *rig, unsigned char ci, unsigned char rl)
{
struct rig_state *rig_s;
struct ft890_priv_data *priv;
int n, err; /* for read_ */
@ -1654,7 +1647,6 @@ static int ft890_get_update_data(RIG *rig, unsigned char ci, unsigned char rl)
}
priv = (struct ft890_priv_data *)rig->state.priv;
rig_s = &rig->state;
err = ft890_send_static_cmd(rig, ci);
@ -1663,7 +1655,7 @@ static int ft890_get_update_data(RIG *rig, unsigned char ci, unsigned char rl)
return err;
}
n = read_block(&rig_s->rigport, (char *) priv->update_data, rl);
n = read_block(&rig->state.rigport, (char *) priv->update_data, rl);
if (n < 0)
{
@ -1682,7 +1674,7 @@ static int ft890_get_update_data(RIG *rig, unsigned char ci, unsigned char rl)
* TODO: place variant of this in yaesu.c
*
* Arguments: *rig Valid RIG instance
* ci Command index of the pcs struct
* ci Command index of the ncmd table
*
* Returns: RIG_OK if all called functions are successful,
* otherwise returns error from called functiion
@ -1690,8 +1682,6 @@ static int ft890_get_update_data(RIG *rig, unsigned char ci, unsigned char rl)
static int ft890_send_static_cmd(RIG *rig, unsigned char ci)
{
struct rig_state *rig_s;
struct ft890_priv_data *priv;
int err;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
@ -1701,17 +1691,14 @@ static int ft890_send_static_cmd(RIG *rig, unsigned char ci)
return -RIG_EINVAL;
}
priv = (struct ft890_priv_data *)rig->state.priv;
rig_s = &rig->state;
if (!priv->pcs[ci].ncomp)
if (!ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_TRACE,
"%s: Attempt to send incomplete sequence\n", __func__);
return -RIG_EINVAL;
}
err = write_block(&rig_s->rigport, (char *) priv->pcs[ci].nseq,
err = write_block(&rig->state.rigport, (char *) ncmd[ci].nseq,
YAESU_CMD_LENGTH);
if (err != RIG_OK)
@ -1730,7 +1717,7 @@ static int ft890_send_static_cmd(RIG *rig, unsigned char ci)
* TODO: place variant of this in yaesu.c
*
* Arguments: *rig Valid RIG instance
* ci Command index of the pcs struct
* ci Command index of the ncmd table
* p1-p4 Command parameters
*
* Returns: RIG_OK if all called functions are successful,
@ -1741,7 +1728,6 @@ static int ft890_send_dynamic_cmd(RIG *rig, unsigned char ci,
unsigned char p1, unsigned char p2,
unsigned char p3, unsigned char p4)
{
struct rig_state *rig_s;
struct ft890_priv_data *priv;
int err;
@ -1759,14 +1745,13 @@ static int ft890_send_dynamic_cmd(RIG *rig, unsigned char ci,
priv = (struct ft890_priv_data *)rig->state.priv;
if (priv->pcs[ci].ncomp)
if (ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_TRACE,
"%s: Attempt to modify complete sequence\n", __func__);
return -RIG_EINVAL;
}
rig_s = &rig->state;
memcpy(&priv->p_cmd, &ncmd[ci].nseq, YAESU_CMD_LENGTH);
priv->p_cmd[P1] = p1; /* ick */
@ -1774,7 +1759,7 @@ static int ft890_send_dynamic_cmd(RIG *rig, unsigned char ci,
priv->p_cmd[P3] = p3;
priv->p_cmd[P4] = p4;
err = write_block(&rig_s->rigport, (char *) &priv->p_cmd,
err = write_block(&rig->state.rigport, (char *) &priv->p_cmd,
YAESU_CMD_LENGTH);
if (err != RIG_OK)
@ -1793,7 +1778,7 @@ static int ft890_send_dynamic_cmd(RIG *rig, unsigned char ci,
* TODO: place variant of this in yaesu.c
*
* Arguments: *rig Valid RIG instance
* ci Command index of the pcs struct
* ci Command index of the ncmd table
* freq freq_t frequency value
*
* Returns: RIG_OK if all called functions are successful,
@ -1802,7 +1787,6 @@ static int ft890_send_dynamic_cmd(RIG *rig, unsigned char ci,
static int ft890_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
{
struct rig_state *rig_s;
struct ft890_priv_data *priv;
int err;
// cppcheck-suppress *
@ -1820,15 +1804,13 @@ static int ft890_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
priv = (struct ft890_priv_data *)rig->state.priv;
if (priv->pcs[ci].ncomp)
if (ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_TRACE,
"%s: Attempt to modify complete sequence\n", __func__);
return -RIG_EINVAL;
}
rig_s = &rig->state;
/* Copy native cmd freq_set to private cmd storage area */
memcpy(&priv->p_cmd, &ncmd[ci].nseq, YAESU_CMD_LENGTH);
@ -1838,7 +1820,7 @@ static int ft890_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
rig_debug(RIG_DEBUG_TRACE, fmt, __func__, (int64_t)from_bcd(priv->p_cmd,
FT890_BCD_DIAL) * 10);
err = write_block(&rig_s->rigport, (char *) &priv->p_cmd,
err = write_block(&rig->state.rigport, (char *) &priv->p_cmd,
YAESU_CMD_LENGTH);
if (err != RIG_OK)
@ -1857,7 +1839,7 @@ static int ft890_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
* TODO: place variant of this in yaesu.c
*
* Arguments: *rig Valid RIG instance
* ci Command index of the pcs struct
* ci Command index of the ncmd table
* rit shortfreq_t frequency value
* p1 P1 value -- CLAR_SET_FREQ
* p2 P2 value -- CLAR_OFFSET_PLUS || CLAR_OFFSET_MINUS
@ -1870,7 +1852,6 @@ static int ft890_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
static int ft890_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit)
{
struct rig_state *rig_s;
struct ft890_priv_data *priv;
unsigned char p1;
unsigned char p2;
@ -1888,15 +1869,13 @@ static int ft890_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit)
priv = (struct ft890_priv_data *)rig->state.priv;
if (priv->pcs[ci].ncomp)
if (ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_TRACE,
"%s: Attempt to modify complete sequence\n", __func__);
return -RIG_EINVAL;
}
rig_s = &rig->state;
p1 = CLAR_SET_FREQ;
if (rit < 0)
@ -1922,7 +1901,7 @@ static int ft890_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit)
priv->p_cmd[P1] = p1; /* ick */
priv->p_cmd[P2] = p2;
err = write_block(&rig_s->rigport, (char *) &priv->p_cmd,
err = write_block(&rig->state.rigport, (char *) &priv->p_cmd,
YAESU_CMD_LENGTH);
if (err != RIG_OK)

Wyświetl plik

@ -81,8 +81,6 @@
struct ft897_priv_data
{
yaesu_cmd_set_t pcs[FT897_NATIVE_SIZE]; /* TODO: why? */
/* rx status */
struct timeval rx_status_tv;
unsigned char rx_status;
@ -492,8 +490,6 @@ const struct rig_caps ft897d_caps =
int ft897_init(RIG *rig)
{
struct ft897_priv_data *priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if ((rig->state.priv = calloc(1, sizeof(struct ft897_priv_data))) == NULL)
@ -501,11 +497,6 @@ int ft897_init(RIG *rig)
return -RIG_ENOMEM;
}
priv = rig->state.priv;
/* Copy complete native cmd set to private cmd storage area */
memcpy(priv->pcs, ncmd, sizeof(ncmd));
return RIG_OK;
}
@ -576,12 +567,11 @@ static int check_cache_timeout(struct timeval *tv)
static int ft897_read_eeprom(RIG *rig, unsigned short addr, unsigned char *out)
{
struct ft897_priv_data *p = (struct ft897_priv_data *) rig->state.priv;
unsigned char data[YAESU_CMD_LENGTH];
int n;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
memcpy(data, (char *)p->pcs[FT897_NATIVE_CAT_EEPROM_READ].nseq,
memcpy(data, (char *)ncmd[FT897_NATIVE_CAT_EEPROM_READ].nseq,
YAESU_CMD_LENGTH);
data[0] = addr >> 8;
@ -641,7 +631,7 @@ static int ft897_get_status(RIG *rig, int status)
rig_flush(&rig->state.rigport);
write_block(&rig->state.rigport, (char *) p->pcs[status].nseq,
write_block(&rig->state.rigport, (char *) ncmd[status].nseq,
YAESU_CMD_LENGTH);
if ((n = read_block(&rig->state.rigport, (char *) data, len)) < 0)
@ -956,17 +946,15 @@ int ft897_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd)
*/
static int ft897_send_cmd(RIG *rig, int index)
{
struct ft897_priv_data *p = (struct ft897_priv_data *) rig->state.priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if (p->pcs[index].ncomp == 0)
if (ncmd[index].ncomp == 0)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: incomplete sequence\n", __func__);
return -RIG_EINTERNAL;
}
write_block(&rig->state.rigport, (char *) p->pcs[index].nseq, YAESU_CMD_LENGTH);
write_block(&rig->state.rigport, (char *) ncmd[index].nseq, YAESU_CMD_LENGTH);
return ft817_read_ack(rig);
}
@ -975,18 +963,17 @@ static int ft897_send_cmd(RIG *rig, int index)
*/
static int ft897_send_icmd(RIG *rig, int index, unsigned char *data)
{
struct ft897_priv_data *p = (struct ft897_priv_data *) rig->state.priv;
unsigned char cmd[YAESU_CMD_LENGTH];
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if (p->pcs[index].ncomp == 1)
if (ncmd[index].ncomp == 1)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: Complete sequence\n", __func__);
return -RIG_EINTERNAL;
}
cmd[YAESU_CMD_LENGTH - 1] = p->pcs[index].nseq[YAESU_CMD_LENGTH - 1];
cmd[YAESU_CMD_LENGTH - 1] = ncmd[index].nseq[YAESU_CMD_LENGTH - 1];
memcpy(cmd, data, YAESU_CMD_LENGTH - 1);
write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH);

Wyświetl plik

@ -140,7 +140,6 @@ struct ft900_priv_data
vfo_t current_vfo; /* active VFO from last cmd */
unsigned char
p_cmd[YAESU_CMD_LENGTH]; /* private copy of 1 constructed CAT cmd */
yaesu_cmd_set_t pcs[FT900_NATIVE_SIZE]; /* private cmd set */
unsigned char
update_data[FT900_ALL_DATA_LENGTH]; /* returned data--max value, some are less */
unsigned char current_mem; /* private memory channel number */
@ -304,11 +303,6 @@ static int ft900_init(RIG *rig)
priv = rig->state.priv;
/*
* Copy native cmd set to private cmd storage area
*/
memcpy(priv->pcs, ncmd, sizeof(ncmd));
/* TODO: read pacing from preferences */
priv->pacing = FT900_PACING_DEFAULT_VALUE; /* set pacing to minimum for now */
priv->read_update_delay =
@ -1644,10 +1638,9 @@ static int ft900_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
static int ft900_get_update_data(RIG *rig, unsigned char ci, unsigned char rl)
{
struct rig_state *rig_s;
struct ft900_priv_data *priv;
int n, err; /* for read_ */
int err;
int n;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
if (!rig)
@ -1656,7 +1649,6 @@ static int ft900_get_update_data(RIG *rig, unsigned char ci, unsigned char rl)
}
priv = (struct ft900_priv_data *)rig->state.priv;
rig_s = &rig->state;
err = ft900_send_static_cmd(rig, ci);
@ -1665,7 +1657,7 @@ static int ft900_get_update_data(RIG *rig, unsigned char ci, unsigned char rl)
return err;
}
n = read_block(&rig_s->rigport, (char *) priv->update_data, rl);
n = read_block(&rig->state.rigport, (char *) priv->update_data, rl);
if (n < 0)
{
@ -1684,7 +1676,7 @@ static int ft900_get_update_data(RIG *rig, unsigned char ci, unsigned char rl)
* TODO: place variant of this in yaesu.c
*
* Arguments: *rig Valid RIG instance
* ci Command index of the pcs struct
* ci Command index of the ncmd table
*
* Returns: RIG_OK if all called functions are successful,
* otherwise returns error from called functiion
@ -1692,8 +1684,6 @@ static int ft900_get_update_data(RIG *rig, unsigned char ci, unsigned char rl)
static int ft900_send_static_cmd(RIG *rig, unsigned char ci)
{
struct rig_state *rig_s;
struct ft900_priv_data *priv;
int err;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
@ -1703,17 +1693,14 @@ static int ft900_send_static_cmd(RIG *rig, unsigned char ci)
return -RIG_EINVAL;
}
priv = (struct ft900_priv_data *)rig->state.priv;
rig_s = &rig->state;
if (!priv->pcs[ci].ncomp)
if (!ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_TRACE,
"%s: Attempt to send incomplete sequence\n", __func__);
return -RIG_EINVAL;
}
err = write_block(&rig_s->rigport, (char *) priv->pcs[ci].nseq,
err = write_block(&rig->state.rigport, (char *) ncmd[ci].nseq,
YAESU_CMD_LENGTH);
if (err != RIG_OK)
@ -1732,7 +1719,7 @@ static int ft900_send_static_cmd(RIG *rig, unsigned char ci)
* TODO: place variant of this in yaesu.c
*
* Arguments: *rig Valid RIG instance
* ci Command index of the pcs struct
* ci Command index of the ncmd table
* p1-p4 Command parameters
*
* Returns: RIG_OK if all called functions are successful,
@ -1743,7 +1730,6 @@ static int ft900_send_dynamic_cmd(RIG *rig, unsigned char ci,
unsigned char p1, unsigned char p2,
unsigned char p3, unsigned char p4)
{
struct rig_state *rig_s;
struct ft900_priv_data *priv;
int err;
@ -1761,14 +1747,13 @@ static int ft900_send_dynamic_cmd(RIG *rig, unsigned char ci,
priv = (struct ft900_priv_data *)rig->state.priv;
if (priv->pcs[ci].ncomp)
if (ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_TRACE,
"%s: Attempt to modify complete sequence\n", __func__);
return -RIG_EINVAL;
}
rig_s = &rig->state;
memcpy(&priv->p_cmd, &ncmd[ci].nseq, YAESU_CMD_LENGTH);
priv->p_cmd[P1] = p1; /* ick */
@ -1776,7 +1761,7 @@ static int ft900_send_dynamic_cmd(RIG *rig, unsigned char ci,
priv->p_cmd[P3] = p3;
priv->p_cmd[P4] = p4;
err = write_block(&rig_s->rigport, (char *) &priv->p_cmd,
err = write_block(&rig->state.rigport, (char *) &priv->p_cmd,
YAESU_CMD_LENGTH);
if (err != RIG_OK)
@ -1795,7 +1780,7 @@ static int ft900_send_dynamic_cmd(RIG *rig, unsigned char ci,
* TODO: place variant of this in yaesu.c
*
* Arguments: *rig Valid RIG instance
* ci Command index of the pcs struct
* ci Command index of the ncmd table
* freq freq_t frequency value
*
* Returns: RIG_OK if all called functions are successful,
@ -1804,7 +1789,6 @@ static int ft900_send_dynamic_cmd(RIG *rig, unsigned char ci,
static int ft900_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
{
struct rig_state *rig_s;
struct ft900_priv_data *priv;
int err;
// cppcheck-suppress *
@ -1822,15 +1806,13 @@ static int ft900_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
priv = (struct ft900_priv_data *)rig->state.priv;
if (priv->pcs[ci].ncomp)
if (ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_TRACE,
"%s: Attempt to modify complete sequence\n", __func__);
return -RIG_EINVAL;
}
rig_s = &rig->state;
/* Copy native cmd freq_set to private cmd storage area */
memcpy(&priv->p_cmd, &ncmd[ci].nseq, YAESU_CMD_LENGTH);
@ -1840,7 +1822,7 @@ static int ft900_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
rig_debug(RIG_DEBUG_TRACE, fmt, __func__, (int64_t)from_bcd(priv->p_cmd,
FT900_BCD_DIAL) * 10);
err = write_block(&rig_s->rigport, (char *) &priv->p_cmd,
err = write_block(&rig->state.rigport, (char *) &priv->p_cmd,
YAESU_CMD_LENGTH);
if (err != RIG_OK)
@ -1859,7 +1841,7 @@ static int ft900_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
* TODO: place variant of this in yaesu.c
*
* Arguments: *rig Valid RIG instance
* ci Command index of the pcs struct
* ci Command index of the ncmd table
* rit shortfreq_t frequency value
* p1 P1 value -- CLAR_SET_FREQ
* p2 P2 value -- CLAR_OFFSET_PLUS || CLAR_OFFSET_MINUS
@ -1872,7 +1854,6 @@ static int ft900_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
static int ft900_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit)
{
struct rig_state *rig_s;
struct ft900_priv_data *priv;
unsigned char p1;
unsigned char p2;
@ -1890,15 +1871,13 @@ static int ft900_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit)
priv = (struct ft900_priv_data *)rig->state.priv;
if (priv->pcs[ci].ncomp)
if (ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_TRACE,
"%s: Attempt to modify complete sequence\n", __func__);
return -RIG_EINVAL;
}
rig_s = &rig->state;
p1 = CLAR_SET_FREQ;
if (rit < 0)
@ -1924,7 +1903,7 @@ static int ft900_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit)
priv->p_cmd[P1] = p1; /* ick */
priv->p_cmd[P2] = p2;
err = write_block(&rig_s->rigport, (char *) &priv->p_cmd,
err = write_block(&rig->state.rigport, (char *) &priv->p_cmd,
YAESU_CMD_LENGTH);
if (err != RIG_OK)

Wyświetl plik

@ -135,7 +135,6 @@ struct ft920_priv_data
split_t split; /* split active or not */
unsigned char
p_cmd[YAESU_CMD_LENGTH]; /* private copy of 1 constructed CAT cmd */
yaesu_cmd_set_t pcs[FT920_NATIVE_SIZE]; /* private cmd set */
unsigned char
update_data[FT920_VFO_DATA_LENGTH]; /* returned data--max value, some are less */
};
@ -382,11 +381,6 @@ static int ft920_init(RIG *rig)
priv = rig->state.priv;
/*
* Copy native cmd set to private cmd storage area
*/
memcpy(priv->pcs, ncmd, sizeof(ncmd));
/* TODO: read pacing from preferences */
priv->pacing =
FT920_PACING_DEFAULT_VALUE; /* set pacing to minimum for now */
@ -459,7 +453,7 @@ static int ft920_open(RIG *rig)
rig_debug(RIG_DEBUG_TRACE, "%s: read pacing = %i\n", __func__, priv->pacing);
err = write_block(&rig_s->rigport, (char *) priv->p_cmd, YAESU_CMD_LENGTH);
err = write_block(&rig->state.rigport, (char *) priv->p_cmd, YAESU_CMD_LENGTH);
if (err != RIG_OK)
{
@ -2356,7 +2350,6 @@ static int ft920_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
static int ft920_get_update_data(RIG *rig, unsigned char ci, unsigned char rl)
{
struct rig_state *rig_s;
struct ft920_priv_data *priv;
int n; /* for read_ */
int err;
@ -2369,7 +2362,6 @@ static int ft920_get_update_data(RIG *rig, unsigned char ci, unsigned char rl)
}
priv = (struct ft920_priv_data *)rig->state.priv;
rig_s = &rig->state;
err = ft920_send_static_cmd(rig, ci);
@ -2378,7 +2370,7 @@ static int ft920_get_update_data(RIG *rig, unsigned char ci, unsigned char rl)
return err;
}
n = read_block(&rig_s->rigport, (char *)priv->update_data, rl);
n = read_block(&rig->state.rigport, (char *)priv->update_data, rl);
if (n < 0)
{
@ -2397,7 +2389,7 @@ static int ft920_get_update_data(RIG *rig, unsigned char ci, unsigned char rl)
* TODO: place variant of this in yaesu.c
*
* Arguments: *rig Valid RIG instance
* ci Command index of the pcs struct
* ci Command index of the ncmd table
*
* Returns: RIG_OK if all called functions are successful,
* otherwise returns error from called functiion
@ -2405,8 +2397,6 @@ static int ft920_get_update_data(RIG *rig, unsigned char ci, unsigned char rl)
static int ft920_send_static_cmd(RIG *rig, unsigned char ci)
{
struct rig_state *rig_s;
struct ft920_priv_data *priv;
int err;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
@ -2416,21 +2406,18 @@ static int ft920_send_static_cmd(RIG *rig, unsigned char ci)
return -RIG_EINVAL;
}
priv = (struct ft920_priv_data *)rig->state.priv;
rig_s = &rig->state;
/*
* If we've been passed a command index (ci) that is marked
* as dynamic (0), then bail out.
*/
if (!priv->pcs[ci].ncomp)
if (!ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_TRACE, "%s: Attempt to send incomplete sequence\n",
__func__);
return -RIG_EINVAL;
}
err = write_block(&rig_s->rigport, (char *) priv->pcs[ci].nseq,
err = write_block(&rig->state.rigport, (char *) ncmd[ci].nseq,
YAESU_CMD_LENGTH);
if (err != RIG_OK)
@ -2449,7 +2436,7 @@ static int ft920_send_static_cmd(RIG *rig, unsigned char ci)
* TODO: place variant of this in yaesu.c
*
* Arguments: *rig Valid RIG instance
* ci Command index of the pcs struct
* ci Command index of the ncmd table
* p1-p4 Command parameters
*
* Returns: RIG_OK if all called functions are successful,
@ -2460,7 +2447,6 @@ static int ft920_send_dynamic_cmd(RIG *rig, unsigned char ci,
unsigned char p1, unsigned char p2,
unsigned char p3, unsigned char p4)
{
struct rig_state *rig_s;
struct ft920_priv_data *priv;
int err;
@ -2482,7 +2468,7 @@ static int ft920_send_dynamic_cmd(RIG *rig, unsigned char ci,
* If we've been passed a command index (ci) that is marked
* as static (1), then bail out.
*/
if (priv->pcs[ci].ncomp)
if (ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_TRACE,
"%s: Attempted to modify a complete command sequence: %i\n",
@ -2490,7 +2476,6 @@ static int ft920_send_dynamic_cmd(RIG *rig, unsigned char ci,
return -RIG_EINVAL;
}
rig_s = &rig->state;
memcpy(&priv->p_cmd, &ncmd[ci].nseq, YAESU_CMD_LENGTH);
priv->p_cmd[P1] = p1; /* ick */
@ -2498,7 +2483,7 @@ static int ft920_send_dynamic_cmd(RIG *rig, unsigned char ci,
priv->p_cmd[P3] = p3;
priv->p_cmd[P4] = p4;
err = write_block(&rig_s->rigport, (char *) &priv->p_cmd, YAESU_CMD_LENGTH);
err = write_block(&rig->state.rigport, (char *) &priv->p_cmd, YAESU_CMD_LENGTH);
if (err != RIG_OK)
{
@ -2516,7 +2501,7 @@ static int ft920_send_dynamic_cmd(RIG *rig, unsigned char ci,
* TODO: place variant of this in yaesu.c
*
* Arguments: *rig Valid RIG instance
* ci Command index of the pcs struct
* ci Command index of the ncmd table
* freq freq_t frequency value
*
* Returns: RIG_OK if all called functions are successful,
@ -2525,7 +2510,6 @@ static int ft920_send_dynamic_cmd(RIG *rig, unsigned char ci,
static int ft920_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
{
struct rig_state *rig_s;
struct ft920_priv_data *priv;
int err;
// cppcheck-suppress *
@ -2547,15 +2531,13 @@ static int ft920_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
* If we've been passed a command index (ci) that is marked
* as static (1), then bail out.
*/
if (priv->pcs[ci].ncomp)
if (ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_TRACE, "%s: Attempt to modify complete sequence\n",
__func__);
return -RIG_EINVAL;
}
rig_s = &rig->state;
/* Copy native cmd freq_set to private cmd storage area */
memcpy(&priv->p_cmd, &ncmd[ci].nseq, YAESU_CMD_LENGTH);
@ -2565,7 +2547,7 @@ static int ft920_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
rig_debug(RIG_DEBUG_TRACE, fmt, __func__, (int64_t)from_bcd(priv->p_cmd,
FT920_BCD_DIAL) * 10);
err = write_block(&rig_s->rigport, (char *) &priv->p_cmd, YAESU_CMD_LENGTH);
err = write_block(&rig->state.rigport, (char *) &priv->p_cmd, YAESU_CMD_LENGTH);
if (err != RIG_OK)
{
@ -2583,7 +2565,7 @@ static int ft920_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
* TODO: place variant of this in yaesu.c
*
* Arguments: *rig Valid RIG instance
* ci Command index of the pcs struct
* ci Command index of the ncmd table
* rit shortfreq_t frequency value
* p1 P1 value -- CLAR_SET_FREQ
* p2 P2 value -- CLAR_OFFSET_PLUS || CLAR_OFFSET_MINUS
@ -2596,7 +2578,6 @@ static int ft920_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
static int ft920_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit)
{
struct rig_state *rig_s;
struct ft920_priv_data *priv;
unsigned char p1;
unsigned char p2;
@ -2618,15 +2599,13 @@ static int ft920_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit)
* If we've been passed a command index (ci) that is marked
* as static (1), then bail out.
*/
if (priv->pcs[ci].ncomp)
if (ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_TRACE, "%s: Attempt to modify complete sequence\n",
__func__);
return -RIG_EINVAL;
}
rig_s = &rig->state;
p1 = CLAR_SET_FREQ;
if (rit < 0)
@ -2651,7 +2630,7 @@ static int ft920_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit)
priv->p_cmd[P1] = p1; /* ick */
priv->p_cmd[P2] = p2;
err = write_block(&rig_s->rigport, (char *) &priv->p_cmd, YAESU_CMD_LENGTH);
err = write_block(&rig->state.rigport, (char *) &priv->p_cmd, YAESU_CMD_LENGTH);
if (err != RIG_OK)
{

Wyświetl plik

@ -125,7 +125,6 @@ struct ft990_priv_data
unsigned int read_update_delay; /* depends on pacing value */
vfo_t current_vfo; /* active VFO from last cmd */
unsigned char p_cmd[YAESU_CMD_LENGTH]; /* private copy of CAT cmd */
yaesu_cmd_set_t pcs[FT990_NATIVE_SIZE]; /* private cmd set */
ft990_update_data_t update_data; /* returned data */
};
@ -310,9 +309,6 @@ int ft990_init(RIG *rig)
priv = rig->state.priv;
// Copy native cmd set to private cmd storage area
memcpy(priv->pcs, ncmd, sizeof(ncmd));
// Set default pacing value
priv->pacing = FT990_PACING_DEFAULT_VALUE;
@ -2285,7 +2281,6 @@ int ft990_get_vfo(RIG *rig, vfo_t *vfo)
int ft990_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *value)
{
struct ft990_priv_data *priv;
struct rig_state *rig_s;
unsigned char mdata[YAESU_CMD_LENGTH];
int err;
@ -2328,8 +2323,7 @@ int ft990_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *value)
return err;
}
rig_s = &rig->state;
err = read_block(&rig_s->rigport, (char *) mdata, FT990_READ_METER_LENGTH);
err = read_block(&rig->state.rigport, (char *) mdata, FT990_READ_METER_LENGTH);
if (err < 0)
{
@ -3128,7 +3122,6 @@ int ft990_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only)
*/
int ft990_get_update_data(RIG *rig, unsigned char ci, unsigned short ch)
{
struct rig_state *rig_s;
struct ft990_priv_data *priv;
int n;
int err;
@ -3146,7 +3139,6 @@ int ft990_get_update_data(RIG *rig, unsigned char ci, unsigned short ch)
}
priv = (struct ft990_priv_data *)rig->state.priv;
rig_s = &rig->state;
if (ci == FT990_NATIVE_UPDATE_MEM_CHNL_DATA)
// P4 = 0x01 to 0x5a for channel 1 - 90
@ -3198,7 +3190,7 @@ int ft990_get_update_data(RIG *rig, unsigned char ci, unsigned short ch)
return -RIG_EINVAL;
}
n = read_block(&rig_s->rigport, p, rl);
n = read_block(&rig->state.rigport, p, rl);
if (n < 0)
{
@ -3221,15 +3213,13 @@ int ft990_get_update_data(RIG *rig, unsigned char ci, unsigned short ch)
* TODO: place variant of this in yaesu.c
*
* Arguments: *rig Valid RIG instance
* ci Command index of the pcs struct
* ci Command index of the ncmd table
*
* Returns: RIG_OK if all called functions are successful,
* otherwise returns error from called functiion
*/
int ft990_send_static_cmd(RIG *rig, unsigned char ci)
{
struct rig_state *rig_s;
struct ft990_priv_data *priv;
int err;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
@ -3239,17 +3229,14 @@ int ft990_send_static_cmd(RIG *rig, unsigned char ci)
return -RIG_EINVAL;
}
priv = (struct ft990_priv_data *)rig->state.priv;
rig_s = &rig->state;
if (!priv->pcs[ci].ncomp)
if (!ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_TRACE,
"%s: Attempt to send incomplete sequence\n", __func__);
return -RIG_EINVAL;
}
err = write_block(&rig_s->rigport, (char *) priv->pcs[ci].nseq,
err = write_block(&rig->state.rigport, (char *) ncmd[ci].nseq,
YAESU_CMD_LENGTH);
if (err != RIG_OK)
@ -3267,7 +3254,7 @@ int ft990_send_static_cmd(RIG *rig, unsigned char ci)
* TODO: place variant of this in yaesu.c
*
* Arguments: *rig Valid RIG instance
* ci Command index of the pcs struct
* ci Command index of the ncmd table
* p1-p4 Command parameters
*
* Returns: RIG_OK if all called functions are successful,
@ -3277,7 +3264,6 @@ int ft990_send_dynamic_cmd(RIG *rig, unsigned char ci,
unsigned char p1, unsigned char p2,
unsigned char p3, unsigned char p4)
{
struct rig_state *rig_s;
struct ft990_priv_data *priv;
int err;
@ -3295,14 +3281,13 @@ int ft990_send_dynamic_cmd(RIG *rig, unsigned char ci,
priv = (struct ft990_priv_data *)rig->state.priv;
if (priv->pcs[ci].ncomp)
if (ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_TRACE,
"%s: Attempt to modify complete sequence\n", __func__);
return -RIG_EINVAL;
}
rig_s = &rig->state;
memcpy(&priv->p_cmd, &ncmd[ci].nseq, YAESU_CMD_LENGTH);
priv->p_cmd[3] = p1;
@ -3310,7 +3295,7 @@ int ft990_send_dynamic_cmd(RIG *rig, unsigned char ci,
priv->p_cmd[1] = p3;
priv->p_cmd[0] = p4;
err = write_block(&rig_s->rigport, (char *) &priv->p_cmd,
err = write_block(&rig->state.rigport, (char *) &priv->p_cmd,
YAESU_CMD_LENGTH);
if (err != RIG_OK)
@ -3328,7 +3313,7 @@ int ft990_send_dynamic_cmd(RIG *rig, unsigned char ci,
* TODO: place variant of this in yaesu.c
*
* Arguments: *rig Valid RIG instance
* ci Command index of the pcs struct
* ci Command index of the ncmd table
* freq freq_t frequency value
*
* Returns: RIG_OK if all called functions are successful,
@ -3336,7 +3321,6 @@ int ft990_send_dynamic_cmd(RIG *rig, unsigned char ci,
*/
int ft990_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
{
struct rig_state *rig_s;
struct ft990_priv_data *priv;
int err;
// cppcheck-suppress *
@ -3354,15 +3338,13 @@ int ft990_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
priv = (struct ft990_priv_data *)rig->state.priv;
if (priv->pcs[ci].ncomp)
if (ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_TRACE,
"%s: Attempt to modify complete sequence\n", __func__);
return -RIG_EINVAL;
}
rig_s = &rig->state;
/* Copy native cmd freq_set to private cmd storage area */
memcpy(&priv->p_cmd, &ncmd[ci].nseq, YAESU_CMD_LENGTH);
@ -3372,7 +3354,7 @@ int ft990_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
rig_debug(RIG_DEBUG_TRACE, fmt, __func__, (int64_t)from_bcd(priv->p_cmd,
FT990_BCD_DIAL) * 10);
err = write_block(&rig_s->rigport, (char *) &priv->p_cmd,
err = write_block(&rig->state.rigport, (char *) &priv->p_cmd,
YAESU_CMD_LENGTH);
if (err != RIG_OK)
@ -3388,7 +3370,7 @@ int ft990_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
* change the rit frequency.
*
* Arguments: *rig Valid RIG instance
* ci Command index of the pcs struct
* ci Command index of the ncmd table
* rit shortfreq_t frequency value
*
* Returns: RIG_OK if all called functions are successful,
@ -3397,7 +3379,6 @@ int ft990_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq)
int ft990_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit)
{
struct ft990_priv_data *priv;
struct rig_state *rig_s;
int err;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
@ -3411,9 +3392,8 @@ int ft990_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit)
rig_debug(RIG_DEBUG_TRACE, "%s: passed rit = %li Hz\n", __func__, rit);
priv = (struct ft990_priv_data *) rig->state.priv;
rig_s = &rig->state;
if (priv->pcs[ci].ncomp)
if (ncmd[ci].ncomp)
{
rig_debug(RIG_DEBUG_TRACE, "%s: Attempt to modify complete sequence\n",
__func__);
@ -3439,7 +3419,7 @@ int ft990_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit)
// Store bcd format into privat command storage area
to_bcd(priv->p_cmd, labs(rit) / 10, FT990_BCD_RIT);
err = write_block(&rig_s->rigport, (char *) &priv->p_cmd,
err = write_block(&rig->state.rigport, (char *) &priv->p_cmd,
YAESU_CMD_LENGTH);
if (err != RIG_OK)

Wyświetl plik

@ -288,7 +288,7 @@ static int vx1700_do_transaction(RIG *rig,
* TODO: place variant of this in yaesu.c
*
* Arguments: *rig Valid RIG instance
* ci Command index of the ncmd struct
* ci Command index of the ncmd table
*
* Returns: RIG_OK if all called functions are successful,
* otherwise returns error from called functiion
@ -314,7 +314,7 @@ static int vx1700_do_static_cmd(RIG *rig, unsigned char ci)
* TODO: place variant of this in yaesu.c
*
* Arguments: *rig Valid RIG instance
* ci Command index of the ncmd struct
* ci Command index of the cmd struct
* p1-p4 Command parameters
*
* Returns: RIG_OK if all called functions are successful,