public AsyncInputFrameArgs(int servo1target, int servo2target, int ping1value, int ping2value)
        {
            dPos1Mks = ProximityModule.servoTargetToMks(servo1target);
            dPos2Mks = ProximityModule.servoTargetToMks(servo2target);

            dPing1DistanceMm = ProximityModule.pingValueToDistanceMm(ping1value);
            dPing2DistanceMm = ProximityModule.pingValueToDistanceMm(ping2value);
        }
Exemplo n.º 2
0
        private Hashtable wiiValuesControls = new Hashtable(); // of WiimoteValuesUserControl

        #endregion Fields

        #region Constructors

        public ControllerTestForm()
        {
            InitializeComponent();

            compassTrackBar.Value = (int)compassBearing;

            rpCloseButton.Enabled = false;

            disconnectControllerButton.Enabled = false;

            {
                string[] ports = SerialPort.GetPortNames();
                ArrayList alPorts = new ArrayList(ports);

                this.comboBoxPort.Items.AddRange(ports);
                this.comboBoxPortCsa.Items.AddRange(ports);

                // a little hack to preset ports:
                int pos = alPorts.IndexOf("COM1");
                if (pos >= 0)
                {
                    comboBoxPort.SelectedIndex = pos;
                }

                pos = alPorts.IndexOf("COM4");
                if (pos >= 0)
                {
                    comboBoxPortCsa.SelectedIndex = pos;
                }
            }

            oscPortTextBox.Text = "9123";
            oscStopButton.Enabled = false;
            scaOscStopButton.Enabled = false;

            DateTime t1 = DateTime.Now;
            SettingsPersister.ReadOptions();
            TimeSpan ts = DateTime.Now - t1;
            Tracer.WriteLine("ReadOptions() took " + ts.Milliseconds + " ms");

            Tracer.setInterface(statusBar, statusBar2, null); // mainProgressBar);
            Tracer.WriteLine("GUI up");

            periodicMaintenanceTimer = new System.Windows.Forms.Timer();
            periodicMaintenanceTimer.Interval = 300;
            periodicMaintenanceTimer.Tick += new EventHandler(periodicMaintenance);
            periodicMaintenanceTimer.Start();

            Tracer.WriteLine("OK: Maintenance ON");

            //ensureOscilloscope();

            initDashboard();

            //create gamepad device.
            //gamepad = new LogitechRumblepad(this, devicesTreeView);

            //gamepad.leftJoystickVertMoved += new JoystickEventHandler(gamepad_leftJoystickMoved);
            //gamepad.rightJoystickVertMoved += new JoystickEventHandler(gamepad_rightJoystickMoved);
            //gamepad.btnChangedState += new ButtonEventHandler(gamepad_btnChangedState);

            //create picpxmod device.
            _picpxmod = new ProximityModule(this);

            _picpxmod.HasReadFrame += pmFrameCompleteHandler;

            picUsbVendorIdTextBox.Text = string.Format("0x{0:X}", _picpxmod.vendorId);
            picUsbProductIdTextBox.Text = string.Format("0x{0:X}", _picpxmod.productId);
        }