kopia lustrzana https://github.com/Hamlib/Hamlib
Fix cppcheck warnings in pcr
rodzic
ff4a8acb9c
commit
41c4a43e7f
19
pcr/pcr.c
19
pcr/pcr.c
|
@ -167,7 +167,6 @@ static int is_sub_rcvr(RIG *rig, vfo_t vfo);
|
||||||
static int
|
static int
|
||||||
pcr_read_block(RIG *rig, char *rxbuffer, size_t count)
|
pcr_read_block(RIG *rig, char *rxbuffer, size_t count)
|
||||||
{
|
{
|
||||||
int err;
|
|
||||||
int read = 0, tries = 4;
|
int read = 0, tries = 4;
|
||||||
|
|
||||||
struct rig_state *rs = &rig->state;
|
struct rig_state *rs = &rig->state;
|
||||||
|
@ -188,7 +187,7 @@ pcr_read_block(RIG *rig, char *rxbuffer, size_t count)
|
||||||
char *p = &rxbuffer[0];
|
char *p = &rxbuffer[0];
|
||||||
|
|
||||||
/* read first char */
|
/* read first char */
|
||||||
err = read_block(&rs->rigport, p, 1);
|
int err = read_block(&rs->rigport, p, 1);
|
||||||
|
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
{
|
{
|
||||||
|
@ -813,7 +812,7 @@ pcr_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
||||||
|
|
||||||
unsigned char buf[20];
|
unsigned char buf[20];
|
||||||
int buf_len, err;
|
int buf_len, err;
|
||||||
int pcrmode, pcrfilter;
|
int pcrmode;
|
||||||
|
|
||||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: mode = %s, width = %d\n",
|
rig_debug(RIG_DEBUG_VERBOSE, "%s: mode = %s, width = %d\n",
|
||||||
__func__, rig_strrmode(mode), (int)width);
|
__func__, rig_strrmode(mode), (int)width);
|
||||||
|
@ -862,6 +861,7 @@ pcr_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
||||||
|
|
||||||
if (width != RIG_PASSBAND_NOCHANGE)
|
if (width != RIG_PASSBAND_NOCHANGE)
|
||||||
{
|
{
|
||||||
|
int pcrfilter;
|
||||||
if (width == RIG_PASSBAND_NORMAL)
|
if (width == RIG_PASSBAND_NORMAL)
|
||||||
{
|
{
|
||||||
width = rig_passband_normal(rig, mode);
|
width = rig_passband_normal(rig, mode);
|
||||||
|
@ -1076,8 +1076,8 @@ pcr_get_info(RIG *rig)
|
||||||
"Optional devices:%s%s%s, Country: %s",
|
"Optional devices:%s%s%s, Country: %s",
|
||||||
priv->firmware / 10, priv->firmware % 10,
|
priv->firmware / 10, priv->firmware % 10,
|
||||||
priv->protocol / 10, priv->protocol % 10,
|
priv->protocol / 10, priv->protocol % 10,
|
||||||
priv->options & OPT_UT106 ? " DSP" : "",
|
(priv->options & OPT_UT106) ? " DSP" : "",
|
||||||
priv->options & OPT_UT107 ? " DARC" : "",
|
(priv->options & OPT_UT107) ? " DARC" : "",
|
||||||
priv->options ? "" : " none",
|
priv->options ? "" : " none",
|
||||||
country);
|
country);
|
||||||
|
|
||||||
|
@ -1086,8 +1086,8 @@ pcr_get_info(RIG *rig)
|
||||||
__func__,
|
__func__,
|
||||||
priv->firmware / 10, priv->firmware % 10,
|
priv->firmware / 10, priv->firmware % 10,
|
||||||
priv->protocol / 10, priv->protocol % 10,
|
priv->protocol / 10, priv->protocol % 10,
|
||||||
priv->options & OPT_UT106 ? " DSP" : "",
|
(priv->options & OPT_UT106) ? " DSP" : "",
|
||||||
priv->options & OPT_UT107 ? " DARC" : "",
|
(priv->options & OPT_UT107) ? " DARC" : "",
|
||||||
priv->options ? "" : " none",
|
priv->options ? "" : " none",
|
||||||
country);
|
country);
|
||||||
|
|
||||||
|
@ -1974,11 +1974,10 @@ int pcr_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd)
|
||||||
struct pcr_priv_data *priv = (struct pcr_priv_data *) rig->state.priv;
|
struct pcr_priv_data *priv = (struct pcr_priv_data *) rig->state.priv;
|
||||||
struct pcr_rcvr *rcvr = is_sub_rcvr(rig,
|
struct pcr_rcvr *rcvr = is_sub_rcvr(rig,
|
||||||
vfo) ? &priv->sub_rcvr : &priv->main_rcvr;
|
vfo) ? &priv->sub_rcvr : &priv->main_rcvr;
|
||||||
int err;
|
|
||||||
|
|
||||||
if (priv->auto_update == 0)
|
if (priv->auto_update == 0)
|
||||||
{
|
{
|
||||||
err = pcr_transaction(rig, is_sub_rcvr(rig, vfo) ? "I4?" : "I0?");
|
int err = pcr_transaction(rig, is_sub_rcvr(rig, vfo) ? "I4?" : "I0?");
|
||||||
|
|
||||||
if (err != RIG_OK)
|
if (err != RIG_OK)
|
||||||
{
|
{
|
||||||
|
@ -1993,7 +1992,7 @@ int pcr_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd)
|
||||||
* Bit 2: VSC open
|
* Bit 2: VSC open
|
||||||
* Bit 3: RX error (not ready to receive)
|
* Bit 3: RX error (not ready to receive)
|
||||||
*/
|
*/
|
||||||
*dcd = rcvr->squelch_status & 0x02 ? RIG_DCD_ON : RIG_DCD_OFF;
|
*dcd = (rcvr->squelch_status & 0x02) ? RIG_DCD_ON : RIG_DCD_OFF;
|
||||||
|
|
||||||
return RIG_OK;
|
return RIG_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,8 +49,8 @@ struct pcr_priv_data
|
||||||
float volume;
|
float volume;
|
||||||
float squelch;
|
float squelch;
|
||||||
|
|
||||||
int raw_level;
|
unsigned int raw_level;
|
||||||
int squelch_status;
|
unsigned int squelch_status;
|
||||||
|
|
||||||
} main_rcvr, sub_rcvr;
|
} main_rcvr, sub_rcvr;
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue