]> git.rkrishnan.org Git - pihpsdr.git/commitdiff
actions.c: for "KEY" or "SWITCH" actions, check on "PRESSED"
authorc vw <dl1ycf@darc.de>
Mon, 15 Nov 2021 15:29:43 +0000 (16:29 +0100)
committerc vw <dl1ycf@darc.de>
Mon, 15 Nov 2021 15:31:54 +0000 (16:31 +0100)
actions.c

index 359c8a1fdb9f6535ccf7255c726903b3587ee902..97afca51468c2abf5df6cdc73a82bdc70b0102e5 100644 (file)
--- a/actions.c
+++ b/actions.c
@@ -497,7 +497,7 @@ int process_action(void *data) {
       }
       break;
     case COMP_ENABLE:
-      if(can_transmit) {
+      if(can_transmit && a->mode==PRESSED) {
         transmitter_set_compressor(transmitter,transmitter->compressor?FALSE:TRUE);
       }
       break;
@@ -575,7 +575,7 @@ int process_action(void *data) {
       set_drive(value);
       break;
     case DUPLEX:
-      if(can_transmit && !isTransmitting()) {
+      if(can_transmit && !isTransmitting() && a->mode == PRESSED) {
         duplex=duplex==1?0:1;
         g_idle_add(ext_set_duplex, NULL);
       }
@@ -595,26 +595,28 @@ int process_action(void *data) {
       }
       break;
     case FUNCTION:
-      switch(controller) {
-        case NO_CONTROLLER:
-        case CONTROLLER1:
-          function++;
-          if(function>=MAX_FUNCTIONS) {
-            function=0;
-          }
-          toolbar_switches=switches_controller1[function];
-          switches=switches_controller1[function];
-          update_toolbar_labels();
-         break;
-       case CONTROLLER2_V1:
-       case CONTROLLER2_V2:
-          function++;
-          if(function>=MAX_FUNCTIONS) {
-            function=0;
-          }
-          toolbar_switches=switches_controller1[function];
-          update_toolbar_labels();
-         break;
+      if (a->mode==PRESSED) {
+        switch(controller) {
+          case NO_CONTROLLER:
+          case CONTROLLER1:
+            function++;
+            if(function>=MAX_FUNCTIONS) {
+              function=0;
+            }
+            toolbar_switches=switches_controller1[function];
+            switches=switches_controller1[function];
+            update_toolbar_labels();
+           break;
+         case CONTROLLER2_V1:
+         case CONTROLLER2_V2:
+            function++;
+            if(function>=MAX_FUNCTIONS) {
+              function=0;
+            }
+            toolbar_switches=switches_controller1[function];
+            update_toolbar_labels();
+           break;
+        }
       }
       break;
     case IF_SHIFT:
@@ -787,40 +789,64 @@ int process_action(void *data) {
       }
       break;
     case NUMPAD_0:
-      g_idle_add(ext_num_pad,GINT_TO_POINTER(0));
+      if (a->mode==PRESSED) {
+        g_idle_add(ext_num_pad,GINT_TO_POINTER(0));
+      }
       break;
     case NUMPAD_1:
-      g_idle_add(ext_num_pad,GINT_TO_POINTER(1));
+      if (a->mode==PRESSED) {
+        g_idle_add(ext_num_pad,GINT_TO_POINTER(1));
+      }
       break;
     case NUMPAD_2:
-      g_idle_add(ext_num_pad,GINT_TO_POINTER(2));
+      if (a->mode==PRESSED) {
+        g_idle_add(ext_num_pad,GINT_TO_POINTER(2));
+      }
       break;
     case NUMPAD_3:
-      g_idle_add(ext_num_pad,GINT_TO_POINTER(3));
+      if (a->mode==PRESSED) {
+        g_idle_add(ext_num_pad,GINT_TO_POINTER(3));
+      }
       break;
     case NUMPAD_4:
-      g_idle_add(ext_num_pad,GINT_TO_POINTER(4));
+      if (a->mode==PRESSED) {
+        g_idle_add(ext_num_pad,GINT_TO_POINTER(4));
+      }
       break;
     case NUMPAD_5:
-      g_idle_add(ext_num_pad,GINT_TO_POINTER(5));
+      if (a->mode==PRESSED) {
+        g_idle_add(ext_num_pad,GINT_TO_POINTER(5));
+      }
       break;
     case NUMPAD_6:
-      g_idle_add(ext_num_pad,GINT_TO_POINTER(6));
+      if (a->mode==PRESSED) {
+        g_idle_add(ext_num_pad,GINT_TO_POINTER(6));
+      }
       break;
     case NUMPAD_7:
-      g_idle_add(ext_num_pad,GINT_TO_POINTER(7));
+      if (a->mode==PRESSED) {
+        g_idle_add(ext_num_pad,GINT_TO_POINTER(7));
+      }
       break;
     case NUMPAD_8:
-      g_idle_add(ext_num_pad,GINT_TO_POINTER(8));
+      if (a->mode==PRESSED) {
+        g_idle_add(ext_num_pad,GINT_TO_POINTER(8));
+      }
       break;
     case NUMPAD_9:
-      g_idle_add(ext_num_pad,GINT_TO_POINTER(9));
+      if (a->mode==PRESSED) {
+        g_idle_add(ext_num_pad,GINT_TO_POINTER(9));
+      }
       break;
     case NUMPAD_CL:
-      g_idle_add(ext_num_pad,GINT_TO_POINTER(-1));
+      if (a->mode==PRESSED) {
+        g_idle_add(ext_num_pad,GINT_TO_POINTER(-1));
+      }
       break;
     case NUMPAD_ENTER:
-      g_idle_add(ext_num_pad,GINT_TO_POINTER(-2));
+      if (a->mode==PRESSED) {
+        g_idle_add(ext_num_pad,GINT_TO_POINTER(-2));
+      }
       break;
     case PAN:
       update_pan((double)a->val*100);
@@ -848,6 +874,7 @@ int process_action(void *data) {
       active_receiver->panadapter_step=(int)value;
       break;
     case PREAMP:
+      break;
     case PS:
 #ifdef PURESIGNAL
       if(a->mode==PRESSED) {
@@ -1043,7 +1070,9 @@ int process_action(void *data) {
       }
       break;
     case VFO:
-      vfo_step(a->val);
+      if(a->mode==RELATIVE && !locked) {
+        vfo_step(a->val);
+      }
       break;
     case VFO_STEP_MINUS:
       if(a->mode==PRESSED) {
@@ -1070,8 +1099,10 @@ int process_action(void *data) {
       }
       break;
     case VOX:
-      vox_enabled = !vox_enabled;
-      g_idle_add(ext_vfo_update, NULL);
+      if(a->mode==PRESSED) {
+        vox_enabled = !vox_enabled;
+        g_idle_add(ext_vfo_update, NULL);
+      }
       break;
     case VOXLEVEL:
       vox_threshold=KnobOrWheel(a, vox_threshold, 0.0, 1.0, 0.01);