Update TS-890S and TS-990S RIT/XIT handling

Use dedicated commands that make setting much simpler.
Replaces usage of deprecated IF command.
See issue #1380
pull/1630/head
George Baltz N3GB 2024-11-06 16:47:19 -05:00
rodzic d640511b20
commit 238344b0ce
4 zmienionych plików z 59 dodań i 11 usunięć

Wyświetl plik

@ -1885,7 +1885,6 @@ int kenwood_get_vfo_if(RIG *rig, vfo_t *vfo)
RETURNFUNC(RIG_OK);
}
/*
* kenwood_set_freq
*/
@ -2156,6 +2155,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 +2274,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

@ -617,10 +617,10 @@ 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,

Wyświetl plik

@ -343,10 +343,10 @@ 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,