kopia lustrzana https://github.com/Hamlib/Hamlib
Add ALC, SWR and change PWR to table lookup for FT817
https://github.com/Hamlib/Hamlib/issues/406pull/412/head
rodzic
c31fb3dcc4
commit
9a2625ebef
|
@ -69,6 +69,7 @@
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "tones.h"
|
#include "tones.h"
|
||||||
#include "bandplan.h"
|
#include "bandplan.h"
|
||||||
|
#include "cal.h"
|
||||||
|
|
||||||
|
|
||||||
/* Native ft817 cmd set prototypes. These are READ ONLY as each */
|
/* Native ft817 cmd set prototypes. These are READ ONLY as each */
|
||||||
|
@ -159,12 +160,43 @@ enum ft817_digi
|
||||||
{ 0x0F, 60 } /* +60 */ \
|
{ 0x0F, 60 } /* +60 */ \
|
||||||
} }
|
} }
|
||||||
|
|
||||||
|
// Thanks to Olivier Schmitt sc.olivier@gmail.com for these tables
|
||||||
|
#define FT817_PWR_CAL { 9, \
|
||||||
|
{ \
|
||||||
|
{ 0x00, 0 }, \
|
||||||
|
{ 0x01, 10 }, \
|
||||||
|
{ 0x02, 14 }, \
|
||||||
|
{ 0x03, 20 }, \
|
||||||
|
{ 0x04, 34 }, \
|
||||||
|
{ 0x05, 50 }, \
|
||||||
|
{ 0x06, 66 }, \
|
||||||
|
{ 0x07, 82 }, \
|
||||||
|
{ 0x08, 100 } \
|
||||||
|
} }
|
||||||
|
|
||||||
|
#define FT817_ALC_CAL { 6, \
|
||||||
|
{ \
|
||||||
|
{ 0x00, 0 }, \
|
||||||
|
{ 0x01, 20 }, \
|
||||||
|
{ 0x02, 40 }, \
|
||||||
|
{ 0x03, 60 }, \
|
||||||
|
{ 0x04, 80 }, \
|
||||||
|
{ 0x05, 100 } \
|
||||||
|
} }
|
||||||
|
|
||||||
|
#define FT817_SWR_CAL { 2, \
|
||||||
|
{ \
|
||||||
|
{ 0, 0 }, \
|
||||||
|
{ 15, 100 } \
|
||||||
|
} }
|
||||||
|
|
||||||
|
|
||||||
const struct rig_caps ft817_caps =
|
const struct rig_caps ft817_caps =
|
||||||
{
|
{
|
||||||
RIG_MODEL(RIG_MODEL_FT817),
|
RIG_MODEL(RIG_MODEL_FT817),
|
||||||
.model_name = "FT-817",
|
.model_name = "FT-817",
|
||||||
.mfg_name = "Yaesu",
|
.mfg_name = "Yaesu",
|
||||||
.version = "20200903.0",
|
.version = "20201009.0",
|
||||||
.copyright = "LGPL",
|
.copyright = "LGPL",
|
||||||
.status = RIG_STATUS_STABLE,
|
.status = RIG_STATUS_STABLE,
|
||||||
.rig_type = RIG_TYPE_TRANSCEIVER,
|
.rig_type = RIG_TYPE_TRANSCEIVER,
|
||||||
|
@ -268,6 +300,9 @@ const struct rig_caps ft817_caps =
|
||||||
},
|
},
|
||||||
|
|
||||||
.str_cal = FT817_STR_CAL,
|
.str_cal = FT817_STR_CAL,
|
||||||
|
.swr_cal = FT817_SWR_CAL,
|
||||||
|
.alc_cal = FT817_ALC_CAL,
|
||||||
|
.rfpower_meter_cal = FT817_PWR_CAL,
|
||||||
|
|
||||||
.rig_init = ft817_init,
|
.rig_init = ft817_init,
|
||||||
.rig_cleanup = ft817_cleanup,
|
.rig_cleanup = ft817_cleanup,
|
||||||
|
@ -572,7 +607,7 @@ static int ft817_get_status(RIG *rig, int status)
|
||||||
|
|
||||||
case FT817_NATIVE_CAT_GET_RX_STATUS:
|
case FT817_NATIVE_CAT_GET_RX_STATUS:
|
||||||
data = &p->rx_status;
|
data = &p->rx_status;
|
||||||
len = 1;
|
len = 2;
|
||||||
tv = &p->rx_status_tv;
|
tv = &p->rx_status_tv;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -803,6 +838,37 @@ int ft817_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
|
||||||
return RIG_OK;
|
return RIG_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int ft817_get_alc_level(RIG *rig, value_t *val)
|
||||||
|
{
|
||||||
|
struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv;
|
||||||
|
|
||||||
|
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
|
||||||
|
|
||||||
|
if (check_cache_timeout(&p->tx_status_tv))
|
||||||
|
{
|
||||||
|
int n;
|
||||||
|
|
||||||
|
if ((n = ft817_get_status(rig, FT817_NATIVE_CAT_GET_TX_STATUS)) < 0)
|
||||||
|
{
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Valid only if PTT is on.
|
||||||
|
FT-817 returns the number of bars in the lowest 4 bits
|
||||||
|
*/
|
||||||
|
if ((p->tx_status & 0x80) == 0)
|
||||||
|
{
|
||||||
|
val->f = rig_raw2val_float(p->tx_status >> 4, &rig->caps->alc_cal);
|
||||||
|
}
|
||||||
|
else // not transmitting so zero
|
||||||
|
{
|
||||||
|
val->f = 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return RIG_OK;
|
||||||
|
}
|
||||||
|
|
||||||
static int ft817_get_pometer_level(RIG *rig, value_t *val)
|
static int ft817_get_pometer_level(RIG *rig, value_t *val)
|
||||||
{
|
{
|
||||||
struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv;
|
struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv;
|
||||||
|
@ -824,11 +890,9 @@ static int ft817_get_pometer_level(RIG *rig, value_t *val)
|
||||||
*/
|
*/
|
||||||
if ((p->tx_status & 0x80) == 0)
|
if ((p->tx_status & 0x80) == 0)
|
||||||
{
|
{
|
||||||
/* the rig has 10 bars on its display */
|
val->f = rig_raw2val_float(p->tx_status >> 4, &rig->caps->rfpower_meter_cal);
|
||||||
val->f = (p->tx_status & 0x0F) / 10.0;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else // not transmitting so zero
|
||||||
{
|
{
|
||||||
val->f = 0.0;
|
val->f = 0.0;
|
||||||
}
|
}
|
||||||
|
@ -836,7 +900,6 @@ static int ft817_get_pometer_level(RIG *rig, value_t *val)
|
||||||
return RIG_OK;
|
return RIG_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* frontend will always use RAWSTR+cal_table */
|
/* frontend will always use RAWSTR+cal_table */
|
||||||
static int ft817_get_smeter_level(RIG *rig, value_t *val)
|
static int ft817_get_smeter_level(RIG *rig, value_t *val)
|
||||||
{
|
{
|
||||||
|
@ -919,6 +982,10 @@ int ft817_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
||||||
return ft817_get_pometer_level(rig, val);
|
return ft817_get_pometer_level(rig, val);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case RIG_LEVEL_ALC:
|
||||||
|
return ft817_get_alc_level(rig, val);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return -RIG_EINVAL;
|
return -RIG_EINVAL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,8 @@
|
||||||
#define FT817_CACHE_TIMEOUT 50
|
#define FT817_CACHE_TIMEOUT 50
|
||||||
|
|
||||||
|
|
||||||
enum ft817_native_cmd_e {
|
enum ft817_native_cmd_e
|
||||||
|
{
|
||||||
FT817_NATIVE_CAT_LOCK_ON = 0,
|
FT817_NATIVE_CAT_LOCK_ON = 0,
|
||||||
FT817_NATIVE_CAT_LOCK_OFF,
|
FT817_NATIVE_CAT_LOCK_OFF,
|
||||||
FT817_NATIVE_CAT_PTT_ON,
|
FT817_NATIVE_CAT_PTT_ON,
|
||||||
|
@ -121,7 +122,8 @@ enum ft817_native_cmd_e {
|
||||||
typedef enum ft817_native_cmd_e ft817_native_cmd_t;
|
typedef enum ft817_native_cmd_e ft817_native_cmd_t;
|
||||||
|
|
||||||
|
|
||||||
struct ft817_priv_data {
|
struct ft817_priv_data
|
||||||
|
{
|
||||||
yaesu_cmd_set_t pcs[FT817_NATIVE_SIZE]; /* TODO: why? */
|
yaesu_cmd_set_t pcs[FT817_NATIVE_SIZE]; /* TODO: why? */
|
||||||
|
|
||||||
/* rx status */
|
/* rx status */
|
||||||
|
@ -134,37 +136,39 @@ struct ft817_priv_data {
|
||||||
|
|
||||||
/* freq & mode status */
|
/* freq & mode status */
|
||||||
struct timeval fm_status_tv;
|
struct timeval fm_status_tv;
|
||||||
unsigned char fm_status[YAESU_CMD_LENGTH+1];
|
unsigned char fm_status[YAESU_CMD_LENGTH + 1];
|
||||||
};
|
};
|
||||||
|
|
||||||
/* fixme: why declare static? it has no effect */
|
/* fixme: why declare static? it has no effect */
|
||||||
static int ft817_init (RIG *rig);
|
static int ft817_init(RIG *rig);
|
||||||
static int ft817_open (RIG *rig);
|
static int ft817_open(RIG *rig);
|
||||||
static int ft817_cleanup (RIG *rig);
|
static int ft817_cleanup(RIG *rig);
|
||||||
static int ft817_close (RIG *rig);
|
static int ft817_close(RIG *rig);
|
||||||
static int ft817_set_freq (RIG *rig, vfo_t vfo, freq_t freq);
|
static int ft817_set_freq(RIG *rig, vfo_t vfo, freq_t freq);
|
||||||
static int ft817_get_freq (RIG *rig, vfo_t vfo, freq_t *freq);
|
static int ft817_get_freq(RIG *rig, vfo_t vfo, freq_t *freq);
|
||||||
static int ft817_set_mode (RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width);
|
static int ft817_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width);
|
||||||
static int ft817_get_mode (RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width);
|
static int ft817_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width);
|
||||||
static int ft817_set_ptt (RIG *rig, vfo_t vfo, ptt_t ptt);
|
static int ft817_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt);
|
||||||
static int ft817_get_ptt (RIG *rig, vfo_t vfo, ptt_t *ptt);
|
static int ft817_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt);
|
||||||
static int ft817_get_level (RIG *rig, vfo_t vfo, setting_t level, value_t *val);
|
static int ft817_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val);
|
||||||
static int ft817_set_func (RIG *rig, vfo_t vfo, setting_t func, int status);
|
static int ft817_set_func(RIG *rig, vfo_t vfo, setting_t func, int status);
|
||||||
static int ft817_set_dcs_code (RIG *rig, vfo_t vfo, tone_t code);
|
static int ft817_set_dcs_code(RIG *rig, vfo_t vfo, tone_t code);
|
||||||
static int ft817_set_ctcss_tone (RIG *rig, vfo_t vfo, tone_t tone);
|
static int ft817_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone);
|
||||||
static int ft817_set_dcs_sql (RIG *rig, vfo_t vfo, tone_t code);
|
static int ft817_set_dcs_sql(RIG *rig, vfo_t vfo, tone_t code);
|
||||||
static int ft817_set_ctcss_sql (RIG *rig, vfo_t vfo, tone_t tone);
|
static int ft817_set_ctcss_sql(RIG *rig, vfo_t vfo, tone_t tone);
|
||||||
static int ft817_set_rptr_shift (RIG *rig, vfo_t vfo, rptr_shift_t shift);
|
static int ft817_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t shift);
|
||||||
static int ft817_set_rptr_offs (RIG *rig, vfo_t vfo, shortfreq_t offs);
|
static int ft817_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t offs);
|
||||||
static int ft817_set_rit (RIG *rig, vfo_t vfo, shortfreq_t rit);
|
static int ft817_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit);
|
||||||
static int ft817_get_dcd (RIG *rig, vfo_t vfo, dcd_t *dcd);
|
static int ft817_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd);
|
||||||
int ft817_set_powerstat (RIG *rig, powerstat_t status);
|
int ft817_set_powerstat(RIG *rig, powerstat_t status);
|
||||||
static int ft817_vfo_op (RIG *rig, vfo_t vfo, vfo_op_t op);
|
static int ft817_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op);
|
||||||
static int ft817_get_split_vfo (RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo);
|
static int ft817_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
|
||||||
static int ft817_set_split_vfo (RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo);
|
vfo_t *tx_vfo);
|
||||||
static int ft817_power2mW (RIG *rig, unsigned int *mwpower, float power,
|
static int ft817_set_split_vfo(RIG *rig, vfo_t vfo, split_t split,
|
||||||
|
vfo_t tx_vfo);
|
||||||
|
static int ft817_power2mW(RIG *rig, unsigned int *mwpower, float power,
|
||||||
freq_t freq, rmode_t mode);
|
freq_t freq, rmode_t mode);
|
||||||
static int ft817_mW2power (RIG *rig, float *power, unsigned int mwpower,
|
static int ft817_mW2power(RIG *rig, float *power, unsigned int mwpower,
|
||||||
freq_t freq, rmode_t mode);
|
freq_t freq, rmode_t mode);
|
||||||
|
|
||||||
#endif /* _FT817_H */
|
#endif /* _FT817_H */
|
||||||
|
|
Ładowanie…
Reference in New Issue