From 6db44d6d497d6e1399fde1daaf65d1fcf36f11e3 Mon Sep 17 00:00:00 2001 From: Christian Bayer Date: Sun, 28 Jul 2024 20:00:35 +0200 Subject: [PATCH 1/2] upstream 817 --- rigs/yaesu/ft817.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/rigs/yaesu/ft817.c b/rigs/yaesu/ft817.c index 0b0066b42..499e2c019 100644 --- a/rigs/yaesu/ft817.c +++ b/rigs/yaesu/ft817.c @@ -282,10 +282,25 @@ enum ft817_digi { 0x05, 100 } \ } } -#define FT817_SWR_CAL { 2, \ +// SWR values from Christian WA4YA, DL4YA +#define FT817_SWR_CAL { 16, \ { \ - { 0, 0 }, \ - { 15, 100 } \ + { 0, 1.0f }, \ + { 1, 1.4f }, \ + { 2, 1.8f }, \ + { 3, 2.13f }, \ + { 4, 2.25f }, \ + { 5, 3.7f }, \ + { 6, 6.0f }, \ + { 7, 7.0f }, \ + { 8, 8.0f }, \ + { 9, 9.0f }, \ + { 10, 10.0f }, \ + { 11, 10.0f }, \ + { 12, 10.0f }, \ + { 13, 10.0f }, \ + { 14, 10.0f }, \ + { 15, 10.0f } \ } } @@ -294,7 +309,7 @@ struct rig_caps ft817_caps = RIG_MODEL(RIG_MODEL_FT817), .model_name = "FT-817", .mfg_name = "Yaesu", - .version = "20240520.0", + .version = "20240728.1", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, @@ -1178,7 +1193,7 @@ static int ft817_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) } } - *ptt = ((p->tx_status & 0x80) == 0); + *ptt = ((p->tx_status & 0x20) == 0x20); return RIG_OK; } From 748be3707ff353b25585b12a780a5253f9f2a8de Mon Sep 17 00:00:00 2001 From: Christian Bayer Date: Mon, 29 Jul 2024 17:54:50 +0200 Subject: [PATCH 2/2] FT-817 power and SWR levels --- rigs/yaesu/ft817.c | 45 ++++++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/rigs/yaesu/ft817.c b/rigs/yaesu/ft817.c index 499e2c019..2234d42a7 100644 --- a/rigs/yaesu/ft817.c +++ b/rigs/yaesu/ft817.c @@ -128,6 +128,7 @@ struct ft817_priv_data /* Digi mode is not part of regular fm_status response. * So keep track of it in a separate variable. */ unsigned char dig_mode; + float swr; }; static int ft817_init(RIG *rig); @@ -261,15 +262,15 @@ enum ft817_digi // 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 } \ + { 0x00, 0.0f }, \ + { 0x01, 0.5f }, \ + { 0x02, 0.75f }, \ + { 0x03, 1.0f }, \ + { 0x04, 1.7f }, \ + { 0x05, 2.5f }, \ + { 0x06, 3.3f }, \ + { 0x07, 4.1f }, \ + { 0x08, 5.0f } \ } } #define FT817_ALC_CAL { 6, \ @@ -330,7 +331,7 @@ struct rig_caps ft817_caps = .has_set_func = RIG_FUNC_LOCK | RIG_FUNC_TONE | RIG_FUNC_TSQL | RIG_FUNC_CSQL | RIG_FUNC_RIT, .has_get_level = RIG_LEVEL_STRENGTH | RIG_LEVEL_RAWSTR | RIG_LEVEL_RFPOWER | - RIG_LEVEL_ALC | RIG_LEVEL_SWR, + RIG_LEVEL_ALC | RIG_LEVEL_SWR | RIG_LEVEL_RFPOWER_METER_WATTS, .has_set_level = RIG_LEVEL_BAND_SELECT, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, @@ -765,6 +766,7 @@ struct rig_caps ft818_caps = static int ft817_init(RIG *rig) { + struct ft817_priv_data *p; rig_debug(RIG_DEBUG_VERBOSE, "%s: called, version %s\n", __func__, rig->caps->version); @@ -772,6 +774,9 @@ static int ft817_init(RIG *rig) { return -RIG_ENOMEM; } + p = (struct ft817_priv_data *) STATE(rig)->priv; + + p->swr = 10; return RIG_OK; } @@ -979,9 +984,9 @@ static int ft817_get_status(RIG *rig, int status) /* FT-817 returns 2 bytes with 4 nibbles. * Extract raw values here; * convert to float when they are requested. */ - p->swr_level = result[0] & 0xF; - p->pwr_level = result[0] >> 4; - p->alc_level = result[1] & 0xF; + p->swr_level = (result[1] & 0xF0) >> 4; + p->pwr_level = (result[0] & 0xF0) >> 4; + p->alc_level = result[0] & 0x0F; p->mod_level = result[1] >> 4; rig_debug(RIG_DEBUG_TRACE, "%s: swr: %d, pwr %d, alc %d, mod %d\n", __func__, @@ -1168,10 +1173,12 @@ static int ft817_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, } *split = (c[0] & 0x80) ? RIG_SPLIT_ON : RIG_SPLIT_OFF; + *tx_vfo = RIG_VFO_A; } else { *split = (p->tx_status & 0x20) ? RIG_SPLIT_ON : RIG_SPLIT_OFF; + *tx_vfo = RIG_VFO_B; } return RIG_OK; @@ -1193,7 +1200,7 @@ static int ft817_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) } } - *ptt = ((p->tx_status & 0x20) == 0x20); + *ptt = p->tx_status != 0xff; return RIG_OK; } @@ -1227,8 +1234,8 @@ static int ft817_get_tx_level(RIG *rig, value_t *val, unsigned char *tx_level, if (ptt == RIG_PTT_OFF) { - rig_debug(RIG_DEBUG_VERBOSE, "%s: rig not keyed\n", __func__); - return -RIG_ERJCTED; //Or return OK? + val->f = p->swr; + return RIG_OK; } n = ft817_get_status(rig, FT817_NATIVE_CAT_GET_TX_METERING); @@ -1239,7 +1246,7 @@ static int ft817_get_tx_level(RIG *rig, value_t *val, unsigned char *tx_level, } } - val->f = rig_raw2val_float(*tx_level, cal); + p->swr = val->f = rig_raw2val_float(*tx_level, cal); rig_debug(RIG_DEBUG_VERBOSE, "%s: level %f\n", __func__, val->f); return RIG_OK; @@ -1333,6 +1340,10 @@ static int ft817_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) case RIG_LEVEL_SWR: return ft817_get_tx_level(rig, val, &p->swr_level, &rig->caps->swr_cal); + case RIG_LEVEL_RFPOWER_METER_WATTS: + return ft817_get_tx_level(rig, val, &p->pwr_level, + &rig->caps->rfpower_meter_cal); + default: return -RIG_EINVAL; }