kopia lustrzana https://github.com/Hamlib/Hamlib
Add verification of set_ptt with get_ptt
rodzic
a1f5085f4c
commit
7eb50d0d97
17
src/rig.c
17
src/rig.c
|
@ -2485,8 +2485,15 @@ int HAMLIB_API rig_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
|
||||||
|| vfo == RIG_VFO_CURR
|
|| vfo == RIG_VFO_CURR
|
||||||
|| vfo == rig->state.current_vfo)
|
|| vfo == rig->state.current_vfo)
|
||||||
{
|
{
|
||||||
|
int retry = 3;
|
||||||
|
ptt_t tptt;
|
||||||
|
do
|
||||||
|
{
|
||||||
retcode = caps->set_ptt(rig, vfo, ptt);
|
retcode = caps->set_ptt(rig, vfo, ptt);
|
||||||
|
if (retcode != RIG_OK) RETURNFUNC(retcode);
|
||||||
|
retcode = rig_get_ptt(rig, vfo, &tptt);
|
||||||
|
if (tptt != ptt) rig_debug(RIG_DEBUG_WARN, "%s: failed, retry=%d\n", __func__, retry);
|
||||||
|
} while(tptt != ptt && retry-- > 0 && retcode == RIG_OK);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2503,7 +2510,15 @@ int HAMLIB_API rig_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
|
||||||
if (retcode == RIG_OK)
|
if (retcode == RIG_OK)
|
||||||
{
|
{
|
||||||
int rc2;
|
int rc2;
|
||||||
|
int retry = 3;
|
||||||
|
ptt_t tptt;
|
||||||
|
do
|
||||||
|
{
|
||||||
retcode = caps->set_ptt(rig, vfo, ptt);
|
retcode = caps->set_ptt(rig, vfo, ptt);
|
||||||
|
if (retcode != RIG_OK) RETURNFUNC(retcode);
|
||||||
|
retcode = rig_get_ptt(rig, vfo, &tptt);
|
||||||
|
if (tptt != ptt) rig_debug(RIG_DEBUG_WARN, "%s: failed, retry=%d\n", __func__, retry);
|
||||||
|
} while(tptt != ptt && retry-- > 0 && retcode == RIG_OK);
|
||||||
/* try and revert even if we had an error above */
|
/* try and revert even if we had an error above */
|
||||||
rc2 = caps->set_vfo(rig, curr_vfo);
|
rc2 = caps->set_vfo(rig, curr_vfo);
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue