Automatically detect CI-V echo state

Some Icom rigs use USB for the CI-V connection. This can be set to echo or not. This mod permits a check of the echo state on start-up & flags the frame handling accordingly.

A new member of the icom_priv_caps is defined to flag that this check should be done. A new icom_rig_open function performs this check & sets a flag in priv_data which frame.c then uses to process the input accordingly.
pull/83/head
Malcolm Herring 2019-01-09 09:33:04 +00:00
rodzic 0316376b45
commit be436051d8
3 zmienionych plików z 61 dodań i 22 usunięć

Wyświetl plik

@ -127,7 +127,7 @@ int icom_one_transaction (RIG *rig, int cmd, int subcmd, const unsigned char *pa
return retval;
}
if (priv_caps->serial_full_duplex == 0) {
if (!priv_caps->serial_full_duplex && !priv->serial_USB_echo_off) {
/*
* read what we just sent, because TX and RX are looped,

Wyświetl plik

@ -450,6 +450,42 @@ int icom_cleanup(RIG *rig)
}
/*
* ICOM rig open routine
* Detect echo state of USB serial port
*/
int icom_rig_open(RIG *rig)
{
unsigned char ackbuf[MAXFRAMELEN];
int ack_len=sizeof(ackbuf);
int retval = RIG_OK;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
struct rig_state *rs = &rig->state;
struct icom_priv_data *priv = (struct icom_priv_data*)rs->priv;
struct icom_priv_caps *priv_caps = (struct icom_priv_caps *) rig->caps->priv;
if (priv_caps->serial_USB_echo_check) {
priv->serial_USB_echo_off = 0;
retval = icom_transaction (rig, C_RD_TRXID, 0x00, NULL, 0, ackbuf, &ack_len);
if (retval == RIG_OK) {
rig_debug(RIG_DEBUG_VERBOSE, "USB echo on detected\n");
return RIG_OK;
}
priv->serial_USB_echo_off = 1;
retval = icom_transaction (rig, C_RD_TRXID, 0x00, NULL, 0, ackbuf, &ack_len);
if (retval == RIG_OK) {
rig_debug(RIG_DEBUG_VERBOSE, "USB echo off detected\n");
return RIG_OK;
}
}
priv->serial_USB_echo_off = 0;
return retval;
}
/*
* icom_set_freq
* Assumes rig!=NULL, rig->state.priv!=NULL

Wyświetl plik

@ -113,6 +113,7 @@ struct icom_priv_caps {
int serial_full_duplex; /*!< Whether RXD&TXD are not tied together */
unsigned char civ_version; // default to 0, 1=IC7200,IC7300,etc differences
int offs_len; /* Number of bytes in offset frequency field. 0 defaults to 3 */
int serial_USB_echo_check; /* Flag to test USB echo state */
};
@ -124,6 +125,7 @@ struct icom_priv_data {
int split_on; /* record split state */
pltstate_t *pltstate; /* only on optoscan */
unsigned char civ_version; /* 0=default, 1=new commands for IC7200,IC7300, etc */
int serial_USB_echo_off; /* USB is not set to echo */
};
extern const struct ts_sc_list r8500_ts_sc_list[];
@ -149,6 +151,7 @@ extern const pbwidth_t rtty_fil[]; /* rtty filter passband width; available on 7
pbwidth_t icom_get_dsp_flt(RIG *rig, rmode_t mode);
int icom_init(RIG *rig);
int icom_rig_open(RIG *rig);
int icom_cleanup(RIG *rig);
int icom_set_freq(RIG *rig, vfo_t vfo, freq_t freq);
int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq);