pull/224/head
Michael Black 2020-03-08 10:09:57 -05:00
commit aeabef2ffe
3 zmienionych plików z 106 dodań i 30 usunięć

Wyświetl plik

@ -731,31 +731,33 @@ icom_rig_open(RIG *rig)
rig->caps->version);
retval = icom_get_usb_echo_off(rig);
if (retval >= 0) { return RIG_OK; }
// maybe we need power on?
rig_debug(RIG_DEBUG_VERBOSE, "%s trying power on\n", __func__);
retval = abs(rig_set_powerstat(rig, 1));
// this is only a fatal error if powerstat is implemented
// if not iplemented than we're at an error here
if (retval != RIG_OK && retval != RIG_ENIMPL && retval != RIG_ENAVAIL)
if (retval != RIG_OK)
{
rig_debug(RIG_DEBUG_WARN, "%s: unexpected retval here: %s\n",
__func__, rigerror(retval));
rig_debug(RIG_DEBUG_WARN, "%s: rig_set_powerstat failed: =%s\n", __func__,
rigerror(retval));
return retval;
}
// maybe we need power on?
rig_debug(RIG_DEBUG_VERBOSE, "%s trying power on\n", __func__);
retval = abs(rig_set_powerstat(rig, 1));
// Now that we're powered up let's try again
retval = icom_get_usb_echo_off(rig);
// this is only a fatal error if powerstat is implemented
// if not iplemented than we're at an error here
if (retval != RIG_OK && retval != RIG_ENIMPL && retval != RIG_ENAVAIL)
{
rig_debug(RIG_DEBUG_WARN, "%s: unexpected retval here: %s\n",
__func__, rigerror(retval));
if (retval < 0)
{
rig_debug(RIG_DEBUG_ERR, "%s: Unable to determine USB echo status\n", __func__);
return retval;
rig_debug(RIG_DEBUG_WARN, "%s: rig_set_powerstat failed: =%s\n", __func__,
rigerror(retval));
return retval;
}
// Now that we're powered up let's try again
retval = icom_get_usb_echo_off(rig);
if (retval < 0)
{
rig_debug(RIG_DEBUG_ERR, "%s: Unable to determine USB echo status\n", __func__);
return retval;
}
}
retval = rig_get_func(rig, RIG_VFO_CURR, RIG_FUNC_SATMODE, &satmode);
@ -774,6 +776,8 @@ icom_rig_open(RIG *rig)
priv->tx_vfo = RIG_VFO_MAIN;
}
icom_get_freq_range(rig); // try get to get rig range capability dyamically
return RIG_OK;
}
@ -4303,6 +4307,7 @@ int icom_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
{
return rc;
}
if (RIG_OK != (rc = icom_set_vfo(rig, RIG_VFO_A)))
{
return rc;
@ -6521,10 +6526,71 @@ int icom_send_voice_mem(RIG *rig, vfo_t vfo, int ch)
/*
* icom_get_freq_range
* Assumes rig!=NULL, rig->state.priv!=NULL
* Always returns RIG_OK
*/
int icom_get_freq_range(RIG *rig, vfo_t vfo, int ch)
int icom_get_freq_range(RIG *rig)
{
// Automatically fill in the freq range for this rig if available
int nrange = 0;
int ack_len;
int i;
int cmd, subcmd;
int retval;
unsigned char lenbuf[1];
unsigned char cmdbuf[MAXFRAMELEN];
unsigned char ackbuf[MAXFRAMELEN];
struct icom_priv_data *priv = (struct icom_priv_data *) rig->state.priv;
int freq_len = priv->civ_731_mode ? 4 : 5;
cmd = C_CTL_EDGE;
subcmd = 0;
retval = icom_transaction(rig, cmd, subcmd, lenbuf, sizeof(lenbuf), ackbuf,
&ack_len);
if (retval != RIG_OK)
{
rig_debug(RIG_DEBUG_TRACE,
"%s: rig does not have 0x1e command so skipping this check\n", __func__);
return RIG_OK;
}
nrange = from_bcd(lenbuf, 2);
rig_debug(RIG_DEBUG_TRACE, "%s: nrange=%d\n", __func__, nrange);
for (i = 0; i < nrange; ++i)
{
cmd = C_CTL_EDGE;
subcmd = 1;
retval = icom_transaction(rig, cmd, subcmd, cmdbuf, sizeof(cmdbuf), ackbuf,
&ack_len);
if (retval == RIG_OK)
{
freq_t freqlo, freqhi;
rig_debug(RIG_DEBUG_TRACE, "%s: cmdbuf= %02x %02x %02x %02x...\n", __func__,
cmdbuf[0], cmdbuf[1], cmdbuf[2], cmdbuf[3]);
freqlo = from_bcd(&cmdbuf[2], freq_len * 2);
freqhi = from_bcd(&cmdbuf[2 + freq_len], freq_len * 2);
rig_debug(RIG_DEBUG_TRACE, "%s: rig chan %d, low=%.0f, high=%.0f\n", __func__,
i, freqlo, freqhi);
}
else
{
rig_debug(RIG_DEBUG_ERR, "%s: error from C_CTL_EDGE? err=%s\n", __func__,
rigerror(retval));
}
}
#if 0
// To be implemented
// Automatically fill in the freq range for this rig if available
rig_debug(RIG_DEBUG_TRACE, "%s: \n", __func__);
for (i = 0; i < FRQRANGESIZ && !RIG_IS_FRNG_END(caps->rx_range_list1[i]); i++)
{
}
#endif
return RIG_OK;
}
// Sets rig vfo && priv->curr_vfo to default VFOA, or current vfo, or the vfo requested

Wyświetl plik

@ -309,6 +309,7 @@ int icom_set_custom_parm_time(RIG *rig, int parmbuflen, unsigned char *parmbuf,
int seconds);
int icom_get_custom_parm_time(RIG *rig, int parmbuflen, unsigned char *parmbuf,
int *seconds);
int icom_get_freq_range(RIG *rig);
extern const struct confparams icom_cfg_params[];
extern const struct confparams icom_ext_levels[];

Wyświetl plik

@ -76,22 +76,23 @@
#define C_MEM2VFO 0x0a /* Memory to VFO */
#define C_CLR_MEM 0x0b /* Memory clear */
#define C_RD_OFFS 0x0c /* Read duplex offset frequency; default changes with HF/6M/2M */
#define C_SET_OFFS 0x0d /* Set duplex offset frequency */
#define C_CTL_SCAN 0x0e /* Control scan, Sc */
#define C_CTL_SPLT 0x0f /* Control split, and duplex mode Sc */
#define C_SET_TS 0x10 /* Set tuning step, Sc */
#define C_SET_OFFS 0x0d /* Set duplex offset frequency */
#define C_CTL_SCAN 0x0e /* Control scan, Sc */
#define C_CTL_SPLT 0x0f /* Control split, and duplex mode Sc */
#define C_SET_TS 0x10 /* Set tuning step, Sc */
#define C_CTL_ATT 0x11 /* Set/get attenuator, Sc */
#define C_CTL_ANT 0x12 /* Set/get antenna, Sc */
#define C_CTL_ANN 0x13 /* Control announce (speech synth.), Sc */
#define C_CTL_LVL 0x14 /* Set AF/RF/squelch, Sc */
#define C_RD_SQSM 0x15 /* Read squelch condition/S-meter level, Sc */
#define C_CTL_FUNC 0x16 /* Function settings (AGC,NB,etc.), Sc */
#define C_CTL_FUNC 0x16 /* Function settings (AGC,NB,etc.), Sc */
#define C_SND_CW 0x17 /* Send CW message */
#define C_SET_PWR 0x18 /* Set Power ON/OFF, Sc */
#define C_RD_TRXID 0x19 /* Read transceiver ID code */
#define C_RD_TRXID 0x19 /* Read transceiver ID code */
#define C_CTL_MEM 0x1a /* Misc memory/bank/rig control functions, Sc */
#define C_SET_TONE 0x1b /* Set tone frequency */
#define C_SET_TONE 0x1b /* Set tone frequency */
#define C_CTL_PTT 0x1c /* Control Transmit On/Off, Sc */
#define C_CTL_EDGE 0x1e /* Band edges */
#define C_CTL_DVT 0x1f /* Digital modes calsigns & messages */
#define C_CTL_DIG 0x20 /* Digital modes settings & status */
#define C_CTL_RIT 0x21 /* RIT/XIT control */
@ -360,6 +361,14 @@
#define S_PTT 0x00
#define S_ANT_TUN 0x01 /* Auto tuner 0=OFF, 1 = ON, 2=Start Tuning */
/*
* Band Edge control (C_CTL_EDGE) subcommands
*/
#define S_EDGE_RD_N 0x00 // Fixed band edge count
#define S_EDGE_RD 0x01 // Fixed band edges
#define S_EDGE_RD_NU 0x02 // User band edge count
#define S_EDGE_RD_U 0x03 // User band edges
/*
* RIT/XIT control (C_CTL_RIT) subcommands
*/