private void Information_firmwareInformation_ItemClick(object sender, ItemClickEventArgs e) { // show firmware information screen! bool _correctFooter = m_appSettings.AutoFixFooter; frmFirmwareInformation frminfo = new frmFirmwareInformation(); if (m_currentfile != null) { if (File.Exists(m_currentfile)) { T7FileHeader t7InfoHeader = new T7FileHeader(); t7InfoHeader.init(m_currentfile, m_appSettings.AutoFixFooter); string swVersion = t7InfoHeader.getSoftwareVersion(); PartNumberConverter pnc = new PartNumberConverter(); ECUInformation ecuinfo = pnc.GetECUInfo(t7InfoHeader.getPartNumber().Trim(), ""); frminfo.SIDDate = t7InfoHeader.getSIDDate(); if (ecuinfo.Valid) { frminfo.OriginalCarType = ecuinfo.Carmodel.ToString(); frminfo.OriginalEngineType = ecuinfo.Enginetype.ToString(); } if (swVersion.Trim() == "EU0AF01C.55P" || swVersion.Trim() == "EU0AF01C.46T" || swVersion.Trim().StartsWith("ET02U01C") || swVersion.Trim() == "ET03F01C.46S") { // additional requirements for the bytes in that location // http://www.trionictuning.com/forum/viewtopic.php?f=17&t=109&p=8569#p8537 // set these options correct if (swVersion.Trim().StartsWith("EU0AF01C") || swVersion.Trim() == "ET03F01C.46S") { if ((CheckBytesInFile(m_currentfile, 0x4968E, 0, 2) || (CheckBytesInFile(m_currentfile, 0x4968E, 0x00, 1) && CheckBytesInFile(m_currentfile, 0x4968F, 0x80, 1))) && (CheckBytesInFile(m_currentfile, 0x496B4, 0, 2) || (CheckBytesInFile(m_currentfile, 0x496B4, 0x00, 1) && CheckBytesInFile(m_currentfile, 0x496B5, 0x80, 1))) && (CheckBytesInFile(m_currentfile, 0x49760, 0, 2) || (CheckBytesInFile(m_currentfile, 0x49760, 0x00, 1) && CheckBytesInFile(m_currentfile, 0x49761, 0x80, 1)))) { frminfo.EnableSIDAdvancedOptions(true); if (/*CheckBytesInFile(m_currentfile, 0x495FA, 0, 2) &&*/ CheckBytesInFile(m_currentfile, 0x4968E, 0, 2) && CheckBytesInFile(m_currentfile, 0x496B4, 0, 2)) { frminfo.SIDDisableStartScreen = true; } else { frminfo.SIDDisableStartScreen = false; } if (CheckBytesInFile(m_currentfile, 0x49760, 0, 2)) // should be 0x49760 in stead of 0x4975E { frminfo.SIDDisableAdaptionMessages = true; } else { frminfo.SIDDisableAdaptionMessages = false; } /* * Remove startup screen: change to 00 00 instead of 00 80 000495FA // not needed!!! <GS-11042011> 0004968E 000496B4 Remove adaptation messages: Change 0x49760 to 00 00 instead of 00 80 */ } else { frminfo.EnableSIDAdvancedOptions(false); } } else { if ((CheckBytesInFile(m_currentfile, 0x46F4D, 0, 1) || CheckBytesInFile(m_currentfile, 0x46F4D, 0x80, 1)) && (CheckBytesInFile(m_currentfile, 0x4701F, 0, 1) || CheckBytesInFile(m_currentfile, 0x4701F, 0x80, 1))) { frminfo.EnableSIDAdvancedOptions(true); //Disable startscreen, change 0x00046F4D to 00 in stead of 80 if (CheckBytesInFile(m_currentfile, 0x46F4D, 0, 1)) { frminfo.SIDDisableStartScreen = true; } else { frminfo.SIDDisableStartScreen = false; } //Remove the adaption messages, change 0x0004701F to 00 in stead of 80 if (CheckBytesInFile(m_currentfile, 0x4701F, 0, 1)) { frminfo.SIDDisableAdaptionMessages = true; } else { frminfo.SIDDisableAdaptionMessages = false; } } else { frminfo.EnableSIDAdvancedOptions(false); } } } else { frminfo.EnableSIDAdvancedOptions(false); } // Pavel Angelov created this modification. // Disable effect of the emission limitation function. if (swVersion.Trim().StartsWith("EU0AF01C")) { if (CheckBytesInFile(m_currentfile, 0x13837, 0x03, 1)) { frminfo.EmissionLimitation = true; frminfo.EnableEmissionLimitation(true); } else if (CheckBytesInFile(m_currentfile, 0x13837, 0x02, 1)) { frminfo.EmissionLimitation = false; frminfo.EnableEmissionLimitation(true); } else { frminfo.EnableEmissionLimitation(false); } } else { frminfo.EnableEmissionLimitation(false); } frminfo.SoftwareID = t7InfoHeader.getSoftwareVersion(); frminfo.ChassisID = t7InfoHeader.getChassisID(); frminfo.EngineType = t7InfoHeader.getCarDescription(); frminfo.Partnumber = t7InfoHeader.getPartNumber(); frminfo.ImmoID = t7InfoHeader.getImmobilizerID(); frminfo.SoftwareIsOpen = IsBinaryFileOpen(); frminfo.BioPowerSoftware = IsBinaryBiopower(); frminfo.BioPowerEnabled = IsBioPowerEnabled(); frminfo.CompressedSymboltable = IsBinaryPackedVersion(m_currentfile); frminfo.MissingSymbolTable = IsBinaryMissingSymbolTable(); if (frminfo.MissingSymbolTable) frminfo.BioPowerSoftware = true; // only missing in biopower software frminfo.ChecksumEnabled = HasBinaryChecksumEnabled(); frminfo.TorqueLimitersEnabled = HasBinaryTorqueLimiterEnabled(); if (!HasBinaryTorqueLimiters()) frminfo.TorqueLimitersPresent = false; //if (!frminfo.MissingSymbolTable) { frminfo.OBDIIPresent = HasBinaryOBDIIMaps(); if (!frminfo.OBDIIPresent) { frminfo.OBDIIEnabled = false; } else { frminfo.OBDIIEnabled = HasBinaryOBDIIEnabled(); } } if (HasBinaryOBDIIMaps()) { frminfo.OBDIIEnabled = HasBinaryOBDIIEnabled(); } frminfo.SecondLambdaEnabled = HasBinarySecondLambdaEnabled(); if (!HasBinarySecondLambdaMap()) frminfo.SecondLambdaPresent = false; if (!HasBinaryTipInOutParameters()) frminfo.FastThrottleResponsePresent = false; else frminfo.FastThrottleResponsePresent = true; frminfo.FastThrottleReponse = HasBinaryFastThrottleResponse(); frminfo.ExtraFastThrottleReponse = HasBinaryExtraFastThrottleResponse(); if (!HasBinaryTipInOutParameters()) { frminfo.FastThrottleReponse = false; frminfo.ExtraFastThrottleReponse = false; } if (!HasBinaryCatalystLightOffParameters()) frminfo.CatalystLightoffPresent = false; else frminfo.CatalystLightoffPresent = true; frminfo.CatalystLightOff = HasBinaryCatalystLightOffEnabled(); frminfo.ProgrammingDateTime = GetProgrammingDateTime(); if (!m_appSettings.WriteTimestampInBinary) { frminfo.DisableTimeStamping(); } if (frminfo.ShowDialog() == DialogResult.OK) { if (t7InfoHeader.IsTISBinary(m_currentfile)) { // user is trying to update a TIS file, ask for footer correction. if ((frminfo.ImmoID != t7InfoHeader.getImmobilizerID()) || frminfo.ChassisID != t7InfoHeader.getChassisID()) { if (!_correctFooter) { if (MessageBox.Show("It seems you are trying to update data in a TIS file, would you like T7Suite to correct the footer information?", "TIS file question", MessageBoxButtons.YesNo) == DialogResult.Yes) { //_correctFooter = true; // create a backup file at this point File.Copy(m_currentfile, Path.GetDirectoryName(m_currentfile) + "\\" + Path.GetFileNameWithoutExtension(m_currentfile) + DateTime.Now.ToString("yyyyMMddHHmmss") + ".binarybackup", true); t7InfoHeader.init(m_currentfile, true); } } } } t7InfoHeader.setImmobilizerID(frminfo.ImmoID); t7InfoHeader.setSoftwareVersion(frminfo.SoftwareID); t7InfoHeader.setCarDescription(frminfo.EngineType); t7InfoHeader.setChassisID(frminfo.ChassisID); t7InfoHeader.setSIDDate(frminfo.SIDDate); if (GetProgrammingDateTime() != frminfo.ProgrammingDateTime) { SetProgrammingDateTime(frminfo.ProgrammingDateTime); } if (frminfo.SoftwareIsOpen) { SetBinaryFileOpen(); } else { SetBinaryFileClosed(); } if (frminfo.TorqueLimitersEnabled && !HasBinaryTorqueLimiterEnabled() && HasBinaryTorqueLimiters()) { SetTorqueLimiterEnabled(true); } else if (!frminfo.TorqueLimitersEnabled && HasBinaryTorqueLimiterEnabled() && HasBinaryTorqueLimiters()) { SetTorqueLimiterEnabled(false); } if (frminfo.OBDIIEnabled && !HasBinaryOBDIIEnabled()) { SetOBDIIEnabled(true); } else if (!frminfo.OBDIIEnabled && HasBinaryOBDIIEnabled()) { SetOBDIIEnabled(false); } if (frminfo.SecondLambdaEnabled && HasBinarySecondLambdaMap()/*&& !HasBinarySecondLambdaEnabled()*/) { SetSecondLambdaEnabled(true); } else if (!frminfo.SecondLambdaEnabled && HasBinarySecondLambdaMap() && HasBinarySecondLambdaEnabled()) { SetSecondLambdaEnabled(false); } if (HasBinaryTipInOutParameters()) { if (frminfo.FastThrottleReponse && !HasBinaryFastThrottleResponse()) { SetFastThrottleResponse(true); } else if (!frminfo.FastThrottleReponse && HasBinaryFastThrottleResponse()) { SetFastThrottleResponse(false); } if (frminfo.ExtraFastThrottleReponse && !HasBinaryExtraFastThrottleResponse()) { SetExtraFastThrottleResponse(true); } else if (!frminfo.ExtraFastThrottleReponse && !frminfo.FastThrottleReponse && HasBinaryExtraFastThrottleResponse()) { SetExtraFastThrottleResponse(false); } else if (!frminfo.ExtraFastThrottleReponse && frminfo.FastThrottleReponse && HasBinaryExtraFastThrottleResponse()) { SetActG2(false); } } if (HasBinaryCatalystLightOffParameters()) { if (frminfo.CatalystLightOff && !HasBinaryCatalystLightOffEnabled()) { SetCatalystLightOff(true); } else if (!frminfo.CatalystLightOff && HasBinaryCatalystLightOffEnabled()) { SetCatalystLightOff(false); } } if (IsBinaryBiopower()) { if (frminfo.BioPowerEnabled && !IsBioPowerEnabled()) { SetBioPowerEnabled(true); } else if (!frminfo.BioPowerEnabled && IsBioPowerEnabled()) { SetBioPowerEnabled(false); } } t7InfoHeader.save(m_currentfile); if (swVersion.Trim() == "EU0AF01C.55P" || swVersion.Trim() == "EU0AF01C.46T" || swVersion.Trim().StartsWith("ET02U01C") || swVersion.Trim() == "ET03F01C.46S") { if (swVersion.Trim().StartsWith("EU0AF01C") || swVersion.Trim() == "ET03F01C.46S") { if ((CheckBytesInFile(m_currentfile, 0x4968E, 0, 2) || (CheckBytesInFile(m_currentfile, 0x4968E, 0x00, 1) && CheckBytesInFile(m_currentfile, 0x4968F, 0x80, 1))) && (CheckBytesInFile(m_currentfile, 0x496B4, 0, 2) || (CheckBytesInFile(m_currentfile, 0x496B4, 0x00, 1) && CheckBytesInFile(m_currentfile, 0x496B5, 0x80, 1))) && (CheckBytesInFile(m_currentfile, 0x49760, 0, 2) || (CheckBytesInFile(m_currentfile, 0x49760, 0x00, 1) && CheckBytesInFile(m_currentfile, 0x49761, 0x80, 1)))) { if (frminfo.SIDDisableStartScreen) { byte[] data2write = new byte[2]; data2write.SetValue((byte)0x00, 0); data2write.SetValue((byte)0x00, 1); //savedatatobinary(0x495FA, 2, data2write, m_currentfile, false); savedatatobinary(0x4968E, 2, data2write, m_currentfile, false); savedatatobinary(0x496B4, 2, data2write, m_currentfile, false); } else { byte[] data2write = new byte[2]; data2write.SetValue((byte)0x00, 0); data2write.SetValue((byte)0x80, 1); //savedatatobinary(0x495FA, 2, data2write, m_currentfile, false); savedatatobinary(0x4968E, 2, data2write, m_currentfile, false); savedatatobinary(0x496B4, 2, data2write, m_currentfile, false); } if (frminfo.SIDDisableAdaptionMessages) { byte[] data2write = new byte[2]; data2write.SetValue((byte)0x00, 0); data2write.SetValue((byte)0x00, 1); savedatatobinary(0x49760, 2, data2write, m_currentfile, false); } else { byte[] data2write = new byte[2]; data2write.SetValue((byte)0x00, 0); data2write.SetValue((byte)0x80, 1); savedatatobinary(0x49760, 2, data2write, m_currentfile, false); } } } else { if ((CheckBytesInFile(m_currentfile, 0x46F4D, 0, 1) || CheckBytesInFile(m_currentfile, 0x46F4D, 0x80, 1)) && (CheckBytesInFile(m_currentfile, 0x4701F, 0, 1) || CheckBytesInFile(m_currentfile, 0x4701F, 0x80, 1))) { //Disable startscreen, change 0x00046F4D to 00 in stead of 80 //Remove the adaption messages, change 0x0004701F to 00 in stead of 80 if (frminfo.SIDDisableStartScreen) { byte[] data2write = new byte[1]; data2write.SetValue((byte)0x00, 0); savedatatobinary(0x46F4D, 1, data2write, m_currentfile, false); } else { byte[] data2write = new byte[1]; data2write.SetValue((byte)0x80, 0); savedatatobinary(0x46F4D, 1, data2write, m_currentfile, false); } if (frminfo.SIDDisableAdaptionMessages) { byte[] data2write = new byte[1]; data2write.SetValue((byte)0x00, 0); savedatatobinary(0x4701F, 1, data2write, m_currentfile, false); } else { byte[] data2write = new byte[1]; data2write.SetValue((byte)0x80, 0); savedatatobinary(0x4701F, 1, data2write, m_currentfile, false); } } } } // Disable effect of the emission limitation function. if (swVersion.Trim().StartsWith("EU0AF01C")) { if (frminfo.EmissionLimitation) { byte[] data2write = new byte[1]; data2write.SetValue((byte)0x03, 0); savedatatobinary(0x13837, 1, data2write, m_currentfile, false); } else { byte[] data2write = new byte[1]; data2write.SetValue((byte)0x02, 0); savedatatobinary(0x13837, 1, data2write, m_currentfile, false); } } UpdateChecksum(m_currentfile); } } } }