Exemple #1
0
        private void cboxVeh_SelectedIndexChanged(object sender, EventArgs e)
        {
            //mf.FileOpenVehicle(mf.vehiclesDirectory + cboxVeh.SelectedItem.ToString() + ".xml");
            SettingsIO.ImportAll(mf.vehiclesDirectory + cboxVeh.SelectedItem.ToString() + ".XML");

            mf.LoadSettings();
            Close();
        }
        private void btnVehicleLoad_Click(object sender, EventArgs e)
        {
            if (!mf.isJobStarted)
            {
                if (lvVehicles.SelectedItems.Count > 0)
                {
                    DialogResult result3 = MessageBox.Show(
                        "Load: " + lvVehicles.SelectedItems[0].SubItems[0].Text + ".XML",
                        gStr.gsSaveAndReturn,
                        MessageBoxButtons.YesNo,
                        MessageBoxIcon.Question,
                        MessageBoxDefaultButton.Button2);
                    if (result3 == DialogResult.Yes)
                    {
                        SettingsIO.ImportAll(mf.vehiclesDirectory + lvVehicles.SelectedItems[0].SubItems[0].Text + ".XML");
                        mf.vehicleFileName = lvVehicles.SelectedItems[0].SubItems[0].Text;
                        Properties.Vehicle.Default.setVehicle_vehicleName = mf.vehicleFileName;
                        Properties.Vehicle.Default.Save();

                        mf.vehicle = new CVehicle(mf);
                        mf.tool    = new CTool(mf);

                        //fix the checkboxes on summary
                        //SaveDisplaySettings();

                        //reset AOG
                        mf.LoadSettings();

                        chkDisplaySky.Checked             = mf.isSkyOn;
                        chkDisplayGrid.Checked            = mf.isGridOn;
                        chkDisplaySpeedo.Checked          = mf.isSpeedoOn;
                        chkDisplayDayNight.Checked        = mf.isAutoDayNight;
                        chkDisplayExtraGuides.Checked     = mf.isSideGuideLines;
                        chkDisplayLogNMEA.Checked         = mf.isLogNMEA;
                        chkDisplayPolygons.Checked        = mf.isDrawPolygons;
                        chkDisplayLightbar.Checked        = mf.isLightbarOn;
                        chkDisplayKeyboard.Checked        = mf.isKeyboardOn;
                        chkDisplayStartFullScreen.Checked = Properties.Settings.Default.setDisplay_isStartFullScreen;

                        if (mf.isMetric)
                        {
                            rbtnDisplayMetric.Checked = true;
                        }
                        else
                        {
                            rbtnDisplayImperial.Checked = true;
                        }

                        SaveDisplaySettings();

                        //Form Steer Settings
                        mf.p_252.pgn[mf.p_252.countsPerDegree] = unchecked ((byte)Properties.Settings.Default.setAS_countsPerDegree);
                        mf.p_252.pgn[mf.p_252.ackerman]        = unchecked ((byte)Properties.Settings.Default.setAS_ackerman);

                        mf.p_252.pgn[mf.p_252.wasOffsetHi] = unchecked ((byte)(Properties.Settings.Default.setAS_wasOffset >> 8));
                        mf.p_252.pgn[mf.p_252.wasOffsetLo] = unchecked ((byte)(Properties.Settings.Default.setAS_wasOffset));

                        mf.p_252.pgn[mf.p_252.highPWM]          = unchecked ((byte)Properties.Settings.Default.setAS_highSteerPWM);
                        mf.p_252.pgn[mf.p_252.lowPWM]           = unchecked ((byte)Properties.Settings.Default.setAS_lowSteerPWM);
                        mf.p_252.pgn[mf.p_252.gainProportional] = unchecked ((byte)Properties.Settings.Default.setAS_Kp);
                        mf.p_252.pgn[mf.p_252.minPWM]           = unchecked ((byte)Properties.Settings.Default.setAS_minSteerPWM);

                        mf.SendPgnToLoop(mf.p_252.pgn);

                        //machine module settings
                        mf.p_238.pgn[mf.p_238.set0]      = Properties.Vehicle.Default.setArdMac_setting0;
                        mf.p_238.pgn[mf.p_238.raiseTime] = Properties.Vehicle.Default.setArdMac_hydRaiseTime;
                        mf.p_238.pgn[mf.p_238.lowerTime] = Properties.Vehicle.Default.setArdMac_hydLowerTime;

                        mf.SendPgnToLoop(mf.p_238.pgn);

                        //steer config
                        mf.p_251.pgn[mf.p_251.set0]     = Properties.Vehicle.Default.setArdSteer_setting0;
                        mf.p_251.pgn[mf.p_251.set1]     = Properties.Vehicle.Default.setArdSteer_setting1;
                        mf.p_251.pgn[mf.p_251.maxPulse] = Properties.Vehicle.Default.setArdSteer_maxPulseCounts;
                        mf.p_251.pgn[mf.p_251.minSpeed] = 5; //0.5 kmh
                        mf.SendPgnToLoop(mf.p_251.pgn);

                        mf.TimedMessageBox(2500, "Steer and Machine Settings Sent", "Was Steer Module Connected?");
                    }

                    UpdateVehicleListView();
                }
            }
            else
            {
                var form = new FormTimedMessage(2000, gStr.gsFieldIsOpen, gStr.gsCloseFieldFirst);
                form.Show(this);
            }
            //Close();
        }
Exemple #3
0
        private void btnVehicleLoad_Click(object sender, EventArgs e)
        {
            if (!mf.isJobStarted)
            {
                if (lvVehicles.SelectedItems.Count > 0)
                {
                    DialogResult result3 = MessageBox.Show(
                        "Load: " + lvVehicles.SelectedItems[0].SubItems[0].Text + ".XML",
                        gStr.gsSaveAndReturn,
                        MessageBoxButtons.YesNo,
                        MessageBoxIcon.Question,
                        MessageBoxDefaultButton.Button2);
                    if (result3 == DialogResult.Yes)
                    {
                        SettingsIO.ImportAll(mf.vehiclesDirectory + lvVehicles.SelectedItems[0].SubItems[0].Text + ".XML");
                        mf.vehicleFileName = lvVehicles.SelectedItems[0].SubItems[0].Text;
                        Properties.Vehicle.Default.setVehicle_vehicleName = mf.vehicleFileName;
                        Properties.Vehicle.Default.Save();

                        mf.vehicle = new CVehicle(mf);
                        mf.tool    = new CTool(mf);

                        //fix the checkboxes on summary
                        //SaveDisplaySettings();

                        //reset AOG
                        mf.LoadSettings();

                        chkDisplaySky.Checked             = mf.isSkyOn;
                        chkDisplayFloor.Checked           = mf.isTextureOn;
                        chkDisplayGrid.Checked            = mf.isGridOn;
                        chkDisplaySpeedo.Checked          = mf.isSpeedoOn;
                        chkDisplayDayNight.Checked        = mf.isAutoDayNight;
                        chkDisplayExtraGuides.Checked     = mf.isSideGuideLines;
                        chkDisplayLogNMEA.Checked         = mf.isLogNMEA;
                        chkDisplayPolygons.Checked        = mf.isDrawPolygons;
                        chkDisplayLightbar.Checked        = mf.isLightbarOn;
                        chkDisplayKeyboard.Checked        = mf.isKeyboardOn;
                        chkDisplayStartFullScreen.Checked = Properties.Settings.Default.setDisplay_isStartFullScreen;

                        if (mf.isMetric)
                        {
                            rbtnDisplayMetric.Checked = true;
                        }
                        else
                        {
                            rbtnDisplayImperial.Checked = true;
                        }

                        SaveDisplaySettings();

                        lblCurrentVehicle.Text = Properties.Vehicle.Default.setVehicle_vehicleName;

                        if (mf.isMetric)
                        {
                            lblInchesCm.Text               = gStr.gsCentimeters;
                            lblFeetMeters.Text             = gStr.gsMeters;
                            lblSecTotalWidthFeet.Visible   = false;
                            lblSecTotalWidthInches.Visible = false;
                            lblSecTotalWidthMeters.Visible = true;
                        }
                        else
                        {
                            lblInchesCm.Text               = gStr.gsInches;
                            lblFeetMeters.Text             = "Feet";
                            lblSecTotalWidthFeet.Visible   = true;
                            lblSecTotalWidthInches.Visible = true;
                            lblSecTotalWidthMeters.Visible = false;
                        }

                        if (mf.isMetric)
                        {
                            lblSecTotalWidthMeters.Text = (mf.tool.toolWidth * 100).ToString() + " cm";
                        }
                        else
                        {
                            double toFeet = mf.tool.toolWidth * 3.2808;
                            lblSecTotalWidthFeet.Text = Convert.ToString((int)toFeet) + "'";
                            double temp = Math.Round((toFeet - Math.Truncate(toFeet)) * 12, 0);
                            lblSecTotalWidthInches.Text = Convert.ToString(temp) + '"';
                        }


                        //Form Steer Settings
                        mf.p_252.pgn[mf.p_252.countsPerDegree] = unchecked ((byte)Properties.Settings.Default.setAS_countsPerDegree);
                        mf.p_252.pgn[mf.p_252.ackerman]        = unchecked ((byte)Properties.Settings.Default.setAS_ackerman);

                        mf.p_252.pgn[mf.p_252.wasOffsetHi] = unchecked ((byte)(Properties.Settings.Default.setAS_wasOffset >> 8));
                        mf.p_252.pgn[mf.p_252.wasOffsetLo] = unchecked ((byte)(Properties.Settings.Default.setAS_wasOffset));

                        mf.p_252.pgn[mf.p_252.highPWM]          = unchecked ((byte)Properties.Settings.Default.setAS_highSteerPWM);
                        mf.p_252.pgn[mf.p_252.lowPWM]           = unchecked ((byte)Properties.Settings.Default.setAS_lowSteerPWM);
                        mf.p_252.pgn[mf.p_252.gainProportional] = unchecked ((byte)Properties.Settings.Default.setAS_Kp);
                        mf.p_252.pgn[mf.p_252.minPWM]           = unchecked ((byte)Properties.Settings.Default.setAS_minSteerPWM);

                        mf.SendPgnToLoop(mf.p_252.pgn);

                        //machine module settings
                        mf.p_238.pgn[mf.p_238.set0]      = Properties.Vehicle.Default.setArdMac_setting0;
                        mf.p_238.pgn[mf.p_238.raiseTime] = Properties.Vehicle.Default.setArdMac_hydRaiseTime;
                        mf.p_238.pgn[mf.p_238.lowerTime] = Properties.Vehicle.Default.setArdMac_hydLowerTime;

                        mf.SendPgnToLoop(mf.p_238.pgn);

                        //steer config
                        mf.p_251.pgn[mf.p_251.set0]     = Properties.Vehicle.Default.setArdSteer_setting0;
                        mf.p_251.pgn[mf.p_251.set1]     = Properties.Vehicle.Default.setArdSteer_setting1;
                        mf.p_251.pgn[mf.p_251.maxPulse] = Properties.Vehicle.Default.setArdSteer_maxPulseCounts;
                        mf.p_251.pgn[mf.p_251.minSpeed] = 5; //0.5 kmh

                        if (Properties.Settings.Default.setAS_isAngVelGuidance)
                        {
                            mf.p_251.pgn[mf.p_251.angVel] = 1;
                        }
                        else
                        {
                            mf.p_251.pgn[mf.p_251.angVel] = 0;
                        }

                        mf.SendPgnToLoop(mf.p_251.pgn);

                        //Send Pin configuration
                        SendRelaySettingsToMachineModule();

                        ///Remind the user
                        mf.TimedMessageBox(2500, "Steer and Machine Settings Sent", "Were Modules Connected?");
                    }

                    UpdateVehicleListView();
                }
            }
            else
            {
                var form = new FormTimedMessage(2000, gStr.gsFieldIsOpen, gStr.gsCloseFieldFirst);
                form.Show(this);
            }
            //Close();
        }