]> git.rkrishnan.org Git - pihpsdr.git/commitdiff
Added midi actions VFOSTEPUP and VFOSTEPDOWN to allow buttons to be used to change...
authorJohn Melton G0ORX <john.d.melton@googlemail.com>
Sun, 27 Oct 2019 16:20:30 +0000 (16:20 +0000)
committerJohn Melton G0ORX <john.d.melton@googlemail.com>
Sun, 27 Oct 2019 16:20:30 +0000 (16:20 +0000)
ext.c
ext.h
midi.h
midi2.c
midi3.c

diff --git a/ext.c b/ext.c
index 972e8daa2bac5d77d092e1fa1da9592f20a6b53d..ca80aeb978c4da27587caad7db7befc0bf1e0d9c 100644 (file)
--- a/ext.c
+++ b/ext.c
@@ -194,6 +194,31 @@ int ext_tx_set_ps(void *data) {
 }
 #endif
 
+int ext_update_vfo_step(void *data) {
+  int direction=GPOINTER_TO_INT(data);
+  int i=0;
+  while(steps[i]!=step && steps[i]!=0) {
+    i++;
+  }
+
+  if(steps[i]!=0) {
+    if(direction>0) {
+      i++;
+      if(steps[i]!=0) {
+        step=steps[i];
+        vfo_update();
+      }
+    } else {
+      i--;
+      if(i>=0) {
+        step=steps[i];
+        vfo_update();
+      }
+    }
+  }
+  return 0;
+}
+
 int ext_vfo_step(void *data) {
   int step=GPOINTER_TO_INT(data);
   vfo_step(step);
diff --git a/ext.h b/ext.h
index ac995554b6d83fd2f24b1b82cf5dae61c7419fe5..a4a259d37e249491b40f5ee621fee72d58fb494d 100644 (file)
--- a/ext.h
+++ b/ext.h
@@ -85,6 +85,7 @@ extern int ext_function_update(void *data);
 extern int ext_tx_set_ps(void *data);
 #endif
 
+int ext_update_vfo_step(void *data);
 int ext_vfo_step(void *data);
 int ext_vfo_mode_changed(void *data);
 int ext_set_af_gain(void *data);
diff --git a/midi.h b/midi.h
index e21cab2f609a64d28a3779e97f351e0a9af0076a..1f68f0c039adf225a47aadbdc60c20fc0e879b22 100644 (file)
--- a/midi.h
+++ b/midi.h
@@ -78,7 +78,9 @@ enum MIDIaction {
   VFO,                 // change VFO frequency
   VFO_A2B,             // VFO A -> B
   VFO_B2A,             // VFO B -> A
-  VOX                  // VOX on/off
+  VOX,                         // VOX on/off
+  VFO_STEP_UP,         // cycle through vfo steps upwards;
+  VFO_STEP_DOWN,       // cycle through vfo steps downwards;
 };
 
 //
diff --git a/midi2.c b/midi2.c
index c8f81f97a341141472c7cc60675bf738bff19d3b..9b950e27c090a78b3e117c7d86356b237cc38441 100644 (file)
--- a/midi2.c
+++ b/midi2.c
@@ -122,6 +122,8 @@ static struct {
        { VFO_A2B,      "VFOA2B"},
        { VFO_B2A,      "VFOB2A"},
        { VOX,          "VOX"},
+       { VFO_STEP_UP,  "VFOSTEPUP"},
+       { VFO_STEP_DOWN,  "VFOSTEPDOWN"},
         { ACTION_NONE,  "NONE"},
         { ACTION_NONE,  NULL}
 };
diff --git a/midi3.c b/midi3.c
index 7bb8f0ccf272a192cdc90cc6667f94215269e6a9..efa5361f68cf3bb05a87991e8581bd2fb72c72e9 100644 (file)
--- a/midi3.c
+++ b/midi3.c
@@ -334,6 +334,12 @@ void DoTheMidi(enum MIDIaction action, enum MIDItype type, int val) {
            active_receiver->agc=new;
            g_idle_add(ext_vfo_update, NULL);
            break;
+        case VFO_STEP_UP:
+           g_idle_add(ext_update_vfo_step, GINT_TO_POINTER(1));
+            break;
+        case VFO_STEP_DOWN:
+           g_idle_add(ext_update_vfo_step, GINT_TO_POINTER(-1));
+            break;
        case ACTION_NONE:
            // No error message, this is the "official" action for un-used controller buttons.
            break;