kopia lustrzana https://github.com/Hamlib/Hamlib
Merge branch 'master' of https://github.com/dl1ycf/hamlib into dl1ycf-master
commit
cdeb73ee8e
|
@ -32,6 +32,8 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include "hamlib/rig.h"
|
#include "hamlib/rig.h"
|
||||||
|
#include "network.h"
|
||||||
|
#include "serial.h"
|
||||||
#include "iofunc.h"
|
#include "iofunc.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "num_stdio.h"
|
#include "num_stdio.h"
|
||||||
|
@ -50,6 +52,13 @@ static int netrigctl_transaction(RIG *rig, char *cmd, int len, char *buf)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
/* flush anything in the read buffer before command is sent */
|
||||||
|
if (rig->state.rigport.type.rig == RIG_PORT_NETWORK || rig->state.rigport.type.rig == RIG_PORT_UDP_NETWORK) {
|
||||||
|
network_flush(&rig->state.rigport);
|
||||||
|
} else {
|
||||||
|
serial_flush(&rig->state.rigport);
|
||||||
|
}
|
||||||
|
|
||||||
ret = write_block(&rig->state.rigport, cmd, len);
|
ret = write_block(&rig->state.rigport, cmd, len);
|
||||||
if (ret != RIG_OK)
|
if (ret != RIG_OK)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -1339,7 +1348,7 @@ const struct rig_caps netrigctl_caps = {
|
||||||
.status = RIG_STATUS_BETA,
|
.status = RIG_STATUS_BETA,
|
||||||
.rig_type = RIG_TYPE_OTHER,
|
.rig_type = RIG_TYPE_OTHER,
|
||||||
.targetable_vfo = 0,
|
.targetable_vfo = 0,
|
||||||
.ptt_type = RIG_PTT_RIG,
|
.ptt_type = RIG_PTT_RIG_MICDATA,
|
||||||
.dcd_type = RIG_DCD_RIG,
|
.dcd_type = RIG_DCD_RIG,
|
||||||
.port_type = RIG_PORT_NETWORK,
|
.port_type = RIG_PORT_NETWORK,
|
||||||
.timeout = 2000, /* enough for a network */
|
.timeout = 2000, /* enough for a network */
|
||||||
|
|
|
@ -1253,7 +1253,7 @@ int print_conf_list(const struct confparams *cfp, rig_ptr_t data)
|
||||||
cfp->u.n.min, cfp->u.n.max, cfp->u.n.step);
|
cfp->u.n.min, cfp->u.n.max, cfp->u.n.step);
|
||||||
break;
|
break;
|
||||||
case RIG_CONF_COMBO:
|
case RIG_CONF_COMBO:
|
||||||
if (!cfp->u.c.combostr)
|
if (!cfp->u.c.combostr[0])
|
||||||
break;
|
break;
|
||||||
printf("\tCombo: %s", cfp->u.c.combostr[0]);
|
printf("\tCombo: %s", cfp->u.c.combostr[0]);
|
||||||
for (i=1 ; i<RIG_COMBO_MAX && cfp->u.c.combostr[i]; i++)
|
for (i=1 ; i<RIG_COMBO_MAX && cfp->u.c.combostr[i]; i++)
|
||||||
|
@ -1487,11 +1487,36 @@ declare_proto_rig(get_vfo)
|
||||||
/* 'T' */
|
/* 'T' */
|
||||||
declare_proto_rig(set_ptt)
|
declare_proto_rig(set_ptt)
|
||||||
{
|
{
|
||||||
int ptt;
|
int scr;
|
||||||
|
ptt_t ptt;
|
||||||
|
|
||||||
/* TODO MICDATA */
|
CHKSCN1ARG(sscanf(arg1, "%d", &scr));
|
||||||
CHKSCN1ARG(sscanf(arg1, "%d", &ptt));
|
ptt=scr;
|
||||||
return rig_set_ptt(rig, vfo, (ptt_t) ptt);
|
/*
|
||||||
|
* We allow RIG_PTT_ON_MIC and RIG_PTT_ON_DATA arriving from netrigctl.
|
||||||
|
* However, if the rig does not have two separate CAT commands, or if
|
||||||
|
* the rig is actually switched by a hardware signal (DTR etc.), then
|
||||||
|
* we map this to RIG_PTT_ON.
|
||||||
|
* Currently, this is not really necessary here because it is taken
|
||||||
|
* case of in rig_set_ptt, but you never know ....
|
||||||
|
*/
|
||||||
|
switch (ptt) {
|
||||||
|
case RIG_PTT_ON_MIC:
|
||||||
|
case RIG_PTT_ON_DATA:
|
||||||
|
// map to a legal value
|
||||||
|
if (rig->state.pttport.type.ptt != RIG_PTT_RIG_MICDATA) ptt=RIG_PTT_ON;
|
||||||
|
break;
|
||||||
|
case RIG_PTT_ON:
|
||||||
|
case RIG_PTT_OFF:
|
||||||
|
// nothing to do
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// this case is not handled in hamlib, but we guard against
|
||||||
|
// illegal parameters here. The hamlib behaviour is to switch
|
||||||
|
// on PTT whenever ptt != RIG_PTT_OFF.
|
||||||
|
return -RIG_EINVAL;
|
||||||
|
}
|
||||||
|
return rig_set_ptt(rig, vfo, ptt);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 't' */
|
/* 't' */
|
||||||
|
@ -1939,6 +1964,7 @@ declare_proto_rig(set_level)
|
||||||
switch (cfp->type) {
|
switch (cfp->type) {
|
||||||
case RIG_CONF_BUTTON:
|
case RIG_CONF_BUTTON:
|
||||||
/* arg is ignored */
|
/* arg is ignored */
|
||||||
|
val.i=0; // avoid passing uninitialized data
|
||||||
break;
|
break;
|
||||||
case RIG_CONF_CHECKBUTTON:
|
case RIG_CONF_CHECKBUTTON:
|
||||||
case RIG_CONF_COMBO:
|
case RIG_CONF_COMBO:
|
||||||
|
@ -2105,6 +2131,7 @@ declare_proto_rig(set_parm)
|
||||||
switch (cfp->type) {
|
switch (cfp->type) {
|
||||||
case RIG_CONF_BUTTON:
|
case RIG_CONF_BUTTON:
|
||||||
/* arg is ignored */
|
/* arg is ignored */
|
||||||
|
val.i=0; // avoid passing uninitialized data
|
||||||
break;
|
break;
|
||||||
case RIG_CONF_CHECKBUTTON:
|
case RIG_CONF_CHECKBUTTON:
|
||||||
case RIG_CONF_COMBO:
|
case RIG_CONF_COMBO:
|
||||||
|
|
Ładowanie…
Reference in New Issue