kopia lustrzana https://github.com/Hamlib/Hamlib
FT-857 and FT-991 patches
Fixes S meter reporting for FT857 and FT991. Fixes rig split for FT991.working now for WSJT-X rig split mode. 73 Mike W9MDBHamlib-3.0
rodzic
0aa55fded8
commit
f8ccebc694
|
@ -57,6 +57,7 @@
|
|||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h> /* String function definitions */
|
||||
#include <unistd.h> /* UNIX standard function definitions */
|
||||
|
@ -149,7 +150,7 @@ const struct rig_caps ft857_caps = {
|
|||
.rig_model = RIG_MODEL_FT857,
|
||||
.model_name = "FT-857",
|
||||
.mfg_name = "Yaesu",
|
||||
.version = "0.4",
|
||||
.version = "0.5",
|
||||
.copyright = "LGPL",
|
||||
.status = RIG_STATUS_BETA,
|
||||
.rig_type = RIG_TYPE_TRANSCEIVER,
|
||||
|
@ -582,10 +583,14 @@ static int ft857_get_pometer_level(RIG *rig, value_t *val)
|
|||
return n;
|
||||
|
||||
/* Valid only if PTT is on */
|
||||
if ((p->tx_status & 0x80) == 0)
|
||||
val->f = ((p->tx_status & 0x0F) / 15.0);
|
||||
if ((p->tx_status & 0x80) == 0) {
|
||||
// convert watts to dBm
|
||||
val->i = 10 * log10(p->tx_status & 0x0F) + 30;
|
||||
// now convert to db over S9
|
||||
val->i += 73;
|
||||
}
|
||||
else
|
||||
val->f = 0.0;
|
||||
val->i = -911; // invalid value return
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
@ -599,9 +604,7 @@ static int ft857_get_smeter_level(RIG *rig, value_t *val)
|
|||
if ((n = ft857_get_status(rig, FT857_NATIVE_CAT_GET_RX_STATUS)) < 0)
|
||||
return n;
|
||||
|
||||
n = (p->rx_status & 0x0F) - 9;
|
||||
|
||||
val->i = n * ((n > 0) ? 10 : 6);
|
||||
val->i = n = (p->rx_status & 0x0F) * 6 - 20; // Convert S level to dB
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
|
199
yaesu/ft991.c
199
yaesu/ft991.c
|
@ -54,7 +54,7 @@ const struct rig_caps ft991_caps = {
|
|||
.rig_model = RIG_MODEL_FT991,
|
||||
.model_name = "FT-991",
|
||||
.mfg_name = "Yaesu",
|
||||
.version = NEWCAT_VER ".3",
|
||||
.version = NEWCAT_VER ".4",
|
||||
.copyright = "LGPL",
|
||||
.status = RIG_STATUS_BETA,
|
||||
.rig_type = RIG_TYPE_TRANSCEIVER,
|
||||
|
@ -191,7 +191,7 @@ const struct rig_caps ft991_caps = {
|
|||
|
||||
.set_freq = newcat_set_freq,
|
||||
.get_freq = newcat_get_freq,
|
||||
.set_mode = newcat_set_mode,
|
||||
.set_mode = ft991_set_mode,
|
||||
.get_mode = newcat_get_mode,
|
||||
.get_vfo = newcat_get_vfo,
|
||||
.set_ptt = newcat_set_ptt,
|
||||
|
@ -199,6 +199,7 @@ const struct rig_caps ft991_caps = {
|
|||
.set_split_vfo = ft991_set_split_vfo,
|
||||
.get_split_vfo = ft991_get_split_vfo,
|
||||
.get_split_mode = ft991_get_split_mode,
|
||||
.set_split_mode = ft991_set_split_mode,
|
||||
.set_rit = newcat_set_rit,
|
||||
.get_rit = newcat_get_rit,
|
||||
.set_xit = newcat_set_xit,
|
||||
|
@ -255,45 +256,45 @@ const struct rig_caps ft991_caps = {
|
|||
*/
|
||||
int ft991_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
|
||||
{
|
||||
struct newcat_priv_data *priv;
|
||||
struct rig_state *state;
|
||||
unsigned char ci;
|
||||
int err;
|
||||
struct newcat_priv_data *priv;
|
||||
struct rig_state *state;
|
||||
unsigned char ci;
|
||||
int err;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
if (!rig)
|
||||
return -RIG_EINVAL;
|
||||
if (!rig)
|
||||
return -RIG_EINVAL;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed split = 0x%02x\n", __func__, split);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed tx_vfo = 0x%02x\n", __func__, tx_vfo);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed split = 0x%02x\n", __func__, split);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed tx_vfo = 0x%02x\n", __func__, tx_vfo);
|
||||
|
||||
priv = (struct newcat_priv_data *)rig->state.priv;
|
||||
state = &rig->state;
|
||||
priv = (struct newcat_priv_data *)rig->state.priv;
|
||||
state = &rig->state;
|
||||
|
||||
// RX VFO and TX VFO cannot be the same, no support for MEM as TX VFO
|
||||
if (vfo == tx_vfo || tx_vfo == RIG_VFO_MEM)
|
||||
return -RIG_ENTARGET;
|
||||
// RX VFO and TX VFO cannot be the same, no support for MEM as TX VFO
|
||||
if (vfo == tx_vfo || tx_vfo == RIG_VFO_MEM)
|
||||
return -RIG_ENTARGET;
|
||||
|
||||
switch(split) {
|
||||
case RIG_SPLIT_ON:
|
||||
ci = '3';
|
||||
break;
|
||||
case RIG_SPLIT_OFF:
|
||||
ci = '2';
|
||||
break;
|
||||
default:
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
switch(split) {
|
||||
case RIG_SPLIT_ON:
|
||||
ci = '3';
|
||||
break;
|
||||
case RIG_SPLIT_OFF:
|
||||
ci = '2';
|
||||
break;
|
||||
default:
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "FT%c;", ci);
|
||||
if ( RIG_OK != (err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str)))) {
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: write_block err = %d\n", __func__, err);
|
||||
return err;
|
||||
}
|
||||
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "FT%c;", ci);
|
||||
if ( RIG_OK != (err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str)))) {
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: write_block err = %d\n", __func__, err);
|
||||
return err;
|
||||
}
|
||||
|
||||
return RIG_OK;
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -314,30 +315,31 @@ int ft991_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
|
|||
*/
|
||||
int ft991_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo)
|
||||
{
|
||||
struct newcat_priv_data *priv;
|
||||
int err;
|
||||
struct newcat_priv_data *priv;
|
||||
int err;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
if (!rig)
|
||||
return -RIG_EINVAL;
|
||||
if (!rig)
|
||||
return -RIG_EINVAL;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
|
||||
|
||||
priv = (struct newcat_priv_data *)rig->state.priv;
|
||||
priv = (struct newcat_priv_data *)rig->state.priv;
|
||||
|
||||
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "FT;");
|
||||
if (RIG_OK != (err = newcat_get_cmd (rig)))
|
||||
return err;
|
||||
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "FT;");
|
||||
if (RIG_OK != (err = newcat_get_cmd (rig)))
|
||||
return err;
|
||||
|
||||
// Get split mode status
|
||||
*split = priv->ret_data[2]=='1'; // 1=VFOB TX so is in split mode
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: set split = 0x%02x\n", __func__, *split);
|
||||
// Get split mode status
|
||||
*split = priv->ret_data[2]=='1'; // 1=VFOB TX so is in split mode
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: get split = 0x%02x\n", __func__, *split);
|
||||
|
||||
*tx_vfo = RIG_VFO_A;
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: set tx_vfo = 0x%02x\n", __func__, *tx_vfo);
|
||||
*tx_vfo = RIG_VFO_A;
|
||||
if (*split) *tx_vfo = RIG_VFO_B;
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: get tx_vfo = 0x%02x\n", __func__, *tx_vfo);
|
||||
|
||||
return RIG_OK;
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -364,33 +366,100 @@ int ft991_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo)
|
|||
|
||||
int ft991_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode, pbwidth_t *tx_width)
|
||||
{
|
||||
struct newcat_priv_data *priv;
|
||||
int err;
|
||||
split_t split;
|
||||
vfo_t split_vfo;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
if (!rig)
|
||||
return -RIG_EINVAL;
|
||||
|
||||
err = ft991_get_split_vfo(rig, vfo, &split, &split_vfo);
|
||||
if (err != RIG_OK)
|
||||
return err;
|
||||
priv = (struct newcat_priv_data *)rig->state.priv;
|
||||
|
||||
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "OI;");
|
||||
if (RIG_OK != (err = newcat_get_cmd (rig)))
|
||||
return err;
|
||||
*tx_mode = priv->ret_data[22];
|
||||
|
||||
switch ((int)split) {
|
||||
case TRUE: /* '991 is in split mode */
|
||||
err = newcat_get_mode(rig, split_vfo, tx_mode, tx_width);
|
||||
if (err != RIG_OK)
|
||||
return err;
|
||||
break;
|
||||
default:
|
||||
*tx_mode = RIG_MODE_NONE;
|
||||
*tx_width = 0;
|
||||
break;
|
||||
}
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* rig_set_split_mode
|
||||
*
|
||||
* Set the '991 split TX mode
|
||||
*
|
||||
* Parameter | Type | Accepted/expected values
|
||||
* ------------------------------------------------------------------
|
||||
* *rig | input | pointer to private data
|
||||
* vfo | input | currVFO, VFOA, VFOB, MEM
|
||||
* tx_mode | input | supported modes
|
||||
* tx_width | input | supported widths
|
||||
* ------------------------------------------------------------------
|
||||
* Returns RIG_OK on success or an error code on failure
|
||||
*
|
||||
* Comments: Passsband is not set here.
|
||||
* FT991 apparentlhy cannot set VFOB mode directly
|
||||
* So we'll just set A and swap A into B
|
||||
*
|
||||
*/
|
||||
|
||||
int ft991_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width)
|
||||
{
|
||||
struct newcat_priv_data *priv;
|
||||
struct rig_state *state;
|
||||
int err;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
if (!rig)
|
||||
return -RIG_EINVAL;
|
||||
state = &rig->state;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed mode = %i\n", __func__, tx_mode);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: passed width = %li Hz\n", __func__, tx_width);
|
||||
|
||||
priv = (struct newcat_priv_data *)rig->state.priv;
|
||||
|
||||
// Change mode on VFOA and make VFOB match VFOA
|
||||
if (RIG_OK != (err = newcat_set_mode(rig,RIG_VFO_A,tx_mode,tx_width))) {
|
||||
return err;
|
||||
}
|
||||
// Copy A to B
|
||||
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "AB;");
|
||||
if (RIG_OK != (err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str))))
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s:%d write_block err = %d\n", __func__, __LINE__, err);
|
||||
return err;
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (RIG_OK != (err = newcat_get_cmd (rig)))
|
||||
return err;
|
||||
#endif
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
||||
int ft991_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
||||
{
|
||||
struct newcat_priv_data *priv;
|
||||
int err;
|
||||
|
||||
// FT991 can't set VFOB mode directly so we always set VFOA
|
||||
// We will always make VFOB match VFOA mode
|
||||
newcat_set_mode(rig, RIG_VFO_A, mode, width);
|
||||
|
||||
priv = (struct newcat_priv_data *)rig->state.priv;
|
||||
|
||||
// Copy A to B
|
||||
snprintf(priv->cmd_str, sizeof(priv->cmd_str), "AB;");
|
||||
if (RIG_OK != (err = newcat_get_cmd (rig)))
|
||||
return err;
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
int ft991_init(RIG *rig) {
|
||||
struct newcat_priv_data *priv;
|
||||
rig_debug(RIG_DEBUG_VERBOSE,"%s called, version %s\n", __func__,rig->caps->version);
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
#define FT991_OTHER_TX_MODES (RIG_MODE_CW| RIG_MODE_USB| RIG_MODE_LSB | RIG_MODE_PKTUSB | RIG_MODE_PKTLSB ) /* 100 W class */
|
||||
#define FT991_AM_TX_MODES (RIG_MODE_AM) /* set 25W max */
|
||||
|
||||
#define FT991_LEVELS (RIG_LEVEL_ATT|RIG_LEVEL_PREAMP|\
|
||||
#define FT991_LEVELS (RIG_LEVEL_ATT|RIG_LEVEL_PREAMP|RIG_LEVEL_STRENGTH|\
|
||||
RIG_LEVEL_ALC|RIG_LEVEL_RAWSTR|RIG_LEVEL_SWR|\
|
||||
RIG_LEVEL_RFPOWER|RIG_LEVEL_RF|RIG_LEVEL_SQL|\
|
||||
RIG_LEVEL_MICGAIN|RIG_LEVEL_IF|RIG_LEVEL_CWPITCH|\
|
||||
|
@ -122,9 +122,12 @@
|
|||
|
||||
/* Prototypes */
|
||||
int ft991_init(RIG *rig);
|
||||
int ft991_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo);
|
||||
int ft991_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo);
|
||||
int ft991_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode, pbwidth_t *tx_width);
|
||||
static int ft991_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo);
|
||||
static int ft991_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode, pbwidth_t *tx_width);
|
||||
static int ft991_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width);
|
||||
static int ft991_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width);
|
||||
static int ft991_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo);
|
||||
|
||||
/* Reuse newcat_get_cmd */
|
||||
extern int newcat_get_cmd(RIG *rig);
|
||||
|
||||
|
|
|
@ -2270,6 +2270,7 @@ int newcat_get_level(RIG * rig, vfo_t vfo, setting_t level, value_t * val)
|
|||
/*
|
||||
* Read only levels
|
||||
*/
|
||||
case RIG_LEVEL_STRENGTH:
|
||||
case RIG_LEVEL_RAWSTR:
|
||||
if (!newcat_valid_command(rig, "SM"))
|
||||
return -RIG_ENAVAIL;
|
||||
|
@ -2347,6 +2348,11 @@ int newcat_get_level(RIG * rig, vfo_t vfo, setting_t level, value_t * val)
|
|||
if (val->i < 1)
|
||||
val->i = 1;
|
||||
break;
|
||||
case RIG_LEVEL_STRENGTH: // Yaesu's return straight s-meter answers
|
||||
// Return dbS9 -- does >S9 mean 10dB increments? If not, add to rig driver
|
||||
if (val->i > 0) val->i = (atoi(retlvl)-9)*10;
|
||||
else val->i = (atoi(retlvl)-9)*6; // Return dbS9 does >S9 mean 10dB increments?
|
||||
break;
|
||||
case RIG_LEVEL_RAWSTR:
|
||||
case RIG_LEVEL_KEYSPD:
|
||||
case RIG_LEVEL_IF:
|
||||
|
|
Ładowanie…
Reference in New Issue