Merge pull request #361 from g0gjv/master

Correct RIT for older Yaesu and Icom rigs
pull/369/head
Michael Black 2020-09-01 09:04:13 -05:00 zatwierdzone przez GitHub
commit 3ef3a73b79
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
14 zmienionych plików z 92 dodań i 57 usunięć

Wyświetl plik

@ -41,3 +41,18 @@ icr8600 3 2
icr9000 2 2
icr9500 3 2
2020-09, G0GJV Attempting to support RIT. I asked ICOM technical support
"I am doing some work on the Hamlib amateur radio control library, and in
particular looking at control of RIT via CI-V on the Icom IC-9100 Is my
reading of the manual correct - on this (and most older Icom rigs) -
there is no RIT/XIT control available?"
and received the answer
"Hi Mike,
Yes that's right
Thanks
Virgil"
So I've removed the erroneous icom_set_rit function.

Wyświetl plik

@ -360,8 +360,6 @@ const struct rig_caps ic7100_caps =
.set_ptt = icom_set_ptt,
.get_ptt = icom_get_ptt,
.set_rit = icom_set_rit,
.set_rptr_shift = icom_set_rptr_shift,
.get_rptr_shift = icom_get_rptr_shift,
.set_rptr_offs = icom_set_rptr_offs,

Wyświetl plik

@ -239,8 +239,6 @@ const struct rig_caps ic7410_caps =
.set_ant = icom_set_ant,
.get_ant = icom_get_ant,
.set_rit = icom_set_rit,
.decode_event = icom_decode_event,
.set_level = ic7410_set_level,
.get_level = ic7410_get_level,

Wyświetl plik

@ -252,8 +252,6 @@ const struct rig_caps ic9100_caps =
.set_ptt = icom_set_ptt,
.get_ptt = icom_get_ptt,
.set_rit = icom_set_rit,
.set_rptr_shift = icom_set_rptr_shift,
.get_rptr_shift = icom_get_rptr_shift,
.set_rptr_offs = icom_set_rptr_offs,

Wyświetl plik

@ -1256,37 +1256,6 @@ int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
return RIG_OK;
}
int icom_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit)
{
unsigned char freqbuf[MAXFRAMELEN], ackbuf[MAXFRAMELEN];
int freq_len, ack_len = sizeof(ackbuf), retval;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
freq_len = 2;
/*
* to_bcd requires nibble len
*/
to_bcd(freqbuf, rit, freq_len * 2);
retval = icom_transaction(rig, C_SET_OFFS, -1, freqbuf, freq_len,
ackbuf, &ack_len);
if (retval != RIG_OK)
{
return retval;
}
if (ack_len != 1 || ackbuf[0] != ACK)
{
rig_debug(RIG_DEBUG_ERR, "%s: ack NG (%#.2x), len=%d\n", __func__,
ackbuf[0], ack_len);
return -RIG_ERJCTED;
}
return RIG_OK;
}
int icom_get_rit_new(RIG *rig, vfo_t vfo, shortfreq_t *ts)
{
unsigned char tsbuf[MAXFRAMELEN];

Wyświetl plik

@ -222,7 +222,6 @@ int icom_rig_close(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);
int icom_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit);
int icom_get_rit_new(RIG *rig, vfo_t vfo, shortfreq_t *ts);
int icom_set_rit_new(RIG *rig, vfo_t vfo, shortfreq_t ts);
int icom_set_xit_new(RIG *rig, vfo_t vfo, shortfreq_t ts);

Wyświetl plik

@ -271,8 +271,6 @@ const struct rig_caps x108g_caps =
.set_ant = NULL, /*automatically set by rig depending band */
.get_ant = NULL,
.set_rit = icom_set_rit,
.decode_event = icom_decode_event,
.set_level = icom_set_level,
.get_level = icom_get_level,

Wyświetl plik

@ -73,6 +73,7 @@
#define FT2000_FUNCS (RIG_FUNC_TONE|RIG_FUNC_TSQL|RIG_FUNC_LOCK|\
RIG_FUNC_MON|RIG_FUNC_NB|RIG_FUNC_NR|RIG_FUNC_VOX|\
RIG_FUNC_FBKIN|RIG_FUNC_COMP|RIG_FUNC_ANF|RIG_FUNC_MN|\
RIG_FUNC_RIT|RIG_FUNC_XIT|\
RIG_FUNC_TUNER)
/* TBC */

Wyświetl plik

@ -67,7 +67,9 @@
#define FT450_FUNCS (RIG_FU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|RIG_FUNC_COMP|RIG_FUNC_ANF|RIG_FUNC_MN|\
RIG_FUNC_RIT|RIG_FUNC_XIT|\
RIG_FUNC_TUNER)
#define FT950_VFO_OPS (RIG_OP_TUNE|RIG_OP_CPY|RIG_OP_XCHG|\

Wyświetl plik

@ -65,6 +65,7 @@
#define FT991_FUNCS (RIG_FUNC_TONE|RIG_FUNC_TSQL|RIG_FUNC_LOCK|\
RIG_FUNC_MON|RIG_FUNC_NB|RIG_FUNC_NR|RIG_FUNC_VOX|\
RIG_FUNC_FBKIN|RIG_FUNC_COMP|RIG_FUNC_ANF|RIG_FUNC_MN|\
RIG_FUNC_RIT|RIG_FUNC_XIT|\
RIG_FUNC_TUNER)
#define FT991_VFO_OPS (RIG_OP_TUNE|RIG_OP_CPY|RIG_OP_XCHG|\

Wyświetl plik

@ -97,8 +97,9 @@ typedef struct _yaesu_newcat_commands
const cal_table_float_t yaesu_default_swr_cal =
{
4,
{ // first cut at generic Yaesu table, need more points probably
// based on testing by Adam M7OTP on FT-991
{
// first cut at generic Yaesu table, need more points probably
// based on testing by Adam M7OTP on FT-991
{12, 1.0f},
{39, 1.35f},
{89, 2.0f},
@ -252,7 +253,7 @@ static const yaesu_newcat_commands_t valid_commands[] =
{"VT", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE },
{"VV", TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE },
{"VX", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE },
{"XT", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE },
{"XT", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE },
{"ZI", FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE },
};
int valid_commands_count = sizeof(valid_commands) / sizeof(
@ -1158,9 +1159,9 @@ int newcat_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
*ptt = RIG_PTT_OFF;
break;
case '1' : /* Just because,    what the CAT Manual Shows */
case '2' : /* FT-950 Radio:    Mic, Dataport, CW "TX ON" */
case '3' : /* FT-950 CAT port: Radio in "TX ON" mode     [Not what the CAT Manual Shows] */
case '1' : /* Just because, what the CAT Manual Shows */
case '2' : /* FT-950 Radio: Mic, Dataport, CW "TX ON" */
case '3' : /* FT-950 CAT port: Radio in "TX ON" mode [Not what the CAT Manual Shows] */
*ptt = RIG_PTT_ON;
break;
@ -1575,9 +1576,9 @@ int newcat_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit)
rit = - rig->caps->max_rit; /* - */
}
if (rit == 0)
if (rit == 0) // don't turn it off just because it is zero
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RC%cRT0%c", cat_term,
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RC%c",
cat_term);
}
else if (rit < 0)
@ -1599,7 +1600,7 @@ int newcat_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
char *retval;
char rit_on;
//char rit_on;
int err;
int offset = 0;
@ -1643,11 +1644,12 @@ int newcat_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit)
}
retval = priv->ret_data + offset;
rit_on = retval[5];
//rit_on = retval[5];
retval[5] = '\0';
if (rit_on == '1')
//if (rit_on == '1')
{
// return the current offset even if turned off
*rit = (shortfreq_t) atoi(retval);
}
@ -1675,7 +1677,8 @@ int newcat_set_xit(RIG *rig, vfo_t vfo, shortfreq_t xit)
if (xit == 0)
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RC%cXT0%c", cat_term,
// don't turn it off just because the offset is zero
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RC%c",
cat_term);
}
else if (xit < 0)
@ -1697,7 +1700,7 @@ int newcat_get_xit(RIG *rig, vfo_t vfo, shortfreq_t *xit)
{
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
char *retval;
char xit_on;
//char xit_on;
int err;
int offset = 0;
@ -1741,11 +1744,12 @@ int newcat_get_xit(RIG *rig, vfo_t vfo, shortfreq_t *xit)
}
retval = priv->ret_data + offset;
xit_on = retval[6];
//xit_on = retval[6];
retval[5] = '\0';
if (xit_on == '1')
//if (xit_on == '1')
{
// return the offset even when turned off
*xit = (shortfreq_t) atoi(retval);
}
@ -3371,7 +3375,9 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
{
val->f = rig_raw2val_float(atoi(retlvl), &rig->caps->swr_cal);
}
break;
case RIG_LEVEL_AF:
case RIG_LEVEL_MICGAIN:
case RIG_LEVEL_RF:
@ -3687,6 +3693,26 @@ int newcat_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
cat_term);
break;
case RIG_FUNC_RIT:
if (!newcat_valid_command(rig, "RT"))
{
return -RIG_ENAVAIL;
}
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RT%d%c", status ? 1 : 0,
cat_term);
break;
case RIG_FUNC_XIT:
if (!newcat_valid_command(rig, "XT"))
{
return -RIG_ENAVAIL;
}
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "XT%d9%c", status ? 1 : 0,
cat_term);
break;
default:
return -RIG_EINVAL;
}
@ -3831,6 +3857,24 @@ int newcat_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "AC%c", cat_term);
break;
case RIG_FUNC_RIT:
if (!newcat_valid_command(rig, "RT"))
{
return -RIG_ENAVAIL;
}
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RT%c", cat_term);
break;
case RIG_FUNC_XIT:
if (!newcat_valid_command(rig, "XT"))
{
return -RIG_ENAVAIL;
}
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "XT%c", cat_term);
break;
default:
return -RIG_EINVAL;
}
@ -3876,6 +3920,14 @@ int newcat_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
*status = (retfunc[2] == '1') ? 1 : 0;
break;
case RIG_FUNC_RIT:
*status = (retfunc[0] == '1') ? 1 : 0;
break;
case RIG_FUNC_XIT:
*status = (retfunc[0] == '1') ? 1 : 0;
break;
default:
return -RIG_EINVAL;
}