Merge upstream master and fix conflicts

pull/426/head
Mikael Nousiainen 2020-10-26 09:19:38 +02:00
commit 6e74284e55
11 zmienionych plików z 199 dodań i 23 usunięć

Wyświetl plik

@ -335,14 +335,21 @@ Set verbose mode, cumulative (see
below). below).
. .
.TP .TP
.BR \-X ", " \-\-twiddle = \fIseconds\fP .BR \-W ", " \-\-twiddle_timeout = \fIseconds\fP
Enables timeout when VFO twiddling is detected. Some functions will be ignored. Enables timeout when VFO twiddling is detected. Some functions will be ignored.
.IP .IP
Should only be needed when controlling software should be "paused" Should only be needed when controlling software should be "paused"
.B -v
so you can move the VFO. Continuous movement extends the timeout. so you can move the VFO. Continuous movement extends the timeout.
. .
.TP .TP
.BR \-x ", " \-\-uplink=option
1=Sub, 2=Main
.IP
For GPredict use to ignore get_freq for Sub or Main uplink VFO.
.IP
Should allow downlink VFO movement without confusing GPredict or the uplink
.
.TP
.BR \-Z ", " \-\-debug\-time\-stamps .BR \-Z ", " \-\-debug\-time\-stamps
Enable time stamps for the debug messages. Enable time stamps for the debug messages.
.IP .IP

Wyświetl plik

@ -2038,6 +2038,8 @@ struct rig_state {
freq_t lo_freq; /*!< Local oscillator frequency of any transverter */ freq_t lo_freq; /*!< Local oscillator frequency of any transverter */
time_t twiddle_time; /*!< time when vfo twiddling was detected */ time_t twiddle_time; /*!< time when vfo twiddling was detected */
int twiddle_timeout; /*!< timeout to resume from twiddling */ int twiddle_timeout; /*!< timeout to resume from twiddling */
// uplink allows gpredict to behave better by no reading the uplink VFO
int uplink; /*!< uplink=1 will not read Sub, uplink=2 will not read Main */
struct rig_cache cache; struct rig_cache cache;
int vfo_opt; /*!< Is -o switch turned on? */ int vfo_opt; /*!< Is -o switch turned on? */
int auto_power_on; /*!< Allow Hamlib to power rig int auto_power_on; /*!< Allow Hamlib to power rig
@ -2651,6 +2653,11 @@ extern HAMLIB_EXPORT(int)
rig_get_twiddle HAMLIB_PARAMS((RIG *rig, rig_get_twiddle HAMLIB_PARAMS((RIG *rig,
int *seconds)); int *seconds));
extern HAMLIB_EXPORT(int)
rig_set_uplink HAMLIB_PARAMS((RIG *rig,
int val));
extern HAMLIB_EXPORT(const char *) extern HAMLIB_EXPORT(const char *)
rig_get_info HAMLIB_PARAMS((RIG *rig)); rig_get_info HAMLIB_PARAMS((RIG *rig));

Wyświetl plik

@ -426,8 +426,8 @@ static int dummy_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s %s\n", __func__, rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s %s\n", __func__,
rig_strvfo(vfo), fstr); rig_strvfo(vfo), fstr);
if (vfo == RIG_VFO_A) { priv->curr->freq = freq; } if (vfo == RIG_VFO_A || vfo == RIG_VFO_MAIN) { priv->curr->freq = freq; }
else if (vfo == RIG_VFO_B) { priv->curr->tx_freq = freq; } else if (vfo == RIG_VFO_B || vfo == RIG_VFO_SUB) { priv->curr->tx_freq = freq; }
if (!priv->split) if (!priv->split)
{ {
@ -447,13 +447,23 @@ static int dummy_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
if (vfo == RIG_VFO_CURR && rig->caps->rig_model != RIG_MODEL_DUMMY_NOVFO) { vfo = priv->curr_vfo; } if (vfo == RIG_VFO_CURR && rig->caps->rig_model != RIG_MODEL_DUMMY_NOVFO) { vfo = priv->curr_vfo; }
if ((vfo == RIG_VFO_SUB && rig->state.uplink == 1)
|| (vfo == RIG_VFO_MAIN && rig->state.uplink == 2))
{
rig_debug(RIG_DEBUG_TRACE, "%s: uplink=%d, ignoring get_freq\n", __func__,
rig->state.uplink);
return RIG_OK;
}
usleep(CMDSLEEP); usleep(CMDSLEEP);
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__, rig_strvfo(vfo)); rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__, rig_strvfo(vfo));
switch (vfo) switch (vfo)
{ {
case RIG_VFO_MAIN:
case RIG_VFO_A: *freq = priv->curr->freq; break; case RIG_VFO_A: *freq = priv->curr->freq; break;
case RIG_VFO_SUB:
case RIG_VFO_B: *freq = priv->curr->tx_freq; break; case RIG_VFO_B: *freq = priv->curr->tx_freq; break;
default: return -RIG_EINVAL; default: return -RIG_EINVAL;
@ -2025,7 +2035,7 @@ static int dummy_mW2power(RIG *rig, float *power, unsigned int mwpower,
#define DUMMY_VFO_OP 0x7ffffffUL /* All possible VFO OPs */ #define DUMMY_VFO_OP 0x7ffffffUL /* All possible VFO OPs */
#define DUMMY_SCAN 0x7ffffffUL /* All possible scan OPs */ #define DUMMY_SCAN 0x7ffffffUL /* All possible scan OPs */
#define DUMMY_VFOS (RIG_VFO_A|RIG_VFO_B|RIG_VFO_MEM) #define DUMMY_VFOS (RIG_VFO_A|RIG_VFO_B|RIG_VFO_MEM|RIG_VFO_MAIN|RIG_VFO_SUB)
#define DUMMY_MODES (RIG_MODE_AM | RIG_MODE_CW | RIG_MODE_RTTY | \ #define DUMMY_MODES (RIG_MODE_AM | RIG_MODE_CW | RIG_MODE_RTTY | \
RIG_MODE_SSB | RIG_MODE_FM | RIG_MODE_WFM | \ RIG_MODE_SSB | RIG_MODE_FM | RIG_MODE_WFM | \

Wyświetl plik

@ -2249,7 +2249,7 @@ static int kenwood_get_power_minmax(RIG *rig, int *power_now, int *power_min,
int *power_max, int *power_max,
int restore) int restore)
{ {
int retval; int retval, expval;
char levelbuf[19]; char levelbuf[19];
// read power_now, set 0, read power_min, set 255, read_power_max; set 0 // read power_now, set 0, read power_min, set 255, read_power_max; set 0
// we set back to 0 for safety and if restore is true we restore power_min // we set back to 0 for safety and if restore is true we restore power_min
@ -2263,7 +2263,7 @@ static int kenwood_get_power_minmax(RIG *rig, int *power_now, int *power_min,
switch (rig->caps->rig_model) switch (rig->caps->rig_model)
{ {
// TS890S can't take power levels outside 5-100 and 5-50 // TS890S can't take power levels outside 5-100 and 5-25
// So all we'll do is read power_now // So all we'll do is read power_now
case RIG_MODEL_TS890S: case RIG_MODEL_TS890S:
rig->state.power_min = *power_min = 5; rig->state.power_min = *power_min = 5;
@ -2271,6 +2271,14 @@ static int kenwood_get_power_minmax(RIG *rig, int *power_now, int *power_min,
if (rig->state.current_mode == RIG_MODE_AM) { *power_max = 50; } if (rig->state.current_mode == RIG_MODE_AM) { *power_max = 50; }
if (rig->state.current_freq >= 70)
{
rig->state.power_max = 50;
if (rig->state.current_mode == RIG_MODE_AM) { *power_max = 13; }
}
cmd = "PC;"; cmd = "PC;";
break; break;
@ -2298,6 +2306,23 @@ static int kenwood_get_power_minmax(RIG *rig, int *power_now, int *power_min,
rig_debug(RIG_DEBUG_TRACE, "%s: retval=%d\n", __func__, retval); rig_debug(RIG_DEBUG_TRACE, "%s: retval=%d\n", __func__, retval);
if (RIG_IS_TS890S)
{
expval = 6;
}
else
{
expval = 18;
}
if (retval != expval)
{
rig_debug(RIG_DEBUG_ERR, "%s: expected %d, got %d in '%s'\n", __func__, expval,
retval,
levelbuf);
return -RIG_EPROTO;
}
if (RIG_IS_TS890S) if (RIG_IS_TS890S)
{ {
n = sscanf(levelbuf, "PC%d;", power_now); n = sscanf(levelbuf, "PC%d;", power_now);

Wyświetl plik

@ -71,6 +71,7 @@
RIG_OP_UP|RIG_OP_DOWN|RIG_OP_BAND_UP|RIG_OP_BAND_DOWN|\ RIG_OP_UP|RIG_OP_DOWN|RIG_OP_BAND_UP|RIG_OP_BAND_DOWN|\
RIG_OP_TO_VFO|RIG_OP_FROM_VFO|RIG_OP_TOGGLE) RIG_OP_TO_VFO|RIG_OP_FROM_VFO|RIG_OP_TOGGLE)
// Based on testing with G3VPX Ian Sumner
#define FTDX101D_SWR_CAL \ #define FTDX101D_SWR_CAL \
{ \ { \
8, \ 8, \

Wyświetl plik

@ -384,6 +384,33 @@ static int set_roofing_filter_for_width(RIG *rig, vfo_t vfo, int width);
static int get_roofing_filter(RIG *rig, vfo_t vfo, struct newcat_roofing_filter **roofing_filter); static int get_roofing_filter(RIG *rig, vfo_t vfo, struct newcat_roofing_filter **roofing_filter);
static ncboolean newcat_valid_command(RIG *rig, char const *const command); static ncboolean newcat_valid_command(RIG *rig, char const *const command);
/*
* The BS command needs to know what band we're on so we can restore band info
* So this converts freq to band index
*/
static int newcat_band_index(freq_t freq)
{
// FTDX101D has band=12=MW...what is that?
int band = 11; // general
if (freq >= 1.8) { band = 0; }
else if (freq >= 3.5) { band = 1; }
else if (freq >= 5) { band = 2; }
else if (freq >= 7) { band = 3; }
else if (freq >= 10) { band = 4; }
else if (freq >= 14) { band = 5; }
else if (freq >= 18) { band = 6; }
else if (freq >= 21) { band = 7; }
else if (freq >= 24.5) { band = 8; }
else if (freq >= 28) { band = 9; }
else if (freq >= 50) { band = 10; }
// what about 11-16?
else if (freq >= 70) { band = 17; }
rig_debug(RIG_DEBUG_TRACE, "%s: band=%d\n", __func__, band);
return band;
}
/* /*
* ************************************ * ************************************
* *
@ -424,6 +451,7 @@ int newcat_init(RIG *rig)
priv->rig_id = NC_RIGID_NONE; priv->rig_id = NC_RIGID_NONE;
priv->current_mem = NC_MEM_CHANNEL_NONE; priv->current_mem = NC_MEM_CHANNEL_NONE;
priv->fast_set_commands = FALSE; priv->fast_set_commands = FALSE;
priv->has_bs_cmd = 1; // assume true until proven otherwise..in set_freq
return RIG_OK; return RIG_OK;
} }
@ -488,9 +516,11 @@ int newcat_open(RIG *rig)
/* Currently we cannot cope with AI mode so turn it off in case /* Currently we cannot cope with AI mode so turn it off in case
last client left it on */ last client left it on */
newcat_set_trn(rig, RIG_TRN_OFF); /* ignore status in case it's if (priv->trn_state > 0)
{
newcat_set_trn(rig, RIG_TRN_OFF);
} /* ignore status in case it's not supported */
not supported */
/* Initialize rig_id in case any subsequent commands need it */ /* Initialize rig_id in case any subsequent commands need it */
(void)newcat_get_rigid(rig); (void)newcat_get_rigid(rig);
@ -743,6 +773,27 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
return err; return err;
} }
rig_debug(RIG_DEBUG_TRACE, "%s: band changing? old=%d, new=%d\n", __func__,
newcat_band_index(freq), newcat_band_index(rig->state.current_freq));
// Restore band memory if we can
if (priv->has_bs_cmd
&& newcat_band_index(freq) != newcat_band_index(rig->state.current_freq))
{
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "BS%c", cat_term);
if (RIG_OK != (err = newcat_set_cmd(rig)))
{
priv->has_bs_cmd = 0; // guess we can't do this so don't try again
rig_debug(RIG_DEBUG_TRACE, "%s: rig does not have BS command\n", __func__);
}
else
{
rig_debug(RIG_DEBUG_TRACE, "%s: need to restore band settings=%s\n", __func__,
priv->ret_data);
}
}
if (RIG_MODEL_FT450 == caps->rig_model && priv->ret_data[2] != target_vfo) if (RIG_MODEL_FT450 == caps->rig_model && priv->ret_data[2] != target_vfo)
{ {
/* revert current VFO */ /* revert current VFO */
@ -4411,6 +4462,7 @@ int newcat_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
last_char_index = strlen(retfunc) - 1; last_char_index = strlen(retfunc) - 1;
rig_debug(RIG_DEBUG_TRACE, "%s: retfunc='%s'\n", __func__, retfunc); rig_debug(RIG_DEBUG_TRACE, "%s: retfunc='%s'\n", __func__, retfunc);
switch (func) switch (func)
{ {
case RIG_FUNC_MN: case RIG_FUNC_MN:
@ -5222,7 +5274,7 @@ int newcat_get_channel(RIG *rig, channel_t *chan, int read_only)
const char *newcat_get_info(RIG *rig) const char *newcat_get_info(RIG *rig)
{ {
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv; struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
static char idbuf[129]; /* extra large static string array */ static char idbuf[513]; /* extra large static string array */
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);

Wyświetl plik

@ -50,10 +50,10 @@
typedef char ncboolean; typedef char ncboolean;
/* shared function version */ /* shared function version */
#define NEWCAT_VER "20201023" #define NEWCAT_VER "20201026"
/* Hopefully large enough for future use, 128 chars plus '\0' */ /* Hopefully large enough for future use, 512 chars plus '\0' */
#define NEWCAT_DATA_LEN 129 #define NEWCAT_DATA_LEN 513
/* arbitrary value for now. 11 bits (8N2+1) == 2.2917 mS @ 4800 bps */ /* arbitrary value for now. 11 bits (8N2+1) == 2.2917 mS @ 4800 bps */
#define NEWCAT_DEFAULT_READ_TIMEOUT (NEWCAT_DATA_LEN * 5) #define NEWCAT_DEFAULT_READ_TIMEOUT (NEWCAT_DATA_LEN * 5)
@ -118,7 +118,8 @@ struct newcat_priv_data
struct timespec cache_start; struct timespec cache_start;
char last_if_response[NEWCAT_DATA_LEN]; char last_if_response[NEWCAT_DATA_LEN];
int poweron; /* to prevent powering on more than once */ int poweron; /* to prevent powering on more than once */
int question_mark_response_means_rejected; int has_bs_cmd; /* used to restore band memory */
int question_mark_response_means_rejected; /* the question mark response has multiple meanings */
}; };
/* /*

Wyświetl plik

@ -109,6 +109,7 @@ void never_used()
icom_power2mW(); icom_power2mW();
icom_send_morse(); icom_send_morse();
icom_send_voice_mem(); icom_send_voice_mem();
icom_stop_morse();
icom_set_bank(); icom_set_bank();
icom_set_ctcss_sql(); icom_set_ctcss_sql();
icom_set_ctcss_tone(); icom_set_ctcss_tone();

Wyświetl plik

@ -1160,11 +1160,11 @@ int HAMLIB_API rig_cleanup(RIG *rig)
* timeout seconds to stop rigctld when VFO is manually changed * timeout seconds to stop rigctld when VFO is manually changed
* turns on/off the radio. * turns on/off the radio.
* *
* \return RIG_OK if the operation has been successful, ortherwise * \return RIG_OK if the operation has been successful, otherwise
* a negative value if an error occurred (in which case, cause is * a negative value if an error occurred (in which case, cause is
* set appropriately). * set appropriately).
* *
* \sa rig_get_twiddle() * \sa rig_set_twiddle()
*/ */
int HAMLIB_API rig_set_twiddle(RIG *rig, int seconds) int HAMLIB_API rig_set_twiddle(RIG *rig, int seconds)
{ {
@ -1180,6 +1180,32 @@ int HAMLIB_API rig_set_twiddle(RIG *rig, int seconds)
return RIG_OK; return RIG_OK;
} }
/**
* \brief For GPredict to avoid reading frequency on uplink VFO
* \param rig The rig handle
* \param seconds 1=Ignore Sub, 2=Ignore Main
*
* \return RIG_OK if the operation has been successful, otherwise
* a negative value if an error occurred (in which case, cause is
* set appropriately).
*
* \sa rig_set_uplink()
*/
int HAMLIB_API rig_set_uplink(RIG *rig, int val)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
if (CHECK_RIG_ARG(rig))
{
return -RIG_EINVAL;
}
rig->state.uplink = val;
return RIG_OK;
}
/** /**
* \brief get the twiddle timeout value (secs) * \brief get the twiddle timeout value (secs)
* \param rig The rig handle * \param rig The rig handle
@ -1309,6 +1335,7 @@ static int get_cache_freq(RIG *rig, vfo_t vfo, freq_t *freq, int *cache_ms)
case RIG_VFO_CURR: case RIG_VFO_CURR:
*freq = rig->state.cache.freqCurr; *freq = rig->state.cache.freqCurr;
break; break;
case RIG_VFO_A: case RIG_VFO_A:
case RIG_VFO_MAIN: case RIG_VFO_MAIN:
case RIG_VFO_MAIN_A: case RIG_VFO_MAIN_A:
@ -1521,6 +1548,20 @@ int HAMLIB_API rig_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
vfo = vfo_fixup(rig, vfo); vfo = vfo_fixup(rig, vfo);
// we ignore get_freq for the uplink VFO for gpredict to behave better
if ((rig->state.uplink == 1 && vfo == RIG_VFO_SUB)
|| (rig->state.uplink == 2 && vfo == RIG_VFO_MAIN))
{
rig_debug(RIG_DEBUG_TRACE, "%s: uplink=%d, ignoring get_freq\n", __func__,
rig->state.uplink);
rig_debug(RIG_DEBUG_TRACE, "%s: split=%d, satmode=%d, tx_vfo=%s\n", __func__,
rig->state.cache.split, rig->state.cache.satmode,
rig_strvfo(rig->state.tx_vfo));
// always return the cached freq for this clause
get_cache_freq(rig, vfo, freq, &cache_ms);
return RIG_OK;
}
// there are some rigs that can't get VFOA freq while VFOB is transmitting // there are some rigs that can't get VFOA freq while VFOB is transmitting
// so we'll return the cached VFOA freq for them // so we'll return the cached VFOA freq for them
// should we use the cached ptt maybe? No -- we have to be 100% sure we're in PTT to ignore this request // should we use the cached ptt maybe? No -- we have to be 100% sure we're in PTT to ignore this request
@ -5138,13 +5179,14 @@ static int wait_morse_ptt(RIG *rig, vfo_t vfo)
{ {
ptt_t pttStatus = RIG_PTT_OFF; ptt_t pttStatus = RIG_PTT_OFF;
int loops = 0; int loops = 0;
int retval;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
hl_usleep(200*1000); // give little time for CW to start PTT hl_usleep(200 * 1000); // give little time for CW to start PTT
do do
{ {
int retval;
rig_debug(RIG_DEBUG_TRACE, "%s: loop#%d until ptt=0, ptt=%d\n", __func__, loops, rig_debug(RIG_DEBUG_TRACE, "%s: loop#%d until ptt=0, ptt=%d\n", __func__, loops,
pttStatus); pttStatus);
elapsed_ms(&rig->state.cache.time_ptt, HAMLIB_ELAPSED_INVALIDATE); elapsed_ms(&rig->state.cache.time_ptt, HAMLIB_ELAPSED_INVALIDATE);
@ -5154,6 +5196,7 @@ static int wait_morse_ptt(RIG *rig, vfo_t vfo)
{ {
return retval; return retval;
} }
// every 25ms should be short enough // every 25ms should be short enough
hl_usleep(25 * 1000); hl_usleep(25 * 1000);
++loops; ++loops;

Wyświetl plik

@ -78,7 +78,7 @@ extern int read_history();
#define MAXNAMSIZ 32 #define MAXNAMSIZ 32
#define MAXNBOPT 100 /* max number of different options */ #define MAXNBOPT 100 /* max number of different options */
#define MAXARGSZ 127 #define MAXARGSZ 511
#define ARG_IN1 0x01 #define ARG_IN1 0x01
#define ARG_OUT1 0x02 #define ARG_OUT1 0x02
@ -229,6 +229,7 @@ declare_proto_rig(chk_vfo);
declare_proto_rig(set_vfo_opt); declare_proto_rig(set_vfo_opt);
declare_proto_rig(set_twiddle); declare_proto_rig(set_twiddle);
declare_proto_rig(get_twiddle); declare_proto_rig(get_twiddle);
declare_proto_rig(set_uplink);
declare_proto_rig(set_cache); declare_proto_rig(set_cache);
declare_proto_rig(get_cache); declare_proto_rig(get_cache);
declare_proto_rig(halt); declare_proto_rig(halt);
@ -317,8 +318,9 @@ static struct test_table test_list[] =
{ 0xbc, "wait_morse", ACTION(wait_morse), }, { 0xbc, "wait_morse", ACTION(wait_morse), },
{ 0x94, "send_voice_mem", ACTION(send_voice_mem), ARG_IN, "Voice Mem#" }, { 0x94, "send_voice_mem", ACTION(send_voice_mem), ARG_IN, "Voice Mem#" },
{ 0x8b, "get_dcd", ACTION(get_dcd), ARG_OUT, "DCD" }, { 0x8b, "get_dcd", ACTION(get_dcd), ARG_OUT, "DCD" },
{ 0x8d, "set_twiddle", ACTION(set_twiddle), ARG_IN | ARG_NOVFO, "Timeout (secs)" }, { 0x8d, "set_twiddle", ACTION(set_twiddle), ARG_IN | ARG_NOVFO, "Timeout (secs)" },
{ 0x8e, "get_twiddle", ACTION(get_twiddle), ARG_OUT | ARG_NOVFO, "Timeout (secs)" }, { 0x8e, "get_twiddle", ACTION(get_twiddle), ARG_OUT | ARG_NOVFO, "Timeout (secs)" },
{ 0x97, "uplink", ACTION(set_uplink), ARG_IN | ARG_NOVFO, "1=Sub, 2=Main" },
{ 0x95, "set_cache", ACTION(set_cache), ARG_IN | ARG_NOVFO, "Timeout (msecs)" }, { 0x95, "set_cache", ACTION(set_cache), ARG_IN | ARG_NOVFO, "Timeout (msecs)" },
{ 0x96, "get_cache", ACTION(get_cache), ARG_OUT | ARG_NOVFO, "Timeout (msecs)" }, { 0x96, "get_cache", ACTION(get_cache), ARG_OUT | ARG_NOVFO, "Timeout (msecs)" },
{ '2', "power2mW", ACTION(power2mW), ARG_IN1 | ARG_IN2 | ARG_IN3 | ARG_OUT1 | ARG_NOVFO, "Power [0.0..1.0]", "Frequency", "Mode", "Power mW" }, { '2', "power2mW", ACTION(power2mW), ARG_IN1 | ARG_IN2 | ARG_IN3 | ARG_OUT1 | ARG_NOVFO, "Power [0.0..1.0]", "Frequency", "Mode", "Power mW" },
@ -4328,7 +4330,7 @@ declare_proto_rig(send_cmd)
int retval; int retval;
struct rig_state *rs; struct rig_state *rs;
int backend_num, cmd_len; int backend_num, cmd_len;
#define BUFSZ 128 #define BUFSZ 512
char bufcmd[BUFSZ * 5]; // allow for 5 chars for binary char bufcmd[BUFSZ * 5]; // allow for 5 chars for binary
unsigned char buf[BUFSZ]; unsigned char buf[BUFSZ];
char eom_buf[4] = { 0xa, 0xd, 0, 0 }; char eom_buf[4] = { 0xa, 0xd, 0, 0 };
@ -4596,6 +4598,16 @@ declare_proto_rig(set_twiddle)
return rig_set_twiddle(rig, seconds); return rig_set_twiddle(rig, seconds);
} }
/* '0x97' */
declare_proto_rig(set_uplink)
{
int val;
CHKSCN1ARG(sscanf(arg1, "%d", &val));
return rig_set_uplink(rig, val);
}
/* '0x8e' */ /* '0x8e' */
declare_proto_rig(get_twiddle) declare_proto_rig(get_twiddle)

Wyświetl plik

@ -86,7 +86,7 @@
* NB: do NOT use -W since it's reserved by POSIX. * NB: do NOT use -W since it's reserved by POSIX.
* TODO: add an option to read from a file * TODO: add an option to read from a file
*/ */
#define SHORT_OPTIONS "m:r:p:d:P:D:s:c:T:t:C:X:lLuovhVZ" #define SHORT_OPTIONS "m:r:p:d:P:D:s:c:T:t:C:W:x:z:lLuovhVZ"
static struct option long_options[] = static struct option long_options[] =
{ {
{"model", 1, 0, 'm'}, {"model", 1, 0, 'm'},
@ -108,6 +108,7 @@ static struct option long_options[] =
{"help", 0, 0, 'h'}, {"help", 0, 0, 'h'},
{"version", 0, 0, 'V'}, {"version", 0, 0, 'V'},
{"twiddle_timeout", 1, 0, 'W'}, {"twiddle_timeout", 1, 0, 'W'},
{"uplink", 1, 0, 'x'},
{"debug-time-stamps", 0, 0, 'Z'}, {"debug-time-stamps", 0, 0, 'Z'},
{0, 0, 0, 0} {0, 0, 0, 0}
}; };
@ -248,6 +249,7 @@ int main(int argc, char *argv[])
int sock_listen; int sock_listen;
int reuseaddr = 1; int reuseaddr = 1;
int twiddle = 0; int twiddle = 0;
int uplink = 0;
char host[NI_MAXHOST]; char host[NI_MAXHOST];
char serv[NI_MAXSERV]; char serv[NI_MAXSERV];
#if HAVE_SIGACTION #if HAVE_SIGACTION
@ -524,6 +526,17 @@ int main(int argc, char *argv[])
twiddle = atoi(optarg); twiddle = atoi(optarg);
break; break;
case 'x':
if (!optarg)
{
usage(); /* wrong arg count */
exit(1);
}
uplink = atoi(optarg);
break;
case 'Z': case 'Z':
rig_set_debug_time_stamp(1); rig_set_debug_time_stamp(1);
break; break;
@ -573,6 +586,9 @@ int main(int argc, char *argv[])
} }
my_rig->state.twiddle_timeout = twiddle; my_rig->state.twiddle_timeout = twiddle;
my_rig->state.uplink = uplink;
rig_debug(RIG_DEBUG_TRACE, "%s: twiddle=%d, uplink=%d\n", __func__,
my_rig->state.twiddle_timeout, my_rig->state.uplink);
/* /*
* ex: RIG_PTT_PARALLEL and /dev/parport0 * ex: RIG_PTT_PARALLEL and /dev/parport0
@ -1169,6 +1185,7 @@ void usage(void)
" -o, --vfo do not default to VFO_CURR, require extra vfo arg\n" " -o, --vfo do not default to VFO_CURR, require extra vfo arg\n"
" -v, --verbose set verbose mode, cumulative (-v to -vvvvv)\n" " -v, --verbose set verbose mode, cumulative (-v to -vvvvv)\n"
" -W, --twiddle_timeout timeout after detecting vfo manual change\n" " -W, --twiddle_timeout timeout after detecting vfo manual change\n"
" -x, --uplink set uplink get_freq ignore, 1=Sub, 2=Main\n"
" -Z, --debug-time-stamps enable time stamps for debug messages\n" " -Z, --debug-time-stamps enable time stamps for debug messages\n"
" -h, --help display this help and exit\n" " -h, --help display this help and exit\n"
" -V, --version output version information and exit\n\n", " -V, --version output version information and exit\n\n",