kopia lustrzana https://github.com/Hamlib/Hamlib
Add support for Flex6K radios
Signed-off-by: Steve Conklin <steve@conklinhouse.com>Hamlib-3.0
rodzic
18f2f54f7d
commit
e17ab36bc8
|
@ -136,6 +136,7 @@
|
||||||
#define RIG_MODEL_THD72A RIG_MAKE_MODEL(RIG_KENWOOD, 33)
|
#define RIG_MODEL_THD72A RIG_MAKE_MODEL(RIG_KENWOOD, 33)
|
||||||
#define RIG_MODEL_TMD710 RIG_MAKE_MODEL(RIG_KENWOOD, 34)
|
#define RIG_MODEL_TMD710 RIG_MAKE_MODEL(RIG_KENWOOD, 34)
|
||||||
#define RIG_MODEL_TMV71 RIG_MAKE_MODEL(RIG_KENWOOD, 35)
|
#define RIG_MODEL_TMV71 RIG_MAKE_MODEL(RIG_KENWOOD, 35)
|
||||||
|
#define RIG_MODEL_F6K RIG_MAKE_MODEL(RIG_KENWOOD, 36) /* Flex 6000 Series */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Icom
|
* Icom
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
|
|
||||||
TSSRC = ts850.c ts870s.c ts570.c ts450s.c ts950.c ts50s.c \
|
TSSRC = ts850.c ts870s.c ts570.c ts450s.c ts950.c ts50s.c \
|
||||||
ts790.c ts2000.c k2.c k3.c ts930.c \
|
ts790.c ts2000.c k2.c k3.c ts930.c \
|
||||||
ts680.c ts690.c ts140.c ts480.c trc80.c ts590.c
|
ts680.c ts690.c ts140.c ts480.c trc80.c ts590.c \
|
||||||
|
flex6xxx.c
|
||||||
|
|
||||||
IC10SRC = ts440.c ts940.c ts711.c ts811.c r5000.c
|
IC10SRC = ts440.c ts940.c ts711.c ts811.c r5000.c
|
||||||
|
|
||||||
THSRC = thd7.c thf7.c thg71.c tmd700.c tmv7.c thf6a.c thd72.c tmd710.c
|
THSRC = thd7.c thf7.c thg71.c tmd700.c tmv7.c thf6a.c thd72.c tmd710.c
|
||||||
|
|
||||||
KENWOODSRC = kenwood.c kenwood.h th.c th.h ic10.c ic10.h elecraft.c elecraft.h \
|
KENWOODSRC = kenwood.c kenwood.h th.c th.h ic10.c ic10.h elecraft.c elecraft.h \
|
||||||
transfox.c
|
transfox.c flex.c flex.h
|
||||||
|
|
||||||
noinst_LTLIBRARIES = libhamlib-kenwood.la
|
noinst_LTLIBRARIES = libhamlib-kenwood.la
|
||||||
libhamlib_kenwood_la_SOURCES = $(TSSRC) $(THSRC) $(IC10SRC) $(KENWOODSRC)
|
libhamlib_kenwood_la_SOURCES = $(TSSRC) $(THSRC) $(IC10SRC) $(KENWOODSRC)
|
||||||
|
|
||||||
EXTRA_DIST = README.kenwood README.k2 README.k3 Android.mk
|
EXTRA_DIST = README.kenwood README.k2 README.k3 README.flex Android.mk
|
||||||
|
|
|
@ -0,0 +1,90 @@
|
||||||
|
FlexRadio 6xxx series notes and Hamlib errata by Steve Conklin, AI4QR.
|
||||||
|
|
||||||
|
Commands as documented from Flex
|
||||||
|
|
||||||
|
----------Kenwood Command Set----------
|
||||||
|
FA Slice receiver A frequency.
|
||||||
|
FB Slice receiver B frequency.
|
||||||
|
FR Receive VFO
|
||||||
|
FT Transmit VFO
|
||||||
|
IF Transceiver Status
|
||||||
|
KS Keying speed
|
||||||
|
MD DSP Mode
|
||||||
|
RX Set receive (TX off)
|
||||||
|
SH Set DSP filter high frequency
|
||||||
|
SL Set DSP filter low frequency
|
||||||
|
TX Set transmit (TX on)
|
||||||
|
|
||||||
|
----------FlexRadio Command Set----------
|
||||||
|
ZZFA Slice receiver A frequency
|
||||||
|
ZZFB Slice receiver B frequency
|
||||||
|
ZZFI Slice Receiver A DSP filter
|
||||||
|
ZZFJ Slice Receiver B DSP filter
|
||||||
|
ZZIF Transceiver Status
|
||||||
|
ZZMD Slice receiver A DSP Mode
|
||||||
|
ZZME Slice receiver B DSP Mode
|
||||||
|
ZZSW Set slice Transmit flag (RX A or RX B)
|
||||||
|
ZZTX Set MOX (on/off)
|
||||||
|
|
||||||
|
================================================
|
||||||
|
rigctl commands used to test operation
|
||||||
|
(freq set and read)
|
||||||
|
f
|
||||||
|
F 14100000
|
||||||
|
F 14070000
|
||||||
|
also test to see if RX and TX can be set out of band
|
||||||
|
|
||||||
|
(mode set and read with passband)
|
||||||
|
m
|
||||||
|
M USB 5 [Should set to USB and 1.6K]
|
||||||
|
M USB 20000 [should set to USb and 4K]
|
||||||
|
also test other modes
|
||||||
|
|
||||||
|
(vfo set and read)
|
||||||
|
v
|
||||||
|
V VFOB
|
||||||
|
[opens with a 5K split]
|
||||||
|
|
||||||
|
(set and get split freq)
|
||||||
|
i
|
||||||
|
I 14078000
|
||||||
|
[ Even if split is turned off, this sets VFOB]
|
||||||
|
|
||||||
|
(split set and read)
|
||||||
|
NOTE: When split off, TX VFO is always A
|
||||||
|
s
|
||||||
|
[ shows split and VFOA is TX]
|
||||||
|
S 1 VFOA
|
||||||
|
s
|
||||||
|
S 1 VFOB
|
||||||
|
|
||||||
|
(keying speed)
|
||||||
|
l KEYSPD
|
||||||
|
L KEYSPD 25
|
||||||
|
l KEYSPD
|
||||||
|
L KEYSPD 10
|
||||||
|
l KEYSPD
|
||||||
|
|
||||||
|
(filter edges)
|
||||||
|
l SLOPE_HIGH
|
||||||
|
l SLOPE_LOW
|
||||||
|
|
||||||
|
===
|
||||||
|
Supported:
|
||||||
|
case RIG_LEVEL_KEYSPD: 'KS'
|
||||||
|
case RIG_LEVEL_SLOPE_HIGH: 'SH'
|
||||||
|
needs list of frequencies
|
||||||
|
case RIG_LEVEL_SLOPE_LOW: 'SL'
|
||||||
|
|
||||||
|
Not supported:
|
||||||
|
case RIG_LEVEL_RFPOWER: 'PC'
|
||||||
|
case RIG_LEVEL_AF: 'AG'
|
||||||
|
case RIG_LEVEL_RF: 'RG'
|
||||||
|
case RIG_LEVEL_SQL: 'SQ'
|
||||||
|
case RIG_LEVEL_AGC: 'GT'
|
||||||
|
case RIG_LEVEL_ATT: 'RA'
|
||||||
|
case RIG_LEVEL_PREAMP: 'PA'
|
||||||
|
case RIG_LEVEL_CWPITCH: 'PT'
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,113 @@
|
||||||
|
/*
|
||||||
|
* Hamlib Flex 6K series support using supported Kenwood commands
|
||||||
|
* Copyright (C) 2010,2011 by Nate Bargmann, n0nb@n0nb.us
|
||||||
|
* Copyright (C) 2011 by Alexander Sack, Alexander Sack, pisymbol@gmail.com
|
||||||
|
* Copyright (C) 2013 by Steve Conklin AI4QR, steve@conklinhouse.com
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* See the file 'COPYING.LIB' in the main Hamlib distribution directory for
|
||||||
|
* the complete text of the GNU Lesser Public License version 2.1.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "flex.h"
|
||||||
|
#include "kenwood.h"
|
||||||
|
|
||||||
|
/* Private helper functions */
|
||||||
|
|
||||||
|
int verify_flexradio_id(RIG *rig, char *id)
|
||||||
|
{
|
||||||
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||||
|
|
||||||
|
if (!rig || !id)
|
||||||
|
return -RIG_EINVAL;
|
||||||
|
|
||||||
|
int err;
|
||||||
|
char *idptr;
|
||||||
|
|
||||||
|
/* Check for a Flex 6700 which returns "904" */
|
||||||
|
err = kenwood_get_id(rig, id);
|
||||||
|
if (err != RIG_OK) {
|
||||||
|
rig_debug(RIG_DEBUG_VERBOSE, "%s: cannot get identification\n", __func__);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ID is 'ID904;' */
|
||||||
|
if (strlen(id) < 5) {
|
||||||
|
rig_debug(RIG_DEBUG_VERBOSE, "%s: unknown ID type (%s)\n", __func__, id);
|
||||||
|
return -RIG_EPROTO;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* check for any white space and skip it */
|
||||||
|
idptr = &id[2];
|
||||||
|
if (*idptr == ' ')
|
||||||
|
idptr++;
|
||||||
|
|
||||||
|
if (strcmp("904", idptr) == 0)
|
||||||
|
rig_debug(RIG_DEBUG_VERBOSE, "%s: Rig ID is %s (Flex 6700)\n", __func__, id);
|
||||||
|
else if (strcmp("905", idptr) == 0)
|
||||||
|
rig_debug(RIG_DEBUG_VERBOSE, "%s: Rig ID is %s (Flex 6500)\n", __func__, id);
|
||||||
|
else if (strcmp("906", idptr) == 0)
|
||||||
|
rig_debug(RIG_DEBUG_VERBOSE, "%s: Rig ID is %s (Flex 6500R)\n", __func__, id);
|
||||||
|
else {
|
||||||
|
rig_debug(RIG_DEBUG_VERBOSE, "%s: Rig (%s) is not a Flex 6000 Series\n", __func__, id);
|
||||||
|
return -RIG_EPROTO;
|
||||||
|
}
|
||||||
|
|
||||||
|
return RIG_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Shared backend function definitions */
|
||||||
|
|
||||||
|
/* flexradio_open()
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
int flexradio_open(RIG *rig)
|
||||||
|
{
|
||||||
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||||
|
|
||||||
|
if (!rig)
|
||||||
|
return -RIG_EINVAL;
|
||||||
|
|
||||||
|
int err;
|
||||||
|
char id[FLEXRADIO_MAX_BUF_LEN];
|
||||||
|
|
||||||
|
//struct flexradio_priv_data *priv = rig->state.priv;
|
||||||
|
|
||||||
|
/* Use check for "ID017;" to verify rig is reachable */
|
||||||
|
err = verify_flexradio_id(rig, id);
|
||||||
|
if (err != RIG_OK)
|
||||||
|
return err;
|
||||||
|
switch(rig->caps->rig_model) {
|
||||||
|
case RIG_MODEL_F6K:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
rig_debug(RIG_DEBUG_WARN, "%s: unrecognized rig model %d\n",
|
||||||
|
__func__, rig->caps->rig_model);
|
||||||
|
return -RIG_EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return RIG_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
//stopped
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
/*
|
||||||
|
* Hamlib Elecraft backend--support extensions to Kenwood commands
|
||||||
|
* Copyright (C) 2010,2011 by Nate Bargmann, n0nb@n0nb.us
|
||||||
|
* Copyright (C) 2013 by Steve Conklin AI4QR, steve@conklinhouse.com
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _FLEXRADIO_H
|
||||||
|
#define _FLEXRADIO_H 1
|
||||||
|
|
||||||
|
#include <hamlib/rig.h>
|
||||||
|
|
||||||
|
#define EXT_LEVEL_NONE -1
|
||||||
|
#define FLEXRADIO_MAX_BUF_LEN 50
|
||||||
|
|
||||||
|
struct flexradio_priv_data {
|
||||||
|
char info[FLEXRADIO_MAX_BUF_LEN];
|
||||||
|
split_t split; /* current split state */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Flexradio extension function declarations */
|
||||||
|
int flexradio_open(RIG *rig);
|
||||||
|
|
||||||
|
#endif /* _FLEXRADIO_H */
|
|
@ -0,0 +1,377 @@
|
||||||
|
/*
|
||||||
|
* Hamlib FlexRadio backend - 6K series rigs
|
||||||
|
* Copyright (c) 2002-2009 by Stephane Fillod
|
||||||
|
* Copyright (C) 2010,2011,2012,2013 by Nate Bargmann, n0nb@arrl.net
|
||||||
|
* Copyright (C) 2013 by Steve Conklin AI4QR, steve@conklinhouse.com
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* See the file 'COPYING.LIB' in the main Hamlib distribution directory for
|
||||||
|
* the complete text of the GNU Lesser Public License version 2.1.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include <hamlib/rig.h>
|
||||||
|
#include "kenwood.h"
|
||||||
|
#include "bandplan.h"
|
||||||
|
#include "flex.h"
|
||||||
|
#include "token.h"
|
||||||
|
#include "cal.h"
|
||||||
|
|
||||||
|
#define F6K_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_PKTLSB|RIG_MODE_PKTUSB)
|
||||||
|
|
||||||
|
#define F6K_FUNC_ALL (RIG_FUNC_VOX)
|
||||||
|
|
||||||
|
#define F6K_LEVEL_ALL (RIG_LEVEL_SLOPE_HIGH|RIG_LEVEL_SLOPE_LOW|RIG_LEVEL_KEYSPD)
|
||||||
|
|
||||||
|
#define F6K_VFO (RIG_VFO_A|RIG_VFO_B)
|
||||||
|
#define F6K_VFO_OP (RIG_OP_UP|RIG_OP_DOWN)
|
||||||
|
|
||||||
|
#define F6K_ANTS (RIG_ANT_1|RIG_ANT_2|RIG_ANT_3)
|
||||||
|
|
||||||
|
|
||||||
|
static rmode_t flex_mode_table[KENWOOD_MODE_TABLE_MAX] = {
|
||||||
|
[0] = RIG_MODE_NONE,
|
||||||
|
[1] = RIG_MODE_LSB,
|
||||||
|
[2] = RIG_MODE_USB,
|
||||||
|
[3] = RIG_MODE_CW,
|
||||||
|
[4] = RIG_MODE_FM,
|
||||||
|
[5] = RIG_MODE_AM,
|
||||||
|
[6] = RIG_MODE_PKTLSB,
|
||||||
|
[7] = RIG_MODE_NONE,
|
||||||
|
[8] = RIG_MODE_NONE,
|
||||||
|
[9] = RIG_MODE_PKTUSB
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct kenwood_priv_caps f6k_priv_caps = {
|
||||||
|
.cmdtrm = EOM_KEN,
|
||||||
|
.mode_table = flex_mode_table,
|
||||||
|
};
|
||||||
|
|
||||||
|
#define DSP_BW_NUM 8
|
||||||
|
|
||||||
|
static int dsp_bw_ssb[DSP_BW_NUM] = {
|
||||||
|
4000, 3300, 2900, 2700, 2400, 2100, 1800, 1600
|
||||||
|
};
|
||||||
|
|
||||||
|
static int dsp_bw_am[DSP_BW_NUM] = {
|
||||||
|
20000, 16000, 14000, 12000, 10000, 8000, 6000, 5600
|
||||||
|
};
|
||||||
|
|
||||||
|
static int dsp_bw_cw[DSP_BW_NUM] = {
|
||||||
|
3000, 1500, 1000, 800, 400, 250, 100, 50
|
||||||
|
};
|
||||||
|
|
||||||
|
static int dsp_bw_dig[DSP_BW_NUM] = {
|
||||||
|
3000, 2000, 1500, 1000, 600, 300, 150, 100
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Private helper functions */
|
||||||
|
|
||||||
|
static int flex6k_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
|
||||||
|
{
|
||||||
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||||
|
|
||||||
|
if (!rig || !mode || !width)
|
||||||
|
return -RIG_EINVAL;
|
||||||
|
|
||||||
|
struct kenwood_priv_caps *caps = kenwood_caps(rig);
|
||||||
|
|
||||||
|
char modebuf[10];
|
||||||
|
int index;
|
||||||
|
int retval;
|
||||||
|
|
||||||
|
retval = kenwood_safe_transaction(rig, "MD", modebuf, 6, 4);
|
||||||
|
if (retval != RIG_OK)
|
||||||
|
return retval;
|
||||||
|
|
||||||
|
*mode = kenwood2rmode(modebuf[2] - '0', caps->mode_table);
|
||||||
|
|
||||||
|
if ((vfo == RIG_VFO_VFO) || (vfo == RIG_VFO_CURR)) {
|
||||||
|
vfo = rig->state.current_vfo;
|
||||||
|
rig_debug(RIG_DEBUG_VERBOSE, "%s: setting VFO to current\n", __func__);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The Flex CAT interface does not support FW for reading filter width,
|
||||||
|
* so use the ZZFI or ZZFJ command
|
||||||
|
*/
|
||||||
|
switch (vfo) {
|
||||||
|
case RIG_VFO_A:
|
||||||
|
retval = kenwood_safe_transaction(rig, "ZZFI", modebuf, 10, 7);
|
||||||
|
break;
|
||||||
|
case RIG_VFO_B:
|
||||||
|
retval = kenwood_safe_transaction(rig, "ZZFJ", modebuf, 10, 7);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %d\n", __func__, vfo);
|
||||||
|
return -RIG_EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (retval != RIG_OK)
|
||||||
|
return retval;
|
||||||
|
|
||||||
|
index = atoi(&modebuf[4]);
|
||||||
|
if (index >= DSP_BW_NUM) {
|
||||||
|
rig_debug(RIG_DEBUG_ERR,
|
||||||
|
"flex6k_get_mode: unexpected ZZF[IJ] answer, index=%d\n", index);
|
||||||
|
return -RIG_ERJCTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (*mode) {
|
||||||
|
case RIG_MODE_AM:
|
||||||
|
*width = dsp_bw_am[index];
|
||||||
|
break;
|
||||||
|
case RIG_MODE_CW:
|
||||||
|
*width = dsp_bw_cw[index];
|
||||||
|
break;
|
||||||
|
case RIG_MODE_USB:
|
||||||
|
case RIG_MODE_LSB:
|
||||||
|
*width = dsp_bw_ssb[index];
|
||||||
|
break;
|
||||||
|
//case RIG_MODE_FM:
|
||||||
|
//*width = 3000; /* not supported yet, needs followup */
|
||||||
|
//break;
|
||||||
|
case RIG_MODE_PKTLSB:
|
||||||
|
case RIG_MODE_PKTUSB:
|
||||||
|
*width = dsp_bw_dig[index];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
rig_debug(RIG_DEBUG_ERR, "%s: unsupported mode %d, setting default BW\n", __func__, *mode);
|
||||||
|
*width = 3000;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return RIG_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int flex6k_find_width(rmode_t mode, pbwidth_t width, int *ridx)
|
||||||
|
{
|
||||||
|
int *w_a; // Width array, these are all ordered in descending order!
|
||||||
|
int idx = 0;
|
||||||
|
|
||||||
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||||
|
|
||||||
|
switch (mode) {
|
||||||
|
case RIG_MODE_AM:
|
||||||
|
w_a = dsp_bw_am;
|
||||||
|
break;
|
||||||
|
case RIG_MODE_CW:
|
||||||
|
w_a = dsp_bw_cw;
|
||||||
|
break;
|
||||||
|
case RIG_MODE_USB:
|
||||||
|
case RIG_MODE_LSB:
|
||||||
|
w_a = dsp_bw_ssb;
|
||||||
|
break;
|
||||||
|
//case RIG_MODE_FM:
|
||||||
|
//*width = 3000; /* not supported yet, needs followup */
|
||||||
|
//break;
|
||||||
|
case RIG_MODE_PKTLSB:
|
||||||
|
case RIG_MODE_PKTUSB:
|
||||||
|
w_a = dsp_bw_dig;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
rig_debug(RIG_DEBUG_ERR, "%s: unsupported mode %d\n", __func__, mode);
|
||||||
|
return -RIG_EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// return the first smaller or equal possibility
|
||||||
|
while((idx < DSP_BW_NUM) && (w_a[idx] > width))
|
||||||
|
idx++;
|
||||||
|
if (idx >= DSP_BW_NUM) {
|
||||||
|
idx = DSP_BW_NUM - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
*ridx = idx;
|
||||||
|
return RIG_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int flex6k_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
||||||
|
{
|
||||||
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||||
|
|
||||||
|
if (!rig)
|
||||||
|
return -RIG_EINVAL;
|
||||||
|
|
||||||
|
struct kenwood_priv_caps *caps = kenwood_caps(rig);
|
||||||
|
char buf[10];
|
||||||
|
char kmode;
|
||||||
|
int idx;
|
||||||
|
int err;
|
||||||
|
|
||||||
|
kmode = rmode2kenwood(mode, caps->mode_table);
|
||||||
|
if (kmode < 0 ) {
|
||||||
|
rig_debug(RIG_DEBUG_WARN, "%s: unsupported mode '%s'\n",
|
||||||
|
__func__, rig_strrmode(mode));
|
||||||
|
return -RIG_EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
sprintf(buf, "MD%c", '0' + kmode);
|
||||||
|
err = kenwood_simple_cmd(rig, buf);
|
||||||
|
if (err != RIG_OK)
|
||||||
|
return err;
|
||||||
|
|
||||||
|
err = flex6k_find_width(mode, width, &idx);
|
||||||
|
if (err != RIG_OK)
|
||||||
|
return err;
|
||||||
|
|
||||||
|
if ((vfo == RIG_VFO_VFO) || (vfo == RIG_VFO_CURR)) {
|
||||||
|
vfo = rig->state.current_vfo;
|
||||||
|
rig_debug(RIG_DEBUG_VERBOSE, "%s: setting VFO to current\n", __func__);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* The Flex CAT interface does not support FW for reading filter width,
|
||||||
|
* so use the ZZFI or ZZFJ command
|
||||||
|
*/
|
||||||
|
switch (vfo) {
|
||||||
|
case RIG_VFO_A:
|
||||||
|
sprintf(buf, "ZZFI%02d;", idx);
|
||||||
|
break;
|
||||||
|
case RIG_VFO_B:
|
||||||
|
sprintf(buf, "ZZFJ%02d;", idx);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %d\n", __func__, vfo);
|
||||||
|
return -RIG_EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
err = kenwood_simple_cmd(rig, buf);
|
||||||
|
if (err != RIG_OK)
|
||||||
|
return err;
|
||||||
|
return RIG_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* F6K rig capabilities.
|
||||||
|
*/
|
||||||
|
const struct rig_caps f6k_caps = {
|
||||||
|
.rig_model = RIG_MODEL_F6K,
|
||||||
|
.model_name = "6xxx",
|
||||||
|
.mfg_name = "FlexRadio",
|
||||||
|
.version = "20130717",
|
||||||
|
.copyright = "LGPL",
|
||||||
|
.status = RIG_STATUS_BETA,
|
||||||
|
.rig_type = RIG_TYPE_TRANSCEIVER,
|
||||||
|
.ptt_type = RIG_PTT_RIG,
|
||||||
|
.dcd_type = RIG_DCD_NONE,
|
||||||
|
.port_type = RIG_PORT_NETWORK,
|
||||||
|
// -spc- TODO set this reasonably, don't know what the flex should be
|
||||||
|
.timeout = 600, /* FA and FB make take up to 500 ms on band change */
|
||||||
|
.retry = 3,
|
||||||
|
|
||||||
|
.has_get_func = RIG_FUNC_NONE, /* has VOX but not implemented here */
|
||||||
|
.has_set_func = RIG_FUNC_NONE,
|
||||||
|
.has_get_level = F6K_LEVEL_ALL,
|
||||||
|
.has_set_level = F6K_LEVEL_ALL,
|
||||||
|
.has_get_parm = RIG_PARM_NONE,
|
||||||
|
.has_set_parm = RIG_PARM_NONE, /* FIXME: parms */
|
||||||
|
.level_gran = {}, /* FIXME: granularity */
|
||||||
|
.parm_gran = {},
|
||||||
|
//.extlevels = elecraft_ext_levels,
|
||||||
|
//.extparms = kenwood_cfg_params,
|
||||||
|
.preamp = { RIG_DBLST_END, },
|
||||||
|
.attenuator = { RIG_DBLST_END, },
|
||||||
|
.max_rit = Hz(0),
|
||||||
|
.max_xit = Hz(0),
|
||||||
|
.max_ifshift = Hz(0),
|
||||||
|
.vfo_ops = RIG_OP_NONE,
|
||||||
|
.targetable_vfo = RIG_TARGETABLE_FREQ|RIG_TARGETABLE_MODE,
|
||||||
|
.transceive = RIG_TRN_RIG,
|
||||||
|
.bank_qty = 0,
|
||||||
|
.chan_desc_sz = 0,
|
||||||
|
|
||||||
|
.chan_list = { RIG_CHAN_END },
|
||||||
|
|
||||||
|
.rx_range_list1 = {
|
||||||
|
{kHz(30), MHz(77), F6K_MODES, -1, -1, F6K_VFO, F6K_ANTS},
|
||||||
|
{MHz(135), MHz(165), F6K_MODES, -1,- 1, F6K_VFO, F6K_ANTS},
|
||||||
|
RIG_FRNG_END,
|
||||||
|
}, /* rx range */
|
||||||
|
.tx_range_list1 = {
|
||||||
|
FRQ_RNG_HF(1, F6K_MODES, mW(10), W(100), F6K_VFO, F6K_ANTS),
|
||||||
|
FRQ_RNG_6m(1, F6K_MODES, mW(10), W(100), F6K_VFO, F6K_ANTS),
|
||||||
|
FRQ_RNG_2m(1, F6K_MODES, mW(10), W(100), F6K_VFO, F6K_ANTS),
|
||||||
|
RIG_FRNG_END,
|
||||||
|
}, /* tx range */
|
||||||
|
|
||||||
|
.rx_range_list2 = {
|
||||||
|
{kHz(30), MHz(77), F6K_MODES, -1, -1, F6K_VFO, F6K_ANTS},
|
||||||
|
{ MHz(135), MHz(165), F6K_MODES, -1, -1, F6K_VFO, F6K_ANTS},
|
||||||
|
RIG_FRNG_END,
|
||||||
|
}, /* rx range */
|
||||||
|
.tx_range_list2 = {
|
||||||
|
FRQ_RNG_HF(2, F6K_MODES, mW(10), W(100), F6K_VFO, F6K_ANTS),
|
||||||
|
FRQ_RNG_6m(2, F6K_MODES, mW(10), W(100), F6K_VFO, F6K_ANTS),
|
||||||
|
FRQ_RNG_2m(2, F6K_MODES, mW(10), W(100), F6K_VFO, F6K_ANTS),
|
||||||
|
RIG_FRNG_END,
|
||||||
|
}, /* tx range */
|
||||||
|
|
||||||
|
.tuning_steps = {
|
||||||
|
{F6K_MODES, 1},
|
||||||
|
RIG_TS_END,
|
||||||
|
},
|
||||||
|
|
||||||
|
/* mode/filter list, remember: order matters! */
|
||||||
|
.filters = {
|
||||||
|
{RIG_MODE_SSB, kHz(2.7)},
|
||||||
|
{RIG_MODE_SSB, kHz(3.3)},
|
||||||
|
{RIG_MODE_SSB, kHz(1.8)},
|
||||||
|
{RIG_MODE_SSB, kHz(1.6)},
|
||||||
|
{RIG_MODE_SSB, kHz(4.0)},
|
||||||
|
{RIG_MODE_SSB, RIG_FLT_ANY},
|
||||||
|
{RIG_MODE_CW, kHz(0.4)},
|
||||||
|
{RIG_MODE_CW, kHz(1.5)},
|
||||||
|
{RIG_MODE_CW, Hz(50)},
|
||||||
|
{RIG_MODE_CW, kHz(3.0)},
|
||||||
|
{RIG_MODE_CW, RIG_FLT_ANY},
|
||||||
|
{RIG_MODE_PKTUSB|RIG_MODE_PKTLSB, kHz(1.5)},
|
||||||
|
{RIG_MODE_PKTUSB|RIG_MODE_PKTLSB, kHz(3.0)},
|
||||||
|
{RIG_MODE_PKTUSB|RIG_MODE_PKTLSB, kHz(0.1)},
|
||||||
|
{RIG_MODE_PKTUSB|RIG_MODE_PKTLSB, RIG_FLT_ANY},
|
||||||
|
{RIG_MODE_AM, kHz(6)},
|
||||||
|
{RIG_MODE_AM, kHz(14)},
|
||||||
|
{RIG_MODE_AM, kHz(5.6)},
|
||||||
|
{RIG_MODE_AM, kHz(20.0)},
|
||||||
|
{RIG_MODE_AM, RIG_FLT_ANY},
|
||||||
|
{RIG_MODE_FM, kHz(13)}, /* TBC */
|
||||||
|
RIG_FLT_END,
|
||||||
|
},
|
||||||
|
.priv = (void *)&f6k_priv_caps,
|
||||||
|
|
||||||
|
.rig_init = kenwood_init,
|
||||||
|
.rig_cleanup = kenwood_cleanup,
|
||||||
|
.rig_open = flexradio_open,
|
||||||
|
.set_freq = kenwood_set_freq,
|
||||||
|
.get_freq = kenwood_get_freq,
|
||||||
|
.set_mode = flex6k_set_mode,
|
||||||
|
.get_mode = flex6k_get_mode,
|
||||||
|
.set_vfo = kenwood_set_vfo,
|
||||||
|
.get_vfo = kenwood_get_vfo_if,
|
||||||
|
.set_split_vfo = kenwood_set_split_vfo,
|
||||||
|
.get_split_vfo = kenwood_get_split_vfo_if,
|
||||||
|
.get_ptt = kenwood_get_ptt,
|
||||||
|
.set_ptt = kenwood_set_ptt,
|
||||||
|
// TODO copy over kenwood_[set|get]_level and modify to handle DSP filter values
|
||||||
|
// correctly - use actual values instead of indices
|
||||||
|
.set_level = kenwood_set_level,
|
||||||
|
.get_level = kenwood_get_level,
|
||||||
|
//.set_ant = kenwood_set_ant_no_ack,
|
||||||
|
//.get_ant = kenwood_get_ant,
|
||||||
|
};
|
|
@ -2556,5 +2556,7 @@ DECLARE_INITRIG_BACKEND(kenwood)
|
||||||
|
|
||||||
rig_register(&transfox_caps);
|
rig_register(&transfox_caps);
|
||||||
|
|
||||||
|
rig_register(&f6k_caps);
|
||||||
|
|
||||||
return RIG_OK;
|
return RIG_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -190,6 +190,8 @@ extern const struct rig_caps thf6a_caps;
|
||||||
|
|
||||||
extern const struct rig_caps transfox_caps;
|
extern const struct rig_caps transfox_caps;
|
||||||
|
|
||||||
|
extern const struct rig_caps f6k_caps;
|
||||||
|
|
||||||
/* use when not interested in the answer, but want to check its len */
|
/* use when not interested in the answer, but want to check its len */
|
||||||
static int inline kenwood_simple_transaction(RIG *rig, const char *cmd, size_t expected)
|
static int inline kenwood_simple_transaction(RIG *rig, const char *cmd, size_t expected)
|
||||||
{
|
{
|
||||||
|
|
Ładowanie…
Reference in New Issue