pull/345/head
c vw 2020-06-29 15:46:40 +02:00
commit f91deb5b99
6 zmienionych plików z 184 dodań i 78 usunięć

Wyświetl plik

@ -164,7 +164,7 @@ const struct rig_caps ft817_caps =
RIG_MODEL(RIG_MODEL_FT817),
.model_name = "FT-817",
.mfg_name = "Yaesu",
.version = "20200625.0",
.version = "20200629.0",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER,
@ -392,6 +392,7 @@ static int ft817_read_eeprom(RIG *rig, unsigned short addr, unsigned char *out)
unsigned char data[YAESU_CMD_LENGTH];
int n;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
memcpy(data, (char *)p->pcs[FT817_NATIVE_CAT_EEPROM_READ].nseq,
YAESU_CMD_LENGTH);
@ -424,6 +425,8 @@ static int ft817_get_status(RIG *rig, int status)
int n;
int retries = rig->state.rigport.retry;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
switch (status)
{
case FT817_NATIVE_CAT_GET_FREQ_MODE_STATUS:
@ -493,9 +496,12 @@ int ft817_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
int retries = rig->state.rigport.retry +
1; // +1 because, because 2 steps are needed even in best scenario
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
while ((f1 == 0 || f1 != f2) && retries-- > 0)
{
rig_debug(RIG_DEBUG_TRACE, "%s: retries=%d\n", __func__, retries);
if ((n = ft817_get_status(rig, FT817_NATIVE_CAT_GET_FREQ_MODE_STATUS)) < 0)
{
return n;
@ -522,6 +528,8 @@ int ft817_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
{
struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if (check_cache_timeout(&p->fm_status_tv))
{
int n;
@ -603,6 +611,8 @@ int ft817_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo)
struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv;
int n;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if (check_cache_timeout(&p->tx_status_tv))
if ((n = ft817_get_status(rig, FT817_NATIVE_CAT_GET_TX_STATUS)) < 0)
{
@ -633,6 +643,8 @@ int ft817_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
{
struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if (check_cache_timeout(&p->tx_status_tv))
{
int n;
@ -652,6 +664,8 @@ static int ft817_get_pometer_level(RIG *rig, value_t *val)
{
struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if (check_cache_timeout(&p->tx_status_tv))
{
int n;
@ -686,6 +700,8 @@ static int ft817_get_smeter_level(RIG *rig, value_t *val)
struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv;
int n;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if (check_cache_timeout(&p->rx_status_tv))
if ((n = ft817_get_status(rig, FT817_NATIVE_CAT_GET_RX_STATUS)) < 0)
{
@ -724,6 +740,8 @@ static int ft817_get_raw_smeter_level(RIG *rig, value_t *val)
{
struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if (check_cache_timeout(&p->rx_status_tv))
{
int n;
@ -769,6 +787,8 @@ int ft817_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd)
{
struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if (check_cache_timeout(&p->rx_status_tv))
{
int n;
@ -794,27 +814,33 @@ int ft817_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd)
/* ---------------------------------------------------------------------- */
static int ft817_read_ack(RIG *rig)
int ft817_read_ack(RIG *rig)
{
#if (FT817_POST_WRITE_DELAY == 0)
char dummy;
int n;
if ((n = read_block(&rig->state.rigport, &dummy, 1)) < 0)
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if (rig->state.rigport.post_write_delay == 0)
{
rig_debug(RIG_DEBUG_ERR, "%s: error reading ack\n", __func__);
return n;
if ((n = read_block(&rig->state.rigport, &dummy, 1)) < 0)
{
rig_debug(RIG_DEBUG_ERR, "%s: error reading ack\n", __func__);
rig_debug(RIG_DEBUG_ERR, "%s: adjusting post_write_delay to avoid ack\n",
__func__);
rig->state.rigport.post_write_delay =
10; // arbitrary choice right now of max 100 cmds/sec
return RIG_OK; // let it continue without checking for ack now
}
rig_debug(RIG_DEBUG_TRACE, "%s: ack received (%d)\n", __func__, dummy);
if (dummy != 0)
{
return -RIG_ERJCTED;
}
}
rig_debug(RIG_DEBUG_TRACE, "%s: ack received (%d)\n", __func__, dummy);
if (dummy != 0)
{
return -RIG_ERJCTED;
}
#endif
return RIG_OK;
}
@ -826,6 +852,8 @@ static int ft817_send_cmd(RIG *rig, int index)
{
struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if (p->pcs[index].ncomp == 0)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: Incomplete sequence\n", __func__);
@ -844,6 +872,8 @@ static int ft817_send_icmd(RIG *rig, int index, unsigned char *data)
struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv;
unsigned char cmd[YAESU_CMD_LENGTH];
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if (p->pcs[index].ncomp == 1)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: Complete sequence\n", __func__);
@ -995,6 +1025,8 @@ int ft817_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
int ft817_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
switch (func)
{
case RIG_FUNC_LOCK:
@ -1202,6 +1234,8 @@ int ft817_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit)
int ft817_set_powerstat(RIG *rig, powerstat_t status)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
switch (status)
{
case RIG_POWER_OFF:
@ -1218,6 +1252,8 @@ int ft817_set_powerstat(RIG *rig, powerstat_t status)
int ft817_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
switch (op)
{
int n;
@ -1284,6 +1320,7 @@ int ft817_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
int ft817_power2mW(RIG *rig, unsigned int *mwpower, float power,
freq_t freq, rmode_t mode)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
*mwpower = (int)(power * 6000);
return RIG_OK;
}
@ -1293,6 +1330,7 @@ int ft817_power2mW(RIG *rig, unsigned int *mwpower, float power,
int ft817_mW2power(RIG *rig, float *power, unsigned int mwpower,
freq_t freq, rmode_t mode)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
*power = mwpower / 6000.0;
return RIG_OK;
}

Wyświetl plik

@ -146,6 +146,7 @@ enum ft857_digi
#define FT857_VFO_ALL (RIG_VFO_A|RIG_VFO_B)
#define FT857_ANTS 0
extern int ft817_read_ack(RIG *rig);
static int ft857_send_icmd(RIG *rig, int index, unsigned char *data);
const struct rig_caps ft857_caps =
@ -153,7 +154,7 @@ const struct rig_caps ft857_caps =
RIG_MODEL(RIG_MODEL_FT857),
.model_name = "FT-857",
.mfg_name = "Yaesu",
.version = "20200323.0",
.version = "20200628.0",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER,
@ -382,6 +383,7 @@ static int ft857_read_eeprom(RIG *rig, unsigned short addr, unsigned char *out)
unsigned char data[YAESU_CMD_LENGTH];
int n;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
memcpy(data, (char *)p->pcs[FT857_NATIVE_CAT_EEPROM_READ].nseq,
YAESU_CMD_LENGTH);
@ -413,6 +415,8 @@ static int ft857_get_status(RIG *rig, int status)
int len;
int n;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
switch (status)
{
case FT857_NATIVE_CAT_GET_FREQ_MODE_STATUS:
@ -468,32 +472,6 @@ static int ft857_get_status(RIG *rig, int status)
return RIG_OK;
}
/* ---------------------------------------------------------------------- */
static int ft857_read_ack(RIG *rig)
{
#if (FT857_POST_WRITE_DELAY == 0)
char dummy;
int n;
if ((n = read_block(&rig->state.rigport, &dummy, 1)) < 0)
{
rig_debug(RIG_DEBUG_ERR, "%s: error reading ack\n", __func__);
return n;
}
rig_debug(RIG_DEBUG_TRACE, "%s: ack received (%d)\n", __func__, dummy);
if (dummy != 0)
{
return -RIG_ERJCTED;
}
#endif
return RIG_OK;
}
/*
* private helper function to send a private command sequence.
* Must only be complete sequences.
@ -502,6 +480,8 @@ static int ft857_send_cmd(RIG *rig, int index)
{
struct ft857_priv_data *p = (struct ft857_priv_data *) rig->state.priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
if (p->pcs[index].ncomp == 0)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: incomplete sequence\n", __func__);
@ -509,7 +489,7 @@ static int ft857_send_cmd(RIG *rig, int index)
}
write_block(&rig->state.rigport, (char *) p->pcs[index].nseq, YAESU_CMD_LENGTH);
return ft857_read_ack(rig);
return ft817_read_ack(rig);
}
/*
@ -520,6 +500,8 @@ static int ft857_send_icmd(RIG *rig, int index, unsigned char *data)
struct ft857_priv_data *p = (struct ft857_priv_data *) rig->state.priv;
unsigned char cmd[YAESU_CMD_LENGTH];
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
if (p->pcs[index].ncomp == 1)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: complete sequence\n", __func__);
@ -530,7 +512,7 @@ static int ft857_send_icmd(RIG *rig, int index, unsigned char *data)
memcpy(cmd, data, YAESU_CMD_LENGTH - 1);
write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH);
return ft857_read_ack(rig);
return ft817_read_ack(rig);
}
/* ---------------------------------------------------------------------- */
@ -540,6 +522,8 @@ int ft857_get_vfo(RIG *rig, vfo_t *vfo)
unsigned char c;
*vfo = RIG_VFO_B;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
if (ft857_read_eeprom(rig, 0x0068, &c) < 0) /* get vfo status */
{
return -RIG_EPROTO;
@ -555,6 +539,8 @@ int ft857_set_vfo(RIG *rig, vfo_t vfo)
vfo_t curvfo;
int retval = ft857_get_vfo(rig, &curvfo);
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
if (retval != RIG_OK)
{
rig_debug(RIG_DEBUG_ERR, "%s: error get_vfo '%s'\n", __func__,
@ -574,6 +560,8 @@ int ft857_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
{
struct ft857_priv_data *p = (struct ft857_priv_data *) rig->state.priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
if (vfo != RIG_VFO_CURR)
{
return -RIG_ENTARGET;
@ -597,6 +585,8 @@ int ft857_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
static void get_mode(RIG *rig, struct ft857_priv_data *priv, rmode_t *mode,
pbwidth_t *width)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
switch (priv->fm_status[4] & 0x7f)
{
case 0x00:
@ -667,6 +657,8 @@ int ft857_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
{
struct ft857_priv_data *p = (struct ft857_priv_data *) rig->state.priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
if (vfo != RIG_VFO_CURR)
{
return -RIG_ENTARGET;
@ -692,6 +684,8 @@ int ft857_get_split_freq_mode(RIG *rig, vfo_t vfo, freq_t *freq, rmode_t *mode,
{
int retcode;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
if (vfo != RIG_VFO_CURR && vfo != RIG_VFO_TX)
{
return -RIG_ENTARGET;
@ -721,6 +715,8 @@ int ft857_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo)
struct ft857_priv_data *p = (struct ft857_priv_data *) rig->state.priv;
int n;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
if (vfo != RIG_VFO_CURR)
{
return -RIG_ENTARGET;
@ -756,6 +752,8 @@ int ft857_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
{
struct ft857_priv_data *p = (struct ft857_priv_data *) rig->state.priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
if (vfo != RIG_VFO_CURR)
{
return -RIG_ENTARGET;
@ -779,6 +777,7 @@ int ft857_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
static int ft857_get_pometer_level(RIG *rig, value_t *val)
{
struct ft857_priv_data *p = (struct ft857_priv_data *) rig->state.priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
if (check_cache_timeout(&p->tx_status_tv))
{
@ -810,6 +809,8 @@ static int ft857_get_smeter_level(RIG *rig, value_t *val)
struct ft857_priv_data *p = (struct ft857_priv_data *) rig->state.priv;
int n;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
if (check_cache_timeout(&p->rx_status_tv))
if ((n = ft857_get_status(rig, FT857_NATIVE_CAT_GET_RX_STATUS)) < 0)
{
@ -826,6 +827,8 @@ static int ft857_get_smeter_level(RIG *rig, value_t *val)
int ft857_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
if (vfo != RIG_VFO_CURR)
{
return -RIG_ENTARGET;
@ -850,6 +853,8 @@ int ft857_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd)
{
struct ft857_priv_data *p = (struct ft857_priv_data *) rig->state.priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
if (vfo != RIG_VFO_CURR)
{
return -RIG_ENTARGET;
@ -882,6 +887,8 @@ int ft857_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
{
unsigned char data[YAESU_CMD_LENGTH - 1];
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
if (vfo != RIG_VFO_CURR)
{
return -RIG_ENTARGET;
@ -902,6 +909,8 @@ int ft857_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
{
int index; /* index of sequence to send */
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
if (vfo != RIG_VFO_CURR)
{
return -RIG_ENTARGET;
@ -970,6 +979,8 @@ int ft857_set_split_freq_mode(RIG *rig, vfo_t vfo, freq_t freq, rmode_t mode,
{
int retcode;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
if (vfo != RIG_VFO_CURR && vfo != RIG_VFO_TX)
{
return -RIG_ENTARGET;
@ -998,6 +1009,8 @@ int ft857_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
{
int index, n;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
if (vfo != RIG_VFO_CURR)
{
return -RIG_ENTARGET;
@ -1036,6 +1049,8 @@ int ft857_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
{
int index, n;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
if (vfo != RIG_VFO_CURR)
{
return -RIG_ENTARGET;
@ -1072,6 +1087,8 @@ int ft857_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
int ft857_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
if (vfo != RIG_VFO_CURR)
{
return -RIG_ENTARGET;
@ -1143,6 +1160,8 @@ int ft857_set_dcs_code(RIG *rig, vfo_t vfo, tone_t code)
unsigned char data[YAESU_CMD_LENGTH - 1];
int n;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
if (vfo != RIG_VFO_CURR)
{
return -RIG_ENTARGET;
@ -1172,6 +1191,8 @@ int ft857_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone)
unsigned char data[YAESU_CMD_LENGTH - 1];
int n;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
if (vfo != RIG_VFO_CURR)
{
return -RIG_ENTARGET;
@ -1201,6 +1222,8 @@ int ft857_set_dcs_sql(RIG *rig, vfo_t vfo, tone_t code)
unsigned char data[YAESU_CMD_LENGTH - 1];
int n;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
if (vfo != RIG_VFO_CURR)
{
return -RIG_ENTARGET;
@ -1230,6 +1253,8 @@ int ft857_set_ctcss_sql(RIG *rig, vfo_t vfo, tone_t tone)
unsigned char data[YAESU_CMD_LENGTH - 1];
int n;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
if (vfo != RIG_VFO_CURR)
{
return -RIG_ENTARGET;
@ -1256,6 +1281,8 @@ int ft857_set_ctcss_sql(RIG *rig, vfo_t vfo, tone_t tone)
int ft857_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t shift)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
if (vfo != RIG_VFO_CURR)
{
return -RIG_ENTARGET;
@ -1282,6 +1309,8 @@ int ft857_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t offs)
{
unsigned char data[YAESU_CMD_LENGTH - 1];
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
if (vfo != RIG_VFO_CURR)
{
return -RIG_ENTARGET;
@ -1300,6 +1329,8 @@ int ft857_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit)
unsigned char data[YAESU_CMD_LENGTH - 1];
int n;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
if (vfo != RIG_VFO_CURR)
{
return -RIG_ENTARGET;
@ -1332,6 +1363,8 @@ int ft857_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit)
int ft857_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
switch (op)
{
case RIG_OP_TOGGLE:

Wyświetl plik

@ -111,6 +111,7 @@ static int ft897_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t rptr_shift);
static int ft897_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t offs);
static int ft897_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit);
static int ft897_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd);
extern int ft817_read_ack(RIG *rig);
// static int ft897_set_powerstat(RIG *rig, powerstat_t status);
/* Native ft897 cmd set prototypes. These are READ ONLY as each */
@ -190,7 +191,7 @@ const struct rig_caps ft897_caps =
RIG_MODEL(RIG_MODEL_FT897),
.model_name = "FT-897",
.mfg_name = "Yaesu",
.version = "20200607.0",
.version = "20200628.0",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER,
@ -417,6 +418,7 @@ static int ft897_read_eeprom(RIG *rig, unsigned short addr, unsigned char *out)
unsigned char data[YAESU_CMD_LENGTH];
int n;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
memcpy(data, (char *)p->pcs[FT897_NATIVE_CAT_EEPROM_READ].nseq,
YAESU_CMD_LENGTH);
@ -448,6 +450,8 @@ static int ft897_get_status(RIG *rig, int status)
int len;
int n;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
switch (status)
{
case FT897_NATIVE_CAT_GET_FREQ_MODE_STATUS:
@ -509,6 +513,8 @@ int ft897_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
{
struct ft897_priv_data *p = (struct ft897_priv_data *) rig->state.priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if (vfo != RIG_VFO_CURR)
{
return -RIG_ENTARGET;
@ -533,6 +539,8 @@ int ft897_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
{
struct ft897_priv_data *p = (struct ft897_priv_data *) rig->state.priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if (vfo != RIG_VFO_CURR)
{
return -RIG_ENTARGET;
@ -620,6 +628,8 @@ int ft897_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
{
struct ft897_priv_data *p = (struct ft897_priv_data *) rig->state.priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if (vfo != RIG_VFO_CURR)
{
return -RIG_ENTARGET;
@ -644,6 +654,8 @@ static int ft897_get_pometer_level(RIG *rig, value_t *val)
{
struct ft897_priv_data *p = (struct ft897_priv_data *) rig->state.priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if (check_cache_timeout(&p->tx_status_tv))
{
int n;
@ -671,6 +683,8 @@ static int ft897_get_swr_level(RIG *rig, value_t *val)
{
struct ft897_priv_data *p = (struct ft897_priv_data *) rig->state.priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if (check_cache_timeout(&p->tx_status_tv))
{
int n;
@ -699,6 +713,8 @@ static int ft897_get_smeter_level(RIG *rig, value_t *val)
struct ft897_priv_data *p = (struct ft897_priv_data *) rig->state.priv;
int n;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if (check_cache_timeout(&p->rx_status_tv))
if ((n = ft897_get_status(rig, FT897_NATIVE_CAT_GET_RX_STATUS)) < 0)
{
@ -716,6 +732,8 @@ static int ft897_get_rawstr_level(RIG *rig, value_t *val)
{
struct ft897_priv_data *p = (struct ft897_priv_data *) rig->state.priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if (check_cache_timeout(&p->rx_status_tv))
{
int n;
@ -733,6 +751,8 @@ static int ft897_get_rawstr_level(RIG *rig, value_t *val)
int ft897_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if (vfo != RIG_VFO_CURR)
{
return -RIG_ENTARGET;
@ -763,6 +783,8 @@ int ft897_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd)
{
struct ft897_priv_data *p = (struct ft897_priv_data *) rig->state.priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if (vfo != RIG_VFO_CURR)
{
return -RIG_ENTARGET;
@ -791,32 +813,6 @@ int ft897_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd)
return RIG_OK;
}
/* ---------------------------------------------------------------------- */
static int ft897_read_ack(RIG *rig)
{
#if (FT897_POST_WRITE_DELAY == 0)
char dummy;
int n;
if ((n = read_block(&rig->state.rigport, &dummy, 1)) < 0)
{
rig_debug(RIG_DEBUG_ERR, "%s: error reading ack\n", __func__);
return n;
}
rig_debug(RIG_DEBUG_TRACE, "%s: ack received (%d)\n", __func__, dummy);
if (dummy != 0)
{
return -RIG_ERJCTED;
}
#endif
return RIG_OK;
}
/*
* private helper function to send a private command sequence.
* Must only be complete sequences.
@ -825,6 +821,8 @@ static int ft897_send_cmd(RIG *rig, int index)
{
struct ft897_priv_data *p = (struct ft897_priv_data *) rig->state.priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if (p->pcs[index].ncomp == 0)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: incomplete sequence\n", __func__);
@ -832,7 +830,7 @@ static int ft897_send_cmd(RIG *rig, int index)
}
write_block(&rig->state.rigport, (char *) p->pcs[index].nseq, YAESU_CMD_LENGTH);
return ft897_read_ack(rig);
return ft817_read_ack(rig);
}
/*
@ -843,6 +841,8 @@ static int ft897_send_icmd(RIG *rig, int index, unsigned char *data)
struct ft897_priv_data *p = (struct ft897_priv_data *) rig->state.priv;
unsigned char cmd[YAESU_CMD_LENGTH];
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if (p->pcs[index].ncomp == 1)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: Complete sequence\n", __func__);
@ -853,7 +853,7 @@ static int ft897_send_icmd(RIG *rig, int index, unsigned char *data)
memcpy(cmd, data, YAESU_CMD_LENGTH - 1);
write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH);
return ft897_read_ack(rig);
return ft817_read_ack(rig);
}
/* ---------------------------------------------------------------------- */
@ -862,6 +862,8 @@ int ft897_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
{
unsigned char data[YAESU_CMD_LENGTH - 1];
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if (vfo != RIG_VFO_CURR)
{
return -RIG_ENTARGET;
@ -884,6 +886,8 @@ int ft897_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
{
int index; /* index of sequence to send */
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if (vfo != RIG_VFO_CURR)
{
return -RIG_ENTARGET;
@ -947,6 +951,8 @@ int ft897_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
{
int index, n;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if (vfo != RIG_VFO_CURR)
{
return -RIG_ENTARGET;
@ -985,6 +991,8 @@ int ft897_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
{
int index, n;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if (vfo != RIG_VFO_CURR)
{
return -RIG_ENTARGET;
@ -1018,6 +1026,8 @@ int ft897_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
{
int index, n;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if (vfo != RIG_VFO_CURR)
{
return -RIG_ENTARGET;
@ -1057,6 +1067,8 @@ int ft897_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo)
struct ft897_priv_data *p = (struct ft897_priv_data *) rig->state.priv;
int n;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if (vfo != RIG_VFO_CURR)
{
return -RIG_ENTARGET;
@ -1090,6 +1102,8 @@ int ft897_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo)
int ft897_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if (vfo != RIG_VFO_CURR)
{
return -RIG_ENTARGET;
@ -1161,6 +1175,8 @@ int ft897_set_dcs_code(RIG *rig, vfo_t vfo, tone_t code)
unsigned char data[YAESU_CMD_LENGTH - 1];
int n;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if (vfo != RIG_VFO_CURR)
{
return -RIG_ENTARGET;
@ -1190,6 +1206,8 @@ int ft897_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone)
unsigned char data[YAESU_CMD_LENGTH - 1];
int n;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if (vfo != RIG_VFO_CURR)
{
return -RIG_ENTARGET;
@ -1219,6 +1237,8 @@ int ft897_set_dcs_sql(RIG *rig, vfo_t vfo, tone_t code)
unsigned char data[YAESU_CMD_LENGTH - 1];
int n;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if (vfo != RIG_VFO_CURR)
{
return -RIG_ENTARGET;
@ -1248,6 +1268,8 @@ int ft897_set_ctcss_sql(RIG *rig, vfo_t vfo, tone_t tone)
unsigned char data[YAESU_CMD_LENGTH - 1];
int n;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if (vfo != RIG_VFO_CURR)
{
return -RIG_ENTARGET;
@ -1274,6 +1296,8 @@ int ft897_set_ctcss_sql(RIG *rig, vfo_t vfo, tone_t tone)
int ft897_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t shift)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if (vfo != RIG_VFO_CURR)
{
return -RIG_ENTARGET;
@ -1300,6 +1324,8 @@ int ft897_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t offs)
{
unsigned char data[YAESU_CMD_LENGTH - 1];
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if (vfo != RIG_VFO_CURR)
{
return -RIG_ENTARGET;
@ -1318,6 +1344,8 @@ int ft897_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit)
unsigned char data[YAESU_CMD_LENGTH - 1];
int n;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
if (vfo != RIG_VFO_CURR)
{
return -RIG_ENTARGET;

Wyświetl plik

@ -121,7 +121,7 @@
/* Delay sequential fast writes */
#define FT991_POST_WRITE_DELAY 50
#define FT991_POST_WRITE_DELAY 25
typedef struct
{

Wyświetl plik

@ -1470,6 +1470,14 @@ int HAMLIB_API parse_hoststr(char *hoststr, char host[256], char port[6])
return RIG_OK;
}
if (sscanf(hoststr, ":%5[0-9]%s", port,
dummy) == 1) // just a port if you please
{
sprintf(hoststr, "%s:%s\n", "localhost", port);
rig_debug(RIG_DEBUG_VERBOSE, "%s: hoststr=%s\n", __func__, hoststr);
return RIG_OK;
}
// if we're here then we must have a hostname
n = sscanf(hoststr, "%255[^:]:%5[0-9]%1s", host, port, dummy);
@ -1494,8 +1502,10 @@ int HAMLIB_API rig_flush(hamlib_port_t *port)
if (port->type.rig != RIG_PORT_SERIAL)
{
rig_debug(RIG_DEBUG_WARN, "%s: Expected serial port type!!\nWhat is this rig?\n", __func__);
rig_debug(RIG_DEBUG_WARN,
"%s: Expected serial port type!!\nWhat is this rig?\n", __func__);
}
return serial_flush(port); // we must be on serial port
}

Wyświetl plik

@ -2205,8 +2205,6 @@ int HAMLIB_API rig_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
case RIG_PTT_SERIAL_RTS:
rig_debug(RIG_DEBUG_ERR, "%s: PTT RTS\n", __func__);
/* when the PTT port is not the control port we want to free the
port when PTT is reset and seize the port when PTT is set,
this allows limited sharing of the PTT port between
@ -2240,7 +2238,6 @@ int HAMLIB_API rig_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
}
}
rig_debug(RIG_DEBUG_ERR, "%s: PTT RTS debug#2\n", __func__);
retcode = ser_set_rts(&rig->state.pttport, ptt != RIG_PTT_OFF);
if (strcmp(rs->pttport.pathname, rs->rigport.pathname)