From b2467e9ba184670cc55d24cf1f614374d2ac18c2 Mon Sep 17 00:00:00 2001 From: c vw Date: Mon, 15 Nov 2021 16:29:43 +0100 Subject: [PATCH] actions.c: for "KEY" or "SWITCH" actions, check on "PRESSED" --- actions.c | 105 +++++++++++++++++++++++++++++++++++------------------- 1 file changed, 68 insertions(+), 37 deletions(-) diff --git a/actions.c b/actions.c index 359c8a1..97afca5 100644 --- 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); -- 2.45.2