Added support for getting VFO A/B lock status for FT-920.

Mention in comments in newcat.* that FTDX-9000* and FT-2000
use the new style CAT command protocol.


git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2263 7ae35d74-ebe9-4afe-98af-79ac388436b8
Hamlib-1.2.7
Nate Bargmann, N0NB 2007-12-01 22:09:52 +00:00
rodzic 799a62ab8d
commit 1c4b323ea4
4 zmienionych plików z 163 dodań i 54 usunięć

Wyświetl plik

@ -12,7 +12,7 @@
* pages 86 to 90
*
*
* $Id: ft920.c,v 1.22 2007-11-27 01:02:17 n0nb Exp $
* $Id: ft920.c,v 1.23 2007-12-01 22:09:52 n0nb Exp $
*
*
* This library is free software; you can redistribute it and/or
@ -109,9 +109,9 @@ static const yaesu_cmd_set_t ncmd[] = {
{ 1, { 0x00, 0x00, 0x00, 0x02, 0x10 } }, /* Status Update Data--Current operating data for VFO/Memory (28 bytes) */
{ 1, { 0x00, 0x00, 0x00, 0x03, 0x10 } }, /* Status Update DATA--VFO A and B Data (28 bytes) */
{ 0, { 0x00, 0x00, 0x00, 0x04, 0x10 } }, /* Status Update Data--Memory Channel Data (14 bytes) P4 = 0x00-0x89 Memory Channel Number */
{ 1, { 0x00, 0x00, 0x00, 0x00, 0x81 } }, /* Tuner off */
{ 1, { 0x00, 0x00, 0x00, 0x01, 0x81 } }, /* Tuner on */
{ 1, { 0x00, 0x00, 0x00, 0x00, 0x82 } }, /* Tuner start */
{ 1, { 0x00, 0x00, 0x00, 0x00, 0x81 } }, /* Tuner bypass */
{ 1, { 0x00, 0x00, 0x00, 0x01, 0x81 } }, /* Tuner inline */
{ 1, { 0x00, 0x00, 0x00, 0x00, 0x82 } }, /* Tuner start tuning for match */
{ 0, { 0x00, 0x00, 0x00, 0x00, 0x8a } }, /* set vfo B frequency */
{ 1, { 0x00, 0x00, 0x00, 0x00, 0x8c } }, /* VFO A wide filter */
{ 1, { 0x00, 0x00, 0x00, 0x02, 0x8c } }, /* VFO A narrow filter */
@ -119,10 +119,6 @@ static const yaesu_cmd_set_t ncmd[] = {
{ 1, { 0x00, 0x00, 0x00, 0x82, 0x8c } }, /* VFO B narrow filter */
{ 1, { 0x00, 0x00, 0x00, 0x01, 0xFA } }, /* Read status flags */
/* { 0, { 0x00, 0x00, 0x00, 0x00, 0x70 } }, */ /* keyer commands */
/* { 1, { 0x00, 0x00, 0x00, 0x00, 0x81 } }, */ /* tuner off */
/* { 1, { 0x00, 0x00, 0x00, 0x01, 0x81 } }, */ /* tuner on */
/* { 1, { 0x00, 0x00, 0x00, 0x00, 0x82 } }, */ /* tuner start*/
};
@ -354,7 +350,7 @@ const struct rig_caps ft920_caps = {
*/
/*
* _init
* rig_init*
*
*/
@ -386,7 +382,8 @@ static int ft920_init(RIG *rig) {
/*
* ft920_cleanup routine
* rig_cleanup*
*
* the serial port is closed by the frontend
*
*/
@ -406,7 +403,7 @@ static int ft920_cleanup(RIG *rig) {
/*
* ft920_open routine
* rig_open*
*
*/
@ -447,7 +444,7 @@ static int ft920_open(RIG *rig) {
/*
* ft920_close routine
* rig_close*
*
*/
@ -462,9 +459,20 @@ static int ft920_close(RIG *rig) {
/*
* set freq for a given VFO
* rig_get_freq*
*
* If vfo is set to RIG_VFO_CUR then vfo from priv_data is used.
* Set freq for a given VFO
*
* Parameter | Type | Accepted/expected values
* ------------------------------------------------------------------
* *rig | input | pointer to private data
* vfo | input | RIG_VFO_A, RIG_VFO_B, RIG_VFO_MEM
* freq | input | frequency to passed VFO
* ------------------------------------------------------------------
* Returns RIG_OK on success or an error code on failure
*
* Comments: If vfo is set to RIG_VFO_CUR then vfo from
* priv_data is used.
*
*/
@ -515,8 +523,18 @@ static int ft920_set_freq(RIG *rig, vfo_t vfo, freq_t freq) {
/*
* rig_get_freq*
*
* Return Freq for a given VFO
*
* Parameter | Type | Accepted/expected values
* ------------------------------------------------------------------
* *rig | input | pointer to private data
* vfo | input | RIG_VFO_A, RIG_VFO_B, RIG_VFO_MEM
* *freq | output | displayed frequency based on passed VFO
* ------------------------------------------------------------------
* Returns RIG_OK on success or an error code on failure
*
*/
static int ft920_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) {
@ -575,9 +593,21 @@ static int ft920_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) {
/*
* set mode and passband: eg AM, CW etc for a given VFO
* rig_set_mode*
*
* If vfo is set to RIG_VFO_CUR then vfo from priv_data is used.
* Set mode and passband: eg AM, CW etc for a given VFO
*
* Parameter | Type | Accepted/expected values
* ------------------------------------------------------------------
* *rig | input | pointer to private data
* vfo | input | RIG_VFO_A, RIG_VFO_B, RIG_VFO_MEM
* mode | input | supported modes (see ft920.h)
* width | input | supported widths (see ft920.h)
* ------------------------------------------------------------------
* Returns RIG_OK on success or an error code on failure
*
* Comments: If vfo is set to RIG_VFO_CUR then vfo from
* priv_data is used.
*
*/
@ -733,7 +763,18 @@ static int ft920_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width ) {
/*
* get mode : eg AM, CW etc for a given VFO
* rig_get_mode*
*
* Get mode and passband: eg AM, CW etc for a given VFO
*
* Parameter | Type | Accepted/expected values
* ------------------------------------------------------------------
* *rig | input | pointer to private data
* vfo | input | RIG_VFO_A, RIG_VFO_B, RIG_VFO_MEM
* *mode | output | supported modes (see ft920.h)
* *width | output | supported widths (see ft920.h)
* ------------------------------------------------------------------
* Returns RIG_OK on success or an error code on failure
*
*/
@ -861,8 +902,19 @@ static int ft920_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
/*
* set vfo and store requested vfo for later RIG_VFO_CURR
* requests.
* rig_set_vfo*
*
* Get active VFO
*
* Parameter | Type | Accepted/expected values
* ------------------------------------------------------------------
* *rig | input | pointer to private data
* vfo | input | RIG_VFO_A, RIG_VFO_B
* ------------------------------------------------------------------
* Returns RIG_OK on success or an error code on failure
*
* Comments: Set vfo and store requested vfo for later
* RIG_VFO_CURR requests.
*
*/
@ -910,9 +962,20 @@ static int ft920_set_vfo(RIG *rig, vfo_t vfo) {
/*
* get current RX vfo/mem and store requested vfo for
* later RIG_VFO_CURR requests plus pass the tested vfo/mem
* back to the frontend.
* rig_get_vfo*
*
* Get active VFO
*
* Parameter | Type | Accepted/expected values
* ------------------------------------------------------------------
* *rig | input | pointer to private data
* *vfo | output | RIG_VFO_A, RIG_VFO_B, RIG_VFO_MEM
* ------------------------------------------------------------------
* Returns RIG_OK on success or an error code on failure
*
* Comments: Get current RX vfo/mem and store requested vfo for
* later RIG_VFO_CURR requests plus pass the tested
* vfo/mem back to the frontend.
*
*/
@ -995,11 +1058,22 @@ static int ft920_get_vfo(RIG *rig, vfo_t *vfo) {
/*
* set the '920 into split TX/RX mode
* rig_set_split_vfo*
*
* VFO cannot be set as the set split on command only changes the
* TX to the sub display. Setting split off returns the TX to the
* main display.
* Set the '920 into split TX/RX mode
*
* Parameter | Type | Accepted/expected values
* ------------------------------------------------------------------
* *rig | input | pointer to private data
* vfo | input | not used
* split | input | RIG_SPLIT_ON, RIG_SPLIT_OFF
* tx_vfo | input | not used
* ------------------------------------------------------------------
* Returns RIG_OK on success or an error code on failure
*
* Comments: VFO cannot be set as the set split on command only
* changes the TX to the sub display. Setting split off
* returns the TX to the main display.
*
*/
@ -1035,9 +1109,18 @@ static int ft920_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
/*
* rig_get_split_vfo*
*
* Get whether the '920 is in split mode
*
* vfo value is not used
* Parameter | Type | Accepted/expected values
* ------------------------------------------------------------------
* *rig | input | pointer to private data
* vfo | input | not used
* *split | output | RIG_SPLIT_ON, RIG_SPLIT_OFF
* *tx_vfo | output | not used
* ------------------------------------------------------------------
* Returns RIG_OK on success or an error code on failure
*
*/
@ -1602,7 +1685,8 @@ static int ft920_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
* *rig | input | pointer to private data
* vfo | input | currVFO, VFOA, VFOB, MEM
* func | input | TUNER
* status | input | 0 = off, 1 = on, 2 = start (toggle)
* status | input | 0 = bypass, 1 =inline, 2 = start tuning
* | | (toggle)
* ------------------------------------------------------------------
* Returns RIG_OK on success or an error code on failure
*
@ -1635,13 +1719,13 @@ static int ft920_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
switch(func) {
case RIG_FUNC_TUNER:
switch(status) {
case TUNER_OFF:
cmd_index = FT920_NATIVE_TUNER_OFF;
case TUNER_BYPASS:
cmd_index = FT920_NATIVE_TUNER_BYPASS;
break;
case TUNER_ON:
cmd_index = FT920_NATIVE_TUNER_ON;
case TUNER_INLINE:
cmd_index = FT920_NATIVE_TUNER_INLINE;
break;
case TUNER_START:
case TUNER_TUNING:
cmd_index = FT920_NATIVE_TUNER_START;
break;
default:
@ -1670,7 +1754,7 @@ static int ft920_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
* *rig | input | pointer to private data
* vfo | input | currVFO, VFOA, VFOB, MEM
* func | input | TUNER
* *status | output | 0 = off, 1 = on, 2 = tuning
* *status | output | 0 = bypass, 1 = inline, 2 = tuning
* ------------------------------------------------------------------
* Returns RIG_OK on success or an error code on failure
*
@ -1714,22 +1798,38 @@ static int ft920_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
* Currently, will only check if tuner is tuning and inline.
*/
stat_0 = priv->update_data[FT920_SUMO_DISPLAYED_STATUS_0];
stat_0 &= SF_TUNE; /* get tuning state */
// stat_0 &= SF_TUNER_TUNE; /* get tuning state */
stat_2 = priv->update_data[FT920_SUMO_DISPLAYED_STATUS_2];
stat_2 &= SF_TUNER; /* get tuner inline state */
// stat_2 &= SF_TUNER_INLINE; /* get tuner inline state */
rig_debug(RIG_DEBUG_TRACE, "%s: stat_0 = 0x%02x, stat_2 = 0x%02x\n",
__func__, stat_0, stat_2);
switch(func) {
case RIG_FUNC_TUNER:
if (stat_0)
*status = TUNER_START;
else if (stat_2)
*status = TUNER_ON;
if (stat_0 & SF_TUNER_TUNE)
*status = TUNER_TUNING;
else if (stat_2 & SF_TUNER_INLINE)
*status = TUNER_INLINE;
else
*status = TUNER_OFF;
*status = TUNER_BYPASS;
break;
case RIG_FUNC_LOCK:
switch(vfo) {
case RIG_VFO_A:
if (stat_2 & SF_VFOA_LOCK)
*status = TRUE;
else
*status = FALSE;
break;
case RIG_VFO_B:
if (stat_2 & SF_VFOB_LOCK)
*status = TRUE;
else
*status = FALSE;
break;
}
break;
default:
return -RIG_EINVAL; /* wrong function! */

Wyświetl plik

@ -9,7 +9,7 @@
* via serial interface to an FT-920 using the "CAT" interface
*
*
* $Id: ft920.h,v 1.15 2007-11-27 01:02:17 n0nb Exp $
* $Id: ft920.h,v 1.16 2007-12-01 22:09:52 n0nb Exp $
*
*
* This library is free software; you can redistribute it and/or
@ -51,7 +51,7 @@
/* Other features */
#define FT920_ANTS 0 /* FIXME: declare Ant A & B and RX input */
#define FT920_FUNC_ALL (RIG_FUNC_TUNER) /* fix */
#define FT920_FUNC_ALL (RIG_FUNC_TUNER | RIG_FUNC_LOCK) /* fix */
/* Returned data length in bytes */
#define FT920_MEM_CHNL_LENGTH 1 /* 0x10 P1 = 01 return size */
@ -121,8 +121,8 @@ enum ft920_native_cmd_e {
FT920_NATIVE_OP_DATA,
FT920_NATIVE_VFO_DATA,
FT920_NATIVE_MEM_CHNL_DATA,
FT920_NATIVE_TUNER_OFF,
FT920_NATIVE_TUNER_ON,
FT920_NATIVE_TUNER_BYPASS,
FT920_NATIVE_TUNER_INLINE,
FT920_NATIVE_TUNER_START,
FT920_NATIVE_VFO_B_FREQ_SET,
FT920_NATIVE_VFO_A_PASSBAND_WIDE,
@ -187,10 +187,12 @@ typedef enum ft920_native_cmd_e ft920_native_cmd_t;
#define CLAR_OFFSET_MINUS 0xff
/* Tuner status values */
#define TUNER_OFF 0
#define TUNER_ON 1
#define TUNER_START 2
/* Tuner status values used to set the
* tuner state and indicate tuner status.
*/
#define TUNER_BYPASS 0
#define TUNER_INLINE 1
#define TUNER_TUNING 2
/*
* Local VFO CMD's, according to spec
@ -220,7 +222,7 @@ typedef enum ft920_native_cmd_e ft920_native_cmd_t;
#define SF_SPLITA (1<<0) /* Split operation with VFO-B on TX */
#define SF_SPLITB (1<<1) /* Split operation with VFO-B on RX */
#define SF_VFOB (SF_SPLITA|SF_SPLITB) /* bits 0 & 1, VFO B TX/RX == 3 */
#define SF_TUNE (1<<2) /* Antenna tuner On/tuning */
#define SF_TUNER_TUNE (1<<2) /* Antenna tuner On and Tuning for match*/
#define SF_PTT_OFF (0<<7) /* Receive mode (PTT line open) */
#define SF_PTT_ON (1<<7) /* Transmission in progress (PTT line grounded) */
#define SF_PTT_MASK (SF_PTT_ON)
@ -234,8 +236,9 @@ typedef enum ft920_native_cmd_e ft920_native_cmd_t;
#define SF_VFO_MASK (SF_QMB|SF_MT|SF_VFO|SF_MR)
#define FT920_SUMO_DISPLAYED_STATUS_2 0x02 /* Status flag byte 2 */
#define SF_TUNER (1<<1) /* Antenna tuner is inline */
#define SF_TUNER_INLINE (1<<1) /* Antenna tuner is inline or bypass */
#define SF_VFOB_LOCK (1<<2) /* VFO B tuning lock status */
#define SF_VFOA_LOCK (1<<3) /* VFO A tuning lock status */
/*
* Offsets for VFO record retrieved via 0x10 P1 = 02, 03

Wyświetl plik

@ -8,8 +8,11 @@
* via serial interface to any newer Yaesu radio using the
* "new" text CAT interface.
*
* Models this code aims to support are FTDX-9000*, FT-2000,
* FT-950, FT-450. Much testing remains. -N0NB
*
* $Id: newcat.c,v 1.2 2007-11-23 03:31:26 n0nb Exp $
*
* $Id: newcat.c,v 1.3 2007-12-01 22:09:52 n0nb Exp $
*
*
* This library is free software; you can redistribute it and/or

Wyświetl plik

@ -8,8 +8,11 @@
* via serial interface to any Yaesu radio using the new "CAT"
* interface commands that are similar to the Kenwood command set.
*
* Models this code aims to support are FTDX-9000*, FT-2000,
* FT-950, FT-450. Much testing remains. -N0NB
*
* $Id: newcat.h,v 1.2 2007-11-23 03:31:26 n0nb Exp $
*
* $Id: newcat.h,v 1.3 2007-12-01 22:09:52 n0nb Exp $
*
*
* This library is free software; you can redistribute it and/or