diff --git a/include/hamlib/rig.h b/include/hamlib/rig.h index 9813e0be5..949bdd288 100644 --- a/include/hamlib/rig.h +++ b/include/hamlib/rig.h @@ -804,8 +804,8 @@ typedef enum { // numbers here reflect the Yaesu values #define RIG_BANDSELECT_HF (RIG_BANDSELECT_160M | RIG_BANDSELECT_80M | RIG_BANDSELECT_60M | RIG_BANDSELECT_40M\ | RIG_BANDSELECT_30M | RIG_BANDSELECT_20M | RIG_BANDSELECT_17M | RIG_BANDSELECT_15M | RIG_BANDSELECT_12M\ RIG_BANDSELECT_10M | RIG_BANDSELECT_6M) -#define RIG_BANDSELECT_UHF (RIG_BANDSELECT_AIR | RIG_BANDSELECT_2M| RIG_BANDSELECT_1_25M( -#define RIG_BANDSELECT_VHF (RIG_BANDSELECT_70CM) +#define RIG_BANDSELECT_VHF (RIG_BANDSELECT_AIR | RIG_BANDSELECT_2M| RIG_BANDSELECT_1_25M( +#define RIG_BANDSELECT_UHF (RIG_BANDSELECT_70CM) /** diff --git a/rigs/yaesu/ft450.c b/rigs/yaesu/ft450.c index d0a7cbb34..a2c245be9 100644 --- a/rigs/yaesu/ft450.c +++ b/rigs/yaesu/ft450.c @@ -69,6 +69,7 @@ const struct rig_caps ft450_caps = [LVL_CWPITCH] = { .min = { .i = 400 }, .max = { .i = 800 }, .step = { .i = 100 } }, [LVL_NOTCHF] = { .min = { .i = 1 }, .max = { .i = 4000 }, .step = { .i = 10 } }, [LVL_VOXGAIN] = { .min = { .f = 0 }, .max = { .f = 1.0 }, .step = { .f = 1.0f/255.0f } }, + [LVL_NR] = { .min = { .f = 0 }, .max = { .f = 1.0 }, .step = { .f = 1.0f/11.0f } }, }, .parm_gran = { [PARM_BANDSELECT] = {.min = {.f = 0.0f}, .max = {.f = 1.0f}, .step = {.s = "BAND160M,BAND80M,BANDUNUSED,BAND40M,BAND30M,BAND20M,BAND17M,BAND15M,BAND12M,BAND10M,BAND6M,BANDGEN"}} diff --git a/rigs/yaesu/newcat.c b/rigs/yaesu/newcat.c index 78ea6a297..757d58694 100644 --- a/rigs/yaesu/newcat.c +++ b/rigs/yaesu/newcat.c @@ -386,7 +386,6 @@ const struct confparams newcat_cfg_params[] = static ncboolean newcat_is_rig(RIG *rig, rig_model_t model); static int newcat_set_vfo_from_alias(RIG *rig, vfo_t *vfo); -static int newcat_scale_float(int scale, float fval); static int newcat_get_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t *width); static int newcat_set_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, @@ -4446,10 +4445,9 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) RETURNFUNC(-RIG_ENAVAIL); } + fpf = (int)((val.f / level_info->step.f) + 0.5); if (newcat_is_rig(rig, RIG_MODEL_FT450)) { - fpf = newcat_scale_float(11, val.f); - if (fpf < 1) { fpf = 1; @@ -4466,24 +4464,15 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { if (is_ft991) { - fpf = newcat_scale_float(15, val.f); - if (fpf > 15) { fpf = 15; } if (fpf < 1) { fpf = 1; } } else { - fpf = newcat_scale_float(15, val.f); - if (fpf > 15) { fpf = 10; } } - if (fpf < 0) - { - fpf = 0; - } - SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "RL0%02d%c", fpf, cat_term); if (rig->caps->targetable_vfo & RIG_TARGETABLE_LEVEL && !is_ft2000 @@ -5566,6 +5555,7 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) case RIG_LEVEL_AF: case RIG_LEVEL_RF: + case RIG_LEVEL_NR: case RIG_LEVEL_SQL: case RIG_LEVEL_COMP: case RIG_LEVEL_ANTIVOX: @@ -5688,18 +5678,6 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) break; - case RIG_LEVEL_NR: - if (is_ft450) - { - val->f = (float)(atoi(retlvl) / 11.); - } - else - { - val->f = (float)(atoi(retlvl) / 15.); - } - - break; - case RIG_LEVEL_VOXDELAY: val->i = atoi(retlvl); @@ -8117,35 +8095,6 @@ int newcat_set_vfo_from_alias(RIG *rig, vfo_t *vfo) RETURNFUNC(RIG_OK); } -/* - * Found newcat_set_level() floating point math problem - * Using rigctl on FT950 I was trying to set RIG_LEVEL_COMP to 12 - * I kept setting it to 11. I wrote some test software and - * found out that 0.12 * 100 = 11 with my setup. - * Compiler is gcc 4.2.4, CPU is AMD X2 - * This works somewhat but Find a better way. - * The newcat_get_level() seems to work correctly. - * Terry KJ4EED - * - */ -int newcat_scale_float(int scale, float fval) -{ - float f; - float fudge = 0.003; - - if ((fval + fudge) > 1.0) - { - f = scale * fval; - } - else - { - f = scale * (fval + fudge); - } - - return (int) f; // RETURN is too verbose here -} - - int newcat_set_narrow(RIG *rig, vfo_t vfo, ncboolean narrow) { struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;