Skip to content

Commit

Permalink
Fix k3.c set_mode to set VFOB correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
mdblack98 committed Mar 1, 2021
1 parent a568374 commit a5b12a1
Showing 1 changed file with 38 additions and 11 deletions.
49 changes: 38 additions & 11 deletions rigs/kenwood/k3.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ const struct rig_caps k3_caps =
RIG_MODEL(RIG_MODEL_K3),
.model_name = "K3",
.mfg_name = "Elecraft",
.version = BACKEND_VER ".7",
.version = BACKEND_VER ".8",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER,
Expand Down Expand Up @@ -334,7 +334,7 @@ const struct rig_caps k3s_caps =
RIG_MODEL(RIG_MODEL_K3S),
.model_name = "K3S",
.mfg_name = "Elecraft",
.version = BACKEND_VER ".6",
.version = BACKEND_VER ".7",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER,
Expand Down Expand Up @@ -484,9 +484,9 @@ const struct rig_caps k4_caps =
RIG_MODEL(RIG_MODEL_K4),
.model_name = "K4",
.mfg_name = "Elecraft",
.version = BACKEND_VER ".6",
.version = BACKEND_VER ".7",
.copyright = "LGPL",
.status = RIG_STATUS_ALPHA,
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER,
.ptt_type = RIG_PTT_RIG,
.dcd_type = RIG_DCD_RIG,
Expand Down Expand Up @@ -633,7 +633,7 @@ const struct rig_caps kx3_caps =
RIG_MODEL(RIG_MODEL_KX3),
.model_name = "KX3",
.mfg_name = "Elecraft",
.version = BACKEND_VER ".6",
.version = BACKEND_VER ".7",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER,
Expand Down Expand Up @@ -782,9 +782,9 @@ const struct rig_caps kx2_caps =
RIG_MODEL(RIG_MODEL_KX2),
.model_name = "KX2",
.mfg_name = "Elecraft",
.version = BACKEND_VER ".6",
.version = BACKEND_VER ".7",
.copyright = "LGPL",
.status = RIG_STATUS_BETA,
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER,
.ptt_type = RIG_PTT_RIG,
.dcd_type = RIG_DCD_RIG,
Expand Down Expand Up @@ -1075,6 +1075,8 @@ int k3_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
{
int err;
char cmd_m[4];
char buf[KENWOOD_MAX_BUF_LEN];
struct kenwood_priv_caps *caps = kenwood_caps(rig);

rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);

Expand Down Expand Up @@ -1102,13 +1104,38 @@ int k3_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
break;
}

/* kenwood_set_mode() ignores width value for K2/K3/TS-570 */
err = kenwood_set_mode(rig, vfo, mode, width);
int kmode;
int c;
kmode = rmode2kenwood(mode, caps->mode_table);
if (kmode < 0)
{
rig_debug(RIG_DEBUG_WARN, "%s: unsupported mode '%s'\n",
__func__, rig_strrmode(mode));
RETURNFUNC(-RIG_EINVAL);
}

if (err != RIG_OK)
if (kmode <= 9)
{
return err;
c = '0' + kmode;
}
else
{
c = 'A' + kmode - 10;
}

rig_debug(RIG_DEBUG_VERBOSE, "%s: kmode=%d, cmode=%c\n", __func__, kmode, c)

This comment has been minimized.

Copy link
@gvanem

gvanem May 7, 2021

Contributor

A missing trailing ;. What compiler allow this?

This comment has been minimized.

Copy link
@mdblack98

mdblack98 May 7, 2021

Author Contributor

Because the macro also has a ; in it.


if (vfo == RIG_VFO_B)
{
snprintf(buf, sizeof(buf), "MD$%c", c);
}
else
{
snprintf(buf, sizeof(buf), "MD%c", c);
}
err = kenwood_transaction(rig, buf, NULL, 0);

if (err != RIG_OK) { RETURNFUNC(err); }

if (width != RIG_PASSBAND_NOCHANGE)
{
Expand Down

0 comments on commit a5b12a1

Please sign in to comment.