Fixed icom ACK/NAK and frame responses

https://github.com/Hamlib/Hamlib/issues/600
pull/608/head
Michael Black W9MDB 2021-03-11 10:24:22 -06:00
rodzic 198f1cb43e
commit 6fcb7ccd37
1 zmienionych plików z 7 dodań i 3 usunięć

Wyświetl plik

@ -269,6 +269,9 @@ int icom_one_transaction(RIG *rig, int cmd, int subcmd,
/* Ok, normal frame */
break;
case NAK:
RETURNFUNC(-RIG_ERJCTED);
default:
/* Timeout after reading at least one character */
/* Problem on ci-v bus? */
@ -277,13 +280,14 @@ int icom_one_transaction(RIG *rig, int cmd, int subcmd,
if (frm_len < ACKFRMLEN) { RETURNFUNC(-RIG_EPROTO); }
rig_debug(RIG_DEBUG_TRACE, "%s: frm_len=%d, frm_len-1=%02x, frm_len-2=%02x\n", __func__, frm_len, buf[frm_len-1], buf[frm_len-2]);
if (NAK == buf[frm_len - 2]) { RETURNFUNC(-RIG_ERJCTED); }
if (ACK != buf[frm_len - 2]) { RETURNFUNC(-RIG_BUSBUSY); }
// has to be one of these two now or frame is corrupt
if (FI != buf[frm_len - 1] && ACK != buf[frm_len - 1]) { RETURNFUNC(-RIG_BUSBUSY); }
*data_len = frm_len - (ACKFRMLEN - 1);
rig_debug(RIG_DEBUG_TRACE, "%s: data_len=%d, frm_len=%d\n", __func__, *data_len,
frm_len);
if (*data_len <= 0) { RETURNFUNC(-RIG_EPROTO); }
memcpy(data, buf + 4, *data_len);
/*