pull/1650/head
Mike Black W9MDB 2024-11-22 17:17:13 -06:00
commit 4811ebe3bc
8 zmienionych plików z 142 dodań i 42 usunięć

Wyświetl plik

@ -853,7 +853,7 @@ static int flrig_open(RIG *rig)
char model_name[256];
snprintf(model_name,sizeof(model_name), "%.248s(%s)", value, "FLRig");
rig->caps->model_name = strdup(model_name);
rig->state.model_name = strdup(model_name);
STATE(rig)->model_name = strdup(model_name);
/* see if get_pwrmeter_scale is available */
retval = flrig_transaction(rig, "rig.get_pwrmeter_scale", NULL, value,

Wyświetl plik

@ -1675,7 +1675,7 @@ int kenwood_set_split(RIG *rig, vfo_t vfo, split_t split, vfo_t txvfo)
}
/* IF TB
/* IF
* Gets split VFO status from kenwood_get_if()
*
*/
@ -1694,30 +1694,6 @@ int kenwood_get_split_vfo_if(RIG *rig, vfo_t rxvfo, split_t *split,
RETURNFUNC(-RIG_EINVAL);
}
if (RIG_IS_TS990S || RIG_IS_TS890S)
{
char buf[4];
if (RIG_OK == (retval = kenwood_safe_transaction(rig, "TB", buf, sizeof(buf),
3)))
{
if ('1' == buf[2])
{
*split = RIG_SPLIT_ON;
*txvfo = RIG_VFO_SUB;
priv->tx_vfo = rs->tx_vfo = *txvfo;
}
else
{
*split = RIG_SPLIT_OFF;
*txvfo = RIG_VFO_MAIN;
priv->tx_vfo = rs->tx_vfo = *txvfo;
}
}
RETURNFUNC(retval);
}
retval = kenwood_get_if(rig);
if (retval != RIG_OK)
@ -1885,7 +1861,6 @@ int kenwood_get_vfo_if(RIG *rig, vfo_t *vfo)
RETURNFUNC(RIG_OK);
}
/*
* kenwood_set_freq
*/
@ -2156,6 +2131,29 @@ int kenwood_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit)
RETURNFUNC(RIG_OK);
}
/* RF
* kenwood_get_rit_new (also usable as kenwood_get_xit_new)
* Gets the RIT or XIT value using dedicated command
* and without using IF.
*/
int kenwood_get_rit_new(RIG *rig, vfo_t vfo, shortfreq_t *rit)
{
int retval, tempf;
char rfbuf[10];
ENTERFUNC;
if (!rit) { RETURNFUNC(-RIG_EINVAL); }
retval = kenwood_safe_transaction(rig, "RF", rfbuf, sizeof rfbuf, 7);
if (retval != RIG_OK) {RETURNFUNC(retval); }
tempf = atoi(rfbuf + 3);
if (rfbuf[2] == '1')
{
tempf = -tempf;
}
*rit = tempf;
RETURNFUNC(RIG_OK);
}
/*
* rit can only move up/down by 10 Hz, so we use a loop...
*/
@ -2252,6 +2250,30 @@ int kenwood_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit)
RETURNFUNC2(retval);
}
/* RU/RD
* Set the RIT/XIT frequency offset
* using dedicated commands (not IF)
*/
int kenwood_set_rit_new(RIG *rig, vfo_t vfo, shortfreq_t rit)
{
int retval, diff;
shortfreq_t oldrit;
char rdbuf[10];
ENTERFUNC;
if (abs(rit) > 9999) { RETURNFUNC(-RIG_EINVAL); }
retval = kenwood_get_rit_new(rig, vfo, &oldrit);
if (retval != RIG_OK) { RETURNFUNC(retval); }
if (rit == oldrit) // if the new value is the same
{
RETURNFUNC(RIG_OK); // Nothing to do
}
diff = rit - oldrit;
SNPRINTF(rdbuf, sizeof rdbuf, "R%c%05d;", diff < 0 ? 'D' : 'U', abs(diff));
retval = kenwood_transaction(rig, rdbuf, NULL, 0);
RETURNFUNC(retval);
}
/*
* rit and xit are the same
*/

Wyświetl plik

@ -223,9 +223,11 @@ int kenwood_set_freq(RIG *rig, vfo_t vfo, freq_t freq);
int kenwood_get_freq(RIG *rig, vfo_t vfo, freq_t *freq);
int kenwood_get_freq_if(RIG *rig, vfo_t vfo, freq_t *freq);
int kenwood_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit);
int kenwood_set_rit_new(RIG *rig, vfo_t vfo, shortfreq_t rit); // Also use this for xit
int kenwood_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit);
int kenwood_set_xit(RIG *rig, vfo_t vfo, shortfreq_t rit);
int kenwood_get_xit(RIG *rig, vfo_t vfo, shortfreq_t *rit);
int kenwood_get_rit_new(RIG *rig, vfo_t vfo, shortfreq_t *rit); // Also use this for xit
int kenwood_set_xit(RIG *rig, vfo_t vfo, shortfreq_t xit);
int kenwood_get_xit(RIG *rig, vfo_t vfo, shortfreq_t *xit);
int kenwood_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width);
int kenwood_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width);
int kenwood_get_mode_if(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width);

Wyświetl plik

@ -466,6 +466,50 @@ static int ts890_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
return RIG_OK;
}
/*
* Gets split VFO status
*
*/
static int ts890s_get_split_vfo(RIG *rig, vfo_t rxvfo, split_t *split,
vfo_t *txvfo)
{
char buf[4];
int retval;
vfo_t tvfo;
struct rig_state *rs = STATE(rig);
struct kenwood_priv_data *priv = rs->priv;
if (RIG_OK == (retval = kenwood_safe_transaction(rig, "FT", buf, sizeof(buf),
3)))
{
if ('0' == buf[2])
{
tvfo = RIG_VFO_A;
}
else if ('1' == buf[2])
{
tvfo = RIG_VFO_B;
}
else if ('3' == buf[2])
{
tvfo = RIG_VFO_MEM;
}
else
{
rig_debug(RIG_DEBUG_ERR, "%s: Unknown VFO - %s\n", __func__, buf);
return -RIG_EPROTO;
}
*txvfo = priv->tx_vfo = rs->tx_vfo = tvfo;
// Now get split status
retval = kenwood_safe_transaction(rig, "TB", buf, sizeof buf, 3);
if (RIG_OK != retval) {return retval;}
*split = priv->split = buf[2] == '1';
}
return retval;
}
static struct kenwood_priv_caps ts890s_priv_caps =
{
@ -617,16 +661,16 @@ struct rig_caps ts890s_caps =
.rig_cleanup = kenwood_cleanup,
.set_freq = kenwood_set_freq,
.get_freq = kenwood_get_freq,
.set_rit = kenwood_set_rit,
.get_rit = kenwood_get_rit,
.set_xit = kenwood_set_xit,
.get_xit = kenwood_get_xit,
.set_rit = kenwood_set_rit_new,
.get_rit = kenwood_get_rit_new,
.set_xit = kenwood_set_rit_new, // Same routines as for RIT
.get_xit = kenwood_get_rit_new, // Same
.set_mode = kenwood_set_mode,
.get_mode = kenwood_get_mode,
.set_vfo = kenwood_set_vfo,
.get_vfo = kenwood_get_vfo_if,
.set_split_vfo = kenwood_set_split_vfo,
.get_split_vfo = kenwood_get_split_vfo_if,
.get_split_vfo = ts890s_get_split_vfo,
.set_ctcss_tone = kenwood_set_ctcss_tone_tn,
.get_ctcss_tone = kenwood_get_ctcss_tone,
.set_ctcss_sql = kenwood_set_ctcss_sql,

Wyświetl plik

@ -88,6 +88,7 @@
/* prototypes */
static int ts990s_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val);
static int ts990s_get_split_vfo(RIG *rig, vfo_t rxvfo, split_t *split, vfo_t *txvfo);
static rmode_t ts990s_mode_table[KENWOOD_MODE_TABLE_MAX] =
{
@ -343,16 +344,16 @@ struct rig_caps ts990s_caps =
.rig_cleanup = kenwood_cleanup,
.set_freq = kenwood_set_freq,
.get_freq = kenwood_get_freq,
.set_rit = kenwood_set_rit,
.get_rit = kenwood_get_rit,
.set_xit = kenwood_set_xit,
.get_xit = kenwood_get_xit,
.set_rit = kenwood_set_rit_new,
.get_rit = kenwood_get_rit_new,
.set_xit = kenwood_set_rit_new, // Use same routines as for rit
.get_xit = kenwood_get_rit_new, // Same
.set_mode = kenwood_set_mode,
.get_mode = kenwood_get_mode,
.set_vfo = kenwood_set_vfo_main_sub,
.get_vfo = kenwood_get_vfo_main_sub,
.set_split_vfo = kenwood_set_split_vfo,
.get_split_vfo = kenwood_get_split_vfo_if,
.get_split_vfo = ts990s_get_split_vfo,
.set_ctcss_tone = kenwood_set_ctcss_tone_tn,
.get_ctcss_tone = kenwood_get_ctcss_tone,
.set_ctcss_sql = kenwood_set_ctcss_sql,
@ -761,3 +762,34 @@ int ts990s_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
return retval;
}
/*
* Gets split VFO status
*
*/
static int ts990s_get_split_vfo(RIG *rig, vfo_t rxvfo, split_t *split,
vfo_t *txvfo)
{
char buf[4];
int retval;
struct rig_state *rs = STATE(rig);
struct kenwood_priv_data *priv = rs->priv;
if (RIG_OK == (retval = kenwood_safe_transaction(rig, "TB", buf, sizeof(buf),
3)))
{
if ('1' == buf[2])
{
*split = RIG_SPLIT_ON;
*txvfo = RIG_VFO_SUB;
}
else
{
*split = RIG_SPLIT_OFF;
*txvfo = RIG_VFO_MAIN;
}
priv->tx_vfo = rs->tx_vfo = *txvfo;
}
return retval;
}

Wyświetl plik

@ -945,7 +945,7 @@ static int ft1000mp_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
RETURNFUNC(retval);
}
priv = (struct ft1000mp_priv_data *)rig->state.priv;
priv = (struct ft1000mp_priv_data *)STATE(rig)->priv;
if (vfo == RIG_VFO_B)
{

Wyświetl plik

@ -1711,7 +1711,7 @@ static int ft817_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
// check if we're already in the mode and return if so
// the memory check was failing when in FM mode -- still showing digmode
if (rig->state.current_mode == mode)
if (STATE(rig)->current_mode == mode)
{
if (digmode[0] == 0x00 && mode == RIG_MODE_RTTY) { return RIG_OK; }
else if (digmode[0] == 0x01 && mode == RIG_MODE_PSKR) { return RIG_OK; }

Wyświetl plik

@ -7979,7 +7979,7 @@ int HAMLIB_API rig_get_rig_info(RIG *rig, char *response, int max_response_len)
"VFO=%s Freq=%.0f Mode=%s Width=%d RX=%d TX=%d\nVFO=%s Freq=%.0f Mode=%s Width=%d RX=%d TX=%d\nSplit=%d SatMode=%d\nRig=%s\nApp=%s\nVersion=20241103 1.1.0\nModel=%u\n",
rig_strvfo(vfoA), freqA, modeAstr, (int)widthA, rxa, txa, rig_strvfo(vfoB),
freqB, modeBstr, (int)widthB, rxb, txb, split, satmode, rig->caps->model_name,
rig->state.client_version, rig->caps->rig_model);
STATE(rig)->client_version, rig->caps->rig_model);
unsigned long crc = CRC32_function((unsigned char *)response, strlen(response));
char tmpstr[32];
SNPRINTF(tmpstr, sizeof(tmpstr), "CRC=0x%08lx\n", crc);