From: DL1YCF <dl1ycf@darc.de>
Date: Thu, 21 Nov 2019 09:08:37 +0000 (+0100)
Subject: Added "CW speed" in MIDI and updated MIDI documentation
X-Git-Url: https://git.rkrishnan.org/specifications//%22%3C?a=commitdiff_plain;h=b6aa48d97ee6289202832caff4997763fd38f27b;p=pihpsdr.git

Added "CW speed" in MIDI and updated MIDI documentation
---

diff --git a/midi.h b/midi.h
index 8d10ab9..999bc0f 100644
--- a/midi.h
+++ b/midi.h
@@ -61,6 +61,7 @@ enum MIDIaction {
   VFO,			// CURRVFO:		change VFO frequency
   CWL,			// CWL:			Left paddle pressed (use with ONOFF)
   CWR,			// CWR:			Right paddle pressed (use with ONOFF)
+  CWSPEED,		// CWSPEED:		Set speed of (iambic) CW keyer
   MIDI_DUP,		// DUP:			toggle duplex on/off
   FILTER_DOWN,		// FILTERDOWN:		cycle through filters downwards
   FILTER_UP,		// FILTERUP:		cycle through filters upwards
diff --git a/midi2.c b/midi2.c
index e1ba495..ce24265 100644
--- a/midi2.c
+++ b/midi2.c
@@ -114,6 +114,7 @@ static struct {
 	{ VFO,			"CURRVFO"},
 	{ CWL,			"CWL"},
 	{ CWR,			"CWR"},
+	{ CWSPEED,		"CWSPEED"},
 	{ MIDI_DUP,  		"DUP"},
         { FILTER_DOWN,  	"FILTERDOWN"},
         { FILTER_UP,    	"FILTERUP"},
diff --git a/midi3.c b/midi3.c
index 80dc87e..45df600 100644
--- a/midi3.c
+++ b/midi3.c
@@ -207,6 +207,31 @@ void DoTheMidi(enum MIDIaction action, enum MIDItype type, int val) {
 	    }
 #endif
 	    break;
+	/////////////////////////////////////////////////////////// "CWSPEED"
+	case CWSPEED: // knob or wheel
+            switch (type) {
+              case MIDI_KNOB:
+		// speed between 5 and 35 wpm
+                new= (int) (5.0 + (double) val * 0.3);
+                break;
+              case MIDI_WHEEL:
+		// here we allow from 1 to 60 wpm
+                new = cw_keyer_speed + val;
+		if (new <  1) new=1;
+		if (new > 60) new=60;
+                break;
+              default:
+                // do not change
+                // we should not come here anyway
+                new = cw_keyer_speed;
+                break;
+            }
+	    cw_keyer_speed=new;
+#ifdef LOCALCW
+	    keyer_update();
+#endif
+            g_idle_add(ext_vfo_update, NULL);
+	    break;
 	/////////////////////////////////////////////////////////// "DUP"
         case MIDI_DUP:
             if(duplex) {
diff --git a/release/documentation/MIDI-manual.odt b/release/documentation/MIDI-manual.odt
index 6d3868e..b311ae2 100644
Binary files a/release/documentation/MIDI-manual.odt and b/release/documentation/MIDI-manual.odt differ
diff --git a/release/documentation/MIDI-manual.pdf b/release/documentation/MIDI-manual.pdf
index 9149d49..ad97f11 100644
Binary files a/release/documentation/MIDI-manual.pdf and b/release/documentation/MIDI-manual.pdf differ