diff --git a/rigs/yaesu/YaesuTargetableVFO.xlsx b/rigs/yaesu/YaesuTargetableVFO.xlsx new file mode 100755 index 000000000..4c33caabc Binary files /dev/null and b/rigs/yaesu/YaesuTargetableVFO.xlsx differ diff --git a/rigs/yaesu/newcat.c b/rigs/yaesu/newcat.c index e87cc8279..6f0a0bd8a 100644 --- a/rigs/yaesu/newcat.c +++ b/rigs/yaesu/newcat.c @@ -11,10 +11,6 @@ * via serial interface to any newer Yaesu radio using the * "new" text CAT interface. * - * Models this code aims to support are FTDX-9000*, FT-2000, FT-DX5000, - * FT-950, FT-450 and FT-1200. Much testing remains. -N0NB - * - * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either @@ -97,6 +93,18 @@ typedef struct _yaesu_newcat_commands ncboolean ft101; } yaesu_newcat_commands_t; +// Easy reference to rig model -- it is set in newcat_valid_command +static ncboolean is_ft450; +static ncboolean is_ft891; +static ncboolean is_ft950; +static ncboolean is_ft991; +static ncboolean is_ft2000; +static ncboolean is_ft9000; +static ncboolean is_ft5000; +static ncboolean is_ft1200; +static ncboolean is_ft3000; +static ncboolean is_ft101; + /* * Even thought this table does make a handy reference, it could be depreciated as it is not really needed. * All of the CAT commands used in the newcat interface are available on the FT-950, FT-2000, FT-5000, and FT-9000. @@ -115,7 +123,7 @@ typedef struct _yaesu_newcat_commands */ static const yaesu_newcat_commands_t valid_commands[] = { - /* Command FT-450 FT-950 FT-891 FT-991 FT-2000 FT-9000 FT-5000 FT-1200 FT-3000 FTDX101D */ + /* Command FT-450 FT-950 FT-891 FT-991 FT-2000 FT-9000 FT-5000 FT-1200 FT-3000 FTDX101D */ {"AB", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"AC", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"AG", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, @@ -176,7 +184,7 @@ static const yaesu_newcat_commands_t valid_commands[] = {"MT", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE }, {"MW", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"MX", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, - {"NA", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, + {"NA", TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE }, {"NB", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"NL", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, {"NR", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, @@ -742,9 +750,7 @@ int newcat_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) /* FT9000 RIG_TARGETABLE_MODE (mode and width) */ /* FT2000 mode only */ - if (newcat_is_rig(rig, RIG_MODEL_FT9000) || - newcat_is_rig(rig, RIG_MODEL_FT2000) || - newcat_is_rig(rig, RIG_MODEL_FTDX5000)) + if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE) { priv->cmd_str[2] = (RIG_VFO_B == vfo) ? '1' : '0'; } @@ -802,9 +808,7 @@ int newcat_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) return err; } - if (newcat_is_rig(rig, RIG_MODEL_FT9000) || - newcat_is_rig(rig, RIG_MODEL_FT2000) || - newcat_is_rig(rig, RIG_MODEL_FTDX5000)) + if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE) { main_sub_vfo = RIG_VFO_B == vfo ? '1' : '0'; } @@ -1159,9 +1163,7 @@ int newcat_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t rptr_shift) return err; } - if (newcat_is_rig(rig, RIG_MODEL_FT9000) || - newcat_is_rig(rig, RIG_MODEL_FT2000) || - newcat_is_rig(rig, RIG_MODEL_FTDX5000)) + if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE) { main_sub_vfo = RIG_VFO_B == vfo ? '1' : '0'; } @@ -1214,9 +1216,7 @@ int newcat_get_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t *rptr_shift) return err; } - if (newcat_is_rig(rig, RIG_MODEL_FT9000) || - newcat_is_rig(rig, RIG_MODEL_FT2000) || - newcat_is_rig(rig, RIG_MODEL_FTDX5000)) + if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE) { main_sub_vfo = (RIG_VFO_B == vfo) ? '1' : '0'; } @@ -1882,9 +1882,7 @@ int newcat_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone) return err; } - if (newcat_is_rig(rig, RIG_MODEL_FT9000) || - newcat_is_rig(rig, RIG_MODEL_FT2000) || - newcat_is_rig(rig, RIG_MODEL_FTDX5000)) + if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE) { main_sub_vfo = (RIG_VFO_B == vfo) ? '1' : '0'; } @@ -1943,9 +1941,7 @@ int newcat_get_ctcss_tone(RIG *rig, vfo_t vfo, tone_t *tone) return err; } - if (newcat_is_rig(rig, RIG_MODEL_FT9000) || - newcat_is_rig(rig, RIG_MODEL_FT2000) || - newcat_is_rig(rig, RIG_MODEL_FTDX5000)) + if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE) { main_sub_vfo = (RIG_VFO_B == vfo) ? '1' : '0'; } @@ -2340,7 +2336,7 @@ int newcat_set_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t option) return err; } - if (newcat_is_rig(rig, RIG_MODEL_FT9000)) + if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE) { main_sub_vfo = RIG_VFO_B == vfo ? '1' : '0'; } @@ -2432,7 +2428,7 @@ int newcat_get_ant(RIG *rig, vfo_t vfo, ant_t dummy, value_t *option, return err; } - if (newcat_is_rig(rig, RIG_MODEL_FT9000)) + if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE) { main_sub_vfo = (RIG_VFO_B == vfo) ? '1' : '0'; } @@ -2499,10 +2495,7 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) return err; } - /* Start with both but mostly FT9000 */ - if (newcat_is_rig(rig, RIG_MODEL_FT9000) || - newcat_is_rig(rig, RIG_MODEL_FT2000) || - newcat_is_rig(rig, RIG_MODEL_FTDX5000)) + if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE) { main_sub_vfo = (RIG_VFO_B == vfo) ? '1' : '0'; } @@ -2585,7 +2578,7 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) snprintf(priv->cmd_str, sizeof(priv->cmd_str), "IS0%+.4d%c", val.i, cat_term); /* problem with %+04d */ - if (newcat_is_rig(rig, RIG_MODEL_FT9000)) + if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE && !is_ft2000) { priv->cmd_str[2] = main_sub_vfo; } @@ -2692,7 +2685,7 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { snprintf(priv->cmd_str, sizeof(priv->cmd_str), "PA00%c", cat_term); - if (newcat_is_rig(rig, RIG_MODEL_FT9000)) + if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE && !is_ft2000) { priv->cmd_str[2] = main_sub_vfo; } @@ -2711,7 +2704,7 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) if (strlen(priv->cmd_str) != 0) { - if (newcat_is_rig(rig, RIG_MODEL_FT9000)) + if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE) { priv->cmd_str[2] = main_sub_vfo; } @@ -2731,7 +2724,7 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RA00%c", cat_term); - if (newcat_is_rig(rig, RIG_MODEL_FT9000)) + if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE && !is_ft2000) { priv->cmd_str[2] = main_sub_vfo; } @@ -2750,7 +2743,7 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) if (strlen(priv->cmd_str) != 0) { - if (newcat_is_rig(rig, RIG_MODEL_FT9000)) + if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE) { priv->cmd_str[2] = main_sub_vfo; } @@ -2809,7 +2802,7 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RL0%02d%c", fpf, cat_term); - if (newcat_is_rig(rig, RIG_MODEL_FT9000)) + if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE && !is_ft2000) { priv->cmd_str[2] = main_sub_vfo; } @@ -2859,9 +2852,7 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) val.i = 3000; } } - else if (newcat_is_rig(rig, RIG_MODEL_FT2000) || - newcat_is_rig(rig, RIG_MODEL_FT9000) || - newcat_is_rig(rig, RIG_MODEL_FTDX5000)) + else if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE) { if (val.i < 1) { @@ -2910,9 +2901,7 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) val.i = 3000; } } - else if (newcat_is_rig(rig, RIG_MODEL_FT2000) || - newcat_is_rig(rig, RIG_MODEL_FT9000) || - newcat_is_rig(rig, RIG_MODEL_FTDX5000)) + else if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE) { if (val.i < 0) { @@ -2988,10 +2977,14 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) snprintf(priv->cmd_str, sizeof(priv->cmd_str), "BP01%03d%c", val.i, cat_term); - if (newcat_is_rig(rig, RIG_MODEL_FT9000)) /* The old CAT Man. shows VFO */ + if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE && !is_ft9000) { priv->cmd_str[2] = main_sub_vfo; } + else if (is_ft9000) // different BP command format + { + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "BP%03d%c", val.i, cat_term); + } break; @@ -3023,9 +3016,7 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) return err; } - if (newcat_is_rig(rig, RIG_MODEL_FT9000) || - newcat_is_rig(rig, RIG_MODEL_FT2000) || - newcat_is_rig(rig, RIG_MODEL_FTDX5000)) + if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE) { main_sub_vfo = (RIG_VFO_B == vfo) ? '1' : '0'; } @@ -3049,7 +3040,7 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) snprintf(priv->cmd_str, sizeof(priv->cmd_str), "PA0%c", cat_term); - if (newcat_is_rig(rig, RIG_MODEL_FT9000)) + if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE) { priv->cmd_str[2] = main_sub_vfo; } @@ -3084,7 +3075,7 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) snprintf(priv->cmd_str, sizeof(priv->cmd_str), "IS0%c", cat_term); - if (newcat_is_rig(rig, RIG_MODEL_FT9000)) + if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE) { priv->cmd_str[2] = main_sub_vfo; } @@ -3135,7 +3126,7 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RA0%c", cat_term); - if (newcat_is_rig(rig, RIG_MODEL_FT9000)) + if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE) { priv->cmd_str[2] = main_sub_vfo; } @@ -3169,7 +3160,7 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RL0%c", cat_term); - if (newcat_is_rig(rig, RIG_MODEL_FT9000)) + if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE) { priv->cmd_str[2] = main_sub_vfo; } @@ -3236,7 +3227,7 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) return -RIG_ENAVAIL; } - if (newcat_is_rig(rig, RIG_MODEL_FT9000)) + if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE) { snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RM09%c", cat_term); } @@ -3253,7 +3244,7 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) return -RIG_ENAVAIL; } - if (newcat_is_rig(rig, RIG_MODEL_FT9000)) + if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE) { snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RM07%c", cat_term); } @@ -3288,7 +3279,7 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) snprintf(priv->cmd_str, sizeof(priv->cmd_str), "BP01%c", cat_term); - if (newcat_is_rig(rig, RIG_MODEL_FT9000)) + if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE) { priv->cmd_str[2] = main_sub_vfo; } @@ -3503,9 +3494,7 @@ int newcat_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) return err; } - if (newcat_is_rig(rig, RIG_MODEL_FT9000) || - newcat_is_rig(rig, RIG_MODEL_FT2000) || - newcat_is_rig(rig, RIG_MODEL_FTDX5000)) + if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE) { main_sub_vfo = (RIG_VFO_B == vfo) ? '1' : '0'; } @@ -3521,7 +3510,7 @@ int newcat_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) snprintf(priv->cmd_str, sizeof(priv->cmd_str), "BC0%d%c", status ? 1 : 0, cat_term); - if (newcat_is_rig(rig, RIG_MODEL_FT9000)) + if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE && !is_ft2000) { priv->cmd_str[2] = main_sub_vfo; } @@ -3537,7 +3526,7 @@ int newcat_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) snprintf(priv->cmd_str, sizeof(priv->cmd_str), "BP00%03d%c", status ? 1 : 0, cat_term); - if (newcat_is_rig(rig, RIG_MODEL_FT9000)) + if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE && !is_ft2000) { priv->cmd_str[2] = main_sub_vfo; } @@ -3676,7 +3665,7 @@ int newcat_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status) snprintf(priv->cmd_str, sizeof(priv->cmd_str), "BC0%c", cat_term); - if (newcat_is_rig(rig, RIG_MODEL_FT9000)) + if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE) { priv->cmd_str[2] = main_sub_vfo; } @@ -3691,7 +3680,7 @@ int newcat_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status) snprintf(priv->cmd_str, sizeof(priv->cmd_str), "BP00%c", cat_term); - if (newcat_is_rig(rig, RIG_MODEL_FT9000)) + if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE) { priv->cmd_str[2] = main_sub_vfo; } @@ -4076,9 +4065,7 @@ int newcat_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op) return err; } - if (newcat_is_rig(rig, RIG_MODEL_FT9000) || - newcat_is_rig(rig, RIG_MODEL_FT2000) || - newcat_is_rig(rig, RIG_MODEL_FTDX5000)) + if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE) { main_sub_vfo = (RIG_VFO_B == vfo) ? '1' : '0'; } @@ -4592,16 +4579,6 @@ const char *newcat_get_info(RIG *rig) ncboolean newcat_valid_command(RIG *rig, char const *const command) { const struct rig_caps *caps; - ncboolean is_ft450; - ncboolean is_ft891; - ncboolean is_ft950; - ncboolean is_ft991; - ncboolean is_ft2000; - ncboolean is_ft9000; - ncboolean is_ft5000; - ncboolean is_ft1200; - ncboolean is_ft3000; - ncboolean is_ft101; int search_high; int search_low; @@ -4962,10 +4939,7 @@ int newcat_set_narrow(RIG *rig, vfo_t vfo, ncboolean narrow) return err; } - if (newcat_is_rig(rig, RIG_MODEL_FT9000) || - newcat_is_rig(rig, RIG_MODEL_FT2000) || - newcat_is_rig(rig, RIG_MODEL_FTDX5000) || - newcat_is_rig(rig, RIG_MODEL_FTDX3000)) + if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE) { main_sub_vfo = (RIG_VFO_B == vfo) ? '1' : '0'; } @@ -5010,10 +4984,7 @@ int newcat_get_narrow(RIG *rig, vfo_t vfo, ncboolean *narrow) return err; } - if (newcat_is_rig(rig, RIG_MODEL_FT9000) || - newcat_is_rig(rig, RIG_MODEL_FT2000) || - newcat_is_rig(rig, RIG_MODEL_FTDX5000) || - newcat_is_rig(rig, RIG_MODEL_FTDX3000)) + if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE) { main_sub_vfo = (RIG_VFO_B == vfo) ? '1' : '0'; } @@ -5066,9 +5037,7 @@ int newcat_set_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) return err; } - if (newcat_is_rig(rig, RIG_MODEL_FT9000) || - newcat_is_rig(rig, RIG_MODEL_FTDX5000) || - newcat_is_rig(rig, RIG_MODEL_FTDX3000)) + if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE && !is_ft2000) { main_sub_vfo = (RIG_VFO_B == vfo) ? '1' : '0'; } @@ -5731,9 +5700,7 @@ int newcat_get_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t *width) return err; } - if (newcat_is_rig(rig, RIG_MODEL_FT9000) || - newcat_is_rig(rig, RIG_MODEL_FTDX5000) || - newcat_is_rig(rig, RIG_MODEL_FTDX3000)) + if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE) { main_sub_vfo = (RIG_VFO_B == vfo) ? '1' : '0'; }