From dd4076355d7b864b102d270476aa77c06cd86618 Mon Sep 17 00:00:00 2001 From: Mikael Nousiainen Date: Tue, 12 Jan 2021 11:00:18 +0200 Subject: [PATCH] Re-enable Yaesu question mark handling and fix newcat_get_cmd retries in case of question mark response --- rigs/yaesu/newcat.c | 44 +++++++++++++++++++++----------------------- rigs/yaesu/newcat.h | 2 +- 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/rigs/yaesu/newcat.c b/rigs/yaesu/newcat.c index 20ef392a7..972f2af62 100644 --- a/rigs/yaesu/newcat.c +++ b/rigs/yaesu/newcat.c @@ -3304,9 +3304,7 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) } // Some Yaesu rigs reject this command in AM/FM modes - // Disabling as it's too general - // Need to be rig/mode specific - //priv->question_mark_response_means_rejected = 1; + priv->question_mark_response_means_rejected = 1; break; case RIG_LEVEL_CWPITCH: @@ -3373,9 +3371,7 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) snprintf(priv->cmd_str, sizeof(priv->cmd_str), "MG%03d%c", fpf, cat_term); // Some Yaesu rigs reject this command in RTTY modes - // Disabling as it's too general - // Need to be rig/mode specific - //priv->question_mark_response_means_rejected = 1; + priv->question_mark_response_means_rejected = 1; break; case RIG_LEVEL_METER: @@ -3583,9 +3579,7 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) } // Some Yaesu rigs reject this command in AM/FM modes - // Disabling as it's too general - // Need to be rig/mode specific - //priv->question_mark_response_means_rejected = 1; + priv->question_mark_response_means_rejected = 1; break; case RIG_LEVEL_COMP: @@ -4874,9 +4868,7 @@ int newcat_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) } // Some Yaesu rigs reject this command in AM/FM modes - // Disabling as it's too general - // Need to be rig/mode specific - //priv->question_mark_response_means_rejected = 1; + priv->question_mark_response_means_rejected = 1; break; case RIG_FUNC_MN: @@ -4894,9 +4886,7 @@ int newcat_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) } // Some Yaesu rigs reject this command in AM/FM modes - // Disabling as it's too general - // Need to be rig/mode specific - //priv->question_mark_response_means_rejected = 1; + priv->question_mark_response_means_rejected = 1; break; case RIG_FUNC_FBKIN: @@ -5002,9 +4992,7 @@ int newcat_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) } // Some Yaesu rigs reject this command in AM/FM modes - // Disabling as it's too general - // Need to be rig/mode specific - //priv->question_mark_response_means_rejected = 1; + priv->question_mark_response_means_rejected = 1; break; case RIG_FUNC_COMP: @@ -9160,9 +9148,18 @@ int newcat_get_cmd(RIG *rig) * Followup 20201213 FTDX3000 FB; command returning ?; so do NOT abort * see https://github.com/Hamlib/Hamlib/issues/464 */ - rig_debug(RIG_DEBUG_ERR, "%s: Command rejected by the rig: '%s'\n", __func__, - priv->cmd_str); - // return -RIG_ERJCTED; + if (priv->question_mark_response_means_rejected) + { + rig_debug(RIG_DEBUG_ERR, "%s: Command rejected by the rig: '%s'\n", __func__, + priv->cmd_str); + return -RIG_ERJCTED; + } + + rig_debug(RIG_DEBUG_WARN, "%s: Rig busy - retrying: '%s'\n", __func__, + priv->cmd_str); + + rc = -RIG_BUSBUSY; /* retry */ + break; } continue; @@ -9305,12 +9302,13 @@ int newcat_set_cmd(RIG *rig) if (priv->question_mark_response_means_rejected) { rig_debug(RIG_DEBUG_ERR, "%s: Command rejected by the rig: '%s'\n", __func__, - priv->cmd_str); + priv->cmd_str); return -RIG_ERJCTED; } /* Rig busy wait please */ - rig_debug(RIG_DEBUG_WARN, "%s: Rig busy - retrying\n", __func__); + rig_debug(RIG_DEBUG_WARN, "%s: Rig busy - retrying: '%s'\n", __func__, + priv->cmd_str); /* read the verify command reply */ if ((rc = read_string(&state->rigport, priv->ret_data, sizeof(priv->ret_data), diff --git a/rigs/yaesu/newcat.h b/rigs/yaesu/newcat.h index 29471517b..7c8918dae 100644 --- a/rigs/yaesu/newcat.h +++ b/rigs/yaesu/newcat.h @@ -50,7 +50,7 @@ typedef char ncboolean; /* shared function version */ -#define NEWCAT_VER "20210111" +#define NEWCAT_VER "20210112" /* Hopefully large enough for future use, 128 chars plus '\0' */ #define NEWCAT_DATA_LEN 129