Example #1
0
        private void initJoystickBoundries(RadioConfigurations radioConfig)
        {
            joyLeft.MaxXValue = radioConfig.Rudder_MaxValue - radioConfig.Rudder_MinValue;
            joyLeft.MaxYValue = radioConfig.Throtle_MaxValue - radioConfig.Throtle_MinValue;

            joyRight.MaxXValue = radioConfig.Aileron_MaxValue - radioConfig.Aileron_MinValue;
            joyRight.MaxYValue = 65533;
        }
Example #2
0
        private void LoadSettingsToUI()
        {
            this.disableSaveSettings = true;

            RadioConfigurations radioConfig = AircraftRadioLogic.Instance.RadioConfig;

            sldElevator_MinValue1.Value    = radioConfig.Elevator_MinValue1;
            sldElevator_MinValue2.Value    = radioConfig.Elevator_MinValue2;
            sldElevator_MaxValue1.Value    = radioConfig.Elevator_MaxValue1;
            sldElevator_MaxValue2.Value    = radioConfig.Elevator_MaxValue2;
            sldElevator_Offset1.Value      = radioConfig.Elevator_Offset1;
            sldElevator_Offset2.Value      = radioConfig.Elevator_Offset2;
            chkElevator_Reverse1.IsChecked = radioConfig.Elevator_Reverse1;
            chkElevator_Reverse2.IsChecked = radioConfig.Elevator_Reverse2;

            sldAileron_Offset1.Value = radioConfig.Aileron_Offset1;
            sldAileron_Offset2.Value = radioConfig.Aileron_Offset2;

            this.disableSaveSettings = false;
        }
Example #3
0
        private void SetControllerValues()
        {
            try
            {
                AircraftState       aircraftState = AircraftRadioLogic.Instance.GetCurrentAircraftStateThreadSafe();
                RadioConfigurations radioConfig   = AircraftRadioLogic.Instance.RadioConfig;

                if (aircraftState.elevatorValueRaw != this.lastAircraftState.elevatorValueRaw)
                {
                    joyRight.YValue = aircraftState.elevatorValueRaw;

                    plotElevator1.PointX = aircraftState.elevatorValueRaw;
                    plotElevator1.PointY = aircraftState.elevatorValue1;

                    plotElevator2.PointX = aircraftState.elevatorValueRaw;
                    plotElevator2.PointY = aircraftState.elevatorValue2;
                }

                if (aircraftState.aileronValue != this.lastAircraftState.aileronValue)
                {
                    joyRight.XValue = aircraftState.aileronValue - radioConfig.Aileron_MinValue;
                }

                if (aircraftState.rudderValue != this.lastAircraftState.rudderValue)
                {
                    joyLeft.XValue = aircraftState.rudderValue - radioConfig.Rudder_MinValue;
                }

                if (aircraftState.throtleValue != this.lastAircraftState.throtleValue)
                {
                    if (radioConfig.Throtle_ReverseJoystick)
                    {
                        joyLeft.YValue = radioConfig.Throtle_MaxValue -
                                         (aircraftState.throtleValue - radioConfig.Throtle_MinValue);
                    }
                    else
                    {
                        joyLeft.YValue = (aircraftState.throtleValue - radioConfig.Throtle_MinValue);
                    }
                }

                this.lastAircraftState = aircraftState;

                this.textBox.Text = Math.Round(AircraftRadioLogic.Instance.GetRadioConnectionFPS(), 1).ToString();

                this.txtTotalSendPackages.Text = AircraftRadioLogic.Instance.GetRadioTotalSends().ToString();

                vtailViewer.LeftValue  = (double)aircraftState.elevatorValue1;
                vtailViewer.RightValue = (double)aircraftState.elevatorValue2;

                //if (AircraftRadioLogic.Instance.COMInitialized)
                {
                    txtChan1Value.Text  = aircraftState.throtleValue.ToString();
                    txtChan2Value.Text  = aircraftState.aileronValue.ToString();
                    txtChan3Value1.Text = aircraftState.elevatorValue1.ToString();
                    txtChan3Value2.Text = aircraftState.elevatorValue2.ToString();
                    txtChan4Value.Text  = aircraftState.rudderValue.ToString();
                }
            }
            catch (Exception ex)
            {
                //AddLogItem("ERR", "Error in SetControllerValues" + ex.ToString());
            }
        }