Add debug to FT817/857/897

Add fallback to non-ack protocol with 10ms post_write_delay if ack error occurs
https://github.com/Hamlib/Hamlib/issues/330
pull/345/head
Michael Black W9MDB 2020-06-29 07:50:55 -05:00
rodzic 3fbaeaf871
commit 555dba37fb
3 zmienionych plików z 115 dodań i 2 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,
@ -805,7 +805,9 @@ int ft817_read_ack(RIG *rig)
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_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);

Wyświetl plik

@ -383,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);
@ -414,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:
@ -477,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__);
@ -495,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__);
@ -515,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;
@ -530,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__,
@ -549,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;
@ -572,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:
@ -642,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;
@ -667,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;
@ -696,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;
@ -731,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;
@ -754,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))
{
@ -785,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)
{
@ -801,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;
@ -825,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;
@ -857,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;
@ -877,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;
@ -945,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;
@ -973,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;
@ -1011,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;
@ -1047,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;
@ -1118,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;
@ -1147,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;
@ -1176,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;
@ -1205,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;
@ -1231,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;
@ -1257,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;
@ -1275,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;
@ -1307,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

@ -418,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);
@ -449,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:
@ -510,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;
@ -534,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;
@ -621,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;
@ -645,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;
@ -672,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;
@ -700,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)
{
@ -717,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;
@ -734,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;
@ -764,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;
@ -800,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__);
@ -818,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__);
@ -837,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;
@ -859,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;
@ -922,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;
@ -960,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;
@ -993,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;
@ -1032,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;
@ -1065,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;
@ -1136,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;
@ -1165,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;
@ -1194,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;
@ -1223,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;
@ -1249,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;
@ -1275,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;
@ -1293,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;