From 6de8bb5089ec4815c69bb1c0db6635679ecdc148 Mon Sep 17 00:00:00 2001 From: "Nate Bargmann, N0NB" Date: Sat, 19 Feb 2011 02:58:11 +0000 Subject: [PATCH] k3_set/get_split_mode dummy functions The K3 will swap VFOs with the frontend's implementation of get_split_mode when the backend's definition in rig_caps is NULL. These functions simply return -RIG_ENAVAIL when called to preserve the K3's operating state. git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@3057 7ae35d74-ebe9-4afe-98af-79ac388436b8 --- kenwood/k3.c | 47 +++++++++++++++++++++++++++++++++++++---------- kenwood/kenwood.h | 4 ++-- 2 files changed, 39 insertions(+), 12 deletions(-) diff --git a/kenwood/k3.c b/kenwood/k3.c index d3ea3749d..9e3fb93cf 100644 --- a/kenwood/k3.c +++ b/kenwood/k3.c @@ -66,6 +66,8 @@ int k3_set_vfo(RIG *rig, vfo_t vfo); int k3_get_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t *val); int k3_set_rit(RIG * rig, vfo_t vfo, shortfreq_t rit); int k3_set_xit(RIG * rig, vfo_t vfo, shortfreq_t rit); +int k3_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width); +int k3_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode, pbwidth_t *tx_width); /* Private helper functions */ @@ -73,7 +75,7 @@ int set_rit_xit(RIG * rig, char *func, shortfreq_t rit); /* - * KIO3 rig capabilities. + * K3 rig capabilities. * This kit can recognize a large subset of TS-570/K2 commands and has many * extensions of its own. Extension backend functions to standard Kenwood * command are defined in elecraft.c (shared with K2) and in this file. @@ -188,6 +190,8 @@ const struct rig_caps k3_caps = { .get_mode = k3_get_mode, .set_vfo = k3_set_vfo, .get_vfo = kenwood_get_vfo_if, + .set_split_mode = k3_set_split_mode, + .get_split_mode = k3_get_split_mode, .set_split_vfo = kenwood_set_split_vfo, .get_split_vfo = kenwood_get_split_vfo_if, .set_rit = k3_set_rit, @@ -469,11 +473,11 @@ int k3_set_rit(RIG * rig, vfo_t vfo, shortfreq_t rit) return -RIG_EINVAL; if (rit == 0) - snprintf(&func, 4, "RT0"); + snprintf(func, 4, "RT0"); else - snprintf(&func, 4, "RT1"); + snprintf(func, 4, "RT1"); - err = set_rit_xit(rig, &func, rit); + err = set_rit_xit(rig, func, rit); if (err != RIG_OK) return err; @@ -497,11 +501,11 @@ int k3_set_xit(RIG * rig, vfo_t vfo, shortfreq_t rit) return -RIG_EINVAL; if (rit == 0) - snprintf(&func, 4, "XT0"); + snprintf(func, 4, "XT0"); else - snprintf(&func, 4, "XT1"); + snprintf(func, 4, "XT1"); - err = set_rit_xit(rig, &func, rit); + err = set_rit_xit(rig, func, rit); if (err != RIG_OK) return err; @@ -509,6 +513,31 @@ int k3_set_xit(RIG * rig, vfo_t vfo, shortfreq_t rit) } +/* The K3 *always* uses VFOB for TX. Do we continually switch VFOs and + * possibly irritate the user? Better just to return -RIG_ENAVAIL + * until this is resolved. + */ +int k3_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width) +{ + rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); + + return -RIG_ENAVAIL; +} + + +/* The K3 *always* uses VFOB for TX. Do we continually switch VFOs and + * possibly irritate the user? Better just to return -RIG_ENAVAIL + * until this is resolved. + */ +int k3_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode, pbwidth_t *tx_width) +{ + rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); + + return -RIG_ENAVAIL; +} + + + /* Private K3 helper functions */ /* @@ -528,7 +557,6 @@ int set_rit_xit(RIG * rig, char *func, shortfreq_t rit) return -RIG_EINVAL; if (rit == 0) { -// snprintf(&cmd, 4, "%s0", func); /* K3 RIT Off command */ err = kenwood_simple_cmd(rig, func); if (err != RIG_OK) @@ -544,14 +572,13 @@ int set_rit_xit(RIG * rig, char *func, shortfreq_t rit) /* Set offset and turn on RIT */ if (rit <= 9999 && rit >= -9999) { offs = (rit < 0) ? '-' : '+'; - snprintf(&cmd, 8, "RO%c%04d", offs, abs((int)rit)); + snprintf(cmd, 8, "RO%c%04d", offs, abs((int)rit)); err = kenwood_simple_cmd(rig, cmd); if (err != RIG_OK) return err; /* K3 RIT ON command */ -// snprintf(&cmd, 4, "%s1", func); err = kenwood_simple_cmd(rig, func); if (err != RIG_OK) return err; diff --git a/kenwood/kenwood.h b/kenwood/kenwood.h index 094d43f81..43883379c 100644 --- a/kenwood/kenwood.h +++ b/kenwood/kenwood.h @@ -68,8 +68,8 @@ struct kenwood_priv_caps { struct kenwood_priv_data { char info[KENWOOD_MAX_BUF_LEN]; split_t split; /* current split state */ - int k2_ext_lvl; /* Initial K2 extension level */ - int k3_ext_lvl; /* Initial K3 extension level */ + int k2_ext_lvl; /* Initial K2 extension level */ + int k3_ext_lvl; /* Initial K3 extension level */ int k2_md_rtty; /* K2 RTTY mode available flag, 1 = RTTY, 0 = N/A */ };