kopia lustrzana https://github.com/Hamlib/Hamlib
astyle files
rodzic
87a83ffbb1
commit
677ccac4bc
|
@ -385,15 +385,19 @@ static int dummy_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
channel_t *curr = priv->curr;
|
||||
char fstr[20];
|
||||
|
||||
if (vfo == RIG_VFO_CURR) vfo = priv->curr_vfo;
|
||||
if (vfo == RIG_VFO_CURR) { vfo = priv->curr_vfo; }
|
||||
|
||||
usleep(CMDSLEEP);
|
||||
sprintf_freq(fstr, freq);
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s %s\n", __func__,
|
||||
rig_strvfo(vfo), fstr);
|
||||
curr->freq = freq;
|
||||
if (vfo == RIG_VFO_A) priv->freq_vfoa = freq;
|
||||
else if (vfo == RIG_VFO_B) priv->freq_vfob = freq;
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: freq_vfoa=%.0f, freq_vfob=%.0f\n", __func__, priv->freq_vfoa, priv->freq_vfob);
|
||||
|
||||
if (vfo == RIG_VFO_A) { priv->freq_vfoa = freq; }
|
||||
else if (vfo == RIG_VFO_B) { priv->freq_vfob = freq; }
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: freq_vfoa=%.0f, freq_vfob=%.0f\n", __func__,
|
||||
priv->freq_vfoa, priv->freq_vfob);
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
@ -402,11 +406,14 @@ static int dummy_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
{
|
||||
struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv;
|
||||
|
||||
if (vfo == RIG_VFO_CURR) vfo = priv->curr_vfo;
|
||||
if (vfo == RIG_VFO_CURR) { vfo = priv->curr_vfo; }
|
||||
|
||||
usleep(CMDSLEEP);
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__, rig_strvfo(vfo));
|
||||
if (vfo == RIG_VFO_A) *freq = priv->freq_vfoa;
|
||||
else if (vfo == RIG_VFO_B) *freq = priv->freq_vfob;
|
||||
|
||||
if (vfo == RIG_VFO_A) { *freq = priv->freq_vfoa; }
|
||||
else if (vfo == RIG_VFO_B) { *freq = priv->freq_vfob; }
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: freq=%.0f\n", __func__, *freq);
|
||||
return RIG_OK;
|
||||
}
|
||||
|
|
|
@ -121,7 +121,8 @@ static int netrigctl_vfostr(RIG *rig, char *vfostr, int len, vfo_t vfo)
|
|||
if (vfo == RIG_VFO_CURR)
|
||||
{
|
||||
vfo = priv->vfo_curr;
|
||||
if (vfo == RIG_VFO_NONE) vfo = RIG_VFO_A;
|
||||
|
||||
if (vfo == RIG_VFO_NONE) { vfo = RIG_VFO_A; }
|
||||
}
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: vfo_opt=%d\n", __func__, rig->state.vfo_opt);
|
||||
|
@ -201,8 +202,10 @@ static int netrigctl_open(RIG *rig)
|
|||
rig_debug(RIG_DEBUG_WARN, "%s: chk_vfo error: %s\n", __func__,
|
||||
rigerror(ret));
|
||||
}
|
||||
else {
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: unknown return from netrigctl_transaction=%d\n", __func__, ret);
|
||||
else
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: unknown return from netrigctl_transaction=%d\n",
|
||||
__func__, ret);
|
||||
}
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: vfo_mode=%d\n", __func__,
|
||||
|
@ -617,7 +620,8 @@ static int netrigctl_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
char vfotmp[16];
|
||||
#endif
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called, vfo=%s, freq=%.0f\n", __func__, rig_strvfo(vfo), *freq);
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called, vfo=%s, freq=%.0f\n", __func__,
|
||||
rig_strvfo(vfo), *freq);
|
||||
|
||||
ret = netrigctl_vfostr(rig, vfostr, sizeof(vfostr), vfo);
|
||||
|
||||
|
@ -627,7 +631,8 @@ static int netrigctl_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
|
||||
ret = netrigctl_transaction(rig, cmd, len, buf);
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: cmd=%s, reply=%s\n", __func__, strtok(cmd,"\r\n"), buf);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: cmd=%s, reply=%s\n", __func__, strtok(cmd,
|
||||
"\r\n"), buf);
|
||||
|
||||
if (ret <= 0)
|
||||
{
|
||||
|
@ -2187,10 +2192,12 @@ static int netrigctl_set_vfo_opt(RIG *rig, int status)
|
|||
|
||||
sprintf(cmdbuf, "\\set_vfo_opt %d\n", status);
|
||||
ret = netrigctl_transaction(rig, cmdbuf, strlen(cmdbuf), buf);
|
||||
|
||||
if (ret > 0)
|
||||
{
|
||||
return -RIG_EPROTO;
|
||||
}
|
||||
|
||||
rig->state.vfo_opt = status;
|
||||
return RIG_OK;
|
||||
}
|
||||
|
|
|
@ -308,13 +308,17 @@ static int ic910_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
{
|
||||
*freq = origfreq;
|
||||
}
|
||||
else if (RIG_VFO_TX == vfo) {
|
||||
else if (RIG_VFO_TX == vfo)
|
||||
{
|
||||
vfo = priv->tx_vfo;
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: VFO_TX asked for so vfo=%s\n", __func__, rig_strvfo(vfo));
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: VFO_TX asked for so vfo=%s\n", __func__,
|
||||
rig_strvfo(vfo));
|
||||
}
|
||||
else if (RIG_VFO_RX == vfo) {
|
||||
else if (RIG_VFO_RX == vfo)
|
||||
{
|
||||
vfo = priv->rx_vfo;
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: VFO_RX asked for so vfo=%s\n", __func__, rig_strvfo(vfo));
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: VFO_RX asked for so vfo=%s\n", __func__,
|
||||
rig_strvfo(vfo));
|
||||
}
|
||||
else { retval = -RIG_EVFO; }
|
||||
|
||||
|
|
|
@ -1974,9 +1974,10 @@ int icom_set_vfo(RIG *rig, vfo_t vfo)
|
|||
else if (vfo == RIG_VFO_TX)
|
||||
{
|
||||
vfo = RIG_VFO_A;
|
||||
if (VFO_HAS_A_B_ONLY && rig->state.cache.satmode) vfo = RIG_VFO_B;
|
||||
else if (VFO_HAS_MAIN_SUB_ONLY) vfo = RIG_VFO_SUB;
|
||||
else if (VFO_HAS_MAIN_SUB_A_B_ONLY && rig->state.cache.satmode) vfo = RIG_VFO_SUB;
|
||||
|
||||
if (VFO_HAS_A_B_ONLY && rig->state.cache.satmode) { vfo = RIG_VFO_B; }
|
||||
else if (VFO_HAS_MAIN_SUB_ONLY) { vfo = RIG_VFO_SUB; }
|
||||
else if (VFO_HAS_MAIN_SUB_A_B_ONLY && rig->state.cache.satmode) { vfo = RIG_VFO_SUB; }
|
||||
}
|
||||
|
||||
if ((vfo == RIG_VFO_A || vfo == RIG_VFO_B) && !VFO_HAS_A_B && VFO_HAS_MAIN_SUB)
|
||||
|
@ -1995,7 +1996,9 @@ int icom_set_vfo(RIG *rig, vfo_t vfo)
|
|||
__func__);
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: debug#1\n", __func__);
|
||||
|
||||
if (vfo != priv->curr_vfo)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: VFO changing from %s to %s\n", __func__,
|
||||
|
@ -2004,6 +2007,7 @@ rig_debug(RIG_DEBUG_TRACE,"%s: debug#1\n", __func__);
|
|||
}
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: debug#2\n", __func__);
|
||||
|
||||
switch (vfo)
|
||||
{
|
||||
case RIG_VFO_A:
|
||||
|
@ -3734,22 +3738,30 @@ int icom_get_split_vfos(RIG *rig, vfo_t *rx_vfo, vfo_t *tx_vfo)
|
|||
if (VFO_HAS_A_B_ONLY)
|
||||
{
|
||||
*rx_vfo = *tx_vfo = RIG_VFO_A;
|
||||
if (priv->split_on) {
|
||||
|
||||
if (priv->split_on)
|
||||
{
|
||||
*rx_vfo = RIG_VFO_A;
|
||||
*tx_vfo = RIG_VFO_B; /* rig doesn't enforce this but
|
||||
convention is needed here */
|
||||
}
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: VFO_HAS_A_B_ONLY, split=%d, rx=%s, tx=%s\n", __func__,
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: VFO_HAS_A_B_ONLY, split=%d, rx=%s, tx=%s\n",
|
||||
__func__,
|
||||
priv->split_on, rig_strvfo(*rx_vfo), rig_strvfo(*tx_vfo));
|
||||
}
|
||||
else if (VFO_HAS_MAIN_SUB_ONLY)
|
||||
{
|
||||
*rx_vfo = *tx_vfo = RIG_VFO_MAIN;
|
||||
if (priv->split_on) {
|
||||
|
||||
if (priv->split_on)
|
||||
{
|
||||
*rx_vfo = RIG_VFO_MAIN;
|
||||
*tx_vfo = RIG_VFO_SUB;
|
||||
}
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: VFO_HAS_MAIN_SUB_ONLY, split=%d, rx=%s, tx=%s\n",
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE,
|
||||
"%s: VFO_HAS_MAIN_SUB_ONLY, split=%d, rx=%s, tx=%s\n",
|
||||
__func__, priv->split_on, rig_strvfo(*rx_vfo), rig_strvfo(*tx_vfo));
|
||||
}
|
||||
else if (VFO_HAS_MAIN_SUB_A_B_ONLY)
|
||||
|
@ -4659,7 +4671,8 @@ int icom_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
|
|||
rig->state.cache.satmode = 1;
|
||||
priv->tx_vfo = RIG_VFO_SUB;
|
||||
}
|
||||
else if ((tx_vfo == RIG_VFO_B && rig->state.cache.satmode) || (tx_vfo == RIG_VFO_A
|
||||
else if ((tx_vfo == RIG_VFO_B && rig->state.cache.satmode)
|
||||
|| (tx_vfo == RIG_VFO_A
|
||||
&& rig->state.cache.satmode))
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: VFO_B and satmode is on so turning off\n",
|
||||
|
@ -4670,7 +4683,9 @@ int icom_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
|
|||
}
|
||||
else if (tx_vfo == RIG_VFO_SUB && rig->state.cache.satmode && split == 1)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: rig in satmode so setting split on is redundant and will create error...returning OK\n", __func__);
|
||||
rig_debug(RIG_DEBUG_VERBOSE,
|
||||
"%s: rig in satmode so setting split on is redundant and will create error...returning OK\n",
|
||||
__func__);
|
||||
// we'll return OK anyways as this is a split mode
|
||||
// and gpredict wants to see the OK response here
|
||||
return RIG_OK; // we'll return OK anyways as this is a split mode
|
||||
|
@ -7123,7 +7138,9 @@ static int set_vfo_curr(RIG *rig, vfo_t vfo, vfo_t curr_vfo)
|
|||
// only need to set vfo if it's changed
|
||||
else if (priv->curr_vfo != vfo)
|
||||
{
|
||||
if (!(VFO_HAS_MAIN_SUB_A_B_ONLY && !priv->split_on && !rig->state.cache.satmode && vfo == RIG_VFO_SUB && priv->curr_vfo == RIG_VFO_B)) {
|
||||
if (!(VFO_HAS_MAIN_SUB_A_B_ONLY && !priv->split_on && !rig->state.cache.satmode
|
||||
&& vfo == RIG_VFO_SUB && priv->curr_vfo == RIG_VFO_B))
|
||||
{
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: setting new vfo=%s\n", __func__,
|
||||
rig_strvfo(vfo));
|
||||
retval = rig_set_vfo(rig, vfo);
|
||||
|
|
50
src/rig.c
50
src/rig.c
|
@ -1364,7 +1364,8 @@ int HAMLIB_API rig_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
|
||||
// If we're in vfo_mode then rigctld will do any VFO swapping we need
|
||||
if ((caps->targetable_vfo & RIG_TARGETABLE_FREQ)
|
||||
|| vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo || rig->state.vfo_opt == 1)
|
||||
|| vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo
|
||||
|| rig->state.vfo_opt == 1)
|
||||
{
|
||||
retcode = caps->get_freq(rig, vfo, freq);
|
||||
|
||||
|
@ -1803,21 +1804,29 @@ int HAMLIB_API rig_set_vfo(RIG *rig, vfo_t vfo)
|
|||
}
|
||||
|
||||
// make sure we are asking for a VFO that the rig actually has
|
||||
if ((vfo == RIG_VFO_A || vfo == RIG_VFO_B) && !VFO_HAS_A_B) {
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: rig does not have %s\n", __func__, rig_strvfo(vfo));
|
||||
if ((vfo == RIG_VFO_A || vfo == RIG_VFO_B) && !VFO_HAS_A_B)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: rig does not have %s\n", __func__,
|
||||
rig_strvfo(vfo));
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
if ((vfo == RIG_VFO_MAIN || vfo == RIG_VFO_SUB) && !VFO_HAS_MAIN_SUB)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: rig does not have %s\n", __func__, rig_strvfo(vfo));
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: rig does not have %s\n", __func__,
|
||||
rig_strvfo(vfo));
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
if (vfo == RIG_VFO_RX)
|
||||
{
|
||||
vfo = RIG_VFO_A;
|
||||
if (VFO_HAS_MAIN_SUB_ONLY) vfo = RIG_VFO_MAIN;
|
||||
if (VFO_HAS_MAIN_SUB_A_B_ONLY) vfo = RIG_VFO_MAIN;
|
||||
|
||||
if (VFO_HAS_MAIN_SUB_ONLY) { vfo = RIG_VFO_MAIN; }
|
||||
|
||||
if (VFO_HAS_MAIN_SUB_A_B_ONLY) { vfo = RIG_VFO_MAIN; }
|
||||
}
|
||||
|
||||
if (vfo == RIG_VFO_TX)
|
||||
{
|
||||
split_t split = 0;
|
||||
|
@ -1829,12 +1838,20 @@ int HAMLIB_API rig_set_vfo(RIG *rig, vfo_t vfo)
|
|||
rig_get_split(rig, vfo, &split);
|
||||
int satmode = rig->state.cache.satmode;
|
||||
vfo = RIG_VFO_A;
|
||||
if (split) vfo = RIG_VFO_B;
|
||||
if (VFO_HAS_MAIN_SUB_ONLY && !split && !satmode) vfo = RIG_VFO_MAIN;
|
||||
if (VFO_HAS_MAIN_SUB_ONLY && (split || satmode)) vfo = RIG_VFO_SUB;
|
||||
if (VFO_HAS_MAIN_SUB_A_B_ONLY && split) vfo = RIG_VFO_B;
|
||||
if (VFO_HAS_MAIN_SUB_A_B_ONLY && satmode) vfo = RIG_VFO_SUB;
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: RIG_VFO_TX changed to %s, split=%d, satmode=%d\n", __func__, rig_strvfo(vfo), split, satmode);
|
||||
|
||||
if (split) { vfo = RIG_VFO_B; }
|
||||
|
||||
if (VFO_HAS_MAIN_SUB_ONLY && !split && !satmode) { vfo = RIG_VFO_MAIN; }
|
||||
|
||||
if (VFO_HAS_MAIN_SUB_ONLY && (split || satmode)) { vfo = RIG_VFO_SUB; }
|
||||
|
||||
if (VFO_HAS_MAIN_SUB_A_B_ONLY && split) { vfo = RIG_VFO_B; }
|
||||
|
||||
if (VFO_HAS_MAIN_SUB_A_B_ONLY && satmode) { vfo = RIG_VFO_SUB; }
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE,
|
||||
"%s: RIG_VFO_TX changed to %s, split=%d, satmode=%d\n", __func__,
|
||||
rig_strvfo(vfo), split, satmode);
|
||||
}
|
||||
|
||||
caps = rig->caps;
|
||||
|
@ -1868,7 +1885,8 @@ int HAMLIB_API rig_set_vfo(RIG *rig, vfo_t vfo)
|
|||
// we only get the freq if we set the vfo OK
|
||||
if (retcode == RIG_OK && caps->get_freq)
|
||||
{
|
||||
if (caps->get_freq) {
|
||||
if (caps->get_freq)
|
||||
{
|
||||
retcode = caps->get_freq(rig, vfo, &curr_freq);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: retcode from rig_get_freq = %s\n", __func__,
|
||||
rigerror(retcode));
|
||||
|
@ -2077,6 +2095,7 @@ int HAMLIB_API rig_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
|
|||
case RIG_PTT_SERIAL_RTS:
|
||||
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: PTT RTS\n", __func__);
|
||||
|
||||
/* when the PTT port is not the control port we want to free the
|
||||
port when PTT is reset and seize the port when PTT is set,
|
||||
this allows limited sharing of the PTT port between
|
||||
|
@ -2147,7 +2166,9 @@ int HAMLIB_API rig_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
|
|||
|
||||
rig->state.cache.ptt = ptt;
|
||||
elapsed_ms(&rig->state.cache.time_ptt, ELAPSED_SET);
|
||||
if (retcode != RIG_OK) rig_debug(RIG_DEBUG_ERR, "%s: return code=%d\n", __func__, retcode);
|
||||
|
||||
if (retcode != RIG_OK) { rig_debug(RIG_DEBUG_ERR, "%s: return code=%d\n", __func__, retcode); }
|
||||
|
||||
return retcode;
|
||||
}
|
||||
|
||||
|
@ -4916,6 +4937,7 @@ int HAMLIB_API rig_set_vfo_opt(RIG *rig, int status)
|
|||
{
|
||||
return -RIG_ENAVAIL;
|
||||
}
|
||||
|
||||
return rig->caps->set_vfo_opt(rig, status);
|
||||
}
|
||||
|
||||
|
|
|
@ -273,7 +273,8 @@ int main(int argc, char *argv[])
|
|||
|
||||
rig_set_debug(verbose);
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "ampctl %s\nLast commit was %s\n", hamlib_version, HAMLIBDATETIME);
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "ampctl %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");
|
||||
|
||||
|
|
|
@ -71,8 +71,10 @@ int main()
|
|||
if (my_rig->caps->rig_model == RIG_MODEL_NETRIGCTL)
|
||||
{
|
||||
status = rig_set_vfo_opt(my_rig, 1);
|
||||
|
||||
if (status != RIG_OK) { printf("set_vfo_opt failed?? Err=%s\n", rigerror(status)); }
|
||||
}
|
||||
|
||||
status = rig_get_freq(my_rig, RIG_VFO_CURR, &freq);
|
||||
|
||||
/* Main VFO frequency */
|
||||
|
@ -143,6 +145,7 @@ int main()
|
|||
rig_close(my_rig);
|
||||
|
||||
int loops = 1;
|
||||
|
||||
while (loops--)
|
||||
{
|
||||
retcode = rig_open(my_rig);
|
||||
|
|
|
@ -1650,6 +1650,7 @@ int rigctl_parse(RIG *my_rig, FILE *fin, FILE *fout, char *argv[], int argc,
|
|||
p3 ? p3 : "");
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: vfo_opt=%d\n", __func__, *vfo_opt);
|
||||
|
||||
if (retcode == RIG_EIO)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: RIG_EIO?\n", __func__);
|
||||
|
|
|
@ -299,7 +299,8 @@ int main(int argc, char *argv[])
|
|||
|
||||
rig_set_debug(verbose);
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "rotctl %s\nLast commit was %s\n", hamlib_version, HAMLIBDATETIME);
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "rotctl %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");
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue