From: c vw Date: Fri, 25 Oct 2019 14:01:48 +0000 (+0200) Subject: debug output X-Git-Url: https://git.rkrishnan.org/pf/content/en/seg/priv/?a=commitdiff_plain;h=49480bd7f23090d024e8ae94d906814dda133b29;p=pihpsdr.git debug output --- diff --git a/midi.inp b/midi.inp index cb0ddce..fb1e922 100644 --- a/midi.inp +++ b/midi.inp @@ -4,71 +4,84 @@ # Note that the Attenuator is implemented twice, as a key and as a wheel # The key is suitable for radios with a step (ALEX) attenuator, the wheel # fits best for radios with a programmable attenuator (0-31 dB). -# The button (Key 2) also works for STEMlab and CHARLY25 # -# The preamp button (Key 1) only has function with STEMlab and CHARLY25 +DEVICE=CMD PL-1 # -# Do not assign the "Key" with number 31. You will unintentionally -# "push" it most of the times you change the VFO frequency. +# Big Wheel: main VFO knob +# Note that there is a "KEY" event (id=31) triggered by pushing the VFO wheel. +# Ignore this, because this happens unintentionally most of the time you +# use the wheel. # -# NOTE: we could just leave out all lines with ACTION=NONE. In this case -# a diagnostic message ("unknown MIDI event") is printed to stderr. +CTRL=31 WHEEL THR=0 59 60 61 62 63 65 66 67 68 69 127 ACTION=VFO +KEY=31 ACTION=NONE # -DEVICE=CMD PL-1 +# Big slider (pitch-bend controller): AF volume +# +PITCH ACTION=AFGAIN +# +# 8 Knobs (top left). These are "wheels" assigned to # -# Big Wheel and Big Slider -# -CTRL=31 WHEEL THR=59 61 63 65 67 69 ACTION=VFO # Big wheel: : main VFO knob -KEY=31 ACTION=NONE # Button integrated in the big wheel (do not assign) -PITCH ACTION=AFGAIN # Big slider : AF gain -# -# 8 Knobs (top left). -# Note that you can push each knob and this generates -# Note On/Off messages for KEY=0...8 which we do not -# assign: we want to glue labels on the Controller and therefore -# we do not have two labels per knob. -# -CTRL=0 WHEEL THR=-1 -1 63 65 128 128 ACTION=ATT # Knob 1 : RX att -KEY=0 ACTION=NONE # Push Knob 1 : (unassigned) -CTRL=1 WHEEL THR=-1 -1 63 65 128 128 ACTION=COMPRESS # Knob 2 : TX compression -KEY=1 ACTION=NONE # Push Knob 1 : (unassigned) -CTRL=2 WHEEL THR=-1 -1 63 65 128 128 ACTION=RITVAL # Knob 3 : RIT value -KEY=2 ACTION=NONE # Push Knob 1 : (unassigned) -CTRL=3 WHEEL THR=-1 -1 63 65 128 128 ACTION=PANLOW # Knob 4 : Panadapter low -KEY=4 ACTION=NONE # Push Knob 1 : (unassigned) -CTRL=4 WHEEL THR=-1 -1 63 65 128 128 ACTION=AGC # Knob 5 : AGC -KEY=4 ACTION=NONE # Push Knob 1 : (unassigned) -CTRL=5 WHEEL THR=-1 -1 63 65 128 128 ACTION=MICGAIN # Knob 6 : MIC gain -KEY=5 ACTION=NONE # Push Knob 1 : (unassigned) -CTRL=6 WHEEL THR=-1 -1 63 65 128 128 ACTION=RFPOWER # Knob 7 : TX drive -KEY=6 ACTION=NONE # Push Knob 1 : (unassigned) -CTRL=7 WHEEL THR=-1 -1 63 65 128 128 ACTION=FILTERUP # Knob 8 : cycle through the filters -KEY=7 ACTION=NONE # Push Knob 1 : (unassigned) +# id=0: top row, leftmost: StepAttenuator +# id=1: top row, 2nd from left: TX compression +# id=2: top row, 2nd from right: RIT value +# id=3: top row, rightmost: Panadapter low +# id=4: bottom row, leftmost: AGC value +# id=5: bottom row, 2nd from left: MIC gain +# id=6: bottom row, 2nd from right: TX drive +# id=7: bottom row, rightmost: cycle through filters +# +CTRL=0 WHEEL THR=-1 -1 -1 -1 1 63 65 127 128 128 128 128 ACTION=ATT +CTRL=1 WHEEL THR=-1 -1 -1 -1 1 63 65 127 128 128 128 128 ACTION=COMPRESS +CTRL=2 WHEEL THR=-1 -1 -1 -1 1 63 65 127 128 128 128 128 ACTION=RITVAL +CTRL=3 WHEEL THR=-1 -1 -1 -1 1 63 65 127 128 128 128 128 ACTION=PANLOW +CTRL=4 WHEEL THR=-1 -1 -1 -1 1 63 65 127 128 128 128 128 ACTION=AGC +CTRL=5 WHEEL THR=-1 -1 -1 -1 1 63 65 127 128 128 128 128 ACTION=MICGAIN +CTRL=6 WHEEL THR=-1 -1 -1 -1 1 63 65 127 128 128 128 128 ACTION=RFPOWER +CTRL=7 WHEEL THR=-1 -1 -1 -1 1 63 65 127 128 128 128 128 ACTION=FILTERUP +# +# Push actions on these knobs generate KEY events are are not assigned +# +KEY=0 ACTION=NONE +KEY=1 ACTION=NONE +KEY=2 ACTION=NONE +KEY=3 ACTION=NONE +KEY=4 ACTION=NONE +KEY=5 ACTION=NONE +KEY=6 ACTION=NONE +KEY=7 ACTION=NONE # # 8 Keys (below the 8 Knobs) # -KEY=16 ACTION=PREAMP # Key 1 : Cycle through Preamp settings -KEY=17 ACTION=ATT # Key 2 : Cycle through ATT (Alex ATT) settings -KEY=18 ACTION=RITCLEAR # Key 3 : Clear RIT value and disable RIT -KEY=19 ACTION=CTUN # Key 4 : toggle CTUN -KEY=20 ACTION=NOISEBLANKER # Key 5 : cycle through NB settings -KEY=21 ACTION=NOISEREDUCTION # Key 6 : cycle through NR settings -KEY=22 ACTION=VOX # Key 7 : toggle VOX -KEY=23 ACTION=AGCATTACK # Key 8 : cycle AGC fast/medium/slow +# id=16 label="1": top row, leftmost: not assigned +# id=17 label="2": top row, 2nd from left: cycle through Alex ATT settings +# id=18 label="3": top row, 2nd from right: clear RIT value and turn off RIT +# id=19 label="4": top row, rightmost: toggle CTUN +# id=20 label="5": bottom row, leftmost: cycle through noise blanker settings +# id=21 label="6": bottom row, 2nd from left: cycle through noise reduction settings +# id=22 label="7": bottom row, 2nd from right: toggle VOX +# id=23 label="8": bottom row, rightmost: cycle through AGC fast/medium/slow +# +KEY=16 ACTION=NONE +KEY=17 ACTION=ATT +KEY=18 ACTION=RITCLEAR +KEY=19 ACTION=CTUN +KEY=20 ACTION=NOISEBLANKER +KEY=21 ACTION=NOISEREDUCTION +KEY=22 ACTION=VOX +KEY=23 ACTION=AGCATTACK # # "other" keys # Note that the "DECK" key switches the MIDI channel of the device. # -KEY=24 ACTION=TUNE # LOAD button: TUNE on/off -KEY=25 ACTION=LOCK # LOCK button: Lock VFO(s) -KEY=26 ACTION=PURESIGNAL # DECK button: toggle PURESIGNAL -KEY=27 ACTION=SWAPVFO # SCRATCH button: Swap VFOs A and B -KEY=31 ACTION=NONE # Button integrated in the big wheel (do not assign) -KEY=32 ACTION=VFOA2B # SYNC button: Frequency VFO A -> VFO B -KEY=33 ACTION=VFOB2A # TAP button: Frequency VFO B -> VFO A -KEY=34 ACTION=MOX # CUE button: MOX on/off -KEY=35 ACTION=SPLIT # >|| button: toggle Split -KEY=36 ACTION=MODEDOWN # << button: Mode down -KEY=37 ACTION=MODEUP # >> button: Mode up -KEY=38 ACTION=BANDDOWN # - button: Band down -KEY=39 ACTION=BANDUP # + button: Band up +KEY=24 ACTION=TUNE # LOAD button: TUNE on/off +KEY=25 ACTION=LOCK # LOCK button: Lock VFO(s) +KEY=26 ACTION=PURESIGNAL # DECK button: toggle PURESIGNAL +KEY=27 ACTION=SWAPVFO # SCRATCH button: Swap VFOs A and B +KEY=32 ACTION=VFOA2B # SYNC button: Frequency VFO A -> VFO B +KEY=33 ACTION=VFOB2A # TAP button: Frequency VFO B -> VFO A +KEY=34 ACTION=MOX # CUE button: MOX on/off +KEY=35 ACTION=SPLIT # >|| button: toggle Split +KEY=36 ACTION=MODEDOWN # << button: Mode down +KEY=37 ACTION=MODEUP # >> button: Mode up +KEY=38 ACTION=BANDDOWN # - button: Band down +KEY=39 ACTION=BANDUP # + button: Band up diff --git a/midi2.c b/midi2.c index 8000ec5..f767b7d 100644 --- a/midi2.c +++ b/midi2.c @@ -17,7 +17,7 @@ void NewMidiEvent(enum MIDIevent event, int channel, int note, int val) { struct desc *desc; int new; - static enum MIDIaction last_wheel_action; + static enum MIDIaction last_wheel_action=ACTION_NONE ; static struct timespec tp, last_wheel_tp={0,0}; long delta; @@ -41,7 +41,7 @@ void NewMidiEvent(enum MIDIevent event, int channel, int note, int val) { new = (val*100)/127; DoTheMidi(desc->action, desc->type, new); } else if (desc->type == MIDI_WHEEL) { - if (desc->delay > 0) { + if (desc->delay > 0 && last_wheel_action == desc->action) { clock_gettime(CLOCK_MONOTONIC, &tp); delta=1000*(tp.tv_sec - last_wheel_tp.tv_sec); delta += (tp.tv_nsec - last_wheel_tp.tv_nsec)/1000000; @@ -49,13 +49,17 @@ void NewMidiEvent(enum MIDIevent event, int channel, int note, int val) { last_wheel_tp = tp; } // translate value to direction + new=0; if ((val >= desc->vfl1) && (val <= desc->vfl2)) new=-100; if ((val >= desc-> fl1) && (val <= desc-> fl2)) new=-10; if ((val >= desc->lft1) && (val <= desc->lft2)) new=-1; if ((val >= desc->rgt1) && (val <= desc->rgt2)) new= 1; if ((val >= desc-> fr1) && (val <= desc-> fr2)) new= 10; if ((val >= desc->vfr1) && (val <= desc->vfr2)) new= 100; - DoTheMidi(desc->action, desc->type, new); + fprintf(stderr,"WHEEL: val=%d new=%d thrs=%d/%d, %d/%d, %d/%d, %d/%d, %d/%d, %d/%d\n", + val, new, desc->vfl1, desc->vfl2, desc->fl1, desc->fl2, desc->lft1, desc->lft2, + desc->rgt1, desc->rgt2, desc->fr1, desc->fr2, desc->vfr1, desc->vfr2); + if (new != 0) DoTheMidi(desc->action, desc->type, new); last_wheel_action=desc->action; } break; diff --git a/midi3.c b/midi3.c index c5ba82e..9503a2b 100644 --- a/midi3.c +++ b/midi3.c @@ -37,13 +37,13 @@ void DoTheMidi(enum MIDIaction action, enum MIDItype type, int val) { } break; case VFO: // only wheel supported - if (type == MIDI_WHEEL) { + if (type == MIDI_WHEEL && !locked) { g_idle_add(ext_vfo_step, GINT_TO_POINTER(val)); } break; case VFOA: // only wheel supported case VFOB: // only wheel supported - if (type == MIDI_WHEEL) { + if (type == MIDI_WHEEL && !locked) { ip=malloc(2*sizeof(int)); *ip = (action == VFOA) ? 0 : 1; // could use (action - VFOA) to support even more VFOs *(ip+1)=val;