From ffe7184970ccfde09e85db02d7d7bad743ee54a1 Mon Sep 17 00:00:00 2001 From: Michael Black W9MDB Date: Sat, 12 Dec 2020 08:24:33 -0600 Subject: [PATCH] Normalize Yaesu RFPOWER_METER_LEVELS to 100W This is a quick fix for most Yaesu rigs We need a new RIG_LEVEL_RFPOWER_METER_WATTS to return watts instead of 0-1.0 https://github.com/Hamlib/Hamlib/issues/462 --- rigs/yaesu/newcat.c | 14 +++++++++++--- rigs/yaesu/newcat.h | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/rigs/yaesu/newcat.c b/rigs/yaesu/newcat.c index a088f0cab..2252ed4ad 100644 --- a/rigs/yaesu/newcat.c +++ b/rigs/yaesu/newcat.c @@ -163,7 +163,7 @@ const cal_table_float_t yaesu_default_comp_meter_cal = 2, { {0, 0.0f}, - {255, 1.0f}, + {255, 100.0f}, } }; @@ -4372,7 +4372,9 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) if (retlvl_len > 3) { // Some rigs like FTDX101 have 6-byte return so we just truncate + rig_debug(RIG_DEBUG_VERBOSE, "%s: retlvl of %s getting truncated\n", __func__, retlvl); retlvl[3] = 0; + rig_debug(RIG_DEBUG_VERBOSE, "%s: retlvl truncated to %s\n", __func__, retlvl); } if (rig->caps->rfpower_meter_cal.size == 0) @@ -4383,6 +4385,12 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { val->f = rig_raw2val_float(atoi(retlvl), &rig->caps->rfpower_meter_cal); } + rig_debug(RIG_DEBUG_VERBOSE, "%s: RFPOWER_METER=%s, converted to %f\n", __func__, retlvl, val->f); + if (val->f > 1.0) + { + rig_debug(RIG_DEBUG_VERBOSE, "%s: val->f(%f) clipped at 1.0\n", __func__, val->f); + val->f = 1.0; + } break; @@ -4395,11 +4403,11 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) if (rig->caps->comp_meter_cal.size == 0) { - val->f = rig_raw2val_float(atoi(retlvl), &yaesu_default_comp_meter_cal); + val->f = rig_raw2val_float(atoi(retlvl), &yaesu_default_comp_meter_cal)/100; } else { - val->f = rig_raw2val_float(atoi(retlvl), &rig->caps->comp_meter_cal); + val->f = rig_raw2val_float(atoi(retlvl), &rig->caps->comp_meter_cal)/100; } break; diff --git a/rigs/yaesu/newcat.h b/rigs/yaesu/newcat.h index 0a88e03fb..6b8e76e6c 100644 --- a/rigs/yaesu/newcat.h +++ b/rigs/yaesu/newcat.h @@ -50,7 +50,7 @@ typedef char ncboolean; /* shared function version */ -#define NEWCAT_VER "20201211" +#define NEWCAT_VER "20201212" /* Hopefully large enough for future use, 128 chars plus '\0' */ #define NEWCAT_DATA_LEN 129