public override void SetTrionicOptions(Trionic5Properties properties) { // save the settings in properties into the binary file //TODO: check which entries are changed and which are not. // non changed should not be saved Trionic5Properties _oriProperties = GetTrionicProperties(); // if (_oriProperties.Carmodel != properties.Carmodel) writecarmodel(properties.Carmodel); if(_oriProperties.Enginetype != properties.Enginetype) writeenginetype(properties.Enginetype); if(_oriProperties.Partnumber != properties.Partnumber) writepartnumber(properties.Partnumber); if(_oriProperties.SoftwareID != properties.SoftwareID) writesoftwareid(properties.SoftwareID); if(_oriProperties.VSSCode != properties.VSSCode) writeimmocode(properties.VSSCode); if(_oriProperties.Dataname != properties.Dataname) writedataname(properties.Dataname); if(_oriProperties.VSSactive != properties.VSSactive) SetVSSEnabled(properties.VSSactive); if (_oriProperties.Tank_diagnosticsactive != properties.Tank_diagnosticsactive) SetTankDiagnosticsEnabled(properties.Tank_diagnosticsactive); if(_oriProperties.AutomaticTransmission != properties.AutomaticTransmission) SetAutoGearboxEnabled(properties.AutomaticTransmission); if(_oriProperties.Heatedplates != properties.Heatedplates) SetHeatplatesEnabled(properties.Heatedplates); if(_oriProperties.Accelerationsenrichment != properties.Accelerationsenrichment) SetPgmStatusValue(PGMStatusbit.Accelerationsenrichment, properties.Accelerationsenrichment); if (_oriProperties.Adaptionofidlecontrol != properties.Adaptionofidlecontrol) SetPgmStatusValue(PGMStatusbit.Adaptionofidlecontrol, properties.Adaptionofidlecontrol); if (_oriProperties.Adaptivity != properties.Adaptivity) SetPgmStatusValue(PGMStatusbit.Adaptivity, properties.Adaptivity); if (_oriProperties.Adaptivitywithclosedthrottle != properties.Adaptivitywithclosedthrottle) SetPgmStatusValue(PGMStatusbit.Adaptivitywithclosedthrottle, properties.Adaptivitywithclosedthrottle); if (_oriProperties.Afterstartenrichment != properties.Afterstartenrichment) SetPgmStatusValue(PGMStatusbit.Afterstartenrichment, properties.Afterstartenrichment); if (_oriProperties.APCcontrol != properties.APCcontrol) SetPgmStatusValue(PGMStatusbit.APCcontrol, properties.APCcontrol); if (_oriProperties.ConstantinjectiontimeE51 != properties.ConstantinjectiontimeE51) SetPgmStatusValue(PGMStatusbit.ConstantinjectiontimeE51, properties.ConstantinjectiontimeE51); if (_oriProperties.Constantinjtimeduringidle != properties.Constantinjtimeduringidle) SetPgmStatusValue(PGMStatusbit.Constantinjtimeduringidle, properties.Constantinjtimeduringidle); if (_oriProperties.Decelerationsenleanment != properties.Decelerationsenleanment) SetPgmStatusValue(PGMStatusbit.Decelerationsenleanment, properties.Decelerationsenleanment); if (_oriProperties.Enrichmentduringstart != properties.Enrichmentduringstart) SetPgmStatusValue(PGMStatusbit.Enrichmentduringstart, properties.Enrichmentduringstart); if (_oriProperties.ETS != properties.ETS) SetPgmStatusValue(PGMStatusbit.ETS, properties.ETS); if (_oriProperties.FactortolambdawhenACisengaged != properties.FactortolambdawhenACisengaged) SetPgmStatusValue(PGMStatusbit.FactortolambdawhenACisengaged, properties.FactortolambdawhenACisengaged); if (_oriProperties.Factortolambdawhenthrottleopening != properties.Factortolambdawhenthrottleopening) SetPgmStatusValue(PGMStatusbit.Factortolambdawhenthrottleopening, properties.Factortolambdawhenthrottleopening); if (_oriProperties.Fueladjustingduringidle != properties.Fueladjustingduringidle) SetPgmStatusValue(PGMStatusbit.Fueladjustingduringidle, properties.Fueladjustingduringidle); if (_oriProperties.Fuelcut != properties.Fuelcut) SetPgmStatusValue(PGMStatusbit.Fuelcut, properties.Fuelcut); if (_oriProperties.Globaladaption != properties.Globaladaption) SetPgmStatusValue(PGMStatusbit.Globaladaption, properties.Globaladaption); if (_oriProperties.Higheridleduringstart != properties.Higheridleduringstart) SetPgmStatusValue(PGMStatusbit.Higheridleduringstart, properties.Higheridleduringstart); if (_oriProperties.Idlecontrol != properties.Idlecontrol) SetPgmStatusValue(PGMStatusbit.Idlecontrol, properties.Idlecontrol); if (_oriProperties.Interpolationofdelay != properties.Interpolationofdelay) SetPgmStatusValue(PGMStatusbit.Interpolationofdelay, properties.Interpolationofdelay); if (_oriProperties.Lambdacontrol != properties.Lambdacontrol) SetPgmStatusValue(PGMStatusbit.Lambdacontrol, properties.Lambdacontrol); if (_oriProperties.Lambdacontrolduringidle != properties.Lambdacontrolduringidle) SetPgmStatusValue(PGMStatusbit.Lambdacontrolduringidle, properties.Lambdacontrolduringidle); if (_oriProperties.Lambdacontrolduringtransients != properties.Lambdacontrolduringtransients) SetPgmStatusValue(PGMStatusbit.Lambdacontrolduringtransients, properties.Lambdacontrolduringtransients); if (_oriProperties.Loadcontrol != properties.Loadcontrol) SetPgmStatusValue(PGMStatusbit.Loadcontrol, properties.Loadcontrol); if (_oriProperties.Purge != properties.Purge) SetPgmStatusValue(PGMStatusbit.Purge, properties.Purge); if (_oriProperties.Tempcompwithactivelambdacontrol != properties.Tempcompwithactivelambdacontrol) SetPgmStatusValue(PGMStatusbit.Tempcompwithactivelambdacontrol, properties.Tempcompwithactivelambdacontrol); if (_oriProperties.Temperaturecompensation != properties.Temperaturecompensation) SetPgmStatusValue(PGMStatusbit.Temperaturecompensation, properties.Temperaturecompensation); if (_oriProperties.ThrottleAccRetadjustsimultMY95 != properties.ThrottleAccRetadjustsimultMY95) SetPgmStatusValue(PGMStatusbit.ThrottleAccRetadjustsimultMY95, properties.ThrottleAccRetadjustsimultMY95); if (_oriProperties.Usesseparateinjmapduringidle != properties.Usesseparateinjmapduringidle) SetPgmStatusValue(PGMStatusbit.Usesseparateinjmapduringidle, properties.Usesseparateinjmapduringidle); if (_oriProperties.WOTenrichment != properties.WOTenrichment) SetPgmStatusValue(PGMStatusbit.WOTenrichment, properties.WOTenrichment); if (GetSymbolLength("Pgm_mod!") > 4) { if (_oriProperties.Loadbufferduringidle != properties.Loadbufferduringidle) SetPgmStatusValue(PGMStatusbit.Loadbufferduringidle, properties.Loadbufferduringidle); if (_oriProperties.Constidleignangleduringgearoneandtwo != properties.Constidleignangleduringgearoneandtwo) SetPgmStatusValue(PGMStatusbit.Constidleignangleduringgearoneandtwo, properties.Constidleignangleduringgearoneandtwo); if (_oriProperties.NofuelcutR12 != properties.NofuelcutR12) SetPgmStatusValue(PGMStatusbit.NofuelcutR12, properties.NofuelcutR12); if (_oriProperties.Airpumpcontrol != properties.Airpumpcontrol) SetPgmStatusValue(PGMStatusbit.Airpumpcontrol, properties.Airpumpcontrol); if (_oriProperties.Normalasperatedengine != properties.Normalasperatedengine) SetPgmStatusValue(PGMStatusbit.Normalasperatedengine, properties.Normalasperatedengine); if (_oriProperties.Knockregulatingdisabled != properties.Knockregulatingdisabled) SetPgmStatusValue(PGMStatusbit.Knockregulatingdisabled, properties.Knockregulatingdisabled); if (_oriProperties.Constantangle != properties.Constantangle) SetPgmStatusValue(PGMStatusbit.Constantangle, properties.Constantangle); if (_oriProperties.PurgevalveMY94 != properties.PurgevalveMY94) SetPgmStatusValue(PGMStatusbit.PurgevalveMY94, properties.PurgevalveMY94); } if(_oriProperties.RAMlocked != properties.RAMlocked) writeramlockedflag(properties.RAMlocked); if (_oriProperties.SecondO2Enable != properties.SecondO2Enable) writesecondo2sensorenabled(properties.SecondO2Enable); if (_oriProperties.InjectorType != properties.InjectorType) { //TODO: we need to do something here ... injector indicator was changed.. ask user? // the injector type was changed, we need to check injector constant to verify settings (or better yet, injection duration) // if the injector duration is off, we need to do our magic and determine new settings based on old->new injector type WriteInjectorTypeMarker(properties.InjectorType); } if (_oriProperties.TurboType != properties.TurboType) { //TODO: we need to do something here ... turbo type changed, ask user? WriteTurboTypeMarker(properties.TurboType); Trionic5Tuner tun = new Trionic5Tuner(); tun.LiftBoostRequestForTurboType(properties.TurboType); } if (_oriProperties.TuningStage != properties.TuningStage) { //TODO: we need to do something here ... tuning stage changed, ask user? // well, we might need to run the tuning wizard to set it to stage properties.TuningStage /*TuningStage stage = DetermineTuningStage(); if (stage != properties.TuningStage) { Trionic5Tuner tun = new Trionic5Tuner(); tun.TuneFileToStage((int)properties.TuningStage, m_currentFile, this, m_fileInfo, true); Console.WriteLine("Silently tuned to stage " + properties.TuningStage.ToString()); }*/ WriteTuningStageMarker(properties.TuningStage); } if (_oriProperties.SyncDateTime != properties.SyncDateTime) SetMemorySyncDate(properties.SyncDateTime); if (_oriProperties.MapSensorType != properties.MapSensorType) { //TODO: we need to do something here ... mapsensor type changed, ask user? // we need to check settings in the binary here to verify whether the bin is already set for the chosen mapsensor type // if not, we need to do our magic here and update the bin to the new mapsensor type /*MapSensorType _detectedType = DetermineMapSensorType(); if (_detectedType != properties.MapSensorType) { // run a wizard in the background to match the selected mapsensor type Trionic5Tuner tun = new Trionic5Tuner(); //tun. //Console.WriteLine("Altering mapsensor type, running wizard " + _detectedType.ToString() + " to " + properties.MapSensorType.ToString()); tun.ConvertFileToThreeBarMapSensor(m_fileInfo, _detectedType, properties.MapSensorType); }*/ WriteThreeBarConversionMarker(m_currentFile, properties.MapSensorType); } if (_oriProperties.HardcodedRPMLimit != properties.HardcodedRPMLimit) { SetHardcodedRPMLimit(m_currentFile, properties.HardcodedRPMLimit); } updatechecksum(m_currentFile); }
abstract public void SetTrionicOptions(Trionic5Properties properties);
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; } } }
public override Trionic5Properties GetTrionicProperties() { //return a Trionic5Properties class with all relevant info Trionic5Properties _props = new Trionic5Properties(); if (DetermineFrequency(m_fileInfo.Filename) == CPUFrequency.CPUFrequency16MHZ) { _props.CPUspeed = "16 Mhz"; } else { _props.CPUspeed = "20 Mhz"; } _props.HardcodedRPMLimit = GetHardcodedRPMLimit(m_currentFile); _props.Partnumber = readpartnumber(m_currentFile); _props.Carmodel = readcarmodel(); _props.Enginetype = readenginetype(); _props.Dataname = readdataname(); _props.Partnumber = GetPartnumber(); _props.SoftwareID = GetSoftwareVersion(); _props.RAMlocked = readramlockedflag(); _props.SecondO2Enable = readsecondO2sensorenabledflag(); if (GetSymbolLength("Pgm_mod!") > 5) { _props.VSSCode = readimmocode(); _props.VSSactive = GetVSSEnabled(); _props.Tank_diagnosticsactive = GetTankPressureDiagnosticsEnabled(); _props.HasVSSOptions = true; } else { _props.VSSCode = "-----"; _props.VSSactive = false; _props.Tank_diagnosticsactive = false; _props.HasVSSOptions = false; } if (GetSymbolLength("Pgm_mod!") > 4) { _props.ExtendedProgramModeOptions = true; } else { _props.ExtendedProgramModeOptions = false; } // bits and bytes _props.AutomaticTransmission = GetAutoGearbox(); _props.Heatedplates = GetHeatplates(); _props.Accelerationsenrichment = GetPgmStatusValue(PGMStatusbit.Accelerationsenrichment); _props.Adaptionofidlecontrol = GetPgmStatusValue(PGMStatusbit.Adaptionofidlecontrol); _props.Adaptivitywithclosedthrottle = GetPgmStatusValue(PGMStatusbit.Adaptivitywithclosedthrottle); _props.Adaptivity = GetPgmStatusValue(PGMStatusbit.Adaptivity); _props.Afterstartenrichment = GetPgmStatusValue(PGMStatusbit.Afterstartenrichment); _props.APCcontrol = GetPgmStatusValue(PGMStatusbit.APCcontrol); _props.ConstantinjectiontimeE51 = GetPgmStatusValue(PGMStatusbit.ConstantinjectiontimeE51); _props.Constantinjtimeduringidle = GetPgmStatusValue(PGMStatusbit.Constantinjtimeduringidle); _props.Decelerationsenleanment = GetPgmStatusValue(PGMStatusbit.Decelerationsenleanment); _props.Enrichmentduringstart = GetPgmStatusValue(PGMStatusbit.Enrichmentduringstart); _props.ETS = GetPgmStatusValue(PGMStatusbit.ETS); _props.FactortolambdawhenACisengaged = GetPgmStatusValue(PGMStatusbit.FactortolambdawhenACisengaged); _props.Factortolambdawhenthrottleopening = GetPgmStatusValue(PGMStatusbit.Factortolambdawhenthrottleopening); _props.Fueladjustingduringidle = GetPgmStatusValue(PGMStatusbit.Fueladjustingduringidle); _props.Fuelcut = GetPgmStatusValue(PGMStatusbit.Fuelcut); _props.Globaladaption = GetPgmStatusValue(PGMStatusbit.Globaladaption); _props.Higheridleduringstart = GetPgmStatusValue(PGMStatusbit.Higheridleduringstart); _props.Idlecontrol = GetPgmStatusValue(PGMStatusbit.Idlecontrol); _props.Interpolationofdelay = GetPgmStatusValue(PGMStatusbit.Interpolationofdelay); _props.Lambdacontrol = GetPgmStatusValue(PGMStatusbit.Lambdacontrol); _props.Lambdacontrolduringidle = GetPgmStatusValue(PGMStatusbit.Lambdacontrolduringidle); _props.Lambdacontrolduringtransients = GetPgmStatusValue(PGMStatusbit.Lambdacontrolduringtransients); if (GetSymbolLength("Pgm_mod!") > 4) { _props.Loadbufferduringidle = GetPgmStatusValue(PGMStatusbit.Loadbufferduringidle); _props.Constidleignangleduringgearoneandtwo = GetPgmStatusValue(PGMStatusbit.Constidleignangleduringgearoneandtwo); _props.NofuelcutR12 = GetPgmStatusValue(PGMStatusbit.NofuelcutR12); _props.Airpumpcontrol = GetPgmStatusValue(PGMStatusbit.Airpumpcontrol); _props.Normalasperatedengine = GetPgmStatusValue(PGMStatusbit.Normalasperatedengine); _props.Knockregulatingdisabled = GetPgmStatusValue(PGMStatusbit.Knockregulatingdisabled); _props.Constantangle = GetPgmStatusValue(PGMStatusbit.Constantangle); _props.PurgevalveMY94 = GetPgmStatusValue(PGMStatusbit.PurgevalveMY94); _props.Loadcontrol = GetPgmStatusValue(PGMStatusbit.Loadcontrol); _props.Purge = GetPgmStatusValue(PGMStatusbit.Purge); _props.Tempcompwithactivelambdacontrol = GetPgmStatusValue(PGMStatusbit.Tempcompwithactivelambdacontrol); _props.Temperaturecompensation = GetPgmStatusValue(PGMStatusbit.Temperaturecompensation); _props.ThrottleAccRetadjustsimultMY95 = GetPgmStatusValue(PGMStatusbit.ThrottleAccRetadjustsimultMY95); _props.WOTenrichment = GetPgmStatusValue(PGMStatusbit.WOTenrichment); _props.Usesseparateinjmapduringidle = GetPgmStatusValue(PGMStatusbit.Usesseparateinjmapduringidle); } FileInfo _fi = new FileInfo(m_currentFile); if (_fi.Length == 0x40000) { _props.IsTrionic55 = true; } else { _props.IsTrionic55 = false; } _props.InjectorType = (InjectorType)ReadInjectorTypeMarker(); _props.TurboType = (TurboType)ReadTurboTypeMarker(); _props.MapSensorType = (MapSensorType)ReadThreeBarConversionMarker(m_currentFile); _props.TuningStage = (TuningStage)ReadTuningStageMarker(); _props.SyncDateTime = GetMemorySyncDate(); return _props; }
private bool OpenWorkingFile(string filename) { bool retval = false; if (File.Exists(filename)) { m_trionicFile = new Trionic5File(); m_trionicFile.LibraryPath = Application.StartupPath + "\\Binaries"; m_trionicFile.SetAutoUpdateChecksum(m_appSettings.AutoChecksum); FileInfo fi = new FileInfo(filename); //<GS-07102010> remove read only flag if possible try { fi.IsReadOnly = false; btnReadOnly.Caption = "File access OK"; } catch (Exception E) { Console.WriteLine("Failed to remove read only flag: " + E.Message); btnReadOnly.Caption = "File is READ ONLY"; } m_trionicFile.onDecodeProgress += new IECUFile.DecodeProgress(m_trionicFile_onDecodeProgress); m_trionicFile.onTransactionLogChanged += new IECUFile.TransactionLogChanged(m_trionicFile_onTransactionLogChanged); m_trionicFile.SelectFile(filename); //m_trionicFileInformation = m_trionicFile.ParseTrionicFile(ofd.FileName); m_trionicFileInformation = m_trionicFile.ParseFile(); props = m_trionicFile.GetTrionicProperties(); // set indicators and menu items accoring to the file that has been opened if (props.IsTrionic55) { barECUType.Caption = "T5.5"; // enable T5.5 maps EnableT55Maps(true); } else { barECUType.Caption = "T5.2"; EnableT55Maps(false); // disable T5.5 maps } barECUSpeed.Caption = props.CPUspeed; if (props.RAMlocked) { barECULocked.Caption = "RAM locked"; } else { barECULocked.Caption = "RAM unlocked"; } if (CheckFileInLibrary(props.Partnumber)) { btnCompareToOriginalFile.Enabled = true; } else { btnCompareToOriginalFile.Enabled = false; } _ecuConnection.MapSensorType = m_trionicFile.GetMapSensorType(m_appSettings.AutoDetectMapsensorType); gridSymbols.DataSource = m_trionicFileInformation.SymbolCollection; barStaticItem2.Caption = "File: " + Path.GetFileName(m_trionicFileInformation.Filename); this.Text = "T5Suite Professional 2.0 [" + Path.GetFileName(m_trionicFileInformation.Filename) + "]"; OpenGridViewGroups(gridSymbols, 0); // enable buttons barButtonItem4.Enabled = true; btnConnectECU.Enabled = true; btnSwitchMode.Enabled = true; //btnSynchronizeMaps.Enabled = true; btnTuneForE85Fuel.Enabled = true; //<GS-06042010> todo btnTuneToLargerInjectors.Enabled = true; //<GS-06042010> todo btnTuneToStage1.Enabled = true; btnTuneToStage2.Enabled = true; btnTuneToStage3.Enabled = true; btnTuneToStageX.Enabled = true; // btnTuneToThreeBarSensor.Enabled = true; barConvertMapSensor.Enabled = true; btnBoostAdaptionWizard.Enabled = true; btnHardcodedRPMLimit.Enabled = true; if (m_trionicFileInformation.Has2DRegKonMat()) { btnChangeRegkonMatRange.Enabled = true; } else { btnChangeRegkonMatRange.Enabled = false; } m_appSettings.Lastfilename = filename; ctrlRealtime1.Currentfile = filename; if (m_AFRMaps != null) { m_AFRMaps.SaveMaps(); // first save changes that might have been done } m_AFRMaps = null; if (m_AFRMaps == null && m_appSettings.AlwaysCreateAFRMaps) { m_AFRMaps = new AFRMaps(); m_AFRMaps.onFuelmapCellChanged += new AFRMaps.FuelmapCellChanged(m_AFRMaps_onFuelmapCellChanged); m_AFRMaps.onIdleFuelmapCellChanged += new AFRMaps.IdleFuelmapCellChanged(m_AFRMaps_onIdleFuelmapCellChanged); m_AFRMaps.onCellLocked += new AFRMaps.CellLocked(m_AFRMaps_onCellLocked); m_AFRMaps.TrionicFile = m_trionicFile; m_AFRMaps.InitializeMaps(); } // add realtime symbollist to ctrlRealtime1 Trionic5Tools.SymbolCollection _rtSymbols = new Trionic5Tools.SymbolCollection(); foreach (Trionic5Tools.SymbolHelper symh in m_trionicFileInformation.SymbolCollection) { if (symh.Start_address > 0 && (symh.Length >= 1 && symh.Length <= 4)) // <GS-29072010> was 1 & 2 only { _rtSymbols.Add(symh); } } ctrlRealtime1.RealtimeSymbolCollection = _rtSymbols; try { LoadUserDefinedRealtimeSymbols(); // try to load it } catch (Exception E) { Console.WriteLine(E.Message); } LoadKnockMaps(); SetTaskProgress(0, false); retval = true; } return retval; }
private void RunMapSensorWizard(MapSensorType targetMapSensorType) { if (m_trionicFile.Exists()) { Trionic5Tuner _tuner = new Trionic5Tuner(); string targetMapSensorString = "3 bar mapsensor"; switch (targetMapSensorType) { case MapSensorType.MapSensor25: targetMapSensorString = "2.5 bar mapsensor"; break; case MapSensorType.MapSensor30: targetMapSensorString = "3.0 bar mapsensor"; break; case MapSensorType.MapSensor35: targetMapSensorString = "3.5 bar mapsensor"; break; case MapSensorType.MapSensor40: targetMapSensorString = "4.0 bar mapsensor"; break; case MapSensorType.MapSensor50: targetMapSensorString = "5.0 bar mapsensor"; break; } MapSensorType fromMapSensortype = m_trionicFile.GetMapSensorType(m_appSettings.AutoDetectMapsensorType); frmMapSensorWizard mapSensorWiz = new frmMapSensorWizard(); mapSensorWiz.SetMapSensorTypes(fromMapSensortype, targetMapSensorType); if (mapSensorWiz.ShowDialog() == DialogResult.OK) { _tuner.AutoUpdateChecksum = m_appSettings.AutoChecksum; _tuner.ConvertFileToThreeBarMapSensor(m_trionicFileInformation, fromMapSensortype, MapSensorType.MapSensor30); props = m_trionicFile.GetTrionicProperties(); m_trionicFile.UpdateChecksum(); TuningReport tuningrep = new TuningReport(); tuningrep.ReportTitle = targetMapSensorString + " report"; tuningrep.DataSource = _tuner.Resume.ResumeTuning; tuningrep.CreateReport(); tuningrep.ShowPreview(defaultLookAndFeel1.LookAndFeel); } } }
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 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; } }
private void btnFirmwareOptions_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (m_trionicFile.Exists()) { props = m_trionicFile.GetTrionicProperties(); if (m_appSettings.UseEasyTrionicOptions) { EditTrionicSettingsEasyStyle(); } else { frmFirmwareSettings _settings = new frmFirmwareSettings(); props = m_trionicFile.GetTrionicProperties(); _settings.ObjectinView = props; if (_settings.ShowDialog() == DialogResult.OK) { // save the settings into the binary file if (_settings.ObjectinView is Trionic5Properties) { Trionic5Properties _changedprops = (Trionic5Properties)_settings.ObjectinView; m_trionicFile.SetTrionicOptions(_changedprops); props = m_trionicFile.GetTrionicProperties(); } } } props = m_trionicFile.GetTrionicProperties(); } }
// center screen? private void StartTableViewerFloating(string symbolname) { bool _isAdjustmentMap = false; if (symbolname == "FuelAdjustmentMap") { symbolname = m_trionicFileInformation.GetInjectionMap(); props = m_trionicFile.GetTrionicProperties(); if (!props.IsTrionic55) symbolname = "Adapt_korr"; _isAdjustmentMap = true; if (m_AFRMaps == null) { m_AFRMaps = new AFRMaps(); m_AFRMaps.onFuelmapCellChanged += new AFRMaps.FuelmapCellChanged(m_AFRMaps_onFuelmapCellChanged); m_AFRMaps.onIdleFuelmapCellChanged += new AFRMaps.IdleFuelmapCellChanged(m_AFRMaps_onIdleFuelmapCellChanged); m_AFRMaps.onCellLocked += new AFRMaps.CellLocked(m_AFRMaps_onCellLocked); m_AFRMaps.TrionicFile = m_trionicFile; m_AFRMaps.InitializeMaps(); } if (!m_AFRMaps.HasValidFuelmap) { // insert the fuel map from SRAM now byte[] fuelmap = _ecuConnection.ReadSymbolData(symbolname, (uint)m_trionicFileInformation.GetSymbolAddressSRAM(symbolname), (uint)m_trionicFileInformation.GetSymbolLength(symbolname)); m_AFRMaps.SetCurrentFuelMap(fuelmap); } } if (m_trionicFile == null) { frmInfoBox info = new frmInfoBox("You should open a binary file first"); return; } if (!m_trionicFile.HasSymbol(symbolname)) { frmInfoBox info = new frmInfoBox(symbolname + " is not present in the current file"); return; } // make it 100% self-defining // the application shouldn't have any know how about the details // it should only define TUNING-FLOW // have this work in online mode as well, this should enable the user to work in online mode in the SRAM //itself when it is connected. if (!PanelExists(symbolname)) { dockManager1.BeginUpdate(); /*Rectangle r = Screen.GetWorkingArea(ctrlRealtime1); Point p = new Point(r.X + r.Width/2, r.Y + r.Height/2); System.Drawing.Point floatpoint = this.PointToScreen(p);*/ System.Drawing.Point floatpoint = this.PointToClient(new System.Drawing.Point(dockSymbols.Location.X + dockSymbols.Width + 30, dockSymbols.Location.Y + 30)); DockPanel dp = dockManager1.AddPanel(floatpoint); dp.ClosedPanel += new DockPanelEventHandler(dockPanel_ClosedPanel); dp.Tag = m_trionicFileInformation.Filename; //IMapViewer mv = new MapViewerEx(); IMapViewer mv; if (m_appSettings.MapViewerType == MapviewerType.Fancy) { mv = new MapViewerEx(); } else if (m_appSettings.MapViewerType == MapviewerType.Normal) { mv = new MapViewer(); } else { mv = new SimpleMapViewer(); } mv.AutoUpdateChecksum = m_appSettings.AutoChecksum; mv.GraphVisible = m_appSettings.ShowGraphs; mv.SetViewSize((Trionic5Tools.ViewSize)m_appSettings.DefaultViewSize); if (m_trionicFile.GetMapSensorType(m_appSettings.AutoDetectMapsensorType) == MapSensorType.MapSensor25) { if (m_appSettings.DefaultViewType == ViewType.Decimal) { mv.Viewtype = Trionic5Tools.ViewType.Decimal; } else { mv.Viewtype = Trionic5Tools.ViewType.Easy; } } else if (m_trionicFile.GetMapSensorType(m_appSettings.AutoDetectMapsensorType) == MapSensorType.MapSensor30) { if (m_appSettings.DefaultViewType == ViewType.Decimal) { mv.Viewtype = Trionic5Tools.ViewType.Decimal3Bar; } else { mv.Viewtype = Trionic5Tools.ViewType.Easy3Bar; } } else if (m_trionicFile.GetMapSensorType(m_appSettings.AutoDetectMapsensorType) == MapSensorType.MapSensor35) { if (m_appSettings.DefaultViewType == ViewType.Decimal) { mv.Viewtype = Trionic5Tools.ViewType.Decimal35Bar; } else { mv.Viewtype = Trionic5Tools.ViewType.Easy35Bar; } } else if (m_trionicFile.GetMapSensorType(m_appSettings.AutoDetectMapsensorType) == MapSensorType.MapSensor40) { if (m_appSettings.DefaultViewType == ViewType.Decimal) { mv.Viewtype = Trionic5Tools.ViewType.Decimal4Bar; } else { mv.Viewtype = Trionic5Tools.ViewType.Easy4Bar; } } else if (m_trionicFile.GetMapSensorType(m_appSettings.AutoDetectMapsensorType) == MapSensorType.MapSensor50) { if (m_appSettings.DefaultViewType == ViewType.Decimal) { mv.Viewtype = Trionic5Tools.ViewType.Decimal5Bar; } else { mv.Viewtype = Trionic5Tools.ViewType.Easy5Bar; } } mv.LoadSymbol(symbolname, m_trionicFile); if (_ecuConnection.Opened && _ECUmode == OperationMode.ModeOnline) { if (_isAdjustmentMap) { mv.Map_content = m_AFRMaps.GetCurrentlyMutatedFuelMap(); } else { mv.Map_content = _ecuConnection.ReadSymbolData(symbolname, (uint)m_trionicFileInformation.GetSymbolAddressSRAM(symbolname), (uint)m_trionicFileInformation.GetSymbolLength(symbolname)); } mv.OnlineMode = true; } int cols = 1; int rows = 1; m_trionicFile.GetMapMatrixWitdhByName(symbolname, out cols, out rows); /* if (m_trionicFile.GetMapSensorType() == MapSensorType.MapSensor30) { mv.Viewtype = Trionic5Tools.ViewType.Easy3Bar; }*/ mv.ShowTable(cols, m_trionicFile.IsTableSixteenBits(symbolname)); mv.Dock = DockStyle.Fill; mv.onClose += new IMapViewer.ViewerClose(OnCloseMapViewer); // what todo on a save action (sram/binary) mv.onSymbolSave += new IMapViewer.NotifySaveSymbol(mv_onSymbolSave); mv.onReadFromSRAM += new IMapViewer.ReadDataFromSRAM(mv_onReadFromSRAM); mv.onAxisEditorRequested += new IMapViewer.AxisEditorRequested(mv_onAxisEditorRequested); mv.onSelectionChanged += new IMapViewer.SelectionChanged(tabdet_onSelectionChanged); mv.onSurfaceGraphViewChangedEx += new IMapViewer.SurfaceGraphViewChangedEx(mv_onSurfaceGraphViewChangedEx); mv.onCellLocked += new IMapViewer.CellLocked(mv_onCellLocked); TryToAddOpenLoopTables(mv); mv.InitEditValues(); // dp.Width = mv.DetermineWidth(); dp.Text = Path.GetFileName(m_trionicFile.GetFileInfo().Filename) + " [" + symbolname + "]"; //if (_ecuConnection.Opened && _APPmode == OperationMode.ModeOnline) dp.Text += " Online"; dp.Controls.Add(mv); mv.GraphVisible = false; int dw = 650; if (mv.X_axisvalues.Length > 0) { dw = 30 + ((mv.X_axisvalues.Length + 1) * 35); } if (dw < 400) dw = 400; dp.FloatSize = new Size(dw, 500); // now set it in the center of the screen! //int x = Screen.PrimaryScreen.WorkingArea.Width / 2 - dp.FloatSize.Width / 2; //int y = Screen.PrimaryScreen.WorkingArea.Height / 2 - dp.FloatSize.Height / 2; int x = this.Left + this.Width / 2 - dp.FloatSize.Width / 2; int y = this.Top + this.Height / 2 - dp.FloatSize.Height / 2; System.Drawing.Point realfloatpoint = new Point(x, y);//this.PointToClient(new System.Drawing.Point(dockSymbols.Location.X + dockSymbols.Width + 30, dockSymbols.Location.Y + 30)); dp.FloatLocation = realfloatpoint; dockManager1.EndUpdate(); } else { BringPanelToForeGround(symbolname); //TODO: Fuel adjustment map should be data-updated! /*if (_ecuConnection.Opened && _ECUmode == OperationMode.ModeOnline) { if (_isAdjustmentMap) { mv.Map_content = m_AFRMaps.GetCurrentlyMutatedFuelMap(); } }*/ } // update all mapviewers with a dummy value for test // UpdateMapViewers(3000, 100, 1.6); }
public abstract void SetTrionicOptions(Trionic5Properties properties);