private void TuneToStage(string m_currentfile, int stage, double maxBoostValue, double maxBoostFirstGear, double maxBoostSecondGear, double maxBoostFirstGearAUT, double fuelCutLevel, double AutoGearBoxPercentage, bool isLpt, TurboType turboType, InjectorType injectorType, MapSensorType mapSensorType) { m_resume = new Trionic5Resume(); m_resume.AddToResumeTable("Tuning your binary to stage: " + stage.ToString()); // get the software ID from the bainery string enginetp = readenginetype(m_currentfile); string partnumber = readpartnumber(m_currentfile); // look up parameters for this sw id PartNumberConverter pnc = new PartNumberConverter(); ECUInformation ecuinfo = pnc.GetECUInfo(partnumber, enginetp); File.Copy(m_currentfile, Path.GetDirectoryName(m_currentfile) + "\\" + Path.GetFileNameWithoutExtension(m_currentfile) + DateTime.Now.ToString("yyyyMMddHHmmss") + "beforetuningtostage" + stage.ToString() + ".bin", true); m_resume.AddToResumeTable("Backup file created (" + Path.GetFileNameWithoutExtension(m_currentfile) + DateTime.Now.ToString("yyyyMMddHHmmss") + "beforetuningtostage" + stage.ToString() + ".bin" + ")"); switch (stage) { case 1: SetRegKonMatFirstGearManual(m_currentfile, 30); SetRegKonMatSecondGearManual(m_currentfile, 45); SetRegKonMatFirstGearAutomatic(m_currentfile, 30); break; case 2: SetRegKonMatFirstGearManual(m_currentfile, 45); SetRegKonMatSecondGearManual(m_currentfile, 45); SetRegKonMatFirstGearAutomatic(m_currentfile, 45); break; case 3: default: SetRegKonMatFirstGearManual(m_currentfile, 45); SetRegKonMatSecondGearManual(m_currentfile, 45); SetRegKonMatFirstGearAutomatic(m_currentfile, 45); break; } if (CheckBoostRegulationMapEmpty(m_currentfile)) { // empty reg_kon_mat switch (stage) { case 1: FillRegulationMapValue(m_currentfile, 45); break; case 2: FillRegulationMapValue(m_currentfile, 45); break; case 3: default: FillRegulationMapValue(m_currentfile, 45); break; } } if (CheckBoostRegulationAUTMapEmpty(m_currentfile)) { switch (stage) { case 1: FillRegulationAUTMapValue(m_currentfile, 45); break; case 2: FillRegulationAUTMapValue(m_currentfile, 45); break; case 3: default: FillRegulationAUTMapValue(m_currentfile, 45); break; } } if (CheckPIDControlEmpty(m_currentfile)) { FillDefaultPIDControls(m_currentfile); } if (CheckPIDControlAUTEmpty(m_currentfile)) { FillDefaultPIDAUTControls(m_currentfile); } //depending on turbotype!!! SetBoostRequestMaps(turboType, injectorType, mapSensorType, m_currentfile, maxBoostValue, AutoGearBoxPercentage, isLpt); if (/*!isLpt*/true) // don't if T5.2&& m_currentfile_size > 0x20000 { // should be percentages /* SetInjectionMap(m_currentfile,15, 15, 255); SetInjectionMap(m_currentfile,14, 15, 253); SetInjectionMap(m_currentfile,13, 15, 253); SetInjectionMap(m_currentfile,12, 15, 249); SetInjectionMap(m_currentfile,11, 15, 248); SetInjectionMap(m_currentfile,10, 15, 245); SetInjectionMap(m_currentfile,9, 15, 236); SetInjectionMap(m_currentfile,15, 14, 255); SetInjectionMap(m_currentfile,14, 14, 253); SetInjectionMap(m_currentfile,13, 14, 253); SetInjectionMap(m_currentfile,12, 14, 235); SetInjectionMap(m_currentfile,11, 14, 234); SetInjectionMap(m_currentfile,10, 14, 226); SetInjectionMap(m_currentfile,9, 14, 225); SetInjectionMap(m_currentfile,15, 13, 248); SetInjectionMap(m_currentfile,14, 13, 245); SetInjectionMap(m_currentfile,13, 13, 245); SetInjectionMap(m_currentfile,12, 13, 224); SetInjectionMap(m_currentfile,11, 13, 217); SetInjectionMap(m_currentfile,10, 13, 205); SetInjectionMap(m_currentfile,9, 13, 189); SetInjectionMap(m_currentfile,15, 12, 219); SetInjectionMap(m_currentfile,14, 12, 215); SetInjectionMap(m_currentfile,13, 12, 213); SetInjectionMap(m_currentfile,12, 12, 206); SetInjectionMap(m_currentfile,11, 12, 205); SetInjectionMap(m_currentfile,10, 12, 198); SetInjectionMap(m_currentfile,9, 12, 176); SetInjectionMap(m_currentfile,15, 11, 198); SetInjectionMap(m_currentfile,14, 11, 192); SetInjectionMap(m_currentfile,13, 11, 191); SetInjectionMap(m_currentfile,12, 11, 190); SetInjectionMap(m_currentfile,11, 11, 190); SetInjectionMap(m_currentfile,10, 11, 183); SetInjectionMap(m_currentfile,9, 11, 163);*/ } IncreaseInjectionKnockMap(m_currentfile, 0, 4); IncreaseInjectionKnockMap(m_currentfile, 1, 4); IncreaseInjectionKnockMap(m_currentfile, 2, 4); //SetIgnitionMap(m_currentfile, 15, 17, 1.5); //SetIgnitionMap(m_currentfile, 14, 17, 1.0); //SetIgnitionMap(m_currentfile, 13, 17, 0.5); //byte fuelcut = (byte)((fuelCutLevel + 1) * 100); SetBoostLimitMap(m_currentfile, 254 /* fuelcut */); //m_resume.m_resume.AddToResumeTable("Updated fuelcut map to: " + fuelCutLevel.ToString() + " bar"); byte fglimit = (byte)((maxBoostFirstGear + 1) * 100); SetFirstGearLimiter(m_currentfile, fglimit); m_resume.AddToResumeTable("Updated first gear limiter (MAN) to: " + maxBoostFirstGear.ToString() + " bar"); byte fgalimit = (byte)((maxBoostFirstGearAUT + 1) * 100); SetFirstGearLimiterAutoTrans(m_currentfile, fgalimit); m_resume.AddToResumeTable("Updated first gear limiter (AUT) to: " + maxBoostFirstGearAUT.ToString() + " bar"); byte sglimit = (byte)((maxBoostSecondGear + 1) * 100); SetSecondGearLimiter(m_currentfile, sglimit); m_resume.AddToResumeTable("Updated second gear limiter (MAN) to: " + maxBoostSecondGear.ToString() + " bar"); // <Guido> add Max_regl_temp1 Max_regl_temp2 SetMaxReglTempValues(m_currentfile, 250); try { Trionic5Anomalies anomalies = new Trionic5Anomalies(); anomalies.CheckBinForAnomalies(m_currentfile, m_resume, false, true, m_fileInformation ); } catch (Exception E) { Console.WriteLine("CheckBinForAnomalies: " + E.Message); } // mark this particular file as tuned to stage X, to prevent running the wizard on this file again! //enginetp = enginetp.Substring(0, enginetp.Length - 4); //enginetp += "T5S" + stage.ToString(); //writeenginetype(enginetp); WriteTunedToStageMarker(m_currentfile, stage); m_resume.AddToResumeTable("Updated binary description with tuned stage"); Trionic5File file = new Trionic5File(); file.LibraryPath = Application.StartupPath + "\\Binaries"; file.SetAutoUpdateChecksum(m_autoUpdateChecksum); file.UpdateChecksum(m_currentfile); }