Fix merge of icom.c

pull/252/head
Michael Black W9MDB 2020-05-11 18:05:11 -05:00
commit 74cdd96eda
7 zmienionych plików z 181 dodań i 34 usunięć

Wyświetl plik

@ -961,14 +961,20 @@ static int flrig_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
return retval; return retval;
} }
if (read_transaction(rig, xml, sizeof(xml)) > 0) if ((retval = read_transaction(rig, xml, sizeof(xml))))
{
rig_debug(RIG_DEBUG_ERR, "%s: read_transation failed retval=%d\n", __func__,
retval);
return retval;
}
if (strstr(xml, "methodResponse>"))
{ {
xml_parse(xml, value, sizeof(value)); xml_parse(xml, value, sizeof(value));
if (strlen(value) == 0) if (strlen(value) == 0)
{ {
rig_debug(RIG_DEBUG_ERR, "%s: retries=%d\n", __func__, retries); rig_debug(RIG_DEBUG_ERR, "%s: retries=%d\n", __func__, retries);
//hl_usleep(10*1000);
} }
} }
} }
@ -1128,6 +1134,7 @@ static int flrig_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
do do
{ {
value[0] = 0;
pxml = xml_build("rig.get_ptt", NULL, xml, sizeof(xml)); pxml = xml_build("rig.get_ptt", NULL, xml, sizeof(xml));
retval = write_transaction(rig, pxml, strlen(pxml)); retval = write_transaction(rig, pxml, strlen(pxml));
@ -1137,7 +1144,14 @@ static int flrig_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
return retval; return retval;
} }
if (read_transaction(rig, xml, sizeof(xml) > 0)) retval = read_transaction(rig, xml, sizeof(xml));
if (retval < 0)
{
return retval;
}
if (strstr(xml, "methodResponse>"))
{ {
xml_parse(xml, value, sizeof(value)); xml_parse(xml, value, sizeof(value));
*ptt = atoi(value); *ptt = atoi(value);
@ -1663,6 +1677,7 @@ static int flrig_get_vfo(RIG *rig, vfo_t *vfo)
do do
{ {
value[0] = 0;
pxml = xml_build("rig.get_AB", NULL, xml, sizeof(xml)); pxml = xml_build("rig.get_AB", NULL, xml, sizeof(xml));
retval = write_transaction(rig, pxml, strlen(pxml)); retval = write_transaction(rig, pxml, strlen(pxml));
@ -1671,9 +1686,15 @@ static int flrig_get_vfo(RIG *rig, vfo_t *vfo)
return retval; return retval;
} }
if (read_transaction(rig, xml, sizeof(xml)) > 0) retval = read_transaction(rig, xml, sizeof(xml));
if (retval < 0)
{
return retval;
}
if (strstr(xml, "methodResponse>"))
{ {
read_transaction(rig, xml, sizeof(xml));
xml_parse(xml, value, sizeof(value)); xml_parse(xml, value, sizeof(value));
rig_debug(RIG_DEBUG_TRACE, "%s: vfo value=%s\n", __func__, value); rig_debug(RIG_DEBUG_TRACE, "%s: vfo value=%s\n", __func__, value);
} }
@ -1849,7 +1870,14 @@ static int flrig_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
return retval; return retval;
} }
if (read_transaction(rig, xml, sizeof(xml)) > 0) retval = read_transaction(rig, xml, sizeof(xml));
if (retval < 0)
{
return retval;
}
if (strstr(xml, "methodResponse>"))
{ {
xml_parse(xml, value, sizeof(value)); xml_parse(xml, value, sizeof(value));
} }

Wyświetl plik

@ -266,21 +266,27 @@ static int ic910_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
{ {
int retval; int retval;
freq_t origfreq; freq_t origfreq;
vfo_t vfo_save;
/* start off by reading the current VFO frequency */ /* start off by reading the current VFO frequency */
if ((retval = icom_get_freq(rig, RIG_VFO_CURR, &origfreq)) != RIG_OK) { return retval; } if ((retval = icom_get_freq(rig, RIG_VFO_CURR, &origfreq)) != RIG_OK) { return retval; }
vfo_save = rig->state.current_vfo;
rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s\n", __func__, rig_strvfo(vfo));
if (RIG_VFO_A == vfo || RIG_VFO_B == vfo) if (RIG_VFO_A == vfo || RIG_VFO_B == vfo)
{ {
/* switch to desired VFO and read its frequency */ /* switch to desired VFO and read its frequency */
if ((retval = icom_set_vfo(rig, vfo)) != RIG_OK) { return retval; } if (vfo_save != vfo)
{
if ((retval = icom_set_vfo(rig, vfo)) != RIG_OK) { return retval; }
}
if ((retval = icom_get_freq(rig, vfo, freq)) != RIG_OK) { return retval; } if ((retval = icom_get_freq(rig, vfo, freq)) != RIG_OK) { return retval; }
if (*freq != origfreq) if (vfo_save != vfo)
{ {
/* swap VFOs back as original was the other one */ /* swap VFOs back as original was the other one */
icom_set_vfo(rig, RIG_VFO_A == vfo ? RIG_VFO_B : RIG_VFO_A); icom_set_vfo(rig, vfo_save);
} }
} }
else if (RIG_VFO_MAIN == vfo || RIG_VFO_SUB == vfo) else if (RIG_VFO_MAIN == vfo || RIG_VFO_SUB == vfo)
@ -480,7 +486,7 @@ const struct rig_caps ic910_caps =
.max_rit = Hz(0), /* SSB,CW: +-1.0kHz FM: +-5.0kHz */ .max_rit = Hz(0), /* SSB,CW: +-1.0kHz FM: +-5.0kHz */
.max_xit = Hz(0), .max_xit = Hz(0),
.max_ifshift = Hz(0), /* 1.2kHz manual knob */ .max_ifshift = Hz(0), /* 1.2kHz manual knob */
.targetable_vfo = RIG_TARGETABLE_FREQ, // .targetable_vfo = RIG_TARGETABLE_FREQ,
.vfo_ops = IC910_VFO_OPS, .vfo_ops = IC910_VFO_OPS,
.scan_ops = IC910_SCAN_OPS, .scan_ops = IC910_SCAN_OPS,
.transceive = RIG_TRN_RIG, .transceive = RIG_TRN_RIG,
@ -566,7 +572,7 @@ const struct rig_caps ic910_caps =
.set_ptt = icom_set_ptt, .set_ptt = icom_set_ptt,
.get_ptt = icom_get_ptt, .get_ptt = icom_get_ptt,
.set_vfo = icom_set_vfo, .set_vfo = icom_set_vfo,
.get_ts = icom_get_ts, .get_ts = icom_get_ts,
.set_ts = icom_set_ts, .set_ts = icom_set_ts,
.get_func = ic910_get_func, .get_func = ic910_get_func,

Wyświetl plik

@ -766,6 +766,7 @@ icom_rig_open(RIG *rig)
} }
retval = rig_get_func(rig, RIG_VFO_CURR, RIG_FUNC_SATMODE, &satmode); retval = rig_get_func(rig, RIG_VFO_CURR, RIG_FUNC_SATMODE, &satmode);
priv->satmode = satmode;
rig_debug(RIG_DEBUG_VERBOSE, "%s: satmode=%d\n", __func__, satmode); rig_debug(RIG_DEBUG_VERBOSE, "%s: satmode=%d\n", __func__, satmode);
// RIG_OK return means this rig has satmode capabiltiy and Main/Sub VFOs // RIG_OK return means this rig has satmode capabiltiy and Main/Sub VFOs
@ -1019,6 +1020,17 @@ int icom_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
} }
priv->curr_freq = freq; priv->curr_freq = freq;
switch(vfo)
{
case RIG_VFO_A: priv->vfoa_freq = freq;break;
case RIG_VFO_B: priv->vfob_freq = freq;break;
case RIG_VFO_MAIN: priv->sub_freq = freq;break;
case RIG_VFO_SUB: priv->main_freq = freq;break;
default:
rig_debug(RIG_DEBUG_ERR,"%s: unknown VFO? VFO=%s\n", __func__, rig_strvfo(vfo));
}
return RIG_OK; return RIG_OK;
} }
@ -1043,6 +1055,20 @@ int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
rs = &rig->state; rs = &rig->state;
priv = (struct icom_priv_data *) rs->priv; priv = (struct icom_priv_data *) rs->priv;
if (rig->caps->rig_model == RIG_MODEL_IC910)
{
ptt_t ptt;
retval = rig_get_ptt(rig,RIG_VFO_CURR,&ptt);
if (retval != RIG_OK) {
return retval;
}
if (ptt) {
rig_debug(RIG_DEBUG_TRACE, "%s: split is on so returning last known freq\n", __func__);
*freq = priv->vfoa_freq;
return RIG_OK;
}
}
#if 0 // disabled to test if IC9700 satmode/gpredict still works OK #if 0 // disabled to test if IC9700 satmode/gpredict still works OK
if (priv->curr_vfo == RIG_VFO_NONE) if (priv->curr_vfo == RIG_VFO_NONE)
@ -1095,6 +1121,13 @@ int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
} }
} }
if (vfo == RIG_VFO_CURR)
{
vfo = priv->curr_vfo;
rig_debug(RIG_DEBUG_VERBOSE, "%s: CurrVFO changed to %s\n", __func__, rig_strvfo(vfo));
}
retval = set_vfo_curr(rig, vfo, priv->curr_vfo); retval = set_vfo_curr(rig, vfo, priv->curr_vfo);
if (retval != RIG_OK) if (retval != RIG_OK)
@ -1107,9 +1140,19 @@ int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
// Pick the appropriate VFO when VFO_RX is requested // Pick the appropriate VFO when VFO_RX is requested
if (vfo == RIG_VFO_RX) if (vfo == RIG_VFO_RX)
{ {
rig_debug(RIG_DEBUG_TRACE, "%s: VFO_RX requested, vfo=%s\n", __func__,
rig_strvfo(vfo));
vfo = (rig->state.vfo_list & RIG_VFO_B) ? RIG_VFO_A : RIG_VFO_MAIN; vfo = (rig->state.vfo_list & RIG_VFO_B) ? RIG_VFO_A : RIG_VFO_MAIN;
rig_debug(RIG_DEBUG_TRACE, "%s: VFO_RX requested, new vfo=%s\n", __func__,
rig_strvfo(vfo));
}
else if (vfo == RIG_VFO_TX) {
if (rig->state.vfo_list == VFO_HAS_MAIN_SUB_A_B_ONLY)
{
vfo = RIG_VFO_A;
if (priv->split_on) vfo = RIG_VFO_B;
else if (priv->satmode) vfo = RIG_VFO_SUB;
}
rig_debug(RIG_DEBUG_TRACE, "%s: VFO_TX requested, new vfo=%s\n", __func__,
rig_strvfo(vfo));
} }
rig_debug(RIG_DEBUG_VERBOSE, "%s: using vfo=%s\n", __func__, rig_debug(RIG_DEBUG_VERBOSE, "%s: using vfo=%s\n", __func__,
@ -1175,6 +1218,16 @@ int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
if (vfo == RIG_VFO_MEM && civ_731_mode) { priv->civ_731_mode = 1; } if (vfo == RIG_VFO_MEM && civ_731_mode) { priv->civ_731_mode = 1; }
switch(vfo)
{
case RIG_VFO_A: priv->vfoa_freq = *freq;break;
case RIG_VFO_B: priv->vfob_freq = *freq;break;
case RIG_VFO_MAIN: priv->sub_freq = *freq;break;
case RIG_VFO_SUB: priv->main_freq = *freq;break;
default:
rig_debug(RIG_DEBUG_ERR,"%s: unknown VFO? VFO=%s\n", __func__, rig_strvfo(vfo));
}
return RIG_OK; return RIG_OK;
} }
@ -1942,6 +1995,8 @@ int icom_set_vfo(RIG *rig, vfo_t vfo)
case RIG_VFO_TX: case RIG_VFO_TX:
icvfo = priv->split_on ? S_VFOB : S_VFOA; icvfo = priv->split_on ? S_VFOB : S_VFOA;
vfo = priv->split_on ? RIG_VFO_B : RIG_VFO_A;
rig_debug(RIG_DEBUG_TRACE,"%s: RIG_VFO_TX changing vfo to %s\n", __func__, rig_strvfo(vfo));
break; break;
case RIG_VFO_VFO: case RIG_VFO_VFO:
@ -2048,6 +2103,7 @@ int icom_set_vfo(RIG *rig, vfo_t vfo)
} }
priv->curr_vfo = vfo; priv->curr_vfo = vfo;
rig->state.current_vfo = vfo;
return RIG_OK; return RIG_OK;
} }
@ -3653,6 +3709,7 @@ int icom_get_split_vfos(const RIG *rig, vfo_t *rx_vfo, vfo_t *tx_vfo)
// e.g. IC9700 split on Main/Sub does not work // e.g. IC9700 split on Main/Sub does not work
// only Main VFOA/B and SubRx/MainTx split works // only Main VFOA/B and SubRx/MainTx split works
rig_get_func((RIG *)rig, RIG_VFO_CURR, RIG_FUNC_SATMODE, &satmode); rig_get_func((RIG *)rig, RIG_VFO_CURR, RIG_FUNC_SATMODE, &satmode);
priv->satmode = satmode;
// don't care about retval here...only care about satmode=1 // don't care about retval here...only care about satmode=1
if (satmode) if (satmode)
@ -3717,7 +3774,7 @@ int icom_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
} }
} }
retval = set_vfo_curr(rig, RIG_VFO_CURR, RIG_VFO_CURR); retval = set_vfo_curr(rig, RIG_VFO_TX, RIG_VFO_TX);
if (retval != RIG_OK) if (retval != RIG_OK)
{ {
@ -3733,6 +3790,7 @@ int icom_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
int satmode = 0; int satmode = 0;
// retval not important here...only satmode=1 means anything // retval not important here...only satmode=1 means anything
rig_get_func(rig, RIG_VFO_CURR, RIG_FUNC_SATMODE, &satmode); rig_get_func(rig, RIG_VFO_CURR, RIG_FUNC_SATMODE, &satmode);
priv->satmode = satmode;
rig_debug(RIG_DEBUG_VERBOSE, "%s: satmode=%d\n", __func__, satmode); rig_debug(RIG_DEBUG_VERBOSE, "%s: satmode=%d\n", __func__, satmode);
if (satmode == 0) // only worth trying if not in satmode if (satmode == 0) // only worth trying if not in satmode
@ -3820,7 +3878,7 @@ int icom_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
return retval; return retval;
} }
if (RIG_OK != (retval = rig_set_freq(rig, RIG_VFO_CURR, tx_freq))) if (RIG_OK != (retval = rig_set_freq(rig, tx_vfo, tx_freq)))
{ {
return retval; return retval;
} }
@ -3888,6 +3946,21 @@ int icom_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq)
rs = &rig->state; rs = &rig->state;
priv = (struct icom_priv_data *) rs->priv; priv = (struct icom_priv_data *) rs->priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: ic910#1\n", __func__);
if (rig->caps->rig_model == RIG_MODEL_IC910)
{
ptt_t ptt;
rig_debug(RIG_DEBUG_VERBOSE, "%s: ic910#2\n", __func__);
retval = rig_get_ptt(rig,RIG_VFO_CURR,&ptt);
if (retval != RIG_OK) {
return retval;
}
if (ptt) {
rig_debug(RIG_DEBUG_TRACE, "%s: split is on so returning last known freq\n", __func__);
*tx_freq = priv->vfob_freq;
return RIG_OK;
}
}
rig_debug(RIG_DEBUG_VERBOSE, "%s curr_vfo=%s\n", __func__, rig_debug(RIG_DEBUG_VERBOSE, "%s curr_vfo=%s\n", __func__,
rig_strvfo(priv->curr_vfo)); rig_strvfo(priv->curr_vfo));
@ -3906,6 +3979,7 @@ int icom_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq)
int satmode = 0; int satmode = 0;
// don't care about the retval here..only satmode=1 is important // don't care about the retval here..only satmode=1 is important
rig_get_func(rig, RIG_VFO_CURR, RIG_FUNC_SATMODE, &satmode); rig_get_func(rig, RIG_VFO_CURR, RIG_FUNC_SATMODE, &satmode);
priv->satmode = satmode;
rig_debug(RIG_DEBUG_VERBOSE, "%s: satmode=%d\n", __func__, satmode); rig_debug(RIG_DEBUG_VERBOSE, "%s: satmode=%d\n", __func__, satmode);
if (satmode == 0) // only worth trying if not in satmode if (satmode == 0) // only worth trying if not in satmode
@ -3961,7 +4035,7 @@ int icom_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq)
{ {
return retval; return retval;
} }
priv->vfob_freq = *tx_freq;
if (RIG_OK != (retval = icom_vfo_op(rig, vfo, RIG_OP_XCHG))) if (RIG_OK != (retval = icom_vfo_op(rig, vfo, RIG_OP_XCHG)))
{ {
return retval; return retval;
@ -4038,6 +4112,7 @@ int icom_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq)
} }
} }
priv->vfob_freq = *tx_freq;
return retval; return retval;
} }
@ -4562,12 +4637,12 @@ int icom_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
if (VFO_HAS_A_B && (tx_vfo == RIG_VFO_A || tx_vfo == RIG_VFO_B)) if (VFO_HAS_A_B && (tx_vfo == RIG_VFO_A || tx_vfo == RIG_VFO_B))
{ {
rig_debug(RIG_DEBUG_TRACE, "%s: vfo clause 2\n", __func__); rig_debug(RIG_DEBUG_TRACE, "%s: vfo clause 2\n", __func__);
rig_debug(RIG_DEBUG_TRACE, "%s: set_vfo to VFO_A because tx_vfo=%s\n", __func__, rig_debug(RIG_DEBUG_TRACE, "%s: rx_vfo to VFO_A, tx_vfo to VFO_B because tx_vfo=%s\n", __func__,
rig_strvfo(tx_vfo)); rig_strvfo(tx_vfo));
priv->tx_vfo = RIG_VFO_B; priv->tx_vfo = RIG_VFO_B;
priv->rx_vfo = RIG_VFO_A; priv->rx_vfo = RIG_VFO_A;
//vfo_final = RIG_VFO_A; vfo_final = RIG_VFO_A;
} }
else if (VFO_HAS_MAIN_SUB_A_B_ONLY && (tx_vfo == RIG_VFO_MAIN else if (VFO_HAS_MAIN_SUB_A_B_ONLY && (tx_vfo == RIG_VFO_MAIN
|| tx_vfo == RIG_VFO_SUB)) || tx_vfo == RIG_VFO_SUB))
@ -4718,6 +4793,7 @@ int icom_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo)
} }
rig_get_func(rig, RIG_VFO_CURR, RIG_FUNC_SATMODE, &satmode); rig_get_func(rig, RIG_VFO_CURR, RIG_FUNC_SATMODE, &satmode);
priv->satmode = satmode;
priv->split_on = RIG_SPLIT_ON == *split; priv->split_on = RIG_SPLIT_ON == *split;
@ -5068,6 +5144,7 @@ int icom_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
priv->x25cmdfails = 0; // we reset this to try it again priv->x25cmdfails = 0; // we reset this to try it again
priv->x1cx03cmdfails = 0; // we reset this to try it again priv->x1cx03cmdfails = 0; // we reset this to try it again
priv->satmode = status;
break; break;
@ -6960,6 +7037,8 @@ static int set_vfo_curr(RIG *rig, vfo_t vfo, vfo_t curr_vfo)
rig_debug(RIG_DEBUG_TRACE, "%s: curr_vfo now=%s\n", __func__, rig_debug(RIG_DEBUG_TRACE, "%s: curr_vfo now=%s\n", __func__,
rig_strvfo(priv->curr_vfo)); rig_strvfo(priv->curr_vfo));
rig->state.current_vfo = vfo;
return RIG_OK; return RIG_OK;
} }

Wyświetl plik

@ -31,7 +31,11 @@
#include <sys/time.h> #include <sys/time.h>
#endif #endif
<<<<<<< HEAD
#define BACKEND_VER "20200510" #define BACKEND_VER "20200510"
=======
#define BACKEND_VER "20200511"
>>>>>>> 3b2225e4891cf4420814b19c214b8c64e174539d
/* /*
* defines used by comp_cal_str in rig.c * defines used by comp_cal_str in rig.c
@ -187,8 +191,11 @@ struct icom_priv_data
freq_t curr_freq; // our current freq depending on which vfo is selected freq_t curr_freq; // our current freq depending on which vfo is selected
freq_t main_freq; // track last setting of main -- not being used yet freq_t main_freq; // track last setting of main -- not being used yet
freq_t sub_freq; // track last setting of sub -- not being used yet freq_t sub_freq; // track last setting of sub -- not being used yet
freq_t vfoa_freq; // track last setting of vfoa -- used to return last freq when ptt is asserted
freq_t vfob_freq; // track last setting of vfob -- used to return last freq when ptt is asserted
int x25cmdfails; // This will get set if the 0x25 command fails so we try just once int x25cmdfails; // This will get set if the 0x25 command fails so we try just once
int x1cx03cmdfails; // This will get set if the 0x1c 0x03 command fails so we try just once int x1cx03cmdfails; // This will get set if the 0x1c 0x03 command fails so we try just once
int satmode; // Remember satmode for handling TX/RX VFOs and such
}; };
extern const struct ts_sc_list r8500_ts_sc_list[]; extern const struct ts_sc_list r8500_ts_sc_list[];

Wyświetl plik

@ -1191,7 +1191,6 @@ static int twiddling(RIG *rig)
return 1; // would be better as error but other software won't handle it return 1; // would be better as error but other software won't handle it
} }
} }
return 0; // return 0; //
} }
@ -1270,6 +1269,7 @@ int HAMLIB_API rig_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
curr_vfo = rig->state.current_vfo; curr_vfo = rig->state.current_vfo;
retcode = caps->set_vfo(rig, vfo); retcode = caps->set_vfo(rig, vfo);
vfo = rig->state.current_vfo; // can't call get_vfo since Icoms don't have it
if (retcode != RIG_OK) if (retcode != RIG_OK)
{ {
@ -1341,8 +1341,8 @@ int HAMLIB_API rig_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
if (cache_ms < rig->state.cache.timeout_ms && rig->state.cache.vfo_freq == vfo) if (cache_ms < rig->state.cache.timeout_ms && rig->state.cache.vfo_freq == vfo)
{ {
rig_debug(RIG_DEBUG_TRACE, "%s: %s cache hit age=%dms\n", __func__, rig_debug(RIG_DEBUG_TRACE, "%s: %s cache hit age=%dms, freq=%g\n", __func__,
rig_strvfo(vfo), cache_ms); rig_strvfo(vfo), cache_ms, *freq);
*freq = rig->state.cache.freq; *freq = rig->state.cache.freq;
return RIG_OK; return RIG_OK;
} }
@ -1364,8 +1364,10 @@ int HAMLIB_API rig_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|| vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo)
{ {
retcode = caps->get_freq(rig, vfo, freq); retcode = caps->get_freq(rig, vfo, freq);
rig->state.cache.freq = *freq; if (retcode == RIG_OK) {
rig->state.cache.vfo_freq = vfo; rig->state.cache.freq = *freq;
rig->state.cache.vfo_freq = vfo;
}
} }
else else
{ {

Wyświetl plik

@ -241,7 +241,7 @@ declare_proto_rig(pause);
*/ */
static struct test_table test_list[] = static struct test_table test_list[] =
{ {
{ 'F', "set_freq", ACTION(set_freq), ARG_IN, "Frequency" }, { 'F', "set_freq", ACTION(set_freq), ARG_IN1 | ARG_OUT1, "Frequency" },
{ 'f', "get_freq", ACTION(get_freq), ARG_OUT, "Frequency", "VFO" }, { 'f', "get_freq", ACTION(get_freq), ARG_OUT, "Frequency", "VFO" },
{ 'M', "set_mode", ACTION(set_mode), ARG_IN, "Mode", "Passband" }, { 'M', "set_mode", ACTION(set_mode), ARG_IN, "Mode", "Passband" },
{ 'm', "get_mode", ACTION(get_mode), ARG_OUT, "Mode", "Passband" }, { 'm', "get_mode", ACTION(get_mode), ARG_OUT, "Mode", "Passband" },
@ -277,7 +277,7 @@ static struct test_table test_list[] =
{ 0x91, "get_ctcss_sql", ACTION(get_ctcss_sql), ARG_OUT, "CTCSS Sql" }, { 0x91, "get_ctcss_sql", ACTION(get_ctcss_sql), ARG_OUT, "CTCSS Sql" },
{ 0x92, "set_dcs_sql", ACTION(set_dcs_sql), ARG_IN, "DCS Sql" }, { 0x92, "set_dcs_sql", ACTION(set_dcs_sql), ARG_IN, "DCS Sql" },
{ 0x93, "get_dcs_sql", ACTION(get_dcs_sql), ARG_OUT, "DCS Sql" }, { 0x93, "get_dcs_sql", ACTION(get_dcs_sql), ARG_OUT, "DCS Sql" },
{ 'V', "set_vfo", ACTION(set_vfo), ARG_IN | ARG_NOVFO, "VFO" }, { 'V', "set_vfo", ACTION(set_vfo), ARG_IN | ARG_NOVFO | ARG_OUT, "VFO" },
{ 'v', "get_vfo", ACTION(get_vfo), ARG_OUT, "VFO" }, { 'v', "get_vfo", ACTION(get_vfo), ARG_OUT, "VFO" },
{ 'T', "set_ptt", ACTION(set_ptt), ARG_IN, "PTT" }, { 'T', "set_ptt", ACTION(set_ptt), ARG_IN, "PTT" },
{ 't', "get_ptt", ACTION(get_ptt), ARG_OUT, "PTT" }, { 't', "get_ptt", ACTION(get_ptt), ARG_OUT, "PTT" },
@ -970,16 +970,12 @@ int rigctl_parse(RIG *my_rig, FILE *fin, FILE *fout, char *argv[], int argc,
{ {
rig_debug(RIG_DEBUG_TRACE, "%s: debug7\n", __func__); rig_debug(RIG_DEBUG_TRACE, "%s: debug7\n", __func__);
#ifdef XXREMOVEDXX
if (prompt) if (prompt)
{ {
rig_debug(RIG_DEBUG_TRACE, "%s: debug8\n", __func__); rig_debug(RIG_DEBUG_TRACE, "%s: debug8\n", __func__);
fprintf_flush(fout, "%s: ", cmd_entry->arg2); fprintf_flush(fout, "%s: ", cmd_entry->arg2);
} }
#endif
if (scanfc(fin, "%s", arg2) < 1) if (scanfc(fin, "%s", arg2) < 1)
{ {
rig_debug(RIG_DEBUG_WARN, "%s: nothing to scan#9?\n", __func__); rig_debug(RIG_DEBUG_WARN, "%s: nothing to scan#9?\n", __func__);
@ -1926,9 +1922,20 @@ int set_conf(RIG *my_rig, char *conf_parms)
declare_proto_rig(set_freq) declare_proto_rig(set_freq)
{ {
freq_t freq; freq_t freq;
int retval;
char *fmt = "%"PRIll"%c";
CHKSCN1ARG(sscanf(arg1, "%"SCNfreq, &freq)); CHKSCN1ARG(sscanf(arg1, "%"SCNfreq, &freq));
return rig_set_freq(rig, vfo, freq); retval = rig_set_freq(rig, vfo, freq);
if (retval == RIG_OK)
{
fprintf(fout, "%s%c", rig_strvfo(vfo), resp_sep);
fprintf(fout, fmt, (int64_t)freq, resp_sep);
}
return retval;
} }
@ -1937,7 +1944,6 @@ declare_proto_rig(get_freq)
{ {
int status; int status;
freq_t freq; freq_t freq;
// cppcheck-suppress *
char *fmt = "%"PRIll"%c"; char *fmt = "%"PRIll"%c";
status = rig_get_freq(rig, vfo, &freq); status = rig_get_freq(rig, vfo, &freq);
@ -1959,7 +1965,7 @@ declare_proto_rig(get_freq)
fprintf(fout, "%s: ", cmd->arg2); /* i.e. "Frequency" */ fprintf(fout, "%s: ", cmd->arg2); /* i.e. "Frequency" */
} }
fprintf(fout, "%s%c", rig_strvfo(rig->state.current_vfo), resp_sep); fprintf(fout, "%s%c", rig_strvfo(vfo), resp_sep);
return status; return status;
} }
@ -2088,6 +2094,8 @@ declare_proto_rig(get_mode)
/* 'V' */ /* 'V' */
declare_proto_rig(set_vfo) declare_proto_rig(set_vfo)
{ {
int retval;
if (!strcmp(arg1, "?")) if (!strcmp(arg1, "?"))
{ {
char s[SPRINTF_MAX_SIZE]; char s[SPRINTF_MAX_SIZE];
@ -2096,7 +2104,20 @@ declare_proto_rig(set_vfo)
return RIG_OK; return RIG_OK;
} }
return rig_set_vfo(rig, rig_parse_vfo(arg1)); vfo = rig_parse_vfo(arg1);
retval = rig_set_vfo(rig, vfo);
if (retval == RIG_OK)
{
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
{
// fprintf(fout, "%s: ", cmd->arg1);
}
fprintf(fout, "%s%c", rig_strvfo(vfo), resp_sep);
}
return retval;
} }
@ -4288,7 +4309,7 @@ declare_proto_rig(send_cmd)
int i; int i;
rig_debug(RIG_DEBUG_TRACE, "%s: send_cmd_term==-1, arg1=%s\n", __func__, arg1); rig_debug(RIG_DEBUG_TRACE, "%s: send_cmd_term==-1, arg1=%s\n", __func__, arg1);
if (arg1[strlen(arg1)-1] != ';' && strstr(arg1, "\\0x") == NULL) if (arg1[strlen(arg1) - 1] != ';' && strstr(arg1, "\\0x") == NULL)
{ {
rig_debug(RIG_DEBUG_ERR, "%s: expecting binary hex string here\n", __func__); rig_debug(RIG_DEBUG_ERR, "%s: expecting binary hex string here\n", __func__);
return -RIG_EINVAL; return -RIG_EINVAL;

Wyświetl plik

@ -24,8 +24,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef UTHASH_H #ifndef UTHASH_H
#define UTHASH_H #define UTHASH_H
// cppcheck-suppress *
#include <string.h> /* memcmp,strlen */ #include <string.h> /* memcmp,strlen */
// cppcheck-suppress *
#include <stddef.h> /* ptrdiff_t */ #include <stddef.h> /* ptrdiff_t */
// cppcheck-suppress *
#include <stdlib.h> /* exit() */ #include <stdlib.h> /* exit() */
/* These macros use decltype or the earlier __typeof GNU extension. /* These macros use decltype or the earlier __typeof GNU extension.
@ -61,6 +64,7 @@ do {
typedef unsigned int uint32_t; typedef unsigned int uint32_t;
typedef unsigned char uint8_t; typedef unsigned char uint8_t;
#else #else
// cppcheck-suppress *
#include <inttypes.h> /* uint32_t */ #include <inttypes.h> /* uint32_t */
#endif #endif