kopia lustrzana https://github.com/Hamlib/Hamlib
Add post_ptt_delay for situations where more time is needed for external relay operations
Detect Doppler frequency changes for Kenwood rigs and avoid querying frequency...just set it...to provide stable timing https://github.com/Hamlib/Hamlib/issues/1412pull/1413/head^2
rodzic
fb03d095df
commit
6cb17e49dc
|
@ -2380,6 +2380,7 @@ typedef struct hamlib_port {
|
|||
int fd_sync_error_read; /*!< file descriptor for reading synchronous data error codes */
|
||||
#endif
|
||||
short timeout_retry; /*!< number of retries to make in case of read timeout errors, some serial interfaces may require this, 0 to disable */
|
||||
int post_ptt_delay; /*!< delay after PTT to allow for relays and such */
|
||||
} hamlib_port_t;
|
||||
|
||||
|
||||
|
@ -2759,6 +2760,7 @@ struct rig_state {
|
|||
void *morse_data_handler_priv_data;
|
||||
FIFO_RIG *fifo_morse;
|
||||
int port_multicast; /*!< May be different so this is initially a copy of rigctl'd port selection */
|
||||
int doppler; /*!< True if doppler changing detected */
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -1862,7 +1862,9 @@ int kenwood_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
}
|
||||
|
||||
// Malchite is so slow we don't do the get_freq
|
||||
if (!RIG_IS_MALACHITE)
|
||||
// And when we have detected Doppler operations we just set the freq all the time
|
||||
// This should provide stable timing for set_ptt operation so relay delays are consistent
|
||||
if (!RIG_IS_MALACHITE && rig->state.doppler == 0)
|
||||
{
|
||||
rig_get_freq(rig, tvfo, &tfreq);
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "token.h"
|
||||
#include "idx_builtin.h"
|
||||
|
||||
#define BACKEND_VER "20231025"
|
||||
#define BACKEND_VER "20231031"
|
||||
|
||||
#define EOM_KEN ';'
|
||||
#define EOM_TH '\r'
|
||||
|
|
23
src/conf.c
23
src/conf.c
|
@ -61,6 +61,11 @@ static const struct confparams frontend_cfg_params[] =
|
|||
"Delay in ms between each command sent out",
|
||||
"0", RIG_CONF_NUMERIC, { .n = { 0, 1000, 1 } }
|
||||
},
|
||||
{
|
||||
TOK_POST_PTT_DELAY, "post_ptt_delay", "Post ptt delay",
|
||||
"Delay in ms after PTT is asserted",
|
||||
"0", RIG_CONF_NUMERIC, { .n = { 0, 2000, 1 } } // 2000ms should be more than enough
|
||||
},
|
||||
{
|
||||
TOK_TIMEOUT, "timeout", "Timeout", "Timeout in ms",
|
||||
"0", RIG_CONF_NUMERIC, { .n = { 0, 10000, 1 } }
|
||||
|
@ -71,7 +76,7 @@ static const struct confparams frontend_cfg_params[] =
|
|||
},
|
||||
{
|
||||
TOK_TIMEOUT_RETRY, "timeout_retry", "Number of retries for read timeouts",
|
||||
"Set the number of retries for data read timeouts that may occur especially with some serial interfaces",
|
||||
"Set the # of retries for read timeouts that may occur with some serial interfaces",
|
||||
"1", RIG_CONF_NUMERIC, { .n = { 0, 100, 1 } }
|
||||
},
|
||||
{
|
||||
|
@ -91,8 +96,8 @@ static const struct confparams frontend_cfg_params[] =
|
|||
"0", RIG_CONF_NUMERIC, { .n = { 0.0, 1000.0, .001 } }
|
||||
},
|
||||
{
|
||||
TOK_POLL_INTERVAL, "poll_interval", "Rig state poll interval in milliseconds",
|
||||
"Polling interval in milliseconds for transceive emulation, value of 0 disables polling",
|
||||
TOK_POLL_INTERVAL, "poll_interval", "Rig state poll interval in ms",
|
||||
"Polling interval in ms for transceive emulation, value of 0 disables polling",
|
||||
"0", RIG_CONF_NUMERIC, { .n = { 0, 1000000, 1 } }
|
||||
},
|
||||
{
|
||||
|
@ -102,7 +107,7 @@ static const struct confparams frontend_cfg_params[] =
|
|||
},
|
||||
{
|
||||
TOK_PTT_PATHNAME, "ptt_pathname", "PTT path name",
|
||||
"Path name to the device file of the Push-To-Talk",
|
||||
"Path to the device of the Push-To-Talk",
|
||||
"/dev/rig", RIG_CONF_STRING,
|
||||
},
|
||||
{
|
||||
|
@ -117,7 +122,7 @@ static const struct confparams frontend_cfg_params[] =
|
|||
},
|
||||
{
|
||||
TOK_DCD_PATHNAME, "dcd_pathname", "DCD path name",
|
||||
"Path name to the device file of the Data Carrier Detect (or squelch)",
|
||||
"Path to the device of the Data Carrier Detect (or squelch)",
|
||||
"/dev/rig", RIG_CONF_STRING,
|
||||
},
|
||||
{
|
||||
|
@ -172,12 +177,12 @@ static const struct confparams frontend_cfg_params[] =
|
|||
},
|
||||
{
|
||||
TOK_ASYNC, "async", "Asynchronous data transfer support",
|
||||
"True enables asynchronous data transfer for backends that support it. This allows use of transceive and spectrum data.",
|
||||
"True enables async data for rigs that support it to allow use of transceive and spectrum data",
|
||||
"0", RIG_CONF_CHECKBUTTON, { }
|
||||
},
|
||||
{
|
||||
TOK_TUNER_CONTROL_PATHNAME, "tuner_control_pathname", "Tuner script/program path name",
|
||||
"Path name to a script/program to control a tuner with 1 argument of 0/1 for Tuner Off/On",
|
||||
"Path to a program to control a tuner with 1 argument of 0/1 for Tuner Off/On",
|
||||
"hamlib_tuner_control", RIG_CONF_STRING,
|
||||
},
|
||||
{
|
||||
|
@ -770,6 +775,10 @@ static int frontend_get_conf2(RIG *rig, token_t token, char *val, int val_len)
|
|||
SNPRINTF(val, val_len, "%d", rs->rigport.post_write_delay);
|
||||
break;
|
||||
|
||||
case TOK_POST_PTT_DELAY:
|
||||
SNPRINTF(val, val_len, "%d", rs->rigport.post_ptt_delay);
|
||||
break;
|
||||
|
||||
case TOK_TIMEOUT:
|
||||
SNPRINTF(val, val_len, "%d", rs->rigport.timeout);
|
||||
break;
|
||||
|
|
21
src/rig.c
21
src/rig.c
|
@ -1887,8 +1887,24 @@ int rig_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
rig_strvfo(vfo), freq);
|
||||
#endif
|
||||
|
||||
if (vfo == RIG_VFO_A || vfo == RIG_VFO_MAIN) { freq += rig->state.offset_vfoa; }
|
||||
else if (vfo == RIG_VFO_B || vfo == RIG_VFO_SUB) { freq += rig->state.offset_vfob; }
|
||||
if (vfo == RIG_VFO_A || vfo == RIG_VFO_MAIN)
|
||||
{
|
||||
if (rig->state.cache.freqMainA != freq && ((int)freq % 10) != 0)
|
||||
{
|
||||
rig->state.doppler = 1;
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: doppler detected because old freq %f != new && new freq has 1Hz or such values\n", __func__, rig->state.cache.freqMainA);
|
||||
}
|
||||
freq += rig->state.offset_vfoa;
|
||||
}
|
||||
else if (vfo == RIG_VFO_B || vfo == RIG_VFO_SUB)
|
||||
{
|
||||
if (rig->state.cache.freqMainB != freq && ((int)freq % 10) != 0)
|
||||
{
|
||||
rig->state.doppler = 1;
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: doppler detected because old freq %f != new && new freq has 1Hz or such values\n", __func__, rig->state.cache.freqMainA);
|
||||
}
|
||||
freq += rig->state.offset_vfob;
|
||||
}
|
||||
|
||||
if (rig->state.twiddle_state == TWIDDLE_ON)
|
||||
{
|
||||
|
@ -3499,6 +3515,7 @@ int HAMLIB_API rig_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
|
|||
|
||||
memcpy(&rig->state.pttport_deprecated, &rig->state.pttport,
|
||||
sizeof(rig->state.pttport_deprecated));
|
||||
if (rig->state.rigport.post_ptt_delay > 0) hl_usleep(rig->state.rigport.post_ptt_delay*1000);
|
||||
ELAPSED2;
|
||||
|
||||
RETURNFUNC(retcode);
|
||||
|
|
|
@ -97,6 +97,7 @@
|
|||
#define TOK_TUNER_CONTROL_PATHNAME TOKEN_FRONTEND(38)
|
||||
/** \brief Number of retries permitted in case of read timeouts */
|
||||
#define TOK_TIMEOUT_RETRY TOKEN_FRONTEND(39)
|
||||
#define TOK_POST_PTT_DELAY TOKEN_FRONTEND(40)
|
||||
|
||||
/*
|
||||
* rig specific tokens
|
||||
|
|
Ładowanie…
Reference in New Issue