Add a ptt check to ensure ptt is off for FTDX3000 and FTDX5000

Will wait up to 300ms for PTT off to occur
Should help prevent trying to set freq while ptt is on
https://github.com/Hamlib/Hamlib/issues/639
pull/649/head
Michael Black W9MDB 2021-04-02 08:19:15 -05:00
rodzic c5b0b97383
commit 04b4b83f15
2 zmienionych plików z 17 dodań i 4 usunięć

Wyświetl plik

@ -806,13 +806,26 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
if (is_ftdx3000 || is_ftdx5000)
{
// we have a few rigs that can't set freq while PTT_ON
// so we'll try a few times to see if we just need to wait a bit
// 3 retries should be about 400ms -- hopefully more than enough
ptt_t ptt;
int retry = 3;
if (RIG_OK != (err = newcat_get_ptt(rig, vfo, &ptt)))
do
{
ERRMSG(err, "newcat_set_cmd failed");
RETURNFUNC(err);
if (RIG_OK != (err = newcat_get_ptt(rig, vfo, &ptt)))
{
ERRMSG(err, "newcat_set_cmd failed");
RETURNFUNC(err);
}
if (ptt == RIG_PTT_ON)
{
rig_debug(RIG_DEBUG_WARN, "%s: ptt still on...retry#%d\n", __func__, retry);
hl_usleep(100 * 1000); // 100ms pause if ptt still on
}
}
while (err == RIG_OK && ptt == RIG_PTT_ON && retry-- > 0);
if (ptt) { return RIG_ENTARGET; }
}

Wyświetl plik

@ -50,7 +50,7 @@
typedef char ncboolean;
/* shared function version */
#define NEWCAT_VER "20210327"
#define NEWCAT_VER "20210330"
/* Hopefully large enough for future use, 128 chars plus '\0' */
#define NEWCAT_DATA_LEN 129