kopia lustrzana https://github.com/Hamlib/Hamlib
astyle files prepping for 4.1 release
rodzic
28c7ee7f88
commit
598b105e79
|
@ -1883,7 +1883,7 @@ static int flrig_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
|
|||
int retval;
|
||||
char cmd_arg[MAXARGLEN];
|
||||
char *cmd;
|
||||
char *param_type="i4";
|
||||
char *param_type = "i4";
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s level=%d, val=%f\n", __func__,
|
||||
rig_strvfo(vfo), (int)level, val.f);
|
||||
|
@ -1897,13 +1897,13 @@ static int flrig_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
|
|||
|
||||
switch (level)
|
||||
{
|
||||
case RIG_LEVEL_RF: cmd = "rig.set_rfgain"; val.f*= 100; break;
|
||||
case RIG_LEVEL_RF: cmd = "rig.set_rfgain"; val.f *= 100; break;
|
||||
|
||||
case RIG_LEVEL_AF: cmd = "rig.set_volume"; val.f*= 100; break;
|
||||
case RIG_LEVEL_AF: cmd = "rig.set_volume"; val.f *= 100; break;
|
||||
|
||||
case RIG_LEVEL_MICGAIN: cmd = "rig.set_micgain"; val.f*= 100; break;
|
||||
case RIG_LEVEL_MICGAIN: cmd = "rig.set_micgain"; val.f *= 100; break;
|
||||
|
||||
case RIG_LEVEL_RFPOWER: cmd = "rig.set_power"; val.f*= 100; break;
|
||||
case RIG_LEVEL_RFPOWER: cmd = "rig.set_power"; val.f *= 100; break;
|
||||
|
||||
default:
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: invalid level=%d\n", __func__, (int)level);
|
||||
|
@ -1949,7 +1949,7 @@ static int flrig_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
case RIG_LEVEL_MICGAIN: cmd = "rig.get_micgain"; break;
|
||||
|
||||
case RIG_LEVEL_STRENGTH: cmd = "rig.get_smeter"; break;
|
||||
|
||||
|
||||
case RIG_LEVEL_RFPOWER: cmd = "rig.get_power"; break;
|
||||
|
||||
case RIG_LEVEL_RFPOWER_METER_WATTS:
|
||||
|
|
|
@ -715,7 +715,7 @@ int icom_get_usb_echo_off(RIG *rig)
|
|||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: ack_len=%d\n", __func__, ack_len);
|
||||
|
||||
if (retval == -RIG_ETIMEOUT) return retval;
|
||||
if (retval == -RIG_ETIMEOUT) { return retval; }
|
||||
|
||||
if (retval == RIG_OK)
|
||||
{
|
||||
|
|
|
@ -342,7 +342,7 @@ int dwtdll_cleanup(RIG *rig)
|
|||
struct dwtdll_priv_data *priv = (struct dwtdll_priv_data *)rig->state.priv;
|
||||
|
||||
/* Clean up the dll access */
|
||||
if (priv) FreeLibrary(priv->dll);
|
||||
if (priv) { FreeLibrary(priv->dll); }
|
||||
|
||||
if (rig->state.priv)
|
||||
{
|
||||
|
|
|
@ -345,7 +345,7 @@ int elektor507_cleanup(RIG *rig)
|
|||
rig->state.priv;
|
||||
|
||||
/* Clean up the dll access */
|
||||
if (priv) FreeLibrary(priv->extra_priv.dll);
|
||||
if (priv) { FreeLibrary(priv->extra_priv.dll); }
|
||||
|
||||
if (rig->state.priv)
|
||||
{
|
||||
|
|
|
@ -272,7 +272,7 @@ int g3_cleanup(RIG *rig)
|
|||
struct g3_priv_data *priv = (struct g3_priv_data *)rig->state.priv;
|
||||
|
||||
/* Clean up the dll access */
|
||||
if (priv) FreeLibrary(priv->dll);
|
||||
if (priv) { FreeLibrary(priv->dll); }
|
||||
|
||||
if (rig->state.priv)
|
||||
{
|
||||
|
|
|
@ -540,9 +540,10 @@ int newcat_open(RIG *rig)
|
|||
rig_debug(RIG_DEBUG_VERBOSE, "%s: rig_id=%d\n", __func__, priv->rig_id);
|
||||
|
||||
#if 0 // possible future enhancement?
|
||||
|
||||
// some rigs have a CAT TOT timeout that defaults to 10ms
|
||||
// so we'll increase CAT timeout to 100ms
|
||||
if (priv->rig_id == NC_RIGID_FT2000
|
||||
if (priv->rig_id == NC_RIGID_FT2000
|
||||
|| priv->rig_id == NC_RIGID_FT2000D
|
||||
|| priv->rig_id == NC_RIGID_FT891
|
||||
|| priv->rig_id == NC_RIGID_FT991
|
||||
|
@ -550,9 +551,11 @@ int newcat_open(RIG *rig)
|
|||
{
|
||||
int err;
|
||||
char *cmd = "EX0291%c";
|
||||
if (priv->rig_id == NC_RIGID_FT950) cmd = "EX0271%c";
|
||||
else if (priv->rig_id == NC_RIGID_FT891) cmd = "EX05071c";
|
||||
else if (priv->rig_id == NC_RIGID_FT991) cmd = "EX0321c";
|
||||
|
||||
if (priv->rig_id == NC_RIGID_FT950) { cmd = "EX0271%c"; }
|
||||
else if (priv->rig_id == NC_RIGID_FT891) { cmd = "EX05071c"; }
|
||||
else if (priv->rig_id == NC_RIGID_FT991) { cmd = "EX0321c"; }
|
||||
|
||||
snprintf(priv->cmd_str, sizeof(priv->cmd_str), cmd, cat_term);
|
||||
|
||||
if (RIG_OK != (err = newcat_set_cmd(rig)))
|
||||
|
@ -560,6 +563,7 @@ int newcat_open(RIG *rig)
|
|||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: returning RIG_OK\n", __func__);
|
||||
|
@ -804,7 +808,7 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
// And only when not in split mode (note this check has been removed for testing)
|
||||
if (newcat_valid_command(rig, "BS")
|
||||
&& newcat_band_index(freq) != newcat_band_index(rig->state.current_freq)
|
||||
// remove the split check here -- hopefully works OK
|
||||
// remove the split check here -- hopefully works OK
|
||||
//&& !rig->state.cache.split
|
||||
&& !is_ft891) // 891 does not remember bandwidth so don't do this
|
||||
{
|
||||
|
@ -813,7 +817,8 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
|
||||
if (RIG_OK != (err = newcat_set_cmd(rig)))
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Unexpected error with BS command#1=%s\n", __func__,
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Unexpected error with BS command#1=%s\n",
|
||||
__func__,
|
||||
rigerror(err));
|
||||
}
|
||||
else
|
||||
|
@ -821,18 +826,26 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
// Also need to do this for the other VFO on some Yaesu rigs
|
||||
// is redundant for rigs where band stack includes both vfos
|
||||
vfo_t vfotmp;
|
||||
err = rig_get_vfo(rig, &vfotmp);
|
||||
if (err != RIG_OK) return err;
|
||||
err = rig_set_vfo(rig, vfotmp==RIG_VFO_MAIN?RIG_VFO_SUB:RIG_VFO_MAIN);
|
||||
if (err != RIG_OK) return err;
|
||||
err = rig_get_vfo(rig, &vfotmp);
|
||||
|
||||
if (err != RIG_OK) { return err; }
|
||||
|
||||
err = rig_set_vfo(rig, vfotmp == RIG_VFO_MAIN ? RIG_VFO_SUB : RIG_VFO_MAIN);
|
||||
|
||||
if (err != RIG_OK) { return err; }
|
||||
|
||||
if (RIG_OK != (err = newcat_set_cmd(rig)))
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Unexpected error with BS command#2=%s\n", __func__,
|
||||
rigerror(err));
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Unexpected error with BS command#2=%s\n",
|
||||
__func__,
|
||||
rigerror(err));
|
||||
}
|
||||
|
||||
// switch back to the starting vfo
|
||||
err = rig_set_vfo(rig, vfotmp==RIG_VFO_MAIN?RIG_VFO_MAIN:RIG_VFO_SUB);
|
||||
if (err != RIG_OK) return err;
|
||||
err = rig_set_vfo(rig, vfotmp == RIG_VFO_MAIN ? RIG_VFO_MAIN : RIG_VFO_SUB);
|
||||
|
||||
if (err != RIG_OK) { return err; }
|
||||
|
||||
// after band select re-read things -- may not have to change anything
|
||||
freq_t tmp_freqA, tmp_freqB;
|
||||
rmode_t tmp_mode;
|
||||
|
@ -841,10 +854,12 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
rig_get_freq(rig, RIG_VFO_SUB, &tmp_freqB);
|
||||
rig_get_mode(rig, RIG_VFO_MAIN, &tmp_mode, &tmp_width);
|
||||
rig_get_mode(rig, RIG_VFO_SUB, &tmp_mode, &tmp_width);
|
||||
|
||||
if ((target_vfo == 0 && tmp_freqA == freq)
|
||||
|| (target_vfo == 1 && tmp_freqB == freq))
|
||||
|| (target_vfo == 1 && tmp_freqB == freq))
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: freq after band select already set to %"PRIfreq"\n", __func__, freq);
|
||||
rig_debug(RIG_DEBUG_VERBOSE,
|
||||
"%s: freq after band select already set to %"PRIfreq"\n", __func__, freq);
|
||||
return RIG_OK; // we're done then!!
|
||||
}
|
||||
}
|
||||
|
@ -2577,7 +2592,7 @@ int newcat_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone)
|
|||
if (tone == 0) /* turn off ctcss */
|
||||
{
|
||||
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CT%c0%c", main_sub_vfo,
|
||||
cat_term);
|
||||
cat_term);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3309,7 +3324,8 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
|
|||
|
||||
break;
|
||||
|
||||
case RIG_LEVEL_IF: {
|
||||
case RIG_LEVEL_IF:
|
||||
{
|
||||
pbwidth_t width;
|
||||
rmode_t mode = 0;
|
||||
|
||||
|
@ -3362,11 +3378,13 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
|
|||
// Some Yaesu rigs reject this command in AM/FM modes
|
||||
if (is_ft991 || is_ftdx5000 || is_ftdx101)
|
||||
{
|
||||
if (mode & RIG_MODE_AM || mode & RIG_MODE_FM || mode & RIG_MODE_AMN || mode & RIG_MODE_FMN)
|
||||
if (mode & RIG_MODE_AM || mode & RIG_MODE_FM || mode & RIG_MODE_AMN
|
||||
|| mode & RIG_MODE_FMN)
|
||||
{
|
||||
priv->question_mark_response_means_rejected = 1;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -3415,7 +3433,8 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
|
|||
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "KS%03d%c", val.i, cat_term);
|
||||
break;
|
||||
|
||||
case RIG_LEVEL_MICGAIN: {
|
||||
case RIG_LEVEL_MICGAIN:
|
||||
{
|
||||
pbwidth_t width;
|
||||
rmode_t mode = 0;
|
||||
|
||||
|
@ -3449,6 +3468,7 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
|
|||
priv->question_mark_response_means_rejected = 1;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -3655,6 +3675,7 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
|
|||
priv->cmd_str[2] = main_sub_vfo;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case RIG_LEVEL_COMP:
|
||||
|
@ -4087,7 +4108,8 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
cat_term);
|
||||
break;
|
||||
|
||||
case RIG_LEVEL_IF: {
|
||||
case RIG_LEVEL_IF:
|
||||
{
|
||||
pbwidth_t width;
|
||||
rmode_t mode = 0;
|
||||
|
||||
|
@ -4112,11 +4134,13 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
// Some Yaesu rigs reject this command in AM/FM modes
|
||||
if (is_ft991 || is_ftdx5000 || is_ftdx101)
|
||||
{
|
||||
if (mode & RIG_MODE_AM || mode & RIG_MODE_FM || mode & RIG_MODE_AMN || mode & RIG_MODE_FMN)
|
||||
if (mode & RIG_MODE_AM || mode & RIG_MODE_FM || mode & RIG_MODE_AMN
|
||||
|| mode & RIG_MODE_FMN)
|
||||
{
|
||||
priv->question_mark_response_means_rejected = 1;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -4138,7 +4162,8 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "KS%c", cat_term);
|
||||
break;
|
||||
|
||||
case RIG_LEVEL_MICGAIN: {
|
||||
case RIG_LEVEL_MICGAIN:
|
||||
{
|
||||
pbwidth_t width;
|
||||
rmode_t mode = 0;
|
||||
|
||||
|
@ -4162,6 +4187,7 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
priv->question_mark_response_means_rejected = 1;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -4966,7 +4992,8 @@ int newcat_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
|
|||
|
||||
switch (func)
|
||||
{
|
||||
case RIG_FUNC_ANF: {
|
||||
case RIG_FUNC_ANF:
|
||||
{
|
||||
pbwidth_t width;
|
||||
rmode_t mode = 0;
|
||||
|
||||
|
@ -4996,10 +5023,12 @@ int newcat_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
|
|||
priv->question_mark_response_means_rejected = 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case RIG_FUNC_MN: {
|
||||
break;
|
||||
}
|
||||
|
||||
case RIG_FUNC_MN:
|
||||
{
|
||||
pbwidth_t width;
|
||||
rmode_t mode = 0;
|
||||
|
||||
|
@ -5029,6 +5058,7 @@ int newcat_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
|
|||
priv->question_mark_response_means_rejected = 1;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -5120,7 +5150,8 @@ int newcat_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
|
|||
|
||||
break;
|
||||
|
||||
case RIG_FUNC_NR: {
|
||||
case RIG_FUNC_NR:
|
||||
{
|
||||
pbwidth_t width;
|
||||
rmode_t mode = 0;
|
||||
|
||||
|
@ -5150,10 +5181,12 @@ int newcat_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
|
|||
priv->question_mark_response_means_rejected = 1;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case RIG_FUNC_COMP: {
|
||||
case RIG_FUNC_COMP:
|
||||
{
|
||||
pbwidth_t width;
|
||||
rmode_t mode = 0;
|
||||
|
||||
|
@ -5182,12 +5215,14 @@ int newcat_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
|
|||
// Some Yaesu rigs reject this command in AM/FM/RTTY modes
|
||||
if (is_ft991 || is_ftdx5000 || is_ftdx101)
|
||||
{
|
||||
if (mode & RIG_MODE_AM || mode & RIG_MODE_FM || mode & RIG_MODE_AMN || mode & RIG_MODE_FMN ||
|
||||
if (mode & RIG_MODE_AM || mode & RIG_MODE_FM || mode & RIG_MODE_AMN
|
||||
|| mode & RIG_MODE_FMN ||
|
||||
mode & RIG_MODE_RTTY || mode & RIG_MODE_RTTYR)
|
||||
{
|
||||
priv->question_mark_response_means_rejected = 1;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -5263,7 +5298,8 @@ int newcat_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
|
|||
|
||||
switch (func)
|
||||
{
|
||||
case RIG_FUNC_ANF: {
|
||||
case RIG_FUNC_ANF:
|
||||
{
|
||||
pbwidth_t width;
|
||||
rmode_t mode = 0;
|
||||
|
||||
|
@ -5292,6 +5328,7 @@ int newcat_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
|
|||
priv->question_mark_response_means_rejected = 1;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -9259,6 +9296,7 @@ int newcat_get_cmd(RIG *rig)
|
|||
while (rc != RIG_OK && retry_count++ <= state->rigport.retry)
|
||||
{
|
||||
rig_flush(&state->rigport); /* discard any unsolicited data */
|
||||
|
||||
if (rc != -RIG_BUSBUSY)
|
||||
{
|
||||
/* send the command */
|
||||
|
@ -9326,6 +9364,7 @@ int newcat_get_cmd(RIG *rig)
|
|||
break; /* retry */
|
||||
|
||||
case '?':
|
||||
|
||||
/* The ? response is ambiguous and undocumented by Yaesu, but for get commands it seems to
|
||||
* indicate that the rig rejected the command because the state of the rig is not valid for the command
|
||||
* or that the command parameter is invalid. Retrying the command does not fix the issue,
|
||||
|
@ -9346,13 +9385,14 @@ int newcat_get_cmd(RIG *rig)
|
|||
*/
|
||||
if (priv->question_mark_response_means_rejected)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Command rejected by the rig (get): '%s'\n", __func__,
|
||||
priv->cmd_str);
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Command rejected by the rig (get): '%s'\n",
|
||||
__func__,
|
||||
priv->cmd_str);
|
||||
return -RIG_ERJCTED;
|
||||
}
|
||||
|
||||
rig_debug(RIG_DEBUG_WARN, "%s: Rig busy - retrying %d of %d: '%s'\n", __func__,
|
||||
retry_count, state->rigport.retry, priv->cmd_str);
|
||||
retry_count, state->rigport.retry, priv->cmd_str);
|
||||
|
||||
rc = -RIG_ERJCTED; /* retry */
|
||||
break;
|
||||
|
@ -9398,76 +9438,88 @@ int newcat_set_cmd_validate(RIG *rig)
|
|||
struct rig_state *state = &rig->state;
|
||||
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
|
||||
char valcmd[16];
|
||||
int retries=8;
|
||||
int retry=0;
|
||||
int retries = 8;
|
||||
int retry = 0;
|
||||
int sleepms = 50;
|
||||
int rc = -RIG_EPROTO;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: priv->cmd_str=%s\n", __func__, priv->cmd_str);
|
||||
if ((strncmp(priv->cmd_str,"FA",2)==0) && (strlen(priv->cmd_str)>3))
|
||||
|
||||
if ((strncmp(priv->cmd_str, "FA", 2) == 0) && (strlen(priv->cmd_str) > 3))
|
||||
{
|
||||
strcpy(valcmd,"FA;");
|
||||
strcpy(valcmd, "FA;");
|
||||
}
|
||||
else if ((strncmp(priv->cmd_str,"FB",2)==0) && (strlen(priv->cmd_str)>3))
|
||||
else if ((strncmp(priv->cmd_str, "FB", 2) == 0) && (strlen(priv->cmd_str) > 3))
|
||||
{
|
||||
strcpy(valcmd,"FB;");
|
||||
strcpy(valcmd, "FB;");
|
||||
}
|
||||
else if ((strncmp(priv->cmd_str,"MD",2)==0) && (strlen(priv->cmd_str)>3))
|
||||
else if ((strncmp(priv->cmd_str, "MD", 2) == 0) && (strlen(priv->cmd_str) > 3))
|
||||
{
|
||||
strcpy(valcmd,priv->cmd_str); // pull the needed part of the cmd
|
||||
valcmd[3]=';';
|
||||
valcmd[4]=0;
|
||||
strcpy(valcmd, priv->cmd_str); // pull the needed part of the cmd
|
||||
valcmd[3] = ';';
|
||||
valcmd[4] = 0;
|
||||
}
|
||||
else if ((strncmp(priv->cmd_str,"TX",2)==0) && (strlen(priv->cmd_str)>3))
|
||||
else if ((strncmp(priv->cmd_str, "TX", 2) == 0) && (strlen(priv->cmd_str) > 3))
|
||||
{
|
||||
strcpy(valcmd,"TX;");
|
||||
strcpy(valcmd, "TX;");
|
||||
}
|
||||
else if ((strncmp(priv->cmd_str,"FT",2)==0) && (strlen(priv->cmd_str)>3))
|
||||
else if ((strncmp(priv->cmd_str, "FT", 2) == 0) && (strlen(priv->cmd_str) > 3))
|
||||
{
|
||||
strcpy(valcmd,"FT;");
|
||||
strcpy(valcmd, "FT;");
|
||||
}
|
||||
else if ((strncmp(priv->cmd_str,"AI",2)==0) && (strlen(priv->cmd_str)>3))
|
||||
else if ((strncmp(priv->cmd_str, "AI", 2) == 0) && (strlen(priv->cmd_str) > 3))
|
||||
{
|
||||
strcpy(valcmd,"AI;");
|
||||
strcpy(valcmd, "AI;");
|
||||
}
|
||||
else if ((strncmp(priv->cmd_str,"VS",2)==0) && (strlen(priv->cmd_str)>3))
|
||||
else if ((strncmp(priv->cmd_str, "VS", 2) == 0) && (strlen(priv->cmd_str) > 3))
|
||||
{
|
||||
strcpy(valcmd,"VS;");
|
||||
strcpy(valcmd, "VS;");
|
||||
}
|
||||
else
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: %s not implemented\n", __func__, priv->cmd_str);
|
||||
return -RIG_ENIMPL;
|
||||
}
|
||||
|
||||
while (rc != RIG_OK && retry++ < retries)
|
||||
{
|
||||
int bytes;
|
||||
char cmd[256]; // big enough
|
||||
rig_flush(&state->rigport); /* discard any unsolicited data */
|
||||
snprintf(cmd,sizeof(cmd),"%s%s",priv->cmd_str,valcmd);
|
||||
snprintf(cmd, sizeof(cmd), "%s%s", priv->cmd_str, valcmd);
|
||||
rc = write_block(&state->rigport, cmd, strlen(cmd));
|
||||
if (rc != RIG_OK) return -RIG_EIO;
|
||||
|
||||
if (rc != RIG_OK) { return -RIG_EIO; }
|
||||
|
||||
bytes = read_string(&state->rigport, priv->ret_data, sizeof(priv->ret_data),
|
||||
&cat_term, sizeof(cat_term));
|
||||
if (strncmp(priv->cmd_str,"FT",2)==0 && strncmp(priv->ret_data,"FT",2)==0)
|
||||
&cat_term, sizeof(cat_term));
|
||||
|
||||
if (strncmp(priv->cmd_str, "FT", 2) == 0
|
||||
&& strncmp(priv->ret_data, "FT", 2) == 0)
|
||||
{
|
||||
// FT command does not echo what's sent so we just check the basic command
|
||||
return RIG_OK;
|
||||
}
|
||||
if (strncmp(priv->cmd_str,"TX",2)==0 && strncmp(priv->ret_data,"TX",2)==0)
|
||||
|
||||
if (strncmp(priv->cmd_str, "TX", 2) == 0
|
||||
&& strncmp(priv->ret_data, "TX", 2) == 0)
|
||||
{
|
||||
// TX command does not echo what's sent so we just check the basic command
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
if (bytes > 0)
|
||||
{
|
||||
// if they match we are validated
|
||||
if (strcmp(priv->cmd_str, priv->ret_data)==0) return RIG_OK;
|
||||
else rc = -RIG_EPROTO;
|
||||
if (strcmp(priv->cmd_str, priv->ret_data) == 0) { return RIG_OK; }
|
||||
else { rc = -RIG_EPROTO; }
|
||||
}
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: cmd validation failed, '%s'!='%s', try#%d\n", __func__, priv->cmd_str, priv->ret_data, retry);
|
||||
hl_usleep(sleepms*1000);
|
||||
}
|
||||
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: cmd validation failed, '%s'!='%s', try#%d\n",
|
||||
__func__, priv->cmd_str, priv->ret_data, retry);
|
||||
hl_usleep(sleepms * 1000);
|
||||
}
|
||||
|
||||
return -RIG_EPROTO;
|
||||
}
|
||||
/*
|
||||
|
@ -9498,7 +9550,9 @@ int newcat_set_cmd(RIG *rig)
|
|||
rig_debug(RIG_DEBUG_TRACE, "cmd_str = %s\n", priv->cmd_str);
|
||||
|
||||
rc = newcat_set_cmd_validate(rig);
|
||||
if (rc==RIG_OK) {
|
||||
|
||||
if (rc == RIG_OK)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: cmd_validate OK\n", __func__);
|
||||
return RIG_OK;
|
||||
}
|
||||
|
@ -9507,7 +9561,9 @@ int newcat_set_cmd(RIG *rig)
|
|||
rig_debug(RIG_DEBUG_TRACE, "%s: set_cmd_validate failed\n", __func__);
|
||||
return rc;
|
||||
}
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: newcat_set_cmd_validate not implemented...continuing\n", __func__);
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE,
|
||||
"%s: newcat_set_cmd_validate not implemented...continuing\n", __func__);
|
||||
|
||||
if (RIG_OK != (rc = write_block(&state->rigport, priv->cmd_str,
|
||||
strlen(priv->cmd_str))))
|
||||
|
@ -9521,9 +9577,10 @@ int newcat_set_cmd(RIG *rig)
|
|||
return RIG_OK;
|
||||
}
|
||||
|
||||
if (strncmp(priv->cmd_str,"BS",2)==0)
|
||||
{ // the BS command needs time to do it's thing
|
||||
hl_usleep(200*1000);
|
||||
if (strncmp(priv->cmd_str, "BS", 2) == 0)
|
||||
{
|
||||
// the BS command needs time to do it's thing
|
||||
hl_usleep(200 * 1000);
|
||||
priv->cache_start.tv_sec = 0; // invalidate the cache
|
||||
}
|
||||
|
||||
|
@ -9596,14 +9653,15 @@ int newcat_set_cmd(RIG *rig)
|
|||
*/
|
||||
if (priv->question_mark_response_means_rejected)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Command rejected by the rig (set): '%s'\n", __func__,
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Command rejected by the rig (set): '%s'\n",
|
||||
__func__,
|
||||
priv->cmd_str);
|
||||
return -RIG_ERJCTED;
|
||||
}
|
||||
|
||||
/* Rig busy wait please */
|
||||
rig_debug(RIG_DEBUG_WARN, "%s: Rig busy - retrying: '%s'\n", __func__,
|
||||
priv->cmd_str);
|
||||
priv->cmd_str);
|
||||
|
||||
/* read/flush the verify command reply which should still be there */
|
||||
if ((rc = read_string(&state->rigport, priv->ret_data, sizeof(priv->ret_data),
|
||||
|
|
|
@ -1636,6 +1636,7 @@ int HAMLIB_API parse_hoststr(char *hoststr, char host[256], char port[6])
|
|||
|
||||
// Handle device names 1st
|
||||
if (strstr(hoststr, "/dev")) { return -1; }
|
||||
|
||||
if (strstr(hoststr, "/")) { return -1; } // posible path -- no hostname starts with /
|
||||
|
||||
if (strncasecmp(hoststr, "com", 3) == 0) { return -1; }
|
||||
|
|
|
@ -428,7 +428,8 @@ RIG *HAMLIB_API rig_init(rig_model_t rig_model)
|
|||
// if we don't have list1 we'll try list2
|
||||
if (rs->rx_range_list == NULL)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: rx_range_list1 is empty, using rx_range_list2\n", __func__);
|
||||
rig_debug(RIG_DEBUG_TRACE,
|
||||
"%s: rx_range_list1 is empty, using rx_range_list2\n", __func__);
|
||||
memcpy(rs->tx_range_list, caps->rx_range_list2,
|
||||
sizeof(struct freq_range_list)*FRQRANGESIZ);
|
||||
memcpy(rs->rx_range_list, caps->tx_range_list2,
|
||||
|
|
Ładowanie…
Reference in New Issue