示例#1
0
        public void Cleanup()
        {
            if (flexControl == null)
            {
                return;
            }

            try
            {
                flexControl.SetLEDStatus(false, false, false);
            }
            catch { }
        }
示例#2
0
        public void FlexControl_ButtonClicked(FlexControl.Button button, FlexControl.ClickType type)
        {
            if (console == null || flexControl == null)
            {
                return;
            }

            if (button == FlexControl.Button.Knob &&
                (type == FlexControl.ClickType.Single || type == FlexControl.ClickType.Long))
            {
                switch (type)
                {
                case FlexControl.ClickType.Single:
                    switch (current_knob_mode)
                    {
                    case KnobMode.A1: CurrentKnobMode = KnobMode.A2; led2 = false; break;

                    case KnobMode.A2: CurrentKnobMode = KnobMode.A1; led2 = true; break;

                    case KnobMode.B1: CurrentKnobMode = KnobMode.B2; led2 = false; break;

                    case KnobMode.B2: CurrentKnobMode = KnobMode.B1; led2 = true; break;
                    }
                    break;

                case FlexControl.ClickType.Long:
                    switch (current_knob_mode)
                    {
                    case KnobMode.A1: CurrentKnobMode = KnobMode.B1; led1 = false; break;

                    case KnobMode.A2: CurrentKnobMode = KnobMode.B2; led1 = false; break;

                    case KnobMode.B1: CurrentKnobMode = KnobMode.A1; led1 = true; break;

                    case KnobMode.B2: CurrentKnobMode = KnobMode.A2; led1 = true; break;
                    }
                    break;
                }

                FlexControl.SetLEDStatus(led1, led2, led3);
                return;
            }

            FlexControlButtonFunction function = FlexControlButtonFunction.ClearRIT;

            switch (button)
            {
            case FlexControl.Button.Left:
                switch (type)
                {
                case FlexControl.ClickType.Single: function = button_left_single; break;

                case FlexControl.ClickType.Double: function = button_left_double; break;

                case FlexControl.ClickType.Long: function = button_left_long; break;
                }
                break;

            case FlexControl.Button.Middle:
                switch (type)
                {
                case FlexControl.ClickType.Single: function = button_mid_single; break;

                case FlexControl.ClickType.Double: function = button_mid_double; break;

                case FlexControl.ClickType.Long: function = button_mid_long; break;
                }
                break;

            case FlexControl.Button.Right:
                switch (type)
                {
                case FlexControl.ClickType.Single: function = button_right_single; break;

                case FlexControl.ClickType.Double: function = button_right_double; break;

                case FlexControl.ClickType.Long: function = button_right_long; break;
                }
                break;

            case FlexControl.Button.Knob:
                switch (type)
                {
                case FlexControl.ClickType.Double:
                    switch (current_knob_mode)
                    {
                    case KnobMode.A1:
                    case KnobMode.A2:
                        function = knob_mode_a_button_double;
                        break;

                    case KnobMode.B1:
                    case KnobMode.B2:
                        function = knob_mode_b_button_double;
                        break;
                    }
                    break;
                }
                break;
            }

            switch (function)
            {
            case FlexControlButtonFunction.ToggleTXVFO:
                if (console.VFOATX)
                {
                    console.VFOBTX = true;
                    led3           = true;
                }
                else
                {
                    console.VFOATX = true;
                    led3           = false;
                }
                break;

            case FlexControlButtonFunction.SwapVFO:
                console.VFOSwap(); led3 = false;
                break;

            case FlexControlButtonFunction.ToggleSplit:
                console.VFOSplit = !console.VFOSplit; led3 = console.VFOSplit;
                break;

            case FlexControlButtonFunction.ClearRIT:
                console.RITValue = 0; led3 = false;
                break;

            case FlexControlButtonFunction.ClearXIT:
                console.XITValue = 0; led3 = false;
                break;

            case FlexControlButtonFunction.CWSpeedUp:
                console.CATCWSpeed += 1; led3 = false;
                break;

            case FlexControlButtonFunction.CWSpeedDown:
                console.CATCWSpeed -= 1; led3 = false;
                break;

            case FlexControlButtonFunction.CWXSpeedUp:
                if (console.cwxForm != null)
                {
                    console.cwxForm.WPM += 1;
                }
                led3 = false;
                break;

            case FlexControlButtonFunction.CWXSpeedDown:
                if (console.cwxForm != null)
                {
                    console.cwxForm.WPM -= 1;
                }
                led3 = false;
                break;

            case FlexControlButtonFunction.FilterNext:
                console.RX1Filter += 1; led3 = false;
                if (console.RX1Filter == Filter.NONE)
                {
                    console.RX1Filter = Filter.F1;
                }
                break;

            case FlexControlButtonFunction.FilterPrevious:
                console.RX1Filter -= 1; led3 = false;
                if (console.RX1Filter == Filter.FIRST)
                {
                    console.RX1Filter = Filter.VAR2;
                }
                break;

            case FlexControlButtonFunction.SaveVFOA:
                console.CATMemoryQS(); led3 = false;
                break;

            case FlexControlButtonFunction.RestoreVFOA:
                console.CATMemoryQR(); led3 = false;
                break;

            case FlexControlButtonFunction.TuneStepUp:
                console.CATTuneStepUp(); led3 = false;
                break;

            case FlexControlButtonFunction.TuneStepDown:
                console.CATTuneStepDown(); led3 = false;
                break;

            case FlexControlButtonFunction.CopyVFOAtoB:
                console.CopyVFOAtoB(); led3 = false;
                break;

            case FlexControlButtonFunction.CopyVFOBtoA:
                console.CopyVFOBtoA(); led3 = false;
                break;

            case FlexControlButtonFunction.ZeroBeat:
                console.ZeroBeat(); led3 = false;
                break;

            case FlexControlButtonFunction.None:
                //do nothing
                break;
            }

            FlexControl.SetLEDStatus(led1, led2, led3);
        }