From 4e5f75458d0840097e021cc41d81dbe85a29565f Mon Sep 17 00:00:00 2001
From: c vw <dl1ycf@darc.de>
Date: Wed, 24 Feb 2021 16:21:08 +0100
Subject: [PATCH] MIDI_ACTION_CWKEY works if compiled without LOCALCW

---
 midi3.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/midi3.c b/midi3.c
index 751bd20..0a598fd 100644
--- a/midi3.c
+++ b/midi3.c
@@ -229,14 +229,18 @@ void DoTheMidi(enum MIDIaction action, enum MIDItype type, int val) {
 	  // NO BREAK-IN! The keyer has to take care of sending MIDI PTT
 	  // on/off messages at appropriate times.
           //
-#ifdef LOCALCW
+          // Since this if for immediate key-down, it does not rely on LOCALCW
+          //
 	    if (type == MIDI_TYPE_KEY) {
-              keyer_straight_key(val);
+              if (val != 0) {
+                cw_key_down=960000;  // max. 20 sec to protect hardware
+                cw_key_up=0;
+                cw_key_hit=1;
+              } else {
+                cw_key_down=0;
+                cw_key_up=0;
+              }
             }
-#else
-	    g_print("%s: CWKEY:%d\n",__FUNCTION__,val);
-
-#endif
 	    break;
 	/////////////////////////////////////////////////////////// "CWL"
 	/////////////////////////////////////////////////////////// "CWR"
-- 
2.45.2