From 0e4cf7ee2d93d04d6fd2a29aade22032e3158c1a Mon Sep 17 00:00:00 2001 From: c vw Date: Tue, 12 Jan 2021 17:01:18 +0100 Subject: [PATCH] Added "CWKEY" MIDI-action for use with external keyers --- midi.h | 1 + midi2.c | 1 + midi3.c | 20 ++++++++++++++++++++ 3 files changed, 22 insertions(+) diff --git a/midi.h b/midi.h index cc7024e..54b14f4 100644 --- a/midi.h +++ b/midi.h @@ -61,6 +61,7 @@ enum MIDIaction { MIDI_ACTION_COMPRESS, // COMPRESS: TX compressor value MIDI_ACTION_CTUN, // CTUN: toggle CTUN on/off MIDI_ACTION_VFO, // CURRVFO: change VFO frequency + MIDI_ACTION_CWKEY, // CWKEY: Unconditional CW key-down/up (outside keyer) MIDI_ACTION_CWL, // CWL: Left paddle pressed (use with ONOFF) MIDI_ACTION_CWR, // CWR: Right paddle pressed (use with ONOFF) MIDI_ACTION_CWSPEED, // CWSPEED: Set speed of (iambic) CW keyer diff --git a/midi2.c b/midi2.c index e316ea1..f6caaca 100644 --- a/midi2.c +++ b/midi2.c @@ -125,6 +125,7 @@ static struct { { MIDI_ACTION_COMPRESS, "COMPRESS"}, { MIDI_ACTION_CTUN, "CTUN"}, { MIDI_ACTION_VFO, "CURRVFO"}, + { MIDI_ACTION_CWKEY, "CWKEY"}, { MIDI_ACTION_CWL, "CWL"}, { MIDI_ACTION_CWR, "CWR"}, { MIDI_ACTION_CWSPEED, "CWSPEED"}, diff --git a/midi3.c b/midi3.c index d876cd8..5ad079a 100644 --- a/midi3.c +++ b/midi3.c @@ -217,6 +217,26 @@ void DoTheMidi(enum MIDIaction action, enum MIDItype type, int val) { g_idle_add(ext_vfo_step, GINT_TO_POINTER(val)); } break; + /////////////////////////////////////////////////////////// "CW" + case MIDI_ACTION_CWKEY: // only key + // + // This is a CW key-up/down which works outside the keyer. + // It is intended for the use of external keyers + // and works if not compiled with LOCALCW + // and/or using "CW handled in radio". + // NO BREAK-IN! The keyer has to send a MIDI "PTT on" command and + // wait a decent amount of time before doing key-down. + // + if (type == MIDI_TYPE_KEY) { + if (val != 0) { + cw_key_down=480000; // max. 10 sec + cw_key_up=0; + } else { + cw_key_down=0; + cw_key_up=0; + } + } + break; /////////////////////////////////////////////////////////// "CWL" /////////////////////////////////////////////////////////// "CWR" case MIDI_ACTION_CWL: // only key -- 2.45.2