kopia lustrzana https://github.com/Hamlib/Hamlib
Detect C-IV NAK returns as rejected commands
Only ask Icom rigs once then desist if bandwidth request returns command rejected. This avoids sending the request with every mode query and possibly retrying 'retries' times for rigs that do not suport the '1a 03' command which wastes much time at slow baud rates.libusb-1-0
rodzic
683853d669
commit
5244086e07
|
@ -221,9 +221,8 @@ int icom_one_transaction (RIG *rig, int cmd, int subcmd, const unsigned char *pa
|
|||
return -RIG_EPROTO;
|
||||
}
|
||||
|
||||
if (frm_len < ACKFRMLEN) {
|
||||
return -RIG_EPROTO;
|
||||
}
|
||||
if (frm_len < ACKFRMLEN) return -RIG_EPROTO;
|
||||
if (NAK == buf[frm_len - 2]) return -RIG_ERJCTED;
|
||||
|
||||
*data_len = frm_len-(ACKFRMLEN-1);
|
||||
memcpy(data, buf+4, *data_len);
|
||||
|
@ -256,7 +255,7 @@ int icom_transaction (RIG *rig, int cmd, int subcmd, const unsigned char *payloa
|
|||
|
||||
do {
|
||||
retval = icom_one_transaction (rig, cmd, subcmd, payload, payload_len, data, data_len);
|
||||
if (retval == RIG_OK)
|
||||
if (retval == RIG_OK || retval == -RIG_ERJCTED)
|
||||
break;
|
||||
} while (retry-- > 0);
|
||||
|
||||
|
|
30
icom/icom.c
30
icom/icom.c
|
@ -365,7 +365,7 @@ int icom_init(RIG *rig)
|
|||
|
||||
priv_caps = (const struct icom_priv_caps *) caps->priv;
|
||||
|
||||
priv = (struct icom_priv_data*)malloc(sizeof(struct icom_priv_data));
|
||||
priv = (struct icom_priv_data*)calloc(1, sizeof(struct icom_priv_data));
|
||||
if (!priv) {
|
||||
/* whoops! memory shortage! */
|
||||
return -RIG_ENOMEM;
|
||||
|
@ -535,31 +535,37 @@ pbwidth_t icom_get_dsp_flt(RIG *rig, rmode_t mode) {
|
|||
unsigned char resbuf[MAXFRAMELEN];
|
||||
value_t rfwidth;
|
||||
unsigned char fw_sub_cmd = RIG_MODEL_IC7200 == rig->caps->rig_model ? 0x02 : S_MEM_FILT_WDTH;
|
||||
struct icom_priv_data * priv = (struct icom_priv_data*)rig->state.priv;
|
||||
|
||||
if (rig_has_get_func(rig, RIG_FUNC_RF) && (mode & (RIG_MODE_RTTY | RIG_MODE_RTTYR))) {
|
||||
if(!rig_get_func(rig, RIG_VFO_CURR, RIG_FUNC_RF, &rfstatus) && (rfstatus)) {
|
||||
retval = rig_get_ext_parm (rig, TOK_RTTY_FLTR, &rfwidth);
|
||||
if (retval != RIG_OK || rfwidth.i >= RTTY_FIL_NB)
|
||||
return 0; /* use default */
|
||||
else
|
||||
return rtty_fil[rfwidth.i];
|
||||
if(!rig_get_func(rig, RIG_VFO_CURR, RIG_FUNC_RF, &rfstatus) && (rfstatus)) {
|
||||
retval = rig_get_ext_parm (rig, TOK_RTTY_FLTR, &rfwidth);
|
||||
if (retval != RIG_OK || rfwidth.i >= RTTY_FIL_NB)
|
||||
return 0; /* use default */
|
||||
else
|
||||
return rtty_fil[rfwidth.i];
|
||||
}
|
||||
}
|
||||
if (priv->no_1a_03_cmd) return 0;
|
||||
retval = icom_transaction (rig, C_CTL_MEM, fw_sub_cmd, 0, 0,
|
||||
resbuf, &res_len);
|
||||
resbuf, &res_len);
|
||||
if (-RIG_ERJCTED == retval) {
|
||||
priv->no_1a_03_cmd = -1; /* do not keep asking */
|
||||
return 0;
|
||||
}
|
||||
if (retval != RIG_OK) {
|
||||
rig_debug(RIG_DEBUG_ERR,"%s: protocol error (%#.2x), "
|
||||
"len=%d\n", __FUNCTION__,resbuf[0],res_len);
|
||||
return 0; /* use default */
|
||||
"len=%d\n", __FUNCTION__,resbuf[0],res_len);
|
||||
return 0; /* use default */
|
||||
}
|
||||
if (res_len == 3 && resbuf[0] == C_CTL_MEM) {
|
||||
int i;
|
||||
i = (int) from_bcd(resbuf + 2, 2);
|
||||
|
||||
if (mode & RIG_MODE_AM)
|
||||
return (i + 1)* 200; /* Ic_7800 */
|
||||
return (i + 1)* 200; /* Ic_7800 */
|
||||
else if (mode & (RIG_MODE_CW | RIG_MODE_USB | RIG_MODE_LSB | RIG_MODE_RTTY | RIG_MODE_RTTYR))
|
||||
return i < 10 ? (i+1) * 50 : (i -4) * 100;
|
||||
return i < 10 ? (i+1) * 50 : (i -4) * 100;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -118,6 +118,7 @@ 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 */
|
||||
pltstate_t *pltstate; /* only on optoscan */
|
||||
};
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue