From: c vw <dl1ycf@darc.de>
Date: Mon, 28 Oct 2019 08:49:43 +0000 (+0100)
Subject: merged in John's VFOSTEPUP/DOWN midi commands
X-Git-Url: https://git.rkrishnan.org/pf/components/flags//%22%3C?a=commitdiff_plain;h=704313b4cb23db84f7b41c33db4c363c614705c1;p=pihpsdr.git

merged in John's VFOSTEPUP/DOWN midi commands
---

704313b4cb23db84f7b41c33db4c363c614705c1
diff --cc ext.h
index bc93cf2,a4a259d..e554534
--- a/ext.h
+++ b/ext.h
@@@ -85,8 -85,8 +85,9 @@@ extern int ext_function_update(void *da
  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_id_step(void *data);
  int ext_vfo_mode_changed(void *data);
  int ext_set_af_gain(void *data);
  int ext_set_mic_gain(void *data);
diff --cc midi.h
index 48061d7,1f68f0c..c17101e
--- a/midi.h
+++ b/midi.h
@@@ -76,11 -76,11 +76,13 @@@ enum MIDIaction 
    MIDI_TUNE,			// toggle "tune" state
    TX_DRIVE,		// RF output power
    VFO,			// change VFO frequency
 +  VFOA,			// change VFO-A frequency
 +  VFOB,			// change VFO-B 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 --cc midi3.c
index 21e3eea,efa5361..af9219a
--- a/midi3.c
+++ b/midi3.c
@@@ -264,107 -254,92 +264,113 @@@ void DoTheMidi(enum MIDIaction action, 
  	    if (dnew > 0.5) transmitter->compressor=1;
  	    g_idle_add(ext_set_compression, NULL);
  	    break;
 -	case MIDI_NB:
 +	case MIDI_NB: // only key supported
  	    // cycle through NoiseBlanker settings
 -	    if (active_receiver->nb) {
 +            if (type == MIDI_KEY) {
 +	      if (active_receiver->nb) {
  		active_receiver->nb = 0;
  		active_receiver->nb2= 1;
 -	    } else if (active_receiver->nb2) {
 +	      } else if (active_receiver->nb2) {
  		active_receiver->nb = 0;
  		active_receiver->nb2= 0;
 -	    } else {
 +	      } else {
  		active_receiver->nb = 1;
  		active_receiver->nb2= 0;
 +	      }
 +	      g_idle_add(ext_vfo_update, NULL);
  	    }
 -	    g_idle_add(ext_vfo_update, NULL);
  	    break;
 -	case MIDI_NR:
 +	case MIDI_NR: // only key supported
  	    // cycle through NoiseReduction settings
 -	    if (active_receiver->nr) {
 +	    if (type == MIDI_KEY) {
 +	      if (active_receiver->nr) {
  		active_receiver->nr = 0;
  		active_receiver->nr2= 1;
 -	    } else if (active_receiver->nr2) {
 +	      } else if (active_receiver->nr2) {
  		active_receiver->nr = 0;
  		active_receiver->nr2= 0;
 -	    } else {
 +	      } else {
  		active_receiver->nr = 1;
  		active_receiver->nr2= 0;
 +	      }
 +	      g_idle_add(ext_vfo_update, NULL);
  	    }
 -	    g_idle_add(ext_vfo_update, NULL);
  	    break;
 -	case VOX:
 +	case VOX: // only key supported
  	    // toggle VOX
 -	    vox_enabled = !vox_enabled;
 -	    g_idle_add(ext_vfo_update, NULL);
 +	    if (type == MIDI_KEY) {
 +	      vox_enabled = !vox_enabled;
 +	      g_idle_add(ext_vfo_update, NULL);
 +	    }
  	    break;
 -	case MIDI_CTUN:
 +	case MIDI_CTUN: // only key supported
  	    // toggle CTUN
 -	    new=active_receiver->id;
 -	    if(!vfo[new].ctun) {
 +	    if (type == MIDI_KEY) {
 +	      new=active_receiver->id;
 +	      if(!vfo[new].ctun) {
  		vfo[new].ctun=1;
  		vfo[new].offset=0;
 -	    } else {
 +	      } else {
  		vfo[new].ctun=0;
 +	      }
 +	      vfo[new].ctun_frequency=vfo[new].frequency;
 +	      set_offset(active_receiver,vfo[new].offset);
 +	      g_idle_add(ext_vfo_update, NULL);
  	    }
 -	    vfo[new].ctun_frequency=vfo[new].frequency;
 -	    set_offset(active_receiver,vfo[new].offset);
 -	    g_idle_add(ext_vfo_update, NULL);
  	    break;
 -	case MIDI_PS:
 +	case MIDI_PS: // only key supported
  #ifdef PURESIGNAL
  	    // toggle PURESIGNAL
 -	    new=!(transmitter->puresignal);
 -	    g_idle_add(ext_tx_set_ps,GINT_TO_POINTER(new));
 +	    if (type == MIDI_KEY) {
 +	      new=!(transmitter->puresignal);
 +	      g_idle_add(ext_tx_set_ps,GINT_TO_POINTER(new));
 +	    }
  #endif
  	    break;
 -	case MIDI_SPLIT:
 +	case MIDI_SPLIT: // only key supported
  	    // toggle split mode
 -	    if(!split) {
 +	    if (type == MIDI_KEY) {
 +	      if(!split) {
  		split=1;
  		tx_set_mode(transmitter,vfo[VFO_B].mode);
 -	    } else {
 +	      } else {
  		split=0;
  		tx_set_mode(transmitter,vfo[VFO_A].mode);
 +	      }
 +	      g_idle_add(ext_vfo_update, NULL);
  	    }
 -	    g_idle_add(ext_vfo_update, NULL);
  	    break;
 -	case VFO_A2B:
 -	    g_idle_add(ext_vfo_a_to_b, NULL);
 +	case VFO_A2B: // only key supported
 +	    if (type == MIDI_KEY) {
 +	      g_idle_add(ext_vfo_a_to_b, NULL);
 +	    }
  	    break;
 -	case VFO_B2A:
 -	    g_idle_add(ext_vfo_b_to_a, NULL);
 +	case VFO_B2A: // only key supported
 +	    if (type == MIDI_KEY) {
 +	      g_idle_add(ext_vfo_b_to_a, NULL);
 +	    }
  	    break;
 -	case MIDI_LOCK:
 -	    locked=!locked;
 -	    g_idle_add(ext_vfo_update, NULL);
 +	case MIDI_LOCK: // only key supported
 +	    if (type == MIDI_KEY) {
 +	      locked=!locked;
 +	      g_idle_add(ext_vfo_update, NULL);
 +	    }
  	    break;
 -	case AGCATTACK:
 -	    new=active_receiver->agc + 1;
 -	    if (new > AGC_FAST) new=0;
 -	    active_receiver->agc=new;
 -	    g_idle_add(ext_vfo_update, NULL);
 +	case AGCATTACK: // only key supported
 +	    // cycle through fast/med/slow AGC attack
 +	    if (type == MIDI_KEY) {
 +	      new=active_receiver->agc + 1;
 +	      if (new > AGC_FAST) new=0;
 +	      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;