patch from Rein PA0RCT implementing icom_set_rit, and ability to call rig_set_rit from rigctl

git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@1133 7ae35d74-ebe9-4afe-98af-79ac388436b8
Hamlib-1.1.4
Stéphane Fillod, F8CFE 2002-08-19 22:17:11 +00:00
rodzic 41f5748be2
commit 118b86574d
4 zmienionych plików z 69 dodań i 8 usunięć

Wyświetl plik

@ -2,7 +2,7 @@
* Hamlib CI-V backend - main file
* Copyright (c) 2000-2002 by Stephane Fillod
*
* $Id: icom.c,v 1.63 2002-08-16 17:43:01 fillods Exp $
* $Id: icom.c,v 1.64 2002-08-19 22:17:11 fillods Exp $
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
@ -410,6 +410,38 @@ int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
return RIG_OK;
}
int icom_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit)
{
struct icom_priv_data *priv;
struct rig_state *rs;
unsigned char freqbuf[MAXFRAMELEN], ackbuf[MAXFRAMELEN];
int freq_len, ack_len, retval;
rs = &rig->state;
priv = (struct icom_priv_data*)rs->priv;
freq_len = 2;
/*
* to_bcd requires nibble len
*/
to_bcd(freqbuf, rit, freq_len*2);
retval = icom_transaction (rig, C_SET_OFFS, -1, freqbuf, freq_len,
ackbuf, &ack_len);
if (retval != RIG_OK)
return retval;
if (ack_len != 1 || ackbuf[0] != ACK) {
rig_debug(RIG_DEBUG_ERR,"icom_set_rit: ack NG (%#.2x), "
"len=%d\n", ackbuf[0],ack_len);
return -RIG_ERJCTED;
}
return RIG_OK;
}
/*
* icom_set_mode
* Assumes rig!=NULL, rig->state.priv!=NULL

Wyświetl plik

@ -2,7 +2,7 @@
* Hamlib CI-V backend - main header
* Copyright (c) 2000-2002 by Stephane Fillod
*
* $Id: icom.h,v 1.46 2002-07-09 20:43:37 fillods Exp $
* $Id: icom.h,v 1.47 2002-08-19 22:17:11 fillods Exp $
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
@ -70,6 +70,7 @@ int icom_init(RIG *rig);
int icom_cleanup(RIG *rig);
int icom_set_freq(RIG *rig, vfo_t vfo, freq_t freq);
int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq);
int icom_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit);
int icom_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width);
int icom_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width);
int icom_set_vfo(RIG *rig, vfo_t vfo);

Wyświetl plik

@ -2,7 +2,7 @@
* Hamlib CI-V backend - description of the TenTenc OMNI VI
* Copyright (c) 2000-2002 by Stephane Fillod
*
* $Id: omni.c,v 1.3 2002-08-16 17:43:01 fillods Exp $
* $Id: omni.c,v 1.4 2002-08-19 22:17:11 fillods Exp $
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
@ -46,7 +46,7 @@
static const struct icom_priv_caps omnivip_priv_caps = {
0x04, /* default address */
1, /* 731 mode */
0, /* 731 mode */
NULL,
OMNIVIP_STR_CAL
};
@ -57,7 +57,7 @@ const struct rig_caps omnivip_caps = {
.mfg_name = "Ten-Tec",
.version = "0.1",
.copyright = "LGPL",
.status = RIG_STATUS_UNTESTED,
.status = RIG_STATUS_ALPHA,
.rig_type = RIG_TYPE_TRANSCEIVER,
.ptt_type = RIG_PTT_NONE,
.dcd_type = RIG_DCD_NONE,
@ -82,7 +82,7 @@ const struct rig_caps omnivip_caps = {
.parm_gran = {},
.preamp = { RIG_DBLST_END, },
.attenuator = { RIG_DBLST_END, },
.max_rit = Hz(0),
.max_rit = Hz(9999),
.max_xit = Hz(0),
.max_ifshift = Hz(0),
.targetable_vfo = 0,
@ -145,6 +145,7 @@ const struct rig_caps omnivip_caps = {
.set_mode = icom_set_mode,
.get_mode = icom_get_mode,
.set_vfo = icom_set_vfo,
.set_rit = icom_set_rit,
.decode_event = icom_decode_event,
.set_mem = icom_set_mem,

Wyświetl plik

@ -5,7 +5,7 @@
* It takes commands in interactive mode as well as
* from command line options.
*
* $Id: rigctl.c,v 1.32 2002-07-10 21:34:53 fillods Exp $
* $Id: rigctl.c,v 1.33 2002-08-19 22:17:11 fillods Exp $
*
*
* This program is free software; you can redistribute it and/or
@ -84,6 +84,8 @@ int set_conf(RIG *my_rig, char *conf_parms);
declare_proto_rig(set_freq);
declare_proto_rig(get_freq);
declare_proto_rig(set_rit);
declare_proto_rig(get_rit);
declare_proto_rig(set_mode);
declare_proto_rig(get_mode);
declare_proto_rig(set_vfo);
@ -133,11 +135,13 @@ declare_proto_rig(get_info);
* TODO: add missing rig_set_/rig_get_: [rx]it, ant, sql, dcd, etc.
* NB: 'q' 'Q' '?' are reserved by interactive mode interface
*
* Available letters: -.-------JK-----*-----W-YZ
* Available letters: -.--------K-----*-----W-YZ
*/
struct test_table test_list[] = {
{ 'F', "set_freq", set_freq, ARG_IN, "Frequency" },
{ 'f', "get_freq", get_freq, ARG_OUT, "Frequency" },
{ 'J', "set_rit", set_rit, ARG_IN, "Frequency" },
{ 'j', "get_rit", get_rit, ARG_OUT, "Frequency" },
{ 'M', "set_mode", set_mode, ARG_IN, "Mode", "Passband" },
{ 'm', "get_mode", get_mode, ARG_OUT, "Mode", "Passband" },
{ 'V', "set_vfo", set_vfo, ARG_IN, "VFO" },
@ -682,6 +686,29 @@ declare_proto_rig(get_freq)
return status;
}
declare_proto_rig(set_rit)
{
shortfreq_t rit;
sscanf(arg1, "%ld", &rit);
return rig_set_rit(rig, RIG_VFO_CURR, rit);
}
declare_proto_rig(get_rit)
{
int status;
shortfreq_t rit;
status = rig_get_rit(rig, RIG_VFO_CURR, &rit);
if (status != RIG_OK)
return status;
if (interactive)
printf("%s: ", cmd->arg1);
printf("%ld\n", rit);
return status;
}
declare_proto_rig(set_mode)
{
rmode_t mode;