예제 #1
0
        private void RunTuningWizard()
        {
            props = m_trionicFile.GetTrionicProperties();
            if ((int)props.TuningStage > 3)
            {
                frmInfoBox infofail = new frmInfoBox("This file has already been tuned to a higher stage, the tuning wizard will not be started");
                return;
            }

            frmTuningWizard tunWiz = new frmTuningWizard();
            int _currStage = (int)props.TuningStage;
            if (_currStage == 0) _currStage++;
            tunWiz.TuningStage = _currStage;
            tunWiz.SetMapSensorType(props.MapSensorType);
            tunWiz.SetInjectorType(props.InjectorType);
            tunWiz.SetTurboType(props.TurboType);
            ECUFileType fileType = m_trionicFile.DetermineFileType();
            int frek230 = m_trionicFile.GetSymbolAsInt("Frek_230!");
            int frek250 = m_trionicFile.GetSymbolAsInt("Frek_250!");

            int knockTime = m_trionicFile.GetSymbolAsInt("Knock_matrix_time!");
            tunWiz.SetKnockTime(knockTime);
            int rpmLimit = m_trionicFile.GetSymbolAsInt("Rpm_max!");
            tunWiz.SetRPMLimiter(rpmLimit);

            if (fileType == ECUFileType.Trionic52File)
            {
                if (frek230 == 728 || frek250 == 935)
                {
                    //dtReport.Rows.Add("APC valve type: Trionic 5");
                    tunWiz.SetBPCType(BPCType.Trionic5Valve);
                }
                else
                {
                    tunWiz.SetBPCType(BPCType.Trionic7Valve);
                }
            }
            else if (fileType == ECUFileType.Trionic55File)
            {
                if (frek230 == 90 || frek250 == 70)
                {
                    tunWiz.SetBPCType(BPCType.Trionic5Valve);
                }
                else
                {
                    tunWiz.SetBPCType(BPCType.Trionic7Valve);
                }
            }
            if (tunWiz.ShowDialog() == DialogResult.OK)
            {
                Application.DoEvents();
                Trionic5Tuner _tuner = new Trionic5Tuner();
                _tuner.AutoUpdateChecksum = m_appSettings.AutoChecksum;
                frmInfoBox info;
                TuningResult result = TuningResult.TuningFailed;
                if (tunWiz.TuningStage == 4)
                {
                    result = _tuner.FreeTuneBinary(m_trionicFile, tunWiz.GetPeakTorque(), tunWiz.GetPeakBoost(), tunWiz.IsTorqueBased, tunWiz.GetMapSensorType(), tunWiz.GetTurboType(), tunWiz.GetInjectorType(), tunWiz.GetBCVType(), tunWiz.GetRPMLimiter(), tunWiz.GetKnockTime());
                }
                else
                {
                    result = _tuner.TuneFileToStage(tunWiz.TuningStage, m_trionicFile.GetFileInfo().Filename, m_trionicFile, m_trionicFileInformation, true);

                }
                switch (result)
                {
                    case TuningResult.TuningFailed:
                        info = new frmInfoBox("Tuning of the binary file failed!");
                        break;
                    case TuningResult.TuningFailedAlreadyTuned:
                        info = new frmInfoBox("Your binary file was already tuned!");
                        break;
                    case TuningResult.TuningFailedThreebarSensor:
                        info = new frmInfoBox("Your binary file was already tuned (3 bar sensor)!");
                        break;
                    case TuningResult.TuningSuccess:
                        // show report
                        props = m_trionicFile.GetTrionicProperties();
                        TuningReport tuningrep = new TuningReport();
                        tuningrep.ReportTitle = "Tuning report (stage " + tunWiz.TuningStage.ToString() + ")";
                        tuningrep.SetDataSource(_tuner.Resume.ResumeTuning);
                        tuningrep.CreateReport();
                        tuningrep.ShowReportPreview(defaultLookAndFeel1.LookAndFeel);
                        //info = new frmInfoBox("Your binary file was succesfully tuned to stage 1");
                        break;
                    case TuningResult.TuningCancelled:
                        // show report
                        info = new frmInfoBox("Tuning process cancelled by user");
                        break;
                }
            }
        }
예제 #2
0
        private void btnTuneToStage3_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Trionic5Tuner _tuner = new Trionic5Tuner();
            _tuner.AutoUpdateChecksum = m_appSettings.AutoChecksum;
            frmInfoBox info;
            TuningResult result = _tuner.TuneFileToStage(3, m_trionicFile.GetFileInfo().Filename, m_trionicFile, m_trionicFileInformation, false);
            switch (result)
            {
                case TuningResult.TuningFailed:
                    info = new frmInfoBox("Tuning of the binary file failed!");
                    break;
                case TuningResult.TuningFailedAlreadyTuned:
                    info = new frmInfoBox("Your binary file was already tuned!");
                    break;
                case TuningResult.TuningFailedThreebarSensor:
                    info = new frmInfoBox("Your binary file was already tuned (3 bar sensor)!");
                    break;
                case TuningResult.TuningSuccess:
                    // show report
                    props = m_trionicFile.GetTrionicProperties();
                    //info = new frmInfoBox("Your binary file was succesfully tuned to stage 3");
                    TuningReport tuningrep = new TuningReport();
                    tuningrep.ReportTitle = "Tuning report (stage III)";
                    tuningrep.SetDataSource(_tuner.Resume.ResumeTuning);
                    tuningrep.CreateReport();
                    tuningrep.ShowReportPreview(defaultLookAndFeel1.LookAndFeel);
                    break;
                case TuningResult.TuningCancelled:
                    // show report
                    info = new frmInfoBox("Tuning process cancelled by user");
                    break;

            }
        }