private void btnTuneToStageX_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { // tune with user entered parameters, based in injector type, turbo type, fuel type (to come) etc // create a backup! // start the parameter screen (user can enter turbo, injector, mapsensor, peak torque and peak power) // start the freetune wizard frmFreeTuneSettings tunset = new frmFreeTuneSettings(); props = m_trionicFile.GetTrionicProperties(); tunset.SetMapSensorType(props.MapSensorType); tunset.SetInjectorType(props.InjectorType); tunset.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!"); tunset.SetKnockTime(knockTime); int rpmLimit = m_trionicFile.GetSymbolAsInt("Rpm_max!"); tunset.SetRPMLimiter(rpmLimit); if (fileType == ECUFileType.Trionic52File) { if (frek230 == 728 || frek250 == 935) { //dtReport.Rows.Add("APC valve type: Trionic 5"); tunset.SetBPCType(BPCType.Trionic5Valve); } else { tunset.SetBPCType(BPCType.Trionic7Valve); } } else if (fileType == ECUFileType.Trionic55File) { if (frek230 == 90 || frek250 == 70) { tunset.SetBPCType(BPCType.Trionic5Valve); } else { tunset.SetBPCType(BPCType.Trionic7Valve); } } if (tunset.ShowDialog() == DialogResult.OK) { Trionic5Tuner _tuner = new Trionic5Tuner(); _tuner.AutoUpdateChecksum = m_appSettings.AutoChecksum; TuningResult res = _tuner.FreeTuneBinary(m_trionicFile, tunset.GetPeakTorque(), tunset.GetPeakBoost(), tunset.IsTorqueBased, tunset.GetMapSensorType(), tunset.GetTurboType(), tunset.GetInjectorType(), tunset.GetBCVType(), tunset.GetRPMLimiter(), tunset.GetKnockTime()); string text = "Tuning process completed!"; if (res == TuningResult.TuningFailedAlreadyTuned) { text = "Tuning process aborted, file is already tuned!"; } else if (res == TuningResult.TuningFailedThreebarSensor) { text = "Tuning process aborted, file was converted to another mapsensor type before!"; } props = m_trionicFile.GetTrionicProperties(); if (_tuner.Resume == null) { } _tuner.Resume.AddToResumeTable(text); TuningReport tuningrep = new TuningReport(); tuningrep.ReportTitle = "Tuning report.. stage " + props.TuningStage.ToString(); tuningrep.SetDataSource(_tuner.Resume.ResumeTuning); tuningrep.CreateReport(); tuningrep.ShowReportPreview(defaultLookAndFeel1.LookAndFeel); //frmInfoBox info = new frmInfoBox(text); } }
private void btnFreeTune_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { // create a backup! // start the parameter screen (user can enter turbo, injector, mapsensor, peak torque and peak power) // start the freetune wizard frmFreeTuneSettings tunset = new frmFreeTuneSettings(); Trionic5Properties props = m_trionicFile.GetTrionicProperties(); tunset.SetMapSensorType(props.MapSensorType); tunset.SetInjectorType(props.InjectorType); tunset.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!"); tunset.SetKnockTime(knockTime); int rpmLimit = m_trionicFile.GetSymbolAsInt("Rpm_max!"); tunset.SetRPMLimiter(rpmLimit); if (fileType == ECUFileType.Trionic52File) { if (frek230 == 728 || frek250 == 935) { //dtReport.Rows.Add("APC valve type: Trionic 5"); tunset.SetBPCType(BPCType.Trionic5Valve); } else { tunset.SetBPCType(BPCType.Trionic7Valve); } } else if (fileType == ECUFileType.Trionic55File) { if (frek230 == 90 || frek250 == 70) { tunset.SetBPCType(BPCType.Trionic5Valve); } else { tunset.SetBPCType(BPCType.Trionic7Valve); } } if (tunset.ShowDialog() == DialogResult.OK) { Trionic5Tuner _tuner = new Trionic5Tuner(); TuningResult res = _tuner.FreeTuneBinary(m_trionicFile, tunset.GetPeakTorque(), tunset.GetPeakBoost(), tunset.IsTorqueBased, tunset.GetMapSensorType(), tunset.GetTurboType(), tunset.GetInjectorType(), tunset.GetBCVType(), tunset.GetRPMLimiter(), tunset.GetKnockTime()); string text = "Tuning process completed!"; if (res == TuningResult.TuningFailedAlreadyTuned) { text = "Tuning process aborted, file is already tuned!"; } else if (res == TuningResult.TuningFailedThreebarSensor) { text = "Tuning process aborted, file was converted to another mapsensor type before!"; } frmInfoBox info = new frmInfoBox(text); } }