kopia lustrzana https://github.com/Hamlib/Hamlib
Add support for TX Query on K2 and K3
The K2 and K3 support a TQ command to query the transmit status. As only four bytes are returned it is much faster than the longer IF command response. Access is via rig_get_ext_level--rigctl 'l' command with a Level mnemonic of 'txst'. Returns '0' on RX and '1' on TX. git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@3032 7ae35d74-ebe9-4afe-98af-79ac388436b8Hamlib-1.2.13
rodzic
15615ec467
commit
58842fb417
|
@ -39,6 +39,22 @@ static const struct elec_ext_id_str elec_ext_id_str_lst[] = {
|
|||
};
|
||||
|
||||
|
||||
/* Private Elecraft extra levels definitions
|
||||
*
|
||||
* Token definitions for .cfgparams in rig_caps
|
||||
* See enum rig_conf_e and struct confparams in rig.h
|
||||
*/
|
||||
const struct confparams elecraft_ext_levels[] = {
|
||||
{ TOK_IF_FREQ, "ifctr", "IF center frequency", "IF center freq",
|
||||
NULL, RIG_CONF_NUMERIC, { .n = { 0, 9990, 10 } }
|
||||
},
|
||||
{ TOK_TX_STAT, "txst", "TX status", "TX status",
|
||||
NULL, RIG_CONF_CHECKBUTTON, { { } },
|
||||
},
|
||||
{ RIG_CONF_END, NULL, }
|
||||
};
|
||||
|
||||
|
||||
/* Private function declarations */
|
||||
int verify_kenwood_id(RIG *rig, char *id);
|
||||
int elecraft_get_extension_level(RIG *rig, const char *cmd, int *ext_level);
|
||||
|
|
|
@ -52,6 +52,17 @@ enum k3_data_submodes_e {
|
|||
};
|
||||
|
||||
|
||||
/* Private tokens used for ext_lvl function in Elecraft backends.
|
||||
* Extra levels which are rig specific should be coded in
|
||||
* the individual rig files and token #s >= 101.
|
||||
*/
|
||||
#define TOK_IF_FREQ TOKEN_BACKEND(101) /* K3 FI command */
|
||||
#define TOK_TX_STAT TOKEN_BACKEND(102) /* K3 TQ command */
|
||||
|
||||
/* Token structure assigned to .cfgparams in rig_caps */
|
||||
extern const struct confparams elecraft_ext_levels[];
|
||||
|
||||
|
||||
/* Elecraft extension function declarations */
|
||||
int elecraft_open(RIG *rig);
|
||||
|
||||
|
|
48
kenwood/k2.c
48
kenwood/k2.c
|
@ -85,6 +85,7 @@ struct k2_filt_lst_s k2_fwmd_rtty;
|
|||
int k2_open(RIG *rig);
|
||||
int k2_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width);
|
||||
int k2_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width);
|
||||
int k2_get_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t *val);
|
||||
|
||||
/* Private function declarations */
|
||||
int k2_probe_mdfw(RIG *rig, struct kenwood_priv_data *priv);
|
||||
|
@ -129,6 +130,7 @@ const struct rig_caps k2_caps = {
|
|||
.has_set_parm = RIG_PARM_NONE, /* FIXME: parms */
|
||||
.level_gran = {}, /* FIXME: granularity */
|
||||
.parm_gran = {},
|
||||
.extlevels = elecraft_ext_levels,
|
||||
.preamp = { 14, RIG_DBLST_END, },
|
||||
.attenuator = { 10, RIG_DBLST_END, },
|
||||
.max_rit = Hz(9990),
|
||||
|
@ -213,6 +215,7 @@ const struct rig_caps k2_caps = {
|
|||
.get_ext_parm = kenwood_get_ext_parm,
|
||||
.set_level = kenwood_set_level,
|
||||
.get_level = kenwood_get_level,
|
||||
.get_ext_level = k2_get_ext_level,
|
||||
.vfo_op = kenwood_vfo_op,
|
||||
.set_trn = kenwood_set_trn,
|
||||
.get_powerstat = kenwood_get_powerstat,
|
||||
|
@ -388,6 +391,51 @@ int k2_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
|
|||
}
|
||||
|
||||
|
||||
/* TQ command is a quick transmit status query--K2/K3 only.
|
||||
*
|
||||
* token Defined in elecraft.h or this file
|
||||
* val Type depends on token type from confparams structure:
|
||||
* NUMERIC: val.f
|
||||
* COMBO: val.i, starting from 0 Index to a string table.
|
||||
* STRING: val.cs for set, val.s for get
|
||||
* CHECKBUTTON: val.i 0/1
|
||||
*/
|
||||
int k2_get_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t *val)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
if (!rig || !val)
|
||||
return -RIG_EINVAL;
|
||||
|
||||
char buf[KENWOOD_MAX_BUF_LEN];
|
||||
int err;
|
||||
const struct confparams *cfp;
|
||||
|
||||
cfp = rig_ext_lookup_tok(rig, token);
|
||||
|
||||
switch(token) {
|
||||
case TOK_TX_STAT:
|
||||
err = kenwood_safe_transaction(rig, "TQ", buf, KENWOOD_MAX_BUF_LEN, 4);
|
||||
if (err != RIG_OK)
|
||||
return err;
|
||||
if (cfp->type == RIG_CONF_CHECKBUTTON) {
|
||||
val->i = atoi(&buf[2]);
|
||||
} else {
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: protocol error, invalid token type\n",
|
||||
__func__);
|
||||
return -RIG_EPROTO;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Unsupported get_ext_level %d\n",
|
||||
__func__, token);
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
||||
/* K2 private helper functions follow */
|
||||
|
||||
/* Probes for mode and filter settings, based on information
|
||||
|
|
34
kenwood/k3.c
34
kenwood/k3.c
|
@ -50,24 +50,6 @@
|
|||
#define K3_ANTS (RIG_ANT_1|RIG_ANT_2)
|
||||
|
||||
|
||||
/* Private tokens used for ext_lvl and ext_parm functions in K3 backend.
|
||||
* Extra parameters and levels which are rig specific should be coded in
|
||||
* the individual rig files and token #s >= 101.
|
||||
*/
|
||||
#define TOK_IF_FREQ TOKEN_BACKEND(101) /* K3 FI command */
|
||||
|
||||
/* Private K3 extra levels/params definitions
|
||||
*
|
||||
* See enum rig_conf_e and struct confparams in rig.h
|
||||
*/
|
||||
static const struct confparams k3_ext_levels[] = {
|
||||
{ TOK_IF_FREQ, "ifctr", "IF center frequency", "IF center freq",
|
||||
NULL, RIG_CONF_NUMERIC, { .n = { 0, 9990, 10 } }
|
||||
},
|
||||
{ RIG_CONF_END, NULL, }
|
||||
};
|
||||
|
||||
|
||||
/* kenwood_transaction() will add this to command strings
|
||||
* sent to the rig and remove it from strings returned from
|
||||
* the rig, so no need to append ';' manually to command strings.
|
||||
|
@ -123,7 +105,7 @@ const struct rig_caps k3_caps = {
|
|||
.has_set_parm = RIG_PARM_NONE, /* FIXME: parms */
|
||||
.level_gran = {}, /* FIXME: granularity */
|
||||
.parm_gran = {},
|
||||
.extlevels = k3_ext_levels,
|
||||
.extlevels = elecraft_ext_levels,
|
||||
.extparms = kenwood_cfg_params,
|
||||
.preamp = { 14, RIG_DBLST_END, },
|
||||
.attenuator = { 10, RIG_DBLST_END, },
|
||||
|
@ -402,6 +384,7 @@ int k3_set_vfo(RIG *rig, vfo_t vfo)
|
|||
|
||||
/* Support the FI command for reading the IF center frequency,
|
||||
* useful for panadapters and such that need to know the IF center.
|
||||
* TQ command is a quick transmit status query--K2/K3 only.
|
||||
*
|
||||
* token Defined in elecraft.h or this file
|
||||
* val Type depends on token type from confparams structure:
|
||||
|
@ -429,7 +412,6 @@ int k3_get_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t *val)
|
|||
if (err != RIG_OK)
|
||||
return err;
|
||||
if (cfp->type == RIG_CONF_NUMERIC) {
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: IF freq is: %s\n", __func__, buf);
|
||||
val->f = 8210000.0 + (float)atoi(&buf[2]);
|
||||
} else {
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: protocol error, invalid token type\n",
|
||||
|
@ -437,6 +419,18 @@ int k3_get_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t *val)
|
|||
return -RIG_EPROTO;
|
||||
}
|
||||
break;
|
||||
case TOK_TX_STAT:
|
||||
err = kenwood_safe_transaction(rig, "TQ", buf, KENWOOD_MAX_BUF_LEN, 4);
|
||||
if (err != RIG_OK)
|
||||
return err;
|
||||
if (cfp->type == RIG_CONF_CHECKBUTTON) {
|
||||
val->i = atoi(&buf[2]);
|
||||
} else {
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: protocol error, invalid token type\n",
|
||||
__func__);
|
||||
return -RIG_EPROTO;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Unsupported get_ext_level %d\n",
|
||||
__func__, token);
|
||||
|
|
Ładowanie…
Reference in New Issue