kopia lustrzana https://github.com/Hamlib/Hamlib
astyle files
rodzic
abd8829df1
commit
ee60a68bec
2
NEWS
2
NEWS
|
@ -8,6 +8,8 @@ Please send Hamlib bug reports to hamlib-developer@lists.sourceforge.net
|
|||
|
||||
Version 4.2
|
||||
* 2021-03-?? -- anticipated release date
|
||||
* Frequency and PTT are now validated -- may solve some random problems
|
||||
** where freq and ptt get stuck or not changed
|
||||
* Major rework for PRM80
|
||||
* Add twiddle_timeout and twiddle_rit --set-conf options
|
||||
rigctld --set-conf=twiddle_timeout=5,twiddle_rit=1
|
||||
|
|
|
@ -453,7 +453,7 @@ int long_only;
|
|||
int exact = 0;
|
||||
int ambig = 0;
|
||||
const struct option *pfound = NULL;
|
||||
int indfound=0;
|
||||
int indfound = 0;
|
||||
int option_index;
|
||||
|
||||
while (*s && *s != '=')
|
||||
|
|
|
@ -154,7 +154,7 @@ int barrett950_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
char cmd_buf[MAXCMDLEN];
|
||||
int retval;
|
||||
int i;
|
||||
int chan=-1;
|
||||
int chan = -1;
|
||||
freq_t freq_rx, freq_tx;
|
||||
freq_t freq_MHz;
|
||||
char *response = NULL;
|
||||
|
|
|
@ -187,7 +187,7 @@ int dra818_cleanup(RIG *rig)
|
|||
int dra818_open(RIG *rig)
|
||||
{
|
||||
int i;
|
||||
int r=-1;
|
||||
int r = -1;
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
|
|
|
@ -506,9 +506,11 @@ static int dummy_set_vfo(RIG *rig, vfo_t vfo)
|
|||
|
||||
case RIG_VFO_RX:
|
||||
case RIG_VFO_MAIN: priv->curr = &priv->vfo_a; break;
|
||||
|
||||
case RIG_VFO_A: priv->curr = &priv->vfo_a; break;
|
||||
|
||||
case RIG_VFO_SUB: priv->curr = &priv->vfo_b; break;
|
||||
|
||||
case RIG_VFO_B: priv->curr = &priv->vfo_b; break;
|
||||
|
||||
case RIG_VFO_MEM:
|
||||
|
@ -1006,7 +1008,8 @@ static int dummy_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
|
|||
|
||||
if (RIG_LEVEL_IS_FLOAT(level))
|
||||
{
|
||||
if (val.f > 1.0) RETURNFUNC(-RIG_EINVAL);
|
||||
if (val.f > 1.0) { RETURNFUNC(-RIG_EINVAL); }
|
||||
|
||||
sprintf(lstr, "%f", val.f);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -623,10 +623,14 @@ static const char *modeMapGetFLRig(rmode_t modeHamlib)
|
|||
|
||||
for (i = 0; modeMap[i].mode_hamlib != 0; ++i)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: checking modeMap[%d]=%.0f to modeHamlib=%.0f, mode_flrig='%s'\n", __func__, i, (double)modeMap[i].mode_hamlib, (double)modeHamlib, modeMap[i].mode_flrig);
|
||||
rig_debug(RIG_DEBUG_TRACE,
|
||||
"%s: checking modeMap[%d]=%.0f to modeHamlib=%.0f, mode_flrig='%s'\n", __func__,
|
||||
i, (double)modeMap[i].mode_hamlib, (double)modeHamlib, modeMap[i].mode_flrig);
|
||||
|
||||
if (modeMap[i].mode_hamlib == modeHamlib)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_TRACE,"%s matched mode=%.0f, returning '%s'\n", __func__, (double)modeHamlib, modeMap[i].mode_flrig);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s matched mode=%.0f, returning '%s'\n", __func__,
|
||||
(double)modeHamlib, modeMap[i].mode_flrig);
|
||||
return modeMap[i].mode_flrig;
|
||||
}
|
||||
}
|
||||
|
@ -1295,6 +1299,7 @@ static int flrig_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
|||
rig_debug(RIG_DEBUG_ERR, "%s: strdup failed\n", __func__);
|
||||
return -RIG_EINTERNAL;
|
||||
}
|
||||
|
||||
// if (strncmp(ttmode,"ERROR",5)==0) RETURNFUNC(-RIG_EINTERN);
|
||||
|
||||
pttmode = ttmode;
|
||||
|
|
|
@ -215,7 +215,7 @@ static int netrigctl_open(RIG *rig)
|
|||
len = sprintf(cmd, "\\chk_vfo\n");
|
||||
ret = netrigctl_transaction(rig, cmd, len, buf);
|
||||
|
||||
if (sscanf(buf,"CHKVFO %d", &priv->rigctld_vfo_mode)==1)
|
||||
if (sscanf(buf, "CHKVFO %d", &priv->rigctld_vfo_mode) == 1)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: chkvfo=%d\n", __func__, priv->rigctld_vfo_mode);
|
||||
}
|
||||
|
|
|
@ -259,7 +259,8 @@ static int dummy_rot_set_position(ROT *rot, azimuth_t az, elevation_t el)
|
|||
priv->target_el = el;
|
||||
gettimeofday(&priv->tv, NULL);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
priv->az = priv->target_az = az;
|
||||
priv->el = priv->target_az = el;
|
||||
}
|
||||
|
@ -358,7 +359,7 @@ static int dummy_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
|
|||
return RIG_OK;
|
||||
}
|
||||
|
||||
if (simulating)
|
||||
if (simulating)
|
||||
{
|
||||
dummy_rot_simulate_rotation(rot);
|
||||
}
|
||||
|
|
|
@ -320,6 +320,7 @@ int icom_transaction(RIG *rig, int cmd, int subcmd,
|
|||
{
|
||||
break;
|
||||
}
|
||||
|
||||
rig_debug(RIG_DEBUG_WARN, "%s: timeout retry=%d\n", __func__, retry);
|
||||
|
||||
//hl_usleep(500 * 1000); // pause a half second -- don't think we need this
|
||||
|
|
|
@ -71,19 +71,19 @@ const cal_table_float_t icom_default_rfpower_meter_cal =
|
|||
{
|
||||
13,
|
||||
{
|
||||
{ 0, 0.0f },
|
||||
{ 21, 5.0f },
|
||||
{ 43, 10.0f },
|
||||
{ 65, 15.0f },
|
||||
{ 83, 20.0f },
|
||||
{ 95, 25.0f },
|
||||
{ 105, 30.0f },
|
||||
{ 114, 35.0f },
|
||||
{ 124, 40.0f },
|
||||
{ 143, 50.0f },
|
||||
{ 183, 75.0f },
|
||||
{ 213, 100.0f },
|
||||
{ 255, 120.0f }
|
||||
{ 0, 0.0f },
|
||||
{ 21, 5.0f },
|
||||
{ 43, 10.0f },
|
||||
{ 65, 15.0f },
|
||||
{ 83, 20.0f },
|
||||
{ 95, 25.0f },
|
||||
{ 105, 30.0f },
|
||||
{ 114, 35.0f },
|
||||
{ 124, 40.0f },
|
||||
{ 143, 50.0f },
|
||||
{ 183, 75.0f },
|
||||
{ 213, 100.0f },
|
||||
{ 255, 120.0f }
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1119,7 +1119,8 @@ int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
cmd = C_RD_FREQ;
|
||||
subcmd = -1;
|
||||
|
||||
if (vfo == RIG_VFO_MEM && (priv->civ_731_mode || rig->caps->rig_model == RIG_MODEL_IC706))
|
||||
if (vfo == RIG_VFO_MEM && (priv->civ_731_mode
|
||||
|| rig->caps->rig_model == RIG_MODEL_IC706))
|
||||
{
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: VFO=MEM so turning off civ_731\n", __func__);
|
||||
civ_731_mode = 1;
|
||||
|
@ -2419,7 +2420,8 @@ int icom_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
|
|||
*/
|
||||
if (RIG_LEVEL_IS_FLOAT(level))
|
||||
{
|
||||
if (val.f > 1.0) RETURNFUNC(-RIG_EINVAL);
|
||||
if (val.f > 1.0) { RETURNFUNC(-RIG_EINVAL); }
|
||||
|
||||
icom_val = val.f * 255;
|
||||
}
|
||||
else
|
||||
|
@ -3092,6 +3094,7 @@ int icom_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
break;
|
||||
|
||||
case RIG_LEVEL_RFPOWER_METER:
|
||||
|
||||
// rig table in Watts needs to be divided by 100
|
||||
if (rig->caps->rfpower_meter_cal.size == 0)
|
||||
{
|
||||
|
@ -6227,7 +6230,7 @@ int icom_set_powerstat(RIG *rig, powerstat_t status)
|
|||
retval =
|
||||
icom_transaction(rig, C_SET_PWR, pwr_sc, NULL, 0, ackbuf, &ack_len);
|
||||
rs->rigport.retry = retry;
|
||||
hl_usleep(3000*1000); // give it 3 seconds to wake up
|
||||
hl_usleep(3000 * 1000); // give it 3 seconds to wake up
|
||||
|
||||
break;
|
||||
|
||||
|
|
|
@ -193,9 +193,10 @@ int elecraft_open(RIG *rig)
|
|||
priv->has_kpa3 = 0;
|
||||
|
||||
if (strstr(buf, "P")) { priv->has_kpa3 = 1; }
|
||||
|
||||
if (strstr(buf, "R")) { priv->is_k3s = 1; }
|
||||
else if (strncmp(&buf[13],"--",2)==0) { priv->is_k3 = 1; }
|
||||
else if (strncmp(&buf[11],"----",4)==0) { priv->is_k4 = 1; }
|
||||
else if (strncmp(&buf[13], "--", 2) == 0) { priv->is_k3 = 1; }
|
||||
else if (strncmp(&buf[11], "----", 4) == 0) { priv->is_k4 = 1; }
|
||||
|
||||
if (buf[13] == '0') // then we have a KX3 or KX2
|
||||
{
|
||||
|
@ -204,13 +205,13 @@ int elecraft_open(RIG *rig)
|
|||
|
||||
switch (modelnum)
|
||||
{
|
||||
case '1':
|
||||
model = "KX2";
|
||||
case '1':
|
||||
model = "KX2";
|
||||
priv->is_kx2 = 1;
|
||||
break;
|
||||
|
||||
case '2':
|
||||
model = "KX3";
|
||||
case '2':
|
||||
model = "KX3";
|
||||
priv->is_kx3 = 1;
|
||||
break;
|
||||
|
||||
|
@ -229,7 +230,10 @@ int elecraft_open(RIG *rig)
|
|||
if (strstr(buf, "R")) { model = "K3S"; }
|
||||
}
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: model=%s, is_k2=%d, is_k3=%d, is_k3s=%d, is_kx3=%d, is_kx2=%d, is_k4=%d, kpa3=%d\n", __func__, model, priv->is_k2, priv->is_k3, priv->is_k3s, priv->is_kx3, priv->is_kx2, priv->is_k4, priv->has_kpa3);
|
||||
rig_debug(RIG_DEBUG_TRACE,
|
||||
"%s: model=%s, is_k2=%d, is_k3=%d, is_k3s=%d, is_kx3=%d, is_kx2=%d, is_k4=%d, kpa3=%d\n",
|
||||
__func__, model, priv->is_k2, priv->is_k3, priv->is_k3s, priv->is_kx3,
|
||||
priv->is_kx2, priv->is_k4, priv->has_kpa3);
|
||||
|
||||
err = elecraft_get_extension_level(rig, "K2", &priv->k2_ext_lvl);
|
||||
|
||||
|
@ -286,6 +290,7 @@ int elecraft_open(RIG *rig)
|
|||
// For rigs like K3X vfo emulation need to set VFO_A to start
|
||||
vfo_t vfo;
|
||||
rig_get_vfo(rig, &vfo);
|
||||
|
||||
if (vfo != RIG_VFO_A && vfo != RIG_VFO_B)
|
||||
{
|
||||
rig_set_vfo(rig, RIG_VFO_A);
|
||||
|
|
|
@ -876,7 +876,7 @@ int powersdr_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
|
||||
|
||||
case RIG_LEVEL_AF:
|
||||
n = sscanf(lvlbuf,"ZZAG%f", &val->f);
|
||||
n = sscanf(lvlbuf, "ZZAG%f", &val->f);
|
||||
val->f /= 100.0;
|
||||
break;
|
||||
|
||||
|
|
|
@ -1187,20 +1187,23 @@ int k3_set_vfo(RIG *rig, vfo_t vfo)
|
|||
{
|
||||
RETURNFUNC(err);
|
||||
}
|
||||
|
||||
if (tvfo == vfo) RETURNFUNC(RIG_OK);
|
||||
|
||||
if (tvfo == vfo) { RETURNFUNC(RIG_OK); }
|
||||
|
||||
#if 0 // this doesn't seem to work and IC command VFO B indicator doesn't change
|
||||
|
||||
if (priv->is_kx3)
|
||||
{
|
||||
|
||||
cmd = "SWT24";
|
||||
}
|
||||
|
||||
#endif
|
||||
else if (priv->is_k4)
|
||||
{
|
||||
cmd = "AB2";
|
||||
}
|
||||
|
||||
err = kenwood_transaction(rig, cmd, NULL, 0);
|
||||
|
||||
if (err != RIG_OK)
|
||||
|
@ -1232,13 +1235,16 @@ int k3_get_vfo(RIG *rig, vfo_t *vfo)
|
|||
}
|
||||
|
||||
ret = read_block(&rig->state.rigport, buf, 8);
|
||||
|
||||
if (ret != 8)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: expected 8 bytes from '%s', got %d bytes\n", __func__, buf, ret);
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: expected 8 bytes from '%s', got %d bytes\n",
|
||||
__func__, buf, ret);
|
||||
RETURNFUNC(-RIG_EPROTO);
|
||||
}
|
||||
if ((buf[6]&0x02) == 0) *vfo = RIG_VFO_B;
|
||||
else *vfo = RIG_VFO_A;
|
||||
|
||||
if ((buf[6] & 0x02) == 0) { *vfo = RIG_VFO_B; }
|
||||
else { *vfo = RIG_VFO_A; }
|
||||
|
||||
RETURNFUNC(RIG_OK);
|
||||
}
|
||||
|
|
|
@ -994,7 +994,7 @@ static int kenwood_get_if(RIG *rig)
|
|||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
RETURNFUNC(kenwood_safe_transaction(rig, "IF", priv->info,
|
||||
KENWOOD_MAX_BUF_LEN, caps->if_len););
|
||||
KENWOOD_MAX_BUF_LEN, caps->if_len););
|
||||
}
|
||||
|
||||
|
||||
|
@ -1780,11 +1780,13 @@ int kenwood_scan(RIG *rig, vfo_t vfo, scan_t scan, int ch)
|
|||
|
||||
if (RIG_IS_TS990S)
|
||||
{
|
||||
RETURNFUNC(kenwood_transaction(rig, scan == RIG_SCAN_STOP ? "SC00" : "SC01", NULL, 0));
|
||||
RETURNFUNC(kenwood_transaction(rig, scan == RIG_SCAN_STOP ? "SC00" : "SC01",
|
||||
NULL, 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
RETURNFUNC(kenwood_transaction(rig, scan == RIG_SCAN_STOP ? "SC0" : "SC1", NULL, 0));
|
||||
RETURNFUNC(kenwood_transaction(rig, scan == RIG_SCAN_STOP ? "SC0" : "SC1", NULL,
|
||||
0));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2278,6 +2280,7 @@ static int kenwood_get_power_minmax(RIG *rig, int *power_now, int *power_min,
|
|||
// TS480 can't handle the long command string
|
||||
// We can treat it like the TS890S
|
||||
case RIG_MODEL_TS480:
|
||||
|
||||
// TS890S can't take power levels outside 5-100 and 5-25
|
||||
// So all we'll do is read power_now
|
||||
case RIG_MODEL_TS890S:
|
||||
|
@ -2387,7 +2390,8 @@ int kenwood_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
|
|||
|
||||
if (RIG_LEVEL_IS_FLOAT(level))
|
||||
{
|
||||
if (val.f > 1.0) RETURNFUNC(-RIG_EINVAL);
|
||||
if (val.f > 1.0) { RETURNFUNC(-RIG_EINVAL); }
|
||||
|
||||
kenwood_val = val.f * 255;
|
||||
}
|
||||
else
|
||||
|
@ -2867,7 +2871,8 @@ int kenwood_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
break;
|
||||
|
||||
case 3:
|
||||
RETURNFUNC(get_kenwood_level(rig, vfo == RIG_VFO_MAIN ? "AG0" : "AG1", &val->f, NULL));
|
||||
RETURNFUNC(get_kenwood_level(rig, vfo == RIG_VFO_MAIN ? "AG0" : "AG1", &val->f,
|
||||
NULL));
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -3763,7 +3768,7 @@ int kenwood_set_ptt_safe(RIG *rig, vfo_t vfo, ptt_t ptt)
|
|||
}
|
||||
|
||||
RETURNFUNC(kenwood_transaction(rig,
|
||||
(ptt == RIG_PTT_ON) ? "TX" : "RX", NULL, 0));
|
||||
(ptt == RIG_PTT_ON) ? "TX" : "RX", NULL, 0));
|
||||
}
|
||||
|
||||
|
||||
|
@ -3814,16 +3819,19 @@ int kenwood_set_trn(RIG *rig, int trn)
|
|||
RETURNFUNC(-RIG_ENAVAIL);
|
||||
|
||||
case RIG_MODEL_TS990S:
|
||||
RETURNFUNC(kenwood_transaction(rig, (trn == RIG_TRN_RIG) ? "AI2" : "AI0", NULL, 0));
|
||||
RETURNFUNC(kenwood_transaction(rig, (trn == RIG_TRN_RIG) ? "AI2" : "AI0", NULL,
|
||||
0));
|
||||
break;
|
||||
|
||||
case RIG_MODEL_THD7A:
|
||||
case RIG_MODEL_THD74:
|
||||
RETURNFUNC(kenwood_transaction(rig, (trn == RIG_TRN_RIG) ? "AI 1" : "AI 0", buf, sizeof buf));
|
||||
RETURNFUNC(kenwood_transaction(rig, (trn == RIG_TRN_RIG) ? "AI 1" : "AI 0", buf,
|
||||
sizeof buf));
|
||||
break;
|
||||
|
||||
default:
|
||||
RETURNFUNC(kenwood_transaction(rig, (trn == RIG_TRN_RIG) ? "AI1" : "AI0", NULL, 0));
|
||||
RETURNFUNC(kenwood_transaction(rig, (trn == RIG_TRN_RIG) ? "AI1" : "AI0", NULL,
|
||||
0));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1121,7 +1121,7 @@ static int thd72_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
|
|||
|
||||
static int thd72_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
|
||||
{
|
||||
int retval, f=-1;
|
||||
int retval, f = -1;
|
||||
char c;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__);
|
||||
|
|
|
@ -115,7 +115,7 @@ kenwood_ts480_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
|
|||
return kenwood_set_level(rig, vfo, level, val);
|
||||
|
||||
case RIG_LEVEL_AF:
|
||||
priv->ag_format =2;
|
||||
priv->ag_format = 2;
|
||||
return kenwood_set_level(rig, vfo, level, val);
|
||||
|
||||
case RIG_LEVEL_RF:
|
||||
|
@ -283,6 +283,7 @@ kenwood_ts480_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
{
|
||||
rf_max_level = 100;
|
||||
}
|
||||
|
||||
retval = kenwood_transaction(rig, "RG", ackbuf, sizeof(ackbuf));
|
||||
|
||||
if (RIG_OK != retval)
|
||||
|
|
|
@ -260,7 +260,7 @@ static int tt588_rxFilter[] =
|
|||
static int tt588_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
|
||||
int *data_len)
|
||||
{
|
||||
int i, retval=-RIG_EINTERNAL;
|
||||
int i, retval = -RIG_EINTERNAL;
|
||||
struct rig_state *rs = &rig->state;
|
||||
|
||||
// The original file had "A few XX's" due to sync problems
|
||||
|
|
|
@ -286,7 +286,7 @@ int tentec_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
|||
char ttmode;
|
||||
rmode_t saved_mode;
|
||||
pbwidth_t saved_width;
|
||||
int mdbuf_len, ttfilter=-1, retval;
|
||||
int mdbuf_len, ttfilter = -1, retval;
|
||||
char mdbuf[32];
|
||||
|
||||
switch (mode)
|
||||
|
|
|
@ -697,7 +697,7 @@ tt550_set_rx_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
|||
char ttmode;
|
||||
rmode_t saved_mode;
|
||||
pbwidth_t saved_width;
|
||||
int mdbuf_len, ttfilter=-1, retval;
|
||||
int mdbuf_len, ttfilter = -1, retval;
|
||||
char mdbuf[48];
|
||||
|
||||
/*
|
||||
|
@ -812,7 +812,7 @@ tt550_set_tx_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
|||
char ttmode;
|
||||
rmode_t saved_mode;
|
||||
pbwidth_t saved_width;
|
||||
int mdbuf_len, ttfilter=-1, retval;
|
||||
int mdbuf_len, ttfilter = -1, retval;
|
||||
char mdbuf[48];
|
||||
|
||||
switch (mode)
|
||||
|
|
|
@ -3572,7 +3572,8 @@ int ft1000d_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
|
|||
tx_freq);
|
||||
|
||||
err = rig_set_split_vfo(rig, vfo, RIG_SPLIT_ON, RIG_VFO_B);
|
||||
if (err != RIG_OK) RETURNFUNC(err);
|
||||
|
||||
if (err != RIG_OK) { RETURNFUNC(err); }
|
||||
|
||||
// priv = (struct ft1000d_priv_data *)rig->state.priv;
|
||||
|
||||
|
|
|
@ -695,7 +695,8 @@ int ft1000mp_open(RIG *rig)
|
|||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: rig_open: write_delay = %i msec \n", __func__,
|
||||
rig_s->rigport.write_delay);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: rig_open: post_write_delay = %i msec \n", __func__,
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: rig_open: post_write_delay = %i msec \n",
|
||||
__func__,
|
||||
rig_s->rigport.post_write_delay);
|
||||
|
||||
/*
|
||||
|
@ -814,10 +815,13 @@ int ft1000mp_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
|
||||
|
||||
if (vfo == RIG_VFO_CURR) {
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: current_vfo=%s\n", __func__, rig_strvfo(rig->state.current_vfo));
|
||||
if (vfo == RIG_VFO_CURR)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: current_vfo=%s\n", __func__,
|
||||
rig_strvfo(rig->state.current_vfo));
|
||||
vfo = rig->state.current_vfo;
|
||||
}
|
||||
|
||||
retval = ft1000mp_get_vfo_data(rig, vfo);
|
||||
|
||||
|
||||
|
@ -840,7 +844,8 @@ int ft1000mp_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
/* big endian integer, kinda */
|
||||
f = ((((((p[0] << 8) + p[1]) << 8) + p[2]) << 8) + p[3]) * 10 / 16;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: freq = %"PRIfreq" Hz for VFO [%x]\n", __func__, f,
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: freq = %"PRIfreq" Hz for VFO [%x]\n", __func__,
|
||||
f,
|
||||
vfo);
|
||||
|
||||
*freq = f; /* return displayed frequency */
|
||||
|
@ -866,10 +871,13 @@ int ft1000mp_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
|||
rig_debug(RIG_DEBUG_TRACE, "%s: generic mode = %s\n", __func__,
|
||||
rig_strrmode(mode));
|
||||
|
||||
if (vfo == RIG_VFO_CURR) {
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: current_vfo=%s\n", __func__, rig_strvfo(rig->state.current_vfo));
|
||||
if (vfo == RIG_VFO_CURR)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: current_vfo=%s\n", __func__,
|
||||
rig_strvfo(rig->state.current_vfo));
|
||||
vfo = rig->state.current_vfo;
|
||||
}
|
||||
|
||||
/*
|
||||
* translate mode from generic to ft1000mp specific
|
||||
*/
|
||||
|
@ -982,8 +990,10 @@ int ft1000mp_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
|
|||
|
||||
ENTERFUNC;
|
||||
|
||||
if (vfo == RIG_VFO_CURR) {
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: current_vfo=%s\n", __func__, rig_strvfo(rig->state.current_vfo));
|
||||
if (vfo == RIG_VFO_CURR)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: current_vfo=%s\n", __func__,
|
||||
rig_strvfo(rig->state.current_vfo));
|
||||
vfo = rig->state.current_vfo;
|
||||
}
|
||||
|
||||
|
@ -1088,6 +1098,7 @@ int ft1000mp_set_vfo(RIG *rig, vfo_t vfo)
|
|||
}
|
||||
|
||||
#if 0 // seems switching VFOs like this changes the frequencies in the response
|
||||
|
||||
switch (vfo)
|
||||
{
|
||||
case RIG_VFO_A:
|
||||
|
@ -1154,6 +1165,7 @@ int ft1000mp_get_vfo(RIG *rig, vfo_t *vfo)
|
|||
{
|
||||
*vfo = rig->state.current_vfo;
|
||||
}
|
||||
|
||||
#if 0
|
||||
else if (p->update_data[FT1000MP_SUMO_DISPLAYED_STATUS] & SF_VFOAB)
|
||||
{
|
||||
|
@ -1163,6 +1175,7 @@ int ft1000mp_get_vfo(RIG *rig, vfo_t *vfo)
|
|||
{
|
||||
*vfo = rig->state.current_vfo = RIG_VFO_A;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: vfo status = %x %x\n", __func__,
|
||||
|
@ -1214,7 +1227,8 @@ int ft1000mp_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
|
|||
RETURNFUNC(RIG_OK);
|
||||
|
||||
default:
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Unsupported set_func %s", __func__, rig_strfunc(func));
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Unsupported set_func %s", __func__,
|
||||
rig_strfunc(func));
|
||||
RETURNFUNC(-RIG_EINVAL);
|
||||
}
|
||||
|
||||
|
@ -1284,7 +1298,8 @@ int ft1000mp_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
|
|||
|
||||
|
||||
default:
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Unsupported get_func %s", __func__, rig_strfunc(func));
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Unsupported get_func %s", __func__,
|
||||
rig_strfunc(func));
|
||||
RETURNFUNC(-RIG_EINVAL);
|
||||
}
|
||||
|
||||
|
@ -1297,6 +1312,7 @@ int ft1000mp_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
|
|||
int ft1000mp_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit)
|
||||
{
|
||||
ENTERFUNC;
|
||||
|
||||
if (rit != 0)
|
||||
{
|
||||
ft1000mp_set_func(rig, vfo, RIG_FUNC_RIT, 1);
|
||||
|
@ -1678,7 +1694,9 @@ int ft1000mp_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
|
|||
{
|
||||
ENTERFUNC;
|
||||
int retval = rig_set_split_vfo(rig, vfo, RIG_SPLIT_ON, RIG_VFO_B);
|
||||
if (retval != RIG_OK) RETURNFUNC(retval);
|
||||
|
||||
if (retval != RIG_OK) { RETURNFUNC(retval); }
|
||||
|
||||
RETURNFUNC(ft1000mp_set_freq(rig, RIG_VFO_B, tx_freq));
|
||||
}
|
||||
|
||||
|
|
|
@ -92,26 +92,33 @@ int ft3000_set_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t option)
|
|||
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
|
||||
|
||||
ENTERFUNC;
|
||||
|
||||
switch (ant)
|
||||
{
|
||||
case 1:
|
||||
cmd = "AN01;"; // R3/1 ANT1/ANT3
|
||||
break;
|
||||
case 2:
|
||||
cmd = "AN02;"; // RE/2 ANT2/ANT3
|
||||
break;
|
||||
case 3:
|
||||
cmd = "AN03;"; // TRX ANT3
|
||||
break;
|
||||
default:
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: expected 1,2,3 got %d\n", __func__, ant);
|
||||
RETURNFUNC(-RIG_EINVAL);
|
||||
case 1:
|
||||
cmd = "AN01;"; // R3/1 ANT1/ANT3
|
||||
break;
|
||||
|
||||
case 2:
|
||||
cmd = "AN02;"; // RE/2 ANT2/ANT3
|
||||
break;
|
||||
|
||||
case 3:
|
||||
cmd = "AN03;"; // TRX ANT3
|
||||
break;
|
||||
|
||||
default:
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: expected 1,2,3 got %d\n", __func__, ant);
|
||||
RETURNFUNC(-RIG_EINVAL);
|
||||
}
|
||||
|
||||
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "%s", cmd);
|
||||
|
||||
if (RIG_OK != (err = newcat_get_cmd(rig)))
|
||||
{
|
||||
RETURNFUNC(err);
|
||||
}
|
||||
|
||||
RETURNFUNC(RIG_OK);
|
||||
}
|
||||
|
||||
|
@ -127,6 +134,7 @@ int ft3000_get_ant(RIG *rig, vfo_t vfo, ant_t dummy, value_t *option,
|
|||
|
||||
// find out what ANT3 setting
|
||||
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "%s", "AN0;");
|
||||
|
||||
if (RIG_OK != (err = newcat_get_cmd(rig)))
|
||||
{
|
||||
RETURNFUNC(err);
|
||||
|
@ -135,22 +143,26 @@ int ft3000_get_ant(RIG *rig, vfo_t vfo, ant_t dummy, value_t *option,
|
|||
if (strlen(priv->ret_data) >= 7)
|
||||
{
|
||||
char c = priv->ret_data[3];
|
||||
switch(c)
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case '1':
|
||||
*ant_rx = RIG_ANT_3;
|
||||
*ant_tx = RIG_ANT_1;
|
||||
break;
|
||||
case '2':
|
||||
*ant_rx = RIG_ANT_3;
|
||||
*ant_tx = RIG_ANT_2;
|
||||
break;
|
||||
case '3':
|
||||
*ant_rx = *ant_tx = RIG_ANT_3;
|
||||
break;
|
||||
default:
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: unknown antenna=%c\n", __func__, c);
|
||||
RETURNFUNC(-RIG_EPROTO);
|
||||
case '1':
|
||||
*ant_rx = RIG_ANT_3;
|
||||
*ant_tx = RIG_ANT_1;
|
||||
break;
|
||||
|
||||
case '2':
|
||||
*ant_rx = RIG_ANT_3;
|
||||
*ant_tx = RIG_ANT_2;
|
||||
break;
|
||||
|
||||
case '3':
|
||||
*ant_rx = *ant_tx = RIG_ANT_3;
|
||||
break;
|
||||
|
||||
default:
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: unknown antenna=%c\n", __func__, c);
|
||||
RETURNFUNC(-RIG_EPROTO);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -369,7 +369,8 @@ int ft736_set_split_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x2e};
|
||||
|
||||
int retval = rig_set_split_vfo(rig, RIG_VFO_A, RIG_SPLIT_ON, RIG_VFO_B);
|
||||
if (retval != RIG_OK) RETURNFUNC(retval);
|
||||
|
||||
if (retval != RIG_OK) { RETURNFUNC(retval); }
|
||||
|
||||
/* store bcd format in cmd (MSB) */
|
||||
to_bcd_be(cmd, freq / 10, 8);
|
||||
|
|
|
@ -833,7 +833,8 @@ int ft767_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
|
|||
int retval;
|
||||
|
||||
retval = rig_set_split_vfo(rig, RIG_VFO_A, RIG_SPLIT_ON, RIG_VFO_B);
|
||||
if (retval != RIG_OK) RETURNFUNC(retval);
|
||||
|
||||
if (retval != RIG_OK) { RETURNFUNC(retval); }
|
||||
|
||||
/* This appears to always pass in VFO_CURR as the vfo */
|
||||
/* My decision is to only update the xmit VFO if we're in split mode */
|
||||
|
|
|
@ -1057,7 +1057,8 @@ int ft847_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo)
|
|||
int ft847_set_split_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
||||
{
|
||||
int retval = rig_set_split_vfo(rig, RIG_VFO_A, RIG_SPLIT_ON, RIG_VFO_B);
|
||||
if (retval != RIG_OK) RETURNFUNC(retval);
|
||||
|
||||
if (retval != RIG_OK) { RETURNFUNC(retval); }
|
||||
|
||||
return ft847_set_freq(rig, RIG_VFO_TX, freq);
|
||||
}
|
||||
|
|
|
@ -985,13 +985,15 @@ int ft857_set_split_freq_mode(RIG *rig, vfo_t vfo, freq_t freq, rmode_t mode,
|
|||
int retcode;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__);
|
||||
|
||||
|
||||
if (vfo != RIG_VFO_CURR && vfo != RIG_VFO_TX)
|
||||
{
|
||||
return -RIG_ENTARGET;
|
||||
}
|
||||
|
||||
retcode = rig_set_split_vfo(rig, RIG_VFO_A, RIG_SPLIT_ON, RIG_VFO_B);
|
||||
if (retcode != RIG_OK) RETURNFUNC(retcode);
|
||||
|
||||
if (retcode != RIG_OK) { RETURNFUNC(retcode); }
|
||||
|
||||
|
||||
retcode = ft857_send_cmd(rig, FT857_NATIVE_CAT_SET_VFOAB);
|
||||
|
|
|
@ -1461,7 +1461,8 @@ static int ft920_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
|
|||
tx_freq);
|
||||
|
||||
err = rig_set_split_vfo(rig, RIG_VFO_A, RIG_SPLIT_ON, RIG_VFO_B);
|
||||
if (err != RIG_OK) RETURNFUNC(err);
|
||||
|
||||
if (err != RIG_OK) { RETURNFUNC(err); }
|
||||
|
||||
priv = (struct ft920_priv_data *)rig->state.priv;
|
||||
|
||||
|
|
|
@ -229,7 +229,7 @@ static void dump_if_width(unsigned char data)
|
|||
|
||||
static void dump_mem_shift_flag(unsigned char data)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s:", __func__ );
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s:", __func__);
|
||||
|
||||
switch ((unsigned int)data)
|
||||
{
|
||||
|
@ -627,7 +627,8 @@ int ft980_get_status_data(RIG *rig)
|
|||
return RIG_OK;
|
||||
}
|
||||
|
||||
retval = ft980_transaction(rig, cmd, (unsigned char *)&priv->update_data, FT980_ALL_STATUS_LENGTH);
|
||||
retval = ft980_transaction(rig, cmd, (unsigned char *)&priv->update_data,
|
||||
FT980_ALL_STATUS_LENGTH);
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
|
@ -759,9 +760,11 @@ int ft980_open(RIG *rig)
|
|||
while (retval != 5 && retry_count2++ < rig->state.rigport.retry);
|
||||
|
||||
write_block(&rig->state.rigport, (char *) cmd_OK, YAESU_CMD_LENGTH);
|
||||
retval = read_block(&rig->state.rigport, (char *) &priv->update_data, FT980_ALL_STATUS_LENGTH);
|
||||
retval = read_block(&rig->state.rigport, (char *) &priv->update_data,
|
||||
FT980_ALL_STATUS_LENGTH);
|
||||
}
|
||||
while (!priv->update_data.ext_ctl_flag && retry_count1++ < rig->state.rigport.retry);
|
||||
while (!priv->update_data.ext_ctl_flag
|
||||
&& retry_count1++ < rig->state.rigport.retry);
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
@ -803,9 +806,11 @@ int ft980_close(RIG *rig)
|
|||
while (retval != 5 && retry_count2++ < rig->state.rigport.retry);
|
||||
|
||||
write_block(&rig->state.rigport, (char *) cmd_OK, YAESU_CMD_LENGTH);
|
||||
retval = read_block(&rig->state.rigport, (char *) &priv->update_data, FT980_ALL_STATUS_LENGTH);
|
||||
retval = read_block(&rig->state.rigport, (char *) &priv->update_data,
|
||||
FT980_ALL_STATUS_LENGTH);
|
||||
}
|
||||
while (priv->update_data.ext_ctl_flag && retry_count1++ < rig->state.rigport.retry);
|
||||
while (priv->update_data.ext_ctl_flag
|
||||
&& retry_count1++ < rig->state.rigport.retry);
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
@ -941,7 +946,7 @@ int ft980_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
}
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE,
|
||||
"%s: Selected Memory Freq = %lf\n", __func__, f*10);
|
||||
"%s: Selected Memory Freq = %lf\n", __func__, f * 10);
|
||||
|
||||
*freq = f * 10; /* return displayed frequency */
|
||||
|
||||
|
@ -983,7 +988,8 @@ int ft980_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
|||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
|
||||
rig_debug(RIG_DEBUG_TRACE, " %s: passed vfo = 0x%02x\n", __func__, vfo);
|
||||
rig_debug(RIG_DEBUG_TRACE, " %s: passed mode = %s\n", __func__, rig_strrmode(mode));
|
||||
rig_debug(RIG_DEBUG_TRACE, " %s: passed mode = %s\n", __func__,
|
||||
rig_strrmode(mode));
|
||||
rig_debug(RIG_DEBUG_TRACE, " %s: passed width = %ld Hz\n", __func__, width);
|
||||
|
||||
// Set to selected VFO
|
||||
|
@ -1061,7 +1067,8 @@ int ft980_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
|||
rig_force_cache_timeout(&priv->status_tv);
|
||||
|
||||
/* Mode set */
|
||||
return ft980_transaction(rig, cmd, UPDATE_DATA_OFS(&priv->update_data, FT980_OTHER_STATUS_LENGTH), FT980_OTHER_STATUS_LENGTH);
|
||||
return ft980_transaction(rig, cmd, UPDATE_DATA_OFS(&priv->update_data,
|
||||
FT980_OTHER_STATUS_LENGTH), FT980_OTHER_STATUS_LENGTH);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1184,6 +1191,7 @@ int ft980_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
|
|||
default:
|
||||
return -RIG_EPROTO; /* Oops! file bug report */
|
||||
}
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, " %s: Hamlib mode = %s\n", __func__,
|
||||
rig_strrmode(*mode));
|
||||
|
||||
|
@ -1195,7 +1203,9 @@ int ft980_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
|
|||
{
|
||||
*width = rig_passband_narrow(rig, *mode);
|
||||
}
|
||||
rig_debug(RIG_DEBUG_TRACE, " %s: Filter width = %d Hz\n", __func__, (int)*width);
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, " %s: Filter width = %d Hz\n", __func__,
|
||||
(int)*width);
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
@ -1242,7 +1252,8 @@ int ft980_set_mem(RIG *rig, vfo_t vfo, int ch)
|
|||
|
||||
cmd[3] = ch - 1;
|
||||
|
||||
return ft980_transaction(rig, cmd, UPDATE_DATA_OFS(&priv->update_data, FT980_OTHER_STATUS_LENGTH), FT980_OTHER_STATUS_LENGTH);
|
||||
return ft980_transaction(rig, cmd, UPDATE_DATA_OFS(&priv->update_data,
|
||||
FT980_OTHER_STATUS_LENGTH), FT980_OTHER_STATUS_LENGTH);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -1329,11 +1340,14 @@ int ft980_set_vfo(RIG *rig, vfo_t vfo)
|
|||
cmd[3] = FT980_CMD0A_VFO_SEL_HAM;
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: set VFO GEN/HAM = 0x%02x\n",
|
||||
__func__, cmd[3]);
|
||||
err = ft980_transaction(rig, cmd, UPDATE_DATA_OFS(&priv->update_data, FT980_OTHER_STATUS_LENGTH), FT980_OTHER_STATUS_LENGTH);
|
||||
err = ft980_transaction(rig, cmd, UPDATE_DATA_OFS(&priv->update_data,
|
||||
FT980_OTHER_STATUS_LENGTH), FT980_OTHER_STATUS_LENGTH);
|
||||
|
||||
if (err != RIG_OK)
|
||||
{
|
||||
return err;
|
||||
}
|
||||
|
||||
cmd[3] = FT980_CMD0A_FREQ_SEL_VFO;
|
||||
break;
|
||||
|
||||
|
@ -1341,11 +1355,14 @@ int ft980_set_vfo(RIG *rig, vfo_t vfo)
|
|||
cmd[3] = FT980_CMD0A_VFO_SEL_GEN;
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: set VFO GEN/HAM = 0x%02x\n",
|
||||
__func__, cmd[3]);
|
||||
err = ft980_transaction(rig, cmd, UPDATE_DATA_OFS(&priv->update_data, FT980_OTHER_STATUS_LENGTH), FT980_OTHER_STATUS_LENGTH);
|
||||
err = ft980_transaction(rig, cmd, UPDATE_DATA_OFS(&priv->update_data,
|
||||
FT980_OTHER_STATUS_LENGTH), FT980_OTHER_STATUS_LENGTH);
|
||||
|
||||
if (err != RIG_OK)
|
||||
{
|
||||
return err;
|
||||
}
|
||||
|
||||
cmd[3] = FT980_CMD0A_FREQ_SEL_VFO;
|
||||
break;
|
||||
|
||||
|
@ -1360,7 +1377,8 @@ int ft980_set_vfo(RIG *rig, vfo_t vfo)
|
|||
rig_debug(RIG_DEBUG_TRACE, "%s: set VFO Status = %s\n",
|
||||
__func__, rig_strvfo(vfo));
|
||||
|
||||
return ft980_transaction(rig, cmd, UPDATE_DATA_OFS(&priv->update_data, FT980_OTHER_STATUS_LENGTH), FT980_OTHER_STATUS_LENGTH);
|
||||
return ft980_transaction(rig, cmd, UPDATE_DATA_OFS(&priv->update_data,
|
||||
FT980_OTHER_STATUS_LENGTH), FT980_OTHER_STATUS_LENGTH);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -1388,6 +1406,7 @@ int ft980_get_vfo(RIG *rig, vfo_t *vfo)
|
|||
struct ft980_priv_data *priv = (struct ft980_priv_data *)rig->state.priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
if (!rig)
|
||||
{
|
||||
return -RIG_EARG;
|
||||
|
@ -1395,6 +1414,7 @@ int ft980_get_vfo(RIG *rig, vfo_t *vfo)
|
|||
|
||||
/* Get flags for VFO status */
|
||||
err = ft980_get_status_data(rig);
|
||||
|
||||
if (err != RIG_OK)
|
||||
{
|
||||
return err;
|
||||
|
|
|
@ -780,18 +780,23 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
// but they can change the TX vfo
|
||||
if (is_ftdx101 && rig->state.cache.ptt == RIG_PTT_ON)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: ftdx101 check vfo OK, vfo=%s, tx_vfo=%s\n", __func__, rig_strvfo(vfo), rig_strvfo(rig->state.tx_vfo));
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: ftdx101 check vfo OK, vfo=%s, tx_vfo=%s\n",
|
||||
__func__, rig_strvfo(vfo), rig_strvfo(rig->state.tx_vfo));
|
||||
|
||||
// when in split we can change VFOB but not VFOA
|
||||
if (rig->state.cache.split == RIG_SPLIT_ON && target_vfo == '0') return -RIG_ENTARGET;
|
||||
if (rig->state.cache.split == RIG_SPLIT_ON && target_vfo == '0') { return -RIG_ENTARGET; }
|
||||
|
||||
// when not in split we can't change VFOA at all
|
||||
if (rig->state.cache.split == RIG_SPLIT_OFF && target_vfo == '0') return -RIG_ENTARGET;
|
||||
if (vfo != rig->state.tx_vfo) return -RIG_ENTARGET;
|
||||
if (rig->state.cache.split == RIG_SPLIT_OFF && target_vfo == '0') { return -RIG_ENTARGET; }
|
||||
|
||||
if (vfo != rig->state.tx_vfo) { return -RIG_ENTARGET; }
|
||||
}
|
||||
|
||||
if (is_ftdx3000 || is_ftdx5000)
|
||||
{
|
||||
// we have a few rigs that can't set freq while PTT_ON
|
||||
ptt_t ptt;
|
||||
|
||||
if (RIG_OK != (err = newcat_get_ptt(rig, vfo, &ptt)))
|
||||
{
|
||||
ERRMSG(err, "newcat_set_cmd failed");
|
||||
|
@ -994,7 +999,7 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
// after band select re-read things -- may not have to change anything
|
||||
// reading both VFOs is really only needed for rigs with just one VFO stack
|
||||
// but we read them all to ensure we cover both types
|
||||
freq_t tmp_freqA=0, tmp_freqB=0;
|
||||
freq_t tmp_freqA = 0, tmp_freqB = 0;
|
||||
rmode_t tmp_mode;
|
||||
pbwidth_t tmp_width;
|
||||
|
||||
|
@ -2243,7 +2248,7 @@ int newcat_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode,
|
|||
int newcat_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
|
||||
{
|
||||
int err;
|
||||
vfo_t rx_vfo=RIG_VFO_NONE;
|
||||
vfo_t rx_vfo = RIG_VFO_NONE;
|
||||
|
||||
ENTERFUNC;
|
||||
|
||||
|
@ -3475,7 +3480,8 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
|
|||
{
|
||||
RETURNFUNC(-RIG_ENAVAIL);
|
||||
}
|
||||
if (val.f > 1.0) RETURNFUNC(-RIG_EINVAL);
|
||||
|
||||
if (val.f > 1.0) { RETURNFUNC(-RIG_EINVAL); }
|
||||
|
||||
fpf = newcat_scale_float(255, val.f);
|
||||
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "AG%c%03d%c", main_sub_vfo, fpf,
|
||||
|
@ -3645,7 +3651,8 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
|
|||
newcat_get_mode(rig, vfo, &mode, &width);
|
||||
}
|
||||
|
||||
if (val.f > 1.0) RETURNFUNC(-RIG_EINVAL);
|
||||
if (val.f > 1.0) { RETURNFUNC(-RIG_EINVAL); }
|
||||
|
||||
if (is_ftdx1200 || is_ftdx3000 || is_ft891 || is_ft991 || is_ftdx101
|
||||
|| is_ftdx10)
|
||||
{
|
||||
|
@ -4199,7 +4206,8 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
|
|||
RETURNFUNC(-RIG_ENAVAIL);
|
||||
}
|
||||
|
||||
if (val.f > 1.0) RETURNFUNC(-RIG_EINVAL);
|
||||
if (val.f > 1.0) { RETURNFUNC(-RIG_EINVAL); }
|
||||
|
||||
if (is_ftdx1200 || is_ftdx3000 || is_ft891 || is_ft991 || is_ftdx101
|
||||
|| is_ftdx10)
|
||||
{
|
||||
|
@ -4530,12 +4538,16 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
{
|
||||
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RM08%c", cat_term);
|
||||
}
|
||||
|
||||
if (is_ftdx101)
|
||||
{
|
||||
// separate meters for Main and Sub
|
||||
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RM0%c", cat_term);
|
||||
|
||||
if (rig->state.cache.split)
|
||||
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RM1%c", cat_term);
|
||||
{
|
||||
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RM1%c", cat_term);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -6606,8 +6618,10 @@ ncboolean newcat_valid_command(RIG *rig, char const *const command)
|
|||
is_ftdx5000 = newcat_is_rig(rig, RIG_MODEL_FTDX5000);
|
||||
is_ftdx1200 = newcat_is_rig(rig, RIG_MODEL_FTDX1200);
|
||||
is_ftdx3000 = newcat_is_rig(rig, RIG_MODEL_FTDX3000);
|
||||
is_ftdx101 = newcat_is_rig(rig, RIG_MODEL_FTDX101D) && priv->rig_id == NC_RIGID_FTDX101D;
|
||||
is_ftdx101mp = newcat_is_rig(rig, RIG_MODEL_FTDX101D) && priv->rig_id == NC_RIGID_FTDX101MP;
|
||||
is_ftdx101 = newcat_is_rig(rig, RIG_MODEL_FTDX101D)
|
||||
&& priv->rig_id == NC_RIGID_FTDX101D;
|
||||
is_ftdx101mp = newcat_is_rig(rig, RIG_MODEL_FTDX101D)
|
||||
&& priv->rig_id == NC_RIGID_FTDX101MP;
|
||||
is_ftdx10 = newcat_is_rig(rig, RIG_MODEL_FTDX10);
|
||||
|
||||
if (!is_ft450 && !is_ft950 && !is_ft891 && !is_ft991 && !is_ft2000
|
||||
|
@ -6796,7 +6810,8 @@ int newcat_set_tx_vfo(RIG *rig, vfo_t tx_vfo)
|
|||
|
||||
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "%s%c%c", command, p1, cat_term);
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "cmd_str = %s, vfo=%s\n", priv->cmd_str, rig_strvfo(tx_vfo));
|
||||
rig_debug(RIG_DEBUG_TRACE, "cmd_str = %s, vfo=%s\n", priv->cmd_str,
|
||||
rig_strvfo(tx_vfo));
|
||||
|
||||
rig->state.tx_vfo = tx_vfo;
|
||||
|
||||
|
@ -9710,7 +9725,7 @@ int newcat_set_cmd_validate(RIG *rig)
|
|||
RETURNFUNC(-RIG_ENIMPL);
|
||||
}
|
||||
|
||||
if (strlen(valcmd) == 0) return RIG_OK;
|
||||
if (strlen(valcmd) == 0) { return RIG_OK; }
|
||||
|
||||
while (rc != RIG_OK && retry++ < retries)
|
||||
{
|
||||
|
@ -9722,14 +9737,16 @@ int newcat_set_cmd_validate(RIG *rig)
|
|||
|
||||
if (rc != RIG_OK) { RETURNFUNC(-RIG_EIO); }
|
||||
|
||||
bytes = read_string(&state->rigport, priv->ret_data, sizeof(priv->ret_data), &cat_term, sizeof(cat_term));
|
||||
bytes = read_string(&state->rigport, priv->ret_data, sizeof(priv->ret_data),
|
||||
&cat_term, sizeof(cat_term));
|
||||
|
||||
// FA and FB success is now verified in rig.c with a followup query
|
||||
// so no validation is needed
|
||||
if (strncmp(priv->cmd_str, "FA", 2)==0 || strncmp(priv->cmd_str, "FB", 2))
|
||||
if (strncmp(priv->cmd_str, "FA", 2) == 0 || strncmp(priv->cmd_str, "FB", 2))
|
||||
{
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
if (strncmp(priv->cmd_str, "FT", 2) == 0
|
||||
&& strncmp(priv->ret_data, "FT", 2) == 0)
|
||||
{
|
||||
|
@ -9819,10 +9836,11 @@ int newcat_set_cmd(RIG *rig)
|
|||
{
|
||||
RETURNFUNC(RIG_OK);
|
||||
}
|
||||
|
||||
// freq set and ptt are now verified in rig.c
|
||||
if (strncmp(priv->cmd_str,"FA",2)==0
|
||||
|| strncmp(priv->cmd_str,"FB",2)==0
|
||||
|| strncmp(priv->cmd_str,"TX",2)==0)
|
||||
if (strncmp(priv->cmd_str, "FA", 2) == 0
|
||||
|| strncmp(priv->cmd_str, "FB", 2) == 0
|
||||
|| strncmp(priv->cmd_str, "TX", 2) == 0)
|
||||
{
|
||||
RETURNFUNC(RIG_OK);
|
||||
}
|
||||
|
|
|
@ -703,7 +703,9 @@ static int vx1700_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
|
|||
(void) vfo;
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: freq=%f\n", __func__, tx_freq);
|
||||
int err = rig_set_split_vfo(rig, RIG_VFO_A, RIG_SPLIT_ON, RIG_VFO_B);
|
||||
if (err != RIG_OK) RETURNFUNC(err);
|
||||
|
||||
if (err != RIG_OK) { RETURNFUNC(err); }
|
||||
|
||||
return vx1700_do_freq_cmd(rig, VX1700_NATIVE_TX_FREQ_SET, tx_freq);
|
||||
}
|
||||
|
||||
|
|
|
@ -178,7 +178,7 @@ static int prosistel_rot_set_position(ROT *rot, azimuth_t az, elevation_t el)
|
|||
struct prosistel_rot_priv_caps *priv_caps =
|
||||
(struct prosistel_rot_priv_caps *) rot->caps->priv;
|
||||
char cmdstr[64];
|
||||
int retval=-RIG_EINTERNAL;
|
||||
int retval = -RIG_EINTERNAL;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %.1f %.1f\n", __func__, az, el);
|
||||
|
||||
|
@ -315,7 +315,7 @@ static int prosistel_rot_stop(ROT *rot)
|
|||
struct prosistel_rot_priv_caps *priv_caps =
|
||||
(struct prosistel_rot_priv_caps *) rot->caps->priv;
|
||||
char cmdstr[64];
|
||||
int retval=-RIG_EINTERNAL;
|
||||
int retval = -RIG_EINTERNAL;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ static int satel_cmd(ROT *rot, char *cmd, int cmdlen, char *res, int reslen)
|
|||
int ret;
|
||||
struct rot_state *rs;
|
||||
|
||||
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
|
||||
|
@ -129,16 +129,22 @@ static int satel_cmd(ROT *rot, char *cmd, int cmdlen, char *res, int reslen)
|
|||
rig_flush(&rs->rotport);
|
||||
|
||||
ret = write_block(&rs->rotport, cmd, cmdlen);
|
||||
|
||||
if (ret != RIG_OK)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (reslen > 0 && res != NULL)
|
||||
{
|
||||
ret = read_string(&rs->rotport, res, reslen, "\n", 1);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
@ -155,51 +161,72 @@ static int satel_read_status(ROT *rot, satel_stat_t *stat)
|
|||
rs = &rot->state;
|
||||
|
||||
|
||||
|
||||
|
||||
// read motion state
|
||||
ret = read_string(&rs->rotport, resbuf, BUF_SIZE, "\n", 1);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
stat->motion_enabled = strcmp(resbuf, "Motion ENABLED") == 0 ? true : false;
|
||||
|
||||
// XXX skip mode
|
||||
ret = read_string(&rs->rotport, resbuf, BUF_SIZE, "\n", 1);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
// XXX skip time
|
||||
ret = read_string(&rs->rotport, resbuf, BUF_SIZE, "\n", 1);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
// read azimuth line
|
||||
ret = read_string(&rs->rotport, resbuf, BUF_SIZE, "\n", 1);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
p = resbuf + 10;
|
||||
p[3] = '\0';
|
||||
stat->az = (int)strtof(p, NULL);
|
||||
|
||||
|
||||
// read elevation line
|
||||
ret = read_string(&rs->rotport, resbuf, BUF_SIZE, "\n", 1);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
p = resbuf + 12;
|
||||
p[3] = '\0';
|
||||
stat->el = (int)strtof(p, NULL);
|
||||
|
||||
|
||||
// skip blank line
|
||||
ret = read_string(&rs->rotport, resbuf, BUF_SIZE, "\n", 1);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
// XXX skip stored position count
|
||||
ret = read_string(&rs->rotport, resbuf, BUF_SIZE, "\n", 1);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
return RIG_OK;
|
||||
|
@ -210,10 +237,13 @@ static int satel_get_status(ROT *rot, satel_stat_t *stat)
|
|||
{
|
||||
int ret;
|
||||
|
||||
|
||||
|
||||
ret = satel_cmd(rot, "z", 1, NULL, 0);
|
||||
|
||||
if (ret != RIG_OK)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
return satel_read_status(rot, stat);
|
||||
|
@ -225,24 +255,33 @@ static int satel_rot_open(ROT *rot)
|
|||
char resbuf[BUF_SIZE];
|
||||
int ret;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
|
||||
// are we connected?
|
||||
ret = satel_cmd(rot, "?", 1, resbuf, BUF_SIZE);
|
||||
if (ret != RIG_OK)
|
||||
return ret;
|
||||
|
||||
ret = strncasecmp("SatEL", resbuf, 5);
|
||||
if (ret != RIG_OK)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = strncasecmp("SatEL", resbuf, 5);
|
||||
|
||||
if (ret != 0)
|
||||
{
|
||||
return -RIG_EIO;
|
||||
}
|
||||
|
||||
// yep, reset system
|
||||
ret = satel_cmd(rot, "*", 1, NULL, 0);
|
||||
|
||||
if (ret != RIG_OK)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
@ -254,32 +293,44 @@ static int satel_rot_set_position(ROT *rot, azimuth_t az, elevation_t el)
|
|||
int ret;
|
||||
satel_stat_t stat;
|
||||
|
||||
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %.2f %.2f\n", __func__,
|
||||
az, el);
|
||||
|
||||
|
||||
ret = satel_get_status(rot, &stat);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (stat.motion_enabled == false)
|
||||
{
|
||||
ret = satel_cmd(rot, "g", 1, NULL, 0);
|
||||
|
||||
if (ret != RIG_OK)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
snprintf(cmdbuf, BUF_SIZE, "p%d %d\r\n", (int)az, (int)el);
|
||||
ret = satel_cmd(rot, cmdbuf, strlen(cmdbuf), NULL, 0);
|
||||
|
||||
if (ret != RIG_OK)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
// wait-for, read and discard the status message
|
||||
ret = satel_read_status(rot, &stat);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
@ -290,18 +341,21 @@ static int satel_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
|
|||
int ret;
|
||||
satel_stat_t stat;
|
||||
|
||||
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
|
||||
|
||||
ret = satel_get_status(rot, &stat);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
*az = stat.az;
|
||||
*el = stat.el;
|
||||
|
||||
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -637,6 +637,7 @@ static int frontend_set_conf(RIG *rig, token_t token, const char *val)
|
|||
{
|
||||
return -RIG_EINVAL; //value format error
|
||||
}
|
||||
|
||||
rs->twiddle_timeout = val_i;
|
||||
break;
|
||||
|
||||
|
@ -645,7 +646,8 @@ static int frontend_set_conf(RIG *rig, token_t token, const char *val)
|
|||
{
|
||||
return -RIG_EINVAL; //value format error
|
||||
}
|
||||
rs->twiddle_rit = val_i ? 1: 0;
|
||||
|
||||
rs->twiddle_rit = val_i ? 1 : 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -147,6 +147,7 @@ int HAMLIB_API port_open(hamlib_port_t *p)
|
|||
break;
|
||||
|
||||
#ifdef HAVE_LIBUSB_H
|
||||
|
||||
case RIG_PORT_USB:
|
||||
status = usb_port_open(p);
|
||||
|
||||
|
@ -203,6 +204,7 @@ int HAMLIB_API port_close(hamlib_port_t *p, rig_port_t port_type)
|
|||
break;
|
||||
|
||||
#ifdef HAVE_LIBUSB_H
|
||||
|
||||
case RIG_PORT_USB:
|
||||
ret = usb_port_close(p);
|
||||
break;
|
||||
|
@ -720,7 +722,7 @@ int HAMLIB_API read_string(hamlib_port_t *p,
|
|||
"%s(): Timed out %d.%03d seconds after %d chars\n",
|
||||
__func__,
|
||||
(int)elapsed_time.tv_sec,
|
||||
(int)elapsed_time.tv_usec/1000,
|
||||
(int)elapsed_time.tv_usec / 1000,
|
||||
total_count);
|
||||
|
||||
return -RIG_ETIMEOUT;
|
||||
|
|
|
@ -688,7 +688,7 @@ static int generic_restore_channel(RIG *rig, const channel_t *chan)
|
|||
int HAMLIB_API rig_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
|
||||
{
|
||||
struct rig_caps *rc;
|
||||
int curr_chan_num=-1, get_mem_status = RIG_OK;
|
||||
int curr_chan_num = -1, get_mem_status = RIG_OK;
|
||||
vfo_t curr_vfo;
|
||||
vfo_t vfotmp; /* requested vfo */
|
||||
int retcode;
|
||||
|
@ -833,7 +833,7 @@ int HAMLIB_API rig_get_channel(RIG *rig, vfo_t vfox, channel_t *chan,
|
|||
int read_only)
|
||||
{
|
||||
struct rig_caps *rc;
|
||||
int curr_chan_num=-1, get_mem_status = RIG_OK;
|
||||
int curr_chan_num = -1, get_mem_status = RIG_OK;
|
||||
vfo_t curr_vfo;
|
||||
vfo_t vfotmp = RIG_VFO_NONE; /* requested vfo */
|
||||
int retcode = RIG_OK;
|
||||
|
|
|
@ -778,6 +778,7 @@ static void *read_device(void *p)
|
|||
|
||||
|
||||
#if defined(HAVE_PTHREAD) && defined(HAVE_SOCKETPAIR) && defined(HAVE_SELECT)
|
||||
|
||||
//
|
||||
// This is the right place to ensure that a heartbeat is sent
|
||||
// to the microham device regularly (15 sec delay is the maximum
|
||||
|
@ -787,6 +788,7 @@ static void *read_device(void *p)
|
|||
{
|
||||
heartbeat();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
|
|
152
src/rig.c
152
src/rig.c
|
@ -303,11 +303,14 @@ const char *HAMLIB_API rigerror(int errnum)
|
|||
return "ERR_OUT_OF_RANGE";
|
||||
}
|
||||
|
||||
static char msg[DEBUGMSGSAVE_SIZE*2];
|
||||
static char msg[DEBUGMSGSAVE_SIZE * 2];
|
||||
// we have to remove LF from debugmsgsave since calling function controls LF
|
||||
char *p = &debugmsgsave[strlen(debugmsgsave)-1];
|
||||
if (*p=='\n') *p=0;
|
||||
snprintf(msg, sizeof(msg), "%.80s\n%.15000s%.15000s", rigerror_table[errnum], debugmsgsave2, debugmsgsave);
|
||||
char *p = &debugmsgsave[strlen(debugmsgsave) - 1];
|
||||
|
||||
if (*p == '\n') { *p = 0; }
|
||||
|
||||
snprintf(msg, sizeof(msg), "%.80s\n%.15000s%.15000s", rigerror_table[errnum],
|
||||
debugmsgsave2, debugmsgsave);
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
@ -1372,15 +1375,16 @@ static int set_cache_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s, current_vfo=%s\n", __func__,
|
||||
rig_strvfo(vfo), rig_strvfo(rig->state.current_vfo));
|
||||
|
||||
if (vfo == RIG_VFO_CURR)
|
||||
{
|
||||
if (vfo == RIG_VFO_CURR)
|
||||
{
|
||||
// if CURR then update this before we figure out the real VFO
|
||||
rig->state.cache.freqCurr = freq;
|
||||
elapsed_ms(&rig->state.cache.time_freqCurr, HAMLIB_ELAPSED_SET);
|
||||
vfo = rig->state.current_vfo;
|
||||
vfo = rig->state.current_vfo;
|
||||
}
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: set vfo=%s to freq=%.0f\n", __func__, rig_strvfo(vfo), freq);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: set vfo=%s to freq=%.0f\n", __func__,
|
||||
rig_strvfo(vfo), freq);
|
||||
|
||||
switch (vfo)
|
||||
{
|
||||
|
@ -1392,6 +1396,7 @@ static int set_cache_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
elapsed_ms(&rig->state.cache.time_freqSubB, HAMLIB_ELAPSED_INVALIDATE);
|
||||
elapsed_ms(&rig->state.cache.time_freqMem, HAMLIB_ELAPSED_INVALIDATE);
|
||||
break;
|
||||
|
||||
case RIG_VFO_CURR:
|
||||
rig->state.cache.freqCurr = freq;
|
||||
elapsed_ms(&rig->state.cache.time_freqCurr, HAMLIB_ELAPSED_SET);
|
||||
|
@ -1412,6 +1417,7 @@ static int set_cache_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
break;
|
||||
|
||||
#if 0 // 5.0
|
||||
|
||||
case RIG_VFO_C: // is there a MainC/SubC we need to cover?
|
||||
rig->state.cache.freqMainC = freq;
|
||||
elapsed_ms(&rig->state.cache.time_freqMainC, HAMLIB_ELAPSED_SET);
|
||||
|
@ -1484,14 +1490,16 @@ static int get_cache_freq(RIG *rig, vfo_t vfo, freq_t *freq, int *cache_ms)
|
|||
break;
|
||||
|
||||
#if 0 // 5.0
|
||||
|
||||
case RIG_VFO_C:
|
||||
//case RIG_VFO_MAINC: // not used by any rig yet
|
||||
//case RIG_VFO_MAINC: // not used by any rig yet
|
||||
*freq = rig->state.cache.freqMainC;
|
||||
*cache_ms = elapsed_ms(&rig->state.cache.time_freqMainC, HAMLIB_ELAPSED_GET);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if 0 // no known rigs use this yet
|
||||
|
||||
case RIG_VFO_SUBC:
|
||||
*freq = rig->state.cache.freqSubC;
|
||||
*cache_ms = rig->state.cache.time_freqSubC;
|
||||
|
@ -1575,26 +1583,38 @@ int HAMLIB_API rig_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: TARGETABLE_FREQ vfo=%s\n", __func__,
|
||||
rig_strvfo(vfo));
|
||||
int retry=3;
|
||||
int retry = 3;
|
||||
freq_t tfreq = 0;
|
||||
do {
|
||||
|
||||
do
|
||||
{
|
||||
retcode = caps->set_freq(rig, vfo, freq);
|
||||
if (retcode != RIG_OK) RETURNFUNC(retcode);
|
||||
|
||||
if (retcode != RIG_OK) { RETURNFUNC(retcode); }
|
||||
|
||||
set_cache_freq(rig, RIG_VFO_ALL, (freq_t)0);
|
||||
|
||||
if (caps->get_freq)
|
||||
{
|
||||
retcode = rig_get_freq(rig, vfo, &tfreq);
|
||||
|
||||
// WSJT-X does a 55Hz check so we can stop early if that's the case
|
||||
if ((long long)freq % 100 == 55) retry=0;
|
||||
if (retcode != RIG_OK) RETURNFUNC(retcode);
|
||||
if ((long long)freq % 100 == 55) { retry = 0; }
|
||||
|
||||
if (retcode != RIG_OK) { RETURNFUNC(retcode); }
|
||||
|
||||
if (tfreq != freq)
|
||||
{
|
||||
hl_usleep(50*1000);
|
||||
rig_debug(RIG_DEBUG_WARN, "%s: freq not set correctly?? got %.0f asked for %.0f, retry=%d\n", __func__, (double)tfreq, (double)freq, retry);
|
||||
hl_usleep(50 * 1000);
|
||||
rig_debug(RIG_DEBUG_WARN,
|
||||
"%s: freq not set correctly?? got %.0f asked for %.0f, retry=%d\n", __func__,
|
||||
(double)tfreq, (double)freq, retry);
|
||||
}
|
||||
}
|
||||
else { retry = 0; }
|
||||
} while (tfreq != freq && retry-- > 0);
|
||||
}
|
||||
while (tfreq != freq && retry-- > 0);
|
||||
|
||||
if (retry == 0)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: unable to set frequency!!\n", __func__);
|
||||
|
@ -1628,7 +1648,8 @@ int HAMLIB_API rig_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
|
||||
if (retcode != RIG_OK)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: set_vfo(%s) err %.10000s\n", __func__, rig_strvfo(vfo), rigerror(retcode));
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: set_vfo(%s) err %.10000s\n", __func__,
|
||||
rig_strvfo(vfo), rigerror(retcode));
|
||||
RETURNFUNC(retcode);
|
||||
}
|
||||
|
||||
|
@ -2346,7 +2367,8 @@ int HAMLIB_API rig_set_vfo(RIG *rig, vfo_t vfo)
|
|||
if (retcode == RIG_OK && caps->get_freq)
|
||||
{
|
||||
retcode = caps->get_freq(rig, vfo, &curr_freq);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: retcode from rig_get_freq = %.10000s\n", __func__,
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: retcode from rig_get_freq = %.10000s\n",
|
||||
__func__,
|
||||
rigerror(retcode));
|
||||
}
|
||||
else // don't expire cache if we just read it
|
||||
|
@ -2489,20 +2511,27 @@ int HAMLIB_API rig_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
|
|||
{
|
||||
int retry = 3;
|
||||
ptt_t tptt;
|
||||
|
||||
do
|
||||
{
|
||||
retcode = caps->set_ptt(rig, vfo, ptt);
|
||||
if (retcode != RIG_OK) RETURNFUNC(retcode);
|
||||
|
||||
if (retcode != RIG_OK) { RETURNFUNC(retcode); }
|
||||
|
||||
tptt = -1;
|
||||
// IC-9700 is failing on get_ptt right after set_ptt in split mode
|
||||
retcode = rig_get_ptt(rig, vfo, &tptt);
|
||||
|
||||
if (retcode != RIG_OK)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: rig_get_ptt failed: %s\b", __func__, rigerror(retcode));
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: rig_get_ptt failed: %s\b", __func__,
|
||||
rigerror(retcode));
|
||||
retcode = RIG_OK; // fake the retcode so we retry
|
||||
}
|
||||
if (tptt != ptt) rig_debug(RIG_DEBUG_WARN, "%s: failed, retry=%d\n", __func__, retry);
|
||||
} while(tptt != ptt && retry-- > 0 && retcode == RIG_OK);
|
||||
|
||||
if (tptt != ptt) { rig_debug(RIG_DEBUG_WARN, "%s: failed, retry=%d\n", __func__, retry); }
|
||||
}
|
||||
while (tptt != ptt && retry-- > 0 && retcode == RIG_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2521,13 +2550,19 @@ int HAMLIB_API rig_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
|
|||
int rc2;
|
||||
int retry = 3;
|
||||
ptt_t tptt;
|
||||
|
||||
do
|
||||
{
|
||||
retcode = caps->set_ptt(rig, vfo, ptt);
|
||||
if (retcode != RIG_OK) RETURNFUNC(retcode);
|
||||
|
||||
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);
|
||||
|
||||
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 */
|
||||
rc2 = caps->set_vfo(rig, curr_vfo);
|
||||
|
||||
|
@ -3337,11 +3372,17 @@ int HAMLIB_API rig_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
|
|||
{
|
||||
int retry = 3;
|
||||
freq_t tfreq;
|
||||
do {
|
||||
|
||||
do
|
||||
{
|
||||
retcode = rig_set_freq(rig, tx_vfo, tx_freq);
|
||||
if (retcode != RIG_OK) RETURNFUNC(retcode);
|
||||
|
||||
if (retcode != RIG_OK) { RETURNFUNC(retcode); }
|
||||
|
||||
retcode = rig_get_freq(rig, tx_vfo, &tfreq);
|
||||
} while (tfreq != tx_freq && retry-- > 0 && retcode == RIG_OK);
|
||||
}
|
||||
while (tfreq != tx_freq && retry-- > 0 && retcode == RIG_OK);
|
||||
|
||||
RETURNFUNC(retcode);
|
||||
}
|
||||
|
||||
|
@ -3365,7 +3406,9 @@ int HAMLIB_API rig_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
|
|||
|
||||
int retry = 3;
|
||||
freq_t tfreq;
|
||||
do {
|
||||
|
||||
do
|
||||
{
|
||||
if (caps->set_split_freq)
|
||||
{
|
||||
retcode = caps->set_split_freq(rig, vfo, tx_freq);
|
||||
|
@ -3376,7 +3419,8 @@ int HAMLIB_API rig_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
|
|||
retcode = rig_set_freq(rig, RIG_VFO_CURR, tx_freq);
|
||||
rig_get_freq(rig, vfo, &tfreq);
|
||||
}
|
||||
} while(tfreq != tx_freq && retry-- > 0 && retcode == RIG_OK);
|
||||
}
|
||||
while (tfreq != tx_freq && retry-- > 0 && retcode == RIG_OK);
|
||||
|
||||
/* try and revert even if we had an error above */
|
||||
if (caps->set_vfo)
|
||||
|
@ -3791,22 +3835,27 @@ int HAMLIB_API rig_set_split_freq_mode(RIG *rig,
|
|||
caps = rig->caps;
|
||||
|
||||
int retry = 3;
|
||||
if (caps->set_split_freq_mode)
|
||||
|
||||
if (caps->set_split_freq_mode)
|
||||
{
|
||||
freq_t tfreq;
|
||||
|
||||
// we query freq after set to ensure it really gets done
|
||||
do
|
||||
{
|
||||
freq_t tfreq;
|
||||
// we query freq after set to ensure it really gets done
|
||||
do
|
||||
{
|
||||
retcode = caps->set_split_freq_mode(rig, vfo, tx_freq, tx_mode, tx_width);
|
||||
retcode = rig_get_split_freq(rig, vfo, &tfreq);
|
||||
} while(tfreq != tx_freq && retry-- > 0 && retcode == RIG_OK);
|
||||
if (tfreq != tx_freq) retcode = -RIG_EPROTO;
|
||||
RETURNFUNC(retcode);
|
||||
}
|
||||
else
|
||||
{
|
||||
retcode = rig_set_split_freq(rig, vfo, tx_freq);
|
||||
retcode = caps->set_split_freq_mode(rig, vfo, tx_freq, tx_mode, tx_width);
|
||||
retcode = rig_get_split_freq(rig, vfo, &tfreq);
|
||||
}
|
||||
while (tfreq != tx_freq && retry-- > 0 && retcode == RIG_OK);
|
||||
|
||||
if (tfreq != tx_freq) { retcode = -RIG_EPROTO; }
|
||||
|
||||
RETURNFUNC(retcode);
|
||||
}
|
||||
else
|
||||
{
|
||||
retcode = rig_set_split_freq(rig, vfo, tx_freq);
|
||||
}
|
||||
|
||||
if (RIG_OK == retcode)
|
||||
{
|
||||
|
@ -5689,7 +5738,8 @@ const char *HAMLIB_API rig_get_info(RIG *rig)
|
|||
* for error message).
|
||||
*
|
||||
*/
|
||||
int HAMLIB_API rig_get_vfo_info(RIG *rig, vfo_t vfo, freq_t *freq, rmode_t *mode, pbwidth_t *width)
|
||||
int HAMLIB_API rig_get_vfo_info(RIG *rig, vfo_t vfo, freq_t *freq,
|
||||
rmode_t *mode, pbwidth_t *width)
|
||||
{
|
||||
int retcode;
|
||||
|
||||
|
@ -5701,14 +5751,16 @@ int HAMLIB_API rig_get_vfo_info(RIG *rig, vfo_t vfo, freq_t *freq, rmode_t *mode
|
|||
RETURNFUNC(-RIG_EINVAL);
|
||||
}
|
||||
|
||||
retcode = rig_get_freq(rig,vfo,freq);
|
||||
if (retcode != RIG_OK) RETURNFUNC(retcode);
|
||||
retcode = rig_get_mode(rig,vfo,mode,width);
|
||||
retcode = rig_get_freq(rig, vfo, freq);
|
||||
|
||||
if (retcode != RIG_OK) { RETURNFUNC(retcode); }
|
||||
|
||||
retcode = rig_get_mode(rig, vfo, mode, width);
|
||||
RETURNFUNC(retcode);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief get list of available vfos
|
||||
* \brief get list of available vfos
|
||||
* \param rig The rig handle
|
||||
*
|
||||
* Retrieves all usable vfo entries for the rig
|
||||
|
|
|
@ -419,6 +419,7 @@ int HAMLIB_API rot_open(ROT *rot)
|
|||
break;
|
||||
|
||||
#ifdef HAVE_LIBUSB_H
|
||||
|
||||
case RIG_PORT_USB:
|
||||
status = usb_port_open(&rs->rotport);
|
||||
|
||||
|
@ -531,6 +532,7 @@ int HAMLIB_API rot_close(ROT *rot)
|
|||
break;
|
||||
|
||||
#ifdef HAVE_LIBUSB_H
|
||||
|
||||
case RIG_PORT_USB:
|
||||
usb_port_close(&rs->rotport);
|
||||
break;
|
||||
|
|
91
src/serial.c
91
src/serial.c
|
@ -150,6 +150,7 @@ int HAMLIB_API serial_open(hamlib_port_t *rp)
|
|||
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: %s\n", __func__, rp->pathname);
|
||||
|
||||
if (!strncmp(rp->pathname, "uh-rig", 6))
|
||||
{
|
||||
/*
|
||||
|
@ -160,13 +161,13 @@ int HAMLIB_API serial_open(hamlib_port_t *rp)
|
|||
*/
|
||||
if (rp->parm.serial.parity != RIG_PARITY_NONE)
|
||||
{
|
||||
RETURNFUNC( -RIG_EIO);
|
||||
RETURNFUNC(-RIG_EIO);
|
||||
}
|
||||
|
||||
if ((rp->parm.serial.handshake != RIG_HANDSHAKE_HARDWARE) &&
|
||||
(rp->parm.serial.handshake != RIG_HANDSHAKE_NONE))
|
||||
{
|
||||
RETURNFUNC( -RIG_EIO);
|
||||
RETURNFUNC(-RIG_EIO);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -181,7 +182,7 @@ int HAMLIB_API serial_open(hamlib_port_t *rp)
|
|||
|
||||
if (fd == -1)
|
||||
{
|
||||
RETURNFUNC( -RIG_EIO);
|
||||
RETURNFUNC(-RIG_EIO);
|
||||
}
|
||||
|
||||
rp->fd = fd;
|
||||
|
@ -217,7 +218,7 @@ int HAMLIB_API serial_open(hamlib_port_t *rp)
|
|||
* from the transceiver will be returned to both applications.
|
||||
*/
|
||||
uh_radio_fd = fd;
|
||||
RETURNFUNC( RIG_OK);
|
||||
RETURNFUNC(RIG_OK);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -233,7 +234,7 @@ int HAMLIB_API serial_open(hamlib_port_t *rp)
|
|||
__func__,
|
||||
rp->pathname,
|
||||
strerror(errno));
|
||||
RETURNFUNC( -RIG_EIO);
|
||||
RETURNFUNC(-RIG_EIO);
|
||||
}
|
||||
|
||||
rp->fd = fd;
|
||||
|
@ -243,13 +244,13 @@ int HAMLIB_API serial_open(hamlib_port_t *rp)
|
|||
if (err != RIG_OK)
|
||||
{
|
||||
CLOSE(fd);
|
||||
RETURNFUNC( err);
|
||||
RETURNFUNC(err);
|
||||
}
|
||||
|
||||
serial_flush(rp); // ensure nothing is there when we open
|
||||
hl_usleep(50 * 1000); // give a little time for MicroKeyer to finish
|
||||
|
||||
RETURNFUNC( RIG_OK);
|
||||
RETURNFUNC(RIG_OK);
|
||||
}
|
||||
|
||||
|
||||
|
@ -278,7 +279,7 @@ int HAMLIB_API serial_setup(hamlib_port_t *rp)
|
|||
|
||||
if (!rp)
|
||||
{
|
||||
RETURNFUNC( -RIG_EINVAL);
|
||||
RETURNFUNC(-RIG_EINVAL);
|
||||
}
|
||||
|
||||
fd = rp->fd;
|
||||
|
@ -369,7 +370,7 @@ int HAMLIB_API serial_setup(hamlib_port_t *rp)
|
|||
rp->parm.serial.rate);
|
||||
CLOSE(fd);
|
||||
|
||||
RETURNFUNC( -RIG_ECONF);
|
||||
RETURNFUNC(-RIG_ECONF);
|
||||
}
|
||||
|
||||
/* TODO */
|
||||
|
@ -416,7 +417,7 @@ int HAMLIB_API serial_setup(hamlib_port_t *rp)
|
|||
rp->parm.serial.data_bits);
|
||||
CLOSE(fd);
|
||||
|
||||
RETURNFUNC( -RIG_ECONF);
|
||||
RETURNFUNC(-RIG_ECONF);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -441,7 +442,7 @@ int HAMLIB_API serial_setup(hamlib_port_t *rp)
|
|||
rp->parm.serial.stop_bits);
|
||||
CLOSE(fd);
|
||||
|
||||
RETURNFUNC( -RIG_ECONF);
|
||||
RETURNFUNC(-RIG_ECONF);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -487,7 +488,7 @@ int HAMLIB_API serial_setup(hamlib_port_t *rp)
|
|||
rp->parm.serial.parity);
|
||||
CLOSE(fd);
|
||||
|
||||
RETURNFUNC( -RIG_ECONF);
|
||||
RETURNFUNC(-RIG_ECONF);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -520,7 +521,7 @@ int HAMLIB_API serial_setup(hamlib_port_t *rp)
|
|||
rp->parm.serial.handshake);
|
||||
CLOSE(fd);
|
||||
|
||||
RETURNFUNC( -RIG_ECONF);
|
||||
RETURNFUNC(-RIG_ECONF);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -565,7 +566,7 @@ int HAMLIB_API serial_setup(hamlib_port_t *rp)
|
|||
strerror(errno));
|
||||
CLOSE(fd);
|
||||
|
||||
RETURNFUNC( -RIG_ECONF); /* arg, so close! */
|
||||
RETURNFUNC(-RIG_ECONF); /* arg, so close! */
|
||||
}
|
||||
|
||||
#elif defined(HAVE_TERMIO_H)
|
||||
|
@ -580,7 +581,7 @@ int HAMLIB_API serial_setup(hamlib_port_t *rp)
|
|||
strerror(errno));
|
||||
CLOSE(fd);
|
||||
|
||||
RETURNFUNC( -RIG_ECONF); /* arg, so close! */
|
||||
RETURNFUNC(-RIG_ECONF); /* arg, so close! */
|
||||
}
|
||||
|
||||
#else
|
||||
|
@ -596,7 +597,7 @@ int HAMLIB_API serial_setup(hamlib_port_t *rp)
|
|||
strerror(errno));
|
||||
CLOSE(fd);
|
||||
|
||||
RETURNFUNC( -RIG_ECONF); /* arg, so close! */
|
||||
RETURNFUNC(-RIG_ECONF); /* arg, so close! */
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -614,7 +615,7 @@ int HAMLIB_API serial_setup(hamlib_port_t *rp)
|
|||
term_backup->next = term_options_backup_head;
|
||||
term_options_backup_head = term_backup;
|
||||
|
||||
RETURNFUNC( RIG_OK);
|
||||
RETURNFUNC(RIG_OK);
|
||||
}
|
||||
|
||||
|
||||
|
@ -652,12 +653,12 @@ int HAMLIB_API serial_flush(hamlib_port_t *p)
|
|||
rig_debug(RIG_DEBUG_TRACE, "read flushed %d bytes\n", nbytes);
|
||||
|
||||
|
||||
RETURNFUNC( RIG_OK);
|
||||
RETURNFUNC(RIG_OK);
|
||||
}
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "tcflush%s\n", "");
|
||||
tcflush(p->fd, TCIFLUSH);
|
||||
RETURNFUNC( RIG_OK);
|
||||
RETURNFUNC(RIG_OK);
|
||||
}
|
||||
|
||||
|
||||
|
@ -705,7 +706,7 @@ int ser_open(hamlib_port_t *p)
|
|||
}
|
||||
|
||||
p->fd = ret;
|
||||
RETURNFUNC( ret);
|
||||
RETURNFUNC(ret);
|
||||
}
|
||||
|
||||
|
||||
|
@ -732,7 +733,7 @@ int ser_close(hamlib_port_t *p)
|
|||
uh_close_ptt();
|
||||
uh_ptt_fd = -1;
|
||||
p->fd = -1;
|
||||
RETURNFUNC( 0);
|
||||
RETURNFUNC(0);
|
||||
}
|
||||
|
||||
if (p->fd == uh_radio_fd)
|
||||
|
@ -740,7 +741,7 @@ int ser_close(hamlib_port_t *p)
|
|||
uh_close_radio();
|
||||
uh_radio_fd = -1;
|
||||
p->fd = -1;
|
||||
RETURNFUNC( 0);
|
||||
RETURNFUNC(0);
|
||||
}
|
||||
|
||||
// Find backup termios options to restore before closing
|
||||
|
@ -814,7 +815,7 @@ int ser_close(hamlib_port_t *p)
|
|||
|
||||
rc = CLOSE(p->fd);
|
||||
p->fd = -1;
|
||||
RETURNFUNC( rc);
|
||||
RETURNFUNC(rc);
|
||||
}
|
||||
|
||||
|
||||
|
@ -836,7 +837,7 @@ int HAMLIB_API ser_set_rts(hamlib_port_t *p, int state)
|
|||
// ignore this for microHam ports
|
||||
if (p->fd == uh_ptt_fd || p->fd == uh_radio_fd)
|
||||
{
|
||||
RETURNFUNC( RIG_OK);
|
||||
RETURNFUNC(RIG_OK);
|
||||
}
|
||||
|
||||
#if defined(TIOCMBIS) && defined(TIOCMBIC)
|
||||
|
@ -866,10 +867,10 @@ int HAMLIB_API ser_set_rts(hamlib_port_t *p, int state)
|
|||
"%s: Cannot change RTS - %s\n",
|
||||
__func__,
|
||||
strerror(errno));
|
||||
RETURNFUNC( -RIG_EIO);
|
||||
RETURNFUNC(-RIG_EIO);
|
||||
}
|
||||
|
||||
RETURNFUNC( RIG_OK);
|
||||
RETURNFUNC(RIG_OK);
|
||||
}
|
||||
|
||||
|
||||
|
@ -888,13 +889,13 @@ int HAMLIB_API ser_get_rts(hamlib_port_t *p, int *state)
|
|||
// cannot do this for microHam ports
|
||||
if (p->fd == uh_ptt_fd || p->fd == uh_radio_fd)
|
||||
{
|
||||
RETURNFUNC( -RIG_ENIMPL);
|
||||
RETURNFUNC(-RIG_ENIMPL);
|
||||
}
|
||||
|
||||
retcode = IOCTL(p->fd, TIOCMGET, &y);
|
||||
*state = (y & TIOCM_RTS) == TIOCM_RTS;
|
||||
|
||||
RETURNFUNC( retcode < 0 ? -RIG_EIO : RIG_OK);
|
||||
RETURNFUNC(retcode < 0 ? -RIG_EIO : RIG_OK);
|
||||
}
|
||||
|
||||
|
||||
|
@ -917,13 +918,13 @@ int HAMLIB_API ser_set_dtr(hamlib_port_t *p, int state)
|
|||
// but (un)set ptt on microHam PTT channel.
|
||||
if (p->fd == uh_radio_fd)
|
||||
{
|
||||
RETURNFUNC( RIG_OK);
|
||||
RETURNFUNC(RIG_OK);
|
||||
}
|
||||
|
||||
if (p->fd == uh_ptt_fd)
|
||||
{
|
||||
uh_set_ptt(state);
|
||||
RETURNFUNC( RIG_OK);
|
||||
RETURNFUNC(RIG_OK);
|
||||
}
|
||||
|
||||
#if defined(TIOCMBIS) && defined(TIOCMBIC)
|
||||
|
@ -953,10 +954,10 @@ int HAMLIB_API ser_set_dtr(hamlib_port_t *p, int state)
|
|||
"%s: Cannot change DTR - %s\n",
|
||||
__func__,
|
||||
strerror(errno));
|
||||
RETURNFUNC( -RIG_EIO);
|
||||
RETURNFUNC(-RIG_EIO);
|
||||
}
|
||||
|
||||
RETURNFUNC( RIG_OK);
|
||||
RETURNFUNC(RIG_OK);
|
||||
}
|
||||
|
||||
|
||||
|
@ -976,18 +977,18 @@ int HAMLIB_API ser_get_dtr(hamlib_port_t *p, int *state)
|
|||
if (p->fd == uh_ptt_fd)
|
||||
{
|
||||
*state = uh_get_ptt();
|
||||
RETURNFUNC( RIG_OK);
|
||||
RETURNFUNC(RIG_OK);
|
||||
}
|
||||
|
||||
if (p->fd == uh_radio_fd)
|
||||
{
|
||||
RETURNFUNC( -RIG_ENIMPL);
|
||||
RETURNFUNC(-RIG_ENIMPL);
|
||||
}
|
||||
|
||||
retcode = IOCTL(p->fd, TIOCMGET, &y);
|
||||
*state = (y & TIOCM_DTR) == TIOCM_DTR;
|
||||
|
||||
RETURNFUNC( retcode < 0 ? -RIG_EIO : RIG_OK);
|
||||
RETURNFUNC(retcode < 0 ? -RIG_EIO : RIG_OK);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1004,14 +1005,14 @@ int HAMLIB_API ser_set_brk(hamlib_port_t *p, int state)
|
|||
// ignore this for microHam ports
|
||||
if (p->fd == uh_ptt_fd || p->fd == uh_radio_fd)
|
||||
{
|
||||
RETURNFUNC( RIG_OK);
|
||||
RETURNFUNC(RIG_OK);
|
||||
}
|
||||
|
||||
#if defined(TIOCSBRK) && defined(TIOCCBRK)
|
||||
RETURNFUNC( IOCTL(p->fd, state ? TIOCSBRK : TIOCCBRK, 0) < 0 ?
|
||||
-RIG_EIO : RIG_OK;);
|
||||
RETURNFUNC(IOCTL(p->fd, state ? TIOCSBRK : TIOCCBRK, 0) < 0 ?
|
||||
-RIG_EIO : RIG_OK;);
|
||||
#else
|
||||
RETURNFUNC( -RIG_ENIMPL);
|
||||
RETURNFUNC(-RIG_ENIMPL);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1031,13 +1032,13 @@ int HAMLIB_API ser_get_car(hamlib_port_t *p, int *state)
|
|||
// cannot do this for microHam ports
|
||||
if (p->fd == uh_ptt_fd || p->fd == uh_radio_fd)
|
||||
{
|
||||
RETURNFUNC( -RIG_ENIMPL);
|
||||
RETURNFUNC(-RIG_ENIMPL);
|
||||
}
|
||||
|
||||
retcode = IOCTL(p->fd, TIOCMGET, &y);
|
||||
*state = (y & TIOCM_CAR) == TIOCM_CAR;
|
||||
|
||||
RETURNFUNC( retcode < 0 ? -RIG_EIO : RIG_OK);
|
||||
RETURNFUNC(retcode < 0 ? -RIG_EIO : RIG_OK);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1056,13 +1057,13 @@ int HAMLIB_API ser_get_cts(hamlib_port_t *p, int *state)
|
|||
// cannot do this for microHam ports
|
||||
if (p->fd == uh_ptt_fd || p->fd == uh_radio_fd)
|
||||
{
|
||||
RETURNFUNC( -RIG_ENIMPL);
|
||||
RETURNFUNC(-RIG_ENIMPL);
|
||||
}
|
||||
|
||||
retcode = IOCTL(p->fd, TIOCMGET, &y);
|
||||
*state = (y & TIOCM_CTS) == TIOCM_CTS;
|
||||
|
||||
RETURNFUNC( retcode < 0 ? -RIG_EIO : RIG_OK);
|
||||
RETURNFUNC(retcode < 0 ? -RIG_EIO : RIG_OK);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1081,13 +1082,13 @@ int HAMLIB_API ser_get_dsr(hamlib_port_t *p, int *state)
|
|||
// cannot do this for microHam ports
|
||||
if (p->fd == uh_ptt_fd || p->fd == uh_radio_fd)
|
||||
{
|
||||
RETURNFUNC( -RIG_ENIMPL);
|
||||
RETURNFUNC(-RIG_ENIMPL);
|
||||
}
|
||||
|
||||
retcode = IOCTL(p->fd, TIOCMGET, &y);
|
||||
*state = (y & TIOCM_DSR) == TIOCM_DSR;
|
||||
|
||||
RETURNFUNC( retcode < 0 ? -RIG_EIO : RIG_OK);
|
||||
RETURNFUNC(retcode < 0 ? -RIG_EIO : RIG_OK);
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
|
|
@ -433,7 +433,8 @@ int main(int argc, char *argv[])
|
|||
|
||||
rig_set_debug(verbose);
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "rigctl %s\nLast commit was %s\n", hamlib_version,HAMLIBDATETIME);
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "rigctl %s\nLast commit was %s\n", hamlib_version,
|
||||
HAMLIBDATETIME);
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s",
|
||||
"Report bugs to <hamlib-developer@lists.sourceforge.net>\n\n");
|
||||
|
||||
|
|
|
@ -731,8 +731,10 @@ int rigctl_parse(RIG *my_rig, FILE *fin, FILE *fout, char *argv[], int argc,
|
|||
}
|
||||
|
||||
retcode = fscanf(fin, "%s", ++pcmd);
|
||||
if (retcode == 0) rig_debug(RIG_DEBUG_WARN, "%s: unable to scan %c\n", __func__, *(pcmd-1));
|
||||
while(*++pcmd);
|
||||
|
||||
if (retcode == 0) { rig_debug(RIG_DEBUG_WARN, "%s: unable to scan %c\n", __func__, *(pcmd - 1)); }
|
||||
|
||||
while (*++pcmd);
|
||||
|
||||
*pcmd = '\0';
|
||||
cmd = parse_arg((char *)cmd_name);
|
||||
|
@ -2154,8 +2156,10 @@ declare_proto_rig(set_vfo)
|
|||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: set_vfo(%s) failed, requested %s\n", __func__, rig_strvfo(vfo), arg1);
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: set_vfo(%s) failed, requested %s\n", __func__,
|
||||
rig_strvfo(vfo), arg1);
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
@ -2188,6 +2192,7 @@ declare_proto_rig(get_vfo_info)
|
|||
int retval;
|
||||
|
||||
ENTERFUNC;
|
||||
|
||||
if (!strcmp(arg1, "?"))
|
||||
{
|
||||
char s[SPRINTF_MAX_SIZE];
|
||||
|
@ -2197,22 +2202,24 @@ declare_proto_rig(get_vfo_info)
|
|||
}
|
||||
|
||||
vfo = rig_parse_vfo(arg1);
|
||||
freq_t freq=0;
|
||||
rmode_t mode=RIG_MODE_NONE;
|
||||
freq_t freq = 0;
|
||||
rmode_t mode = RIG_MODE_NONE;
|
||||
pbwidth_t width = 0;
|
||||
retval = rig_get_vfo_info(rig, vfo, &freq, &mode, &width);
|
||||
|
||||
rig_debug(RIG_DEBUG_ERR,"%s: vfo=%s\n", __func__, rig_strvfo(vfo));
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: vfo=%s\n", __func__, rig_strvfo(vfo));
|
||||
|
||||
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||
{
|
||||
fprintf(fout,"%s: %.0f\n", cmd->arg1, freq);
|
||||
fprintf(fout,"%s: %s\n", cmd->arg2, rig_strrmode(mode));
|
||||
fprintf(fout,"%s: %d\n", cmd->arg3, (int)width);
|
||||
fprintf(fout, "%s: %.0f\n", cmd->arg1, freq);
|
||||
fprintf(fout, "%s: %s\n", cmd->arg2, rig_strrmode(mode));
|
||||
fprintf(fout, "%s: %d\n", cmd->arg3, (int)width);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(fout,"%.0f\n%s\n%d\n", freq, rig_strrmode(mode), (int)width);
|
||||
fprintf(fout, "%.0f\n%s\n%d\n", freq, rig_strrmode(mode), (int)width);
|
||||
}
|
||||
|
||||
RETURNFUNC(retval);
|
||||
}
|
||||
|
||||
|
@ -2875,8 +2882,9 @@ declare_proto_rig(set_level)
|
|||
level = rig_parse_level(arg1);
|
||||
|
||||
// some Java apps send comma in international setups so substitute period
|
||||
char *p = strchr(arg2,',');
|
||||
if (p) *p = '.';
|
||||
char *p = strchr(arg2, ',');
|
||||
|
||||
if (p) { *p = '.'; }
|
||||
|
||||
if (!rig_has_set_level(rig, level))
|
||||
{
|
||||
|
|
|
@ -523,7 +523,8 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
twiddle_timeout = atoi(optarg);
|
||||
fprintf(stderr,"twiddle_timeout is deprecated...use e.g. --set-conf=twiddle_timeout=5\n");
|
||||
fprintf(stderr,
|
||||
"twiddle_timeout is deprecated...use e.g. --set-conf=twiddle_timeout=5\n");
|
||||
break;
|
||||
|
||||
case 'x':
|
||||
|
@ -587,7 +588,8 @@ int main(int argc, char *argv[])
|
|||
|
||||
my_rig->state.twiddle_timeout = twiddle_timeout;
|
||||
my_rig->state.uplink = uplink;
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: twiddle=%d, uplink=%d, twiddle_rit=%d\n", __func__,
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: twiddle=%d, uplink=%d, twiddle_rit=%d\n",
|
||||
__func__,
|
||||
my_rig->state.twiddle_timeout, my_rig->state.uplink, my_rig->state.twiddle_rit);
|
||||
|
||||
/*
|
||||
|
@ -969,7 +971,7 @@ int main(int argc, char *argv[])
|
|||
return 0;
|
||||
}
|
||||
|
||||
static FILE*get_fsockout(struct handle_data *handle_data_arg)
|
||||
static FILE *get_fsockout(struct handle_data *handle_data_arg)
|
||||
{
|
||||
#ifdef __MINGW32__
|
||||
int sock_osfhandle = _open_osfhandle(handle_data_arg->sock, _O_RDONLY);
|
||||
|
@ -979,7 +981,7 @@ static FILE*get_fsockout(struct handle_data *handle_data_arg)
|
|||
#endif
|
||||
}
|
||||
|
||||
static FILE* get_fsockin(struct handle_data *handle_data_arg)
|
||||
static FILE *get_fsockin(struct handle_data *handle_data_arg)
|
||||
{
|
||||
#ifdef __MINGW32__
|
||||
int sock_osfhandle = _open_osfhandle(handle_data_arg->sock, _O_RDONLY);
|
||||
|
@ -1093,14 +1095,17 @@ void *handle_socket(void *arg)
|
|||
}
|
||||
|
||||
#if 0
|
||||
|
||||
if (ferror(fsockin) || ferror(fsockout) || retcode == 2)
|
||||
{
|
||||
if (ferror(fsockout)) fsockout = get_fsockout(handle_data_arg);
|
||||
if (ferror(fsockout)) { fsockout = get_fsockout(handle_data_arg); }
|
||||
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: socket error in=%d, out=%d\n", __func__,
|
||||
ferror(fsockin), ferror(fsockout));
|
||||
// if we get an error from the rig we'll try to repoen
|
||||
// that may fix things when COM ports drop and such
|
||||
int retry=4;
|
||||
int retry = 4;
|
||||
|
||||
if (retcode == 2)
|
||||
{
|
||||
do
|
||||
|
@ -1110,9 +1115,11 @@ void *handle_socket(void *arg)
|
|||
rig_debug(RIG_DEBUG_ERR, "%s: rig_close retcode=%d\n", __func__, retcode);
|
||||
retcode = rig_open(my_rig);
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: rig_open retcode=%d\n", __func__, retcode);
|
||||
} while (retry-- > 0 && retcode != RIG_OK);
|
||||
}
|
||||
while (retry-- > 0 && retcode != RIG_OK);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
while (retcode == 0 || retcode == 2 || retcode == -RIG_ENAVAIL);
|
||||
|
|
Ładowanie…
Reference in New Issue