Exemple #1
0
        private void exportFixedTuningPackageToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SymbolCollection scToExport = new SymbolCollection();
            SaveFileDialog sfd = new SaveFileDialog();
            sfd.Filter = "Trionic 7 packages|*.t7p";
            if (sfd.ShowDialog() == DialogResult.OK)
            {

                // add all relevant symbols to the export collection
                //SymbolHelper sh = new SymbolHelper();
                // must contain Varname, FlashAddress, Length, Userdescription
                AddToSymbolCollection(scToExport, "LimEngCal.TurboSpeedTab"); // add axis
                AddToSymbolCollection(scToExport, "LimEngCal.p_AirSP");
                AddToSymbolCollection(scToExport, "AirCtrlCal.m_MaxAirTab"); // add axis
                AddToSymbolCollection(scToExport, "TempLimPosCal.Airmass");
                //AddToSymbolCollection(scToExport, "X_AccPedalAutSP");
                AddToSymbolCollection(scToExport, "BoostCal.RegMap");   // add axis
                AddToSymbolCollection(scToExport, "BoostCal.SetLoadXSP");
                AddToSymbolCollection(scToExport, "BoostCal.n_EngSP");
                AddToSymbolCollection(scToExport, "PedalMapCal.m_RequestMap");// add axis
                AddToSymbolCollection(scToExport, "PedalMapCal.n_EngineMap");
                AddToSymbolCollection(scToExport, "PedalMapCal.X_PedalMap");
                AddToSymbolCollection(scToExport, "BstKnkCal.MaxAirmass");  // add axis
                AddToSymbolCollection(scToExport, "BstKnkCal.OffsetXSP");
                AddToSymbolCollection(scToExport, "BstKnkCal.n_EngYSP");
                AddToSymbolCollection(scToExport, "BstKnkCal.MaxAirmassAu"); // add axis
                AddToSymbolCollection(scToExport, "TorqueCal.M_EngMaxAutTab"); // add axis
                AddToSymbolCollection(scToExport, "TorqueCal.M_EngMaxTab"); // add axis
                AddToSymbolCollection(scToExport, "TorqueCal.M_EngMaxE85Tab"); // add axis
                AddToSymbolCollection(scToExport, "TorqueCal.M_ManGearLim"); // add axis
                AddToSymbolCollection(scToExport, "TorqueCal.M_CabGearLim"); // add axis
                AddToSymbolCollection(scToExport, "TorqueCal.n_Eng5GearSP");
                AddToSymbolCollection(scToExport, "TorqueCal.M_5GearLimTab"); // add axis
                AddToSymbolCollection(scToExport, "TorqueCal.M_NominalMap"); // add axis
                AddToSymbolCollection(scToExport, "TorqueCal.m_AirXSP");
                AddToSymbolCollection(scToExport, "TorqueCal.n_EngYSP");
                AddToSymbolCollection(scToExport, "TorqueCal.m_AirTorqMap"); // add axis
                AddToSymbolCollection(scToExport, "TorqueCal.M_EngXSP");
                AddToSymbolCollection(scToExport, "TorqueCal.m_PedYSP");
                AddToSymbolCollection(scToExport, "FCutCal.m_AirInletLimit");
                AddToSymbolCollection(scToExport, "BoosDiagCal.m_FaultDiff");
                AddToSymbolCollection(scToExport, "BoosDiagCal.ErrMaxMReq");
                AddToSymbolCollection(scToExport, "BFuelCal.Map");
                AddToSymbolCollection(scToExport, "BFuelCal.StartMap");
                AddToSymbolCollection(scToExport, "BFuelCal.E85Map");
                AddToSymbolCollection(scToExport, "BFuelCal.AirXSP");
                AddToSymbolCollection(scToExport, "BFuelCal.RpmYSP");
                AddToSymbolCollection(scToExport, "InjCorrCal.BattCorrSP");
                AddToSymbolCollection(scToExport, "InjCorrCal.BattCorrTab");
                AddToSymbolCollection(scToExport, "InjCorrCal.InjectorConst");
                AddToSymbolCollection(scToExport, "IgnNormCal.Map");
                AddToSymbolCollection(scToExport, "IgnE85Cal.fi_AbsMap");
                AddToSymbolCollection(scToExport, "IgnNormCal.m_AirXSP");
                AddToSymbolCollection(scToExport, "IgnNormCal.n_EngYSP");
                AddToSymbolCollection(scToExport, "IgnKnkCal.IndexMap");
                AddToSymbolCollection(scToExport, "KnkFuelCal.fi_MapMaxOff");
                AddToSymbolCollection(scToExport, "KnkFuelCal.m_AirXSP");
                AddToSymbolCollection(scToExport, "BoostCal.PMap");
                AddToSymbolCollection(scToExport, "BoostCal.IMap");
                AddToSymbolCollection(scToExport, "BoostCal.DMap");
                AddToSymbolCollection(scToExport, "BoostCal.PIDXSP");
                AddToSymbolCollection(scToExport, "BoostCal.PIDYSP");
                AddToSymbolCollection(scToExport, "TorqueCal.M_OverBoostTab");
                AddToSymbolCollection(scToExport, "TorqueCal.n_EngYSP");
                AddToSymbolCollection(scToExport, "KnkFuelCal.EnrichmentMap");
                AddToSymbolCollection(scToExport, "IgnKnkCal.m_AirXSP");
                AddToSymbolCollection(scToExport, "IgnKnkCal.n_EngYSP");
                AddToSymbolCollection(scToExport, "KnkDetCal.RefFactorMap");
                AddToSymbolCollection(scToExport, "KnkDetCal.m_AirXSP");
                AddToSymbolCollection(scToExport, "KnkDetCal.n_EngYSP");
                AddToSymbolCollection(scToExport, "MaxSpdCal.T_EngineSP");
                AddToSymbolCollection(scToExport, "MaxSpdCal.n_EngLimAir");
                AddToSymbolCollection(scToExport, "MaxVehicCal.v_MaxSpeed");
                PackageExporter pe = new PackageExporter();
                if (IsSoftwareOpen())
                {
                    pe.AddressOffset = GetOpenFileOffset();
                }
                pe.ExportPackage(scToExport, m_currentfile, sfd.FileName);
            }
        }
Exemple #2
0
        private void exportAsTuningPackageToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // export selected maps as tuning package (name the file t7p)
            // get selected rows
            int[] selectedrows = gridViewSymbols.GetSelectedRows();
            SymbolCollection scToExport = new SymbolCollection();
            if (selectedrows.Length > 0)
            {
                SaveFileDialog sfd = new SaveFileDialog();
                sfd.Filter = "Trionic 7 packages|*.t7p";
                if (sfd.ShowDialog() == DialogResult.OK)
                {
                    int grouplevel = gridViewSymbols.GetRowLevel((int)selectedrows.GetValue(0));
                    if (grouplevel >= gridViewSymbols.GroupCount)
                    {
                        int[] selrows = gridViewSymbols.GetSelectedRows();
                        if (selrows.Length > 0)
                        {
                            for (int i = 0; i < selrows.Length; i++)
                            {
                                SymbolHelper sh = (SymbolHelper)gridViewSymbols.GetRow((int)selrows.GetValue(i));
                                // make a copy?
                                scToExport.Add(sh);
                            }

                            PackageExporter pe = new PackageExporter();
                            if (IsSoftwareOpen())
                            {
                                pe.AddressOffset = GetOpenFileOffset();
                            }
                            pe.ExportPackage(scToExport, m_currentfile, sfd.FileName);
                        }

                    }
                }

            }
        }
Exemple #3
0
        void edit_FormClosed(object sender, FormClosedEventArgs e)
        {
            if (sender is frmEditTuningPackage)
            {
                frmEditTuningPackage edit = (frmEditTuningPackage)sender;
                if (edit.WriteData)
                {
                    // save the package again with altered settings probably.
                    logger.Debug("We should write the tuning package here!");
                    SaveFileDialog sfd = new SaveFileDialog();
                    sfd.Filter = "Trionic 7 packages|*.t7p";
                    if (sfd.ShowDialog() == DialogResult.OK)
                    {
                        System.Data.DataTable dt = edit.GetDataTable();
                        SymbolCollection scToExport = new SymbolCollection();
                        foreach (DataRow dr in dt.Rows)
                        {
                            SymbolHelper sh = new SymbolHelper();
                            sh.Varname = dr["Map"].ToString();
                            sh.Currentdata = ConvertTuningPackageDataToByteArray(dr["Data"].ToString());
                            sh.Flash_start_address = GetSymbolAddress(m_symbols, sh.Varname);
                            sh.Userdescription = GetUserDescription(m_symbols, sh.Varname);
                            sh.Length = GetSymbolLength(m_symbols, sh.Varname);
                            scToExport.Add(sh);

                        }
                        PackageExporter pe = new PackageExporter();
                        if (IsSoftwareOpen())
                        {
                            pe.AddressOffset = GetOpenFileOffset();
                        }
                        pe.ExportPackage(scToExport, m_currentfile, sfd.FileName);
                    }
                }
            }
            tunpackeditWindow = null;
        }
Exemple #4
0
        private void btnGenerateTuningPackage_ItemClick(object sender, ItemClickEventArgs e)
        {
            // generate the default maps as a tuning package from the ECUs SRAM
            if (m_currentfile != "")
            {
                if (CheckCANConnectivity())
                {
                    frmProgress progress = new frmProgress();
                    progress.SetProgress("Downloading tuning package...");
                    progress.Show();
                    SymbolCollection scToExport = new SymbolCollection();
                    PackageExporter pe = new PackageExporter();
                    SaveFileDialog sfd = new SaveFileDialog();
                    sfd.Filter = "Trionic 7 packages|*.t7p";
                    if (sfd.ShowDialog() == DialogResult.OK)
                    {
                        AddToSymbolCollection(scToExport, "LimEngCal.TurboSpeedTab"); // add axis
                        AddToSymbolCollection(scToExport, "LimEngCal.p_AirSP");
                        AddToSymbolCollection(scToExport, "AirCtrlCal.m_MaxAirTab"); // add axis
                        AddToSymbolCollection(scToExport, "TempLimPosCal.Airmass");
                        //AddToSymbolCollection(scToExport, "X_AccPedalAutSP");
                        AddToSymbolCollection(scToExport, "BoostCal.RegMap");   // add axis
                        AddToSymbolCollection(scToExport, "BoostCal.SetLoadXSP");
                        AddToSymbolCollection(scToExport, "BoostCal.n_EngSP");
                        AddToSymbolCollection(scToExport, "PedalMapCal.m_RequestMap");// add axis
                        AddToSymbolCollection(scToExport, "PedalMapCal.n_EngineMap");
                        AddToSymbolCollection(scToExport, "PedalMapCal.X_PedalMap");
                        AddToSymbolCollection(scToExport, "BstKnkCal.MaxAirmass");  // add axis
                        AddToSymbolCollection(scToExport, "BstKnkCal.OffsetXSP");
                        AddToSymbolCollection(scToExport, "BstKnkCal.n_EngYSP");
                        AddToSymbolCollection(scToExport, "BstKnkCal.MaxAirmassAu"); // add axis
                        AddToSymbolCollection(scToExport, "TorqueCal.M_EngMaxAutTab"); // add axis
                        AddToSymbolCollection(scToExport, "TorqueCal.M_EngMaxTab"); // add axis
                        AddToSymbolCollection(scToExport, "TorqueCal.M_EngMaxE85Tab"); // add axis
                        AddToSymbolCollection(scToExport, "TorqueCal.M_ManGearLim"); // add axis
                        AddToSymbolCollection(scToExport, "TorqueCal.M_CabGearLim"); // add axis
                        AddToSymbolCollection(scToExport, "TorqueCal.n_Eng5GearSP");
                        AddToSymbolCollection(scToExport, "TorqueCal.M_5GearLimTab"); // add axis
                        AddToSymbolCollection(scToExport, "TorqueCal.M_NominalMap"); // add axis
                        AddToSymbolCollection(scToExport, "TorqueCal.m_AirXSP");
                        AddToSymbolCollection(scToExport, "TorqueCal.n_EngYSP");
                        AddToSymbolCollection(scToExport, "TorqueCal.m_AirTorqMap"); // add axis
                        AddToSymbolCollection(scToExport, "TorqueCal.M_EngXSP");
                        AddToSymbolCollection(scToExport, "TorqueCal.m_PedYSP");
                        AddToSymbolCollection(scToExport, "FCutCal.m_AirInletLimit");
                        AddToSymbolCollection(scToExport, "BoosDiagCal.m_FaultDiff");
                        AddToSymbolCollection(scToExport, "BoosDiagCal.ErrMaxMReq");
                        AddToSymbolCollection(scToExport, "BFuelCal.Map");
                        AddToSymbolCollection(scToExport, "BFuelCal.StartMap");
                        AddToSymbolCollection(scToExport, "BFuelCal.E85Map");
                        AddToSymbolCollection(scToExport, "BFuelCal.AirXSP");
                        AddToSymbolCollection(scToExport, "BFuelCal.RpmYSP");
                        AddToSymbolCollection(scToExport, "InjCorrCal.InjectorConst");
                        AddToSymbolCollection(scToExport, "IgnNormCal.Map");
                        AddToSymbolCollection(scToExport, "IgnE85Cal.fi_AbsMap");
                        AddToSymbolCollection(scToExport, "IgnNormCal.m_AirXSP");
                        AddToSymbolCollection(scToExport, "IgnNormCal.n_EngYSP");
                        AddToSymbolCollection(scToExport, "IgnKnkCal.IndexMap");
                        AddToSymbolCollection(scToExport, "KnkFuelCal.fi_MapMaxOff");
                        AddToSymbolCollection(scToExport, "KnkFuelCal.m_AirXSP");
                        AddToSymbolCollection(scToExport, "BoostCal.PMap");
                        AddToSymbolCollection(scToExport, "BoostCal.IMap");
                        AddToSymbolCollection(scToExport, "BoostCal.DMap");
                        AddToSymbolCollection(scToExport, "BoostCal.PIDXSP");
                        AddToSymbolCollection(scToExport, "BoostCal.PIDYSP");
                        AddToSymbolCollection(scToExport, "TorqueCal.M_OverBoostTab");
                        AddToSymbolCollection(scToExport, "TorqueCal.n_EngYSP");
                        AddToSymbolCollection(scToExport, "KnkFuelCal.EnrichmentMap");
                        AddToSymbolCollection(scToExport, "IgnKnkCal.m_AirXSP");
                        AddToSymbolCollection(scToExport, "IgnKnkCal.n_EngYSP");
                        AddToSymbolCollection(scToExport, "KnkDetCal.RefFactorMap");
                        AddToSymbolCollection(scToExport, "KnkDetCal.m_AirXSP");
                        AddToSymbolCollection(scToExport, "KnkDetCal.n_EngYSP");
                        AddToSymbolCollection(scToExport, "MaxSpdCal.T_EngineSP");
                        AddToSymbolCollection(scToExport, "MaxSpdCal.n_EngLimAir");
                        AddToSymbolCollection(scToExport, "MaxVehicCal.v_MaxSpeed");
                        //pe.ExportPackage(scToExport, m_currentfile, sfd.FileName);
                        if (File.Exists(sfd.FileName)) File.Delete(sfd.FileName);
                        foreach (SymbolHelper sh in scToExport)
                        {
                            //<GS-28012011>

                            progress.SetProgress("Downloading: " + sh.Varname);
                            System.Windows.Forms.Application.DoEvents();
                            byte[] data = ReadMapFromSRAM(sh, false);
                            pe.ExportMap(sfd.FileName, sh.Varname, sh.Userdescription, sh.Length, data);
                            Thread.Sleep(1);
                        }
                    }
                    if (progress != null) progress.Close();
                }
                else
                {
                    frmInfoBox info = new frmInfoBox("An active CAN bus connection is needed to download a tuning package");
                }
            }
        }
        private void exportAsTuningPackageToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // well.. export the entire result set as a tuning package
            // export selected maps as tuning package (name the file t7p)
            // get selected rows

            //<GS-22022011> TODO: Let the user choose from which binary file he/she wants to export the data
            // the orginal file or the file that we compared to
            frmFileToExportSelection frmSelection = new frmFileToExportSelection();
            frmSelection.SetOriginalFileName(m_OriginalFilename);
            frmSelection.SetCompareFileName(m_CompareFilename);
            if (frmSelection.ShowDialog() == DialogResult.OK)
            {
                DataTable dt = (DataTable)gridControl1.DataSource;
                SymbolCollection scToExport = new SymbolCollection();
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        string varname = dr["SYMBOLNAME"].ToString();
                        if (varname.StartsWith("Symbolnumber")) varname = dr["Userdescription"].ToString();
                        if (!varname.StartsWith("Symbolnumber") && !varname.StartsWith("overrun") && !varname.StartsWith("Data_name") && !varname.StartsWith("MapChkCal"))
                        {
                            if (frmSelection.UseOriginalFile)
                            {
                                foreach (SymbolHelper sh in m_originalSymbolCollection)
                                {
                                    if (sh.SmartVarname == varname)
                                    {
                                        scToExport.Add(sh);
                                        break;
                                    }
                                }
                            }
                            else
                            {
                                foreach (SymbolHelper sh in m_compareSymbolCollection)
                                {
                                    if (sh.SmartVarname == varname)
                                    {
                                        scToExport.Add(sh);
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    frmSymbolSelection symsel = new frmSymbolSelection();
                    symsel.SetSymbolCollection(scToExport);
                    symsel.SelectAllSymbols();
                    if (symsel.ShowDialog() == DialogResult.OK)
                    {
                        SymbolCollection scSelected = new SymbolCollection();
                        scSelected = symsel.GetSelectedSymbolCollection();
                        PackageExporter pe = new PackageExporter();
                        SaveFileDialog sfd = new SaveFileDialog();
                        sfd.Filter = "Trionic 7 packages|*.t7p";
                        if (sfd.ShowDialog() == DialogResult.OK)
                        {
                            if (frmSelection.UseOriginalFile)
                            {
                                pe.ExportPackage(scSelected, m_OriginalFilename, sfd.FileName);
                            }
                            else
                            {
                                pe.ExportPackage(scSelected, m_filename, sfd.FileName);
                            }
                        }
                    }
                }
            }
        }
        private void exportAsTuningPackageToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // well.. export the entire result set as a tuning package
            // export selected maps as tuning package (name the file t7p)
            // get selected rows

            //<GS-22022011> TODO: Let the user choose from which binary file he/she wants to export the data
            // the orginal file or the file that we compared to
            frmFileToExportSelection frmSelection = new frmFileToExportSelection();

            frmSelection.SetOriginalFileName(m_OriginalFilename);
            frmSelection.SetCompareFileName(m_CompareFilename);
            if (frmSelection.ShowDialog() == DialogResult.OK)
            {
                DataTable        dt         = (DataTable)gridControl1.DataSource;
                SymbolCollection scToExport = new SymbolCollection();
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        string varname = dr["SYMBOLNAME"].ToString();
                        if (varname.StartsWith("Symbolnumber"))
                        {
                            varname = dr["Userdescription"].ToString();
                        }
                        if (!varname.StartsWith("Symbolnumber") && !varname.StartsWith("overrun") && !varname.StartsWith("Data_name") && !varname.StartsWith("MapChkCal"))
                        {
                            if (frmSelection.UseOriginalFile)
                            {
                                foreach (SymbolHelper sh in m_originalSymbolCollection)
                                {
                                    if (sh.SmartVarname == varname)
                                    {
                                        scToExport.Add(sh);
                                        break;
                                    }
                                }
                            }
                            else
                            {
                                foreach (SymbolHelper sh in m_compareSymbolCollection)
                                {
                                    if (sh.SmartVarname == varname)
                                    {
                                        scToExport.Add(sh);
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    frmSymbolSelection symsel = new frmSymbolSelection();
                    symsel.SetSymbolCollection(scToExport);
                    symsel.SelectAllSymbols();
                    if (symsel.ShowDialog() == DialogResult.OK)
                    {
                        SymbolCollection scSelected = new SymbolCollection();
                        scSelected = symsel.GetSelectedSymbolCollection();
                        PackageExporter pe  = new PackageExporter();
                        SaveFileDialog  sfd = new SaveFileDialog();
                        sfd.Filter = "Trionic 7 packages|*.t7p";
                        if (sfd.ShowDialog() == DialogResult.OK)
                        {
                            if (frmSelection.UseOriginalFile)
                            {
                                if (Trionic7File.IsSoftwareOpen(m_originalSymbolCollection))
                                {
                                    pe.AddressOffset = m_OriginalAddressOffset;
                                }
                                pe.ExportPackage(scSelected, m_OriginalFilename, sfd.FileName);
                            }
                            else
                            {
                                if (Trionic7File.IsSoftwareOpen(m_compareSymbolCollection))
                                {
                                    pe.AddressOffset = m_CompareAddressOffset;
                                }
                                pe.ExportPackage(scSelected, m_filename, sfd.FileName);
                            }
                        }
                    }
                }
            }
        }