From 81dd39319b2a973ab7bb83b17b789a4e157a2033 Mon Sep 17 00:00:00 2001 From: Mike Black W9MDB Date: Fri, 26 May 2023 12:19:50 -0500 Subject: [PATCH] Clean up startup messages in newcat.c when power is off --- rigs/yaesu/newcat.c | 11 +++++++++++ rigs/yaesu/newcat.h | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/rigs/yaesu/newcat.c b/rigs/yaesu/newcat.c index 4be778958..de96b331d 100644 --- a/rigs/yaesu/newcat.c +++ b/rigs/yaesu/newcat.c @@ -1579,6 +1579,11 @@ int newcat_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { RETURNFUNC(-RIG_ENAVAIL); } + if (rig->state.powerstat == 0) + { + rig_debug(RIG_DEBUG_WARN, "%s: Cannot get from rig when power is off\n", __func__); + return RIG_OK; // to prevent repeats + } err = newcat_set_vfo_from_alias(rig, &vfo); @@ -10449,6 +10454,11 @@ int newcat_get_vfo_mode(RIG *rig, vfo_t vfo, rmode_t *vfo_mode) { RETURNFUNC(err); } + if (rig->state.powerstat == 0) + { + rig_debug(RIG_DEBUG_WARN, "%s: Cannot get from rig when power is off\n", __func__); + return RIG_OK; // to prevent repeats + } /* vfo, mem, P7 ************************** */ // e.g. FT450 has 27 byte IF response, FT991 has 28 byte if response (one more byte for P2 VFO A Freq) @@ -10537,6 +10547,7 @@ int newcat_get_cmd(RIG *rig) int is_power_status_cmd = strncmp(priv->cmd_str, "PS", 2) == 0; ENTERFUNC; + priv->ret_data[0] = 0; // ensure zero-length ret_data by default if (state->powerstat == 0 && !is_power_status_cmd) { diff --git a/rigs/yaesu/newcat.h b/rigs/yaesu/newcat.h index 05b8f2fdb..02eb111ca 100644 --- a/rigs/yaesu/newcat.h +++ b/rigs/yaesu/newcat.h @@ -50,7 +50,7 @@ typedef char ncboolean; /* shared function version */ -#define NEWCAT_VER "20230517" +#define NEWCAT_VER "20230526" /* Hopefully large enough for future use, 128 chars plus '\0' */ #define NEWCAT_DATA_LEN 129