From 8bd74aa3bcdfec900955c15ef1cc754bfb93d6df Mon Sep 17 00:00:00 2001 From: George Baltz N3GB Date: Fri, 29 Nov 2024 15:10:46 -0500 Subject: [PATCH 1/3] Minimal support for KY commands in simts890.c --- simulators/simts890.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/simulators/simts890.c b/simulators/simts890.c index 6ebc0f264..b1d4158ae 100644 --- a/simulators/simts890.c +++ b/simulators/simts890.c @@ -927,6 +927,24 @@ int main(int argc, char *argv[]) { sscanf(buf, "KS%03d", &keyspd); } + else if (strncmp(buf, "KY", 2) == 0) + { // CW Keying + if (buf[2] == ';') + { + // Checking status - we always have room + OUTPUT("KY0;"); + } + else if (buf[3] == ';') + { + // Stop sending(?) + if (buf[2] != '0') {cmd_err = 1; } + } + else + { + // Send the message + //printf("CW mesg: %s\n", buf + 2); + } + } else if (strncmp(buf, "OM", 2) == 0) { // Operating Mode From bdbe66dfa06114974331e42f1072fef78bfa2f1e Mon Sep 17 00:00:00 2001 From: George Baltz N3GB Date: Sat, 30 Nov 2024 04:17:01 -0500 Subject: [PATCH 2/3] Use short (i.e., variable length) messages in kenwood_send_morse() Enabled for TS-890S & TS-990S(if firmware capable) Kludge the kludges in kenwood_transaction() for KY->KY2 change. --- rigs/kenwood/kenwood.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/rigs/kenwood/kenwood.c b/rigs/kenwood/kenwood.c index e0bad2505..da75b19f8 100644 --- a/rigs/kenwood/kenwood.c +++ b/rigs/kenwood/kenwood.c @@ -375,6 +375,7 @@ transaction_write: skip |= strncmp(cmdstr, "RD", 2) == 0; skip |= strncmp(cmdstr, "KYW", 3) == 0; skip |= strncmp(cmdstr, "KY ", 3) == 0; + skip |= strncmp(cmdstr, "KY2", 3) == 0; skip |= strncmp(cmdstr, "PS1", 3) == 0; skip |= strncmp(cmdstr, "PS0", 3) == 0; skip |= strncmp(cmdstr, "K22", 3) == 0; @@ -382,7 +383,7 @@ transaction_write: if (skip) { // most command we give them a little time -- but not KY - if (strncmp(cmdstr, "KY ", 3) != 0) + if (strncmp(cmdstr, "KY ", 3) != 0 && strncmp(cmdstr, "KY2", 3) != 0) { hl_usleep(200 * 1000); // give little settle time for these commands } @@ -958,7 +959,7 @@ int kenwood_open(RIG *rig) priv->has_rit2 = 1; } - if (RIG_IS_TS590S) + if (RIG_IS_TS590S || RIG_IS_TS990S) { /* we need the firmware version for these rigs to deal with f/w defects */ static char fw_version[7]; @@ -992,7 +993,7 @@ int kenwood_open(RIG *rig) } } - rig_debug(RIG_DEBUG_TRACE, "%s: found f/w version %.1f\n", __func__, + rig_debug(RIG_DEBUG_TRACE, "%s: found f/w version %.2f\n", __func__, priv->fw_rev_uint / 100.0); } @@ -5486,8 +5487,9 @@ int kenwood_reset(RIG *rig, reset_t reset) int kenwood_send_morse(RIG *rig, vfo_t vfo, const char *msg) { char morsebuf[40], m2[30]; - int msg_len, retval, i; + int msg_len, retval; const char *p; + struct kenwood_priv_data *priv; ENTERFUNC; @@ -5551,14 +5553,30 @@ int kenwood_send_morse(RIG *rig, vfo_t vfo, const char *msg) SNPRINTF(morsebuf, sizeof(morsebuf), "KY %s", m2); break; + case RIG_MODEL_TS890S: + SNPRINTF(morsebuf, sizeof morsebuf, "KY2%s", m2); + break; + + case RIG_MODEL_TS990S: + // Variable message length only on newer firmware + priv = STATE(rig)->priv; + if (priv->fw_rev_uint >= 110) + { + SNPRINTF(morsebuf, sizeof morsebuf, "KY2%s", m2); + break; + } + /* FALL THROUGH */ + default: /* the command must consist of 28 bytes 0x20 padded */ SNPRINTF(morsebuf, sizeof(morsebuf), "KY %-24s", m2); - for (i = strlen(morsebuf) - 1; i > 0 && morsebuf[i] == ' '; --i) +#if 0 // Why is this here?? 0x20 == ' ' + for (int i = strlen(morsebuf) - 1; i > 0 && morsebuf[i] == ' '; --i) { morsebuf[i] = 0x20; } +#endif } retval = kenwood_transaction(rig, morsebuf, NULL, 0); From 806b08729356d1515b7c2994b032fb79e187f772 Mon Sep 17 00:00:00 2001 From: George Baltz N3GB Date: Tue, 3 Dec 2024 05:06:10 -0500 Subject: [PATCH 3/3] Fix porting unneeded code --- rigs/kenwood/kenwood.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rigs/kenwood/kenwood.c b/rigs/kenwood/kenwood.c index da75b19f8..3222a69a7 100644 --- a/rigs/kenwood/kenwood.c +++ b/rigs/kenwood/kenwood.c @@ -5572,7 +5572,8 @@ int kenwood_send_morse(RIG *rig, vfo_t vfo, const char *msg) SNPRINTF(morsebuf, sizeof(morsebuf), "KY %-24s", m2); #if 0 // Why is this here?? 0x20 == ' ' - for (int i = strlen(morsebuf) - 1; i > 0 && morsebuf[i] == ' '; --i) + int i; + for (i = strlen(morsebuf) - 1; i > 0 && morsebuf[i] == ' '; --i) { morsebuf[i] = 0x20; }